octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Oplot, Props and Octave supports handle graphics.


From: Ole Jacob Hagen
Subject: Oplot, Props and Octave supports handle graphics.
Date: Wed, 13 Jul 2005 13:52:03 +0000
User-agent: Mozilla Thunderbird 1.0 (X11/20050307)

Oplot, Props and Octave works pretty good with eachother...I think.... :-)

Oplot consists of a transport-channel, visualisation, and octave-module.
This octave-module forks Oplot, and sends data to Oplot by using the transport-module. On Linux unix domain sockets is used.

This octave-module can be easily modified to also implement tcp/ip or pipes. The Oplot-application is able to send back data to Octave, by using the same transport-module as the octave-module.
Usage of Props-code only exists in Oplot, and not in Octave.
The octave-module can transmit and receive datatypes such as: struct, matrix, mxnx3 matrices, numbers, strings. Support of new datatypes can be easily added in oplotcom.cc i $(OPLOT)/src/octave. Remember duplex support. :-)

Props is an independent library in Oplot, where callback and initiatiation are handled. Oplot is only using Props-library, and is setting callbacks to determined classes.

Callbackinterface-class in Props is a parent-class, and is inherited by RootCallbackInterface and FigureCallbackInterface.

RootCallbackInterface is used and inherited by OpFigureManager-class in Oplot. RootCallbackInterface is initialised by the following line in OpFigureManager's ctor:

   Root::instance().setRootCallbackInterface(*this*);


FigureCallbackInterface is used and inherited by OpFigureWindow-class in Oplot. FigureCallbackInterface is initialised by a the following line in OpFigureManager::new_figure(Props::Figure* fig):

int
OpFigureManager::new_figure( Figure* fig) {

   OpFigureWindow* fw = *new* OpFigureWindow(fig, *this*);
   QPoint pos(420,500);
   QSize sz = *this*->parentWidget(*true*)->size();
   fig->setCallbackInterface(fw);
   fw->setPosition(pos,sz);
   *this*->addFigureWindow(fw, (int) fig->getHandle());
   *return* 0;
}


Axes-Callbacks, Line-Callbacks, Image-Callbacks, Text-Callbacks are initialised in a similar fashion:

Axes-Callbacks:

int
OpFigureWindow::new_axes( Axes* ax) {
   OpAxesObject *opax = *new* OpAxesObject(ax, *this*,m_axNum);
   ax->setCallbackInterface(opax);
   m_axNum++;
   *return* 0;
}


Initialisation of callbacks and creation of new child of Axes-object such as Text, Line, Image is created like this:
Guess how Surface, Patch and Rectangle-object should be initialised?

int
OpAxesObject::new_child( Object* p,  Object* c) {
   const std::string* child = c->get_string("Type");
   *if*(*child == "Text") {
       Text *text = *static_cast*<Text *>(c);
       OpTextObject *textObject = *new* OpTextObject(text, *this*);
       text->setCallbackInterface(textObject);
       m_textComponents.push_back(textObject);
   } *else* *if*(*child == "Line") {
       Line* line = *static_cast*<Line*>(c);
       OpLineObject *lineobject = *new* OpLineObject(line, *this*);
       line->setCallbackInterface(lineobject);
       }
       m_visComponents.push_back(lineobject);
   } *else* *if*( *child == "Image") {
       Image *image = *static_cast*<Image *>(c);
       OpImageObject *imageObject = *new* OpImageObject(image, *this*);
       image->setCallbackInterface(imageObject);
       m_visComponents.push_back(imageObject);
   }
   *return* 0;
}


I present to you Oplot with Props and Octave.
e.g root = get(0); root.Clipping <enter> gives "on" as output.

Setting properties such as set(handle_value, 'property_name', property_value) is of course possible. Getting properties with get(handle_value, 'property_name') returns the property_value that is contained in property_name in handle_value...


Available properties and handle graphics objects supported by Props, and Oplot are presented at the bottom of this email.


Cheers,


Ole J.







root: root = get(0) gives
root =
{
  BusyAction = queue
  ButtonDownFcn =
  Children = [](0x0)
  Clipping = on
  CreateFcn =
  CurrentFigure = [](0x0)
  DeleteFcn =
  ErrorMessage =
  HandleVisibility = on
  HitTest = on
  Interruptible = yes
  Parent = [](0x0)
  ScreenDepth = 16
  ScreenSize =

    0  0  0  0

  Selected = off
  SelectionHighlight = no
  Tag =
  Type = Root
  Units = centimeters
  UpdateScene = on
  UserData =
  Visible = on
}

fig = get(gcf) gives:

fig =
{
  Alphamap = [](0x1)
  BackingStore = on
  BusyAction = queue
  ButtonDownFcn =
  Children = 146.41
  Clipping = on
  Color =

    0.80000  0.80000  0.80000

  Colormap = [](0x3)
  CreateFcn =
  CurrentAxes = 146.41
  DeleteFcn =
  Dithermap = [](0x3)
  Dithermapmode = manual
  DoubleBuffer = off
  FixedColors = [](0x3)
  HandleVisibility = on
  HitTest = on
  Interruptible = yes
  MenuBar = figure
  MinColormap = 0
  Name =
  NextPlot = add
  NumberTitle = on
  Parent = 0
  Pointer = arrow
  PointerShapeCData =
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0

  PointerShapeHotSpot =

    0
    0

  Position =

    420  500  600  500

  Renderer = patiners
  RendererMode = auto
  Resize = on
  Selected = off
  SelectionHighlight = no
  ShareColors = yes
  Tag =
  Type = Figure
  Units = pixels
  UserData =
  Visible = on
  WindowStyle = normal
}

ax = get(gca) gives:


ax =
{
  Box = off
  BusyAction = queue
  ButtonDownFcn =
  CameraPosition =

    0  0  7

  CameraPositionMode = auto
  CameraTarget =

    0  0  0

  CameraUpVector =

    0  1  0

  Children =

    194.71  116.84  193.48  134.74  125.46  196.92

  Clipping = on
  ColorOrder =

    0  0  1
    0  1  0
    1  0  0
    0  1  1
    1  0  1
    1  1  0

  CreateFcn =
  DataAspectRatio =
  1  1  1

  DataAspectRatioMode = auto
  DeleteFcn =
  HandleVisibility = on
  HitTest = on
  Interruptible = yes
  NextPlot = add
  Parent = 1
  PlotBoxAspectRatio =

    1  1  1

  PlotBoxAspectRatioMode = auto
  Position =

    0.13000  0.11000  0.77500  0.81500

  Projection = orthographic
  Selected = off
  SelectionHighlight = no
  Tag =
  Title = 176.29
  Type = Axes
  Units = normalized
  UserData =
  View =

     0  90

  Visible = on
  XGrid = off
  XLabel = 189.24
  XLim =

    0  1

  XLimMode = auto
  XTick =

   Columns 1 through 7:

    0.00000  0.10000  0.20000  0.30000  0.40000  0.50000  0.60000

   Columns 8 through 11:

    0.70000  0.80000  0.90000  1.00000

  YGrid = off
  YLabel = 194.79
  YLim =

    0  1

    0  0  1
    0  1  0
    1  0  0
    0  1  1
    1  0  1
    1  1  0

  CreateFcn =
  DataAspectRatio =

    1  1  1

  DataAspectRatioMode = auto
  DeleteFcn =
  HandleVisibility = on
  HitTest = on
  Interruptible = yes
  NextPlot = add
  Parent = 1
  PlotBoxAspectRatio =

    1  1  1

  PlotBoxAspectRatioMode = auto
  Position =

    0.13000  0.11000  0.77500  0.81500

  Projection = orthographic
  Selected = off
  SelectionHighlight = no
  Tag =
  Title = 176.29
  Type = Axes
  Units = normalized
  UserData =
  View =

     0  90

  Visible = on
 XGrid = off
  XLabel = 189.24
  XLim =

    0  1

  XLimMode = auto
  XTick =

   Columns 1 through 7:

    0.00000  0.10000  0.20000  0.30000  0.40000  0.50000  0.60000

   Columns 8 through 11:

    0.70000  0.80000  0.90000  1.00000

  YGrid = off
  YLabel = 194.79
  YLim =

    0  1

  YLimMode = auto
  YTick =

   Columns 1 through 7:

    0.00000  0.10000  0.20000  0.30000  0.40000  0.50000  0.60000

   Columns 8 through 11:

    0.70000  0.80000  0.90000  1.00000

  ZGrid = off
  ZLabel = 188.17
  ZLim =

    0  1

  ZLimMode = auto
  ZTick =

   Columns 1 through 7:

    0.00000  0.10000  0.20000  0.30000  0.40000  0.50000  0.60000

   Columns 8 through 11:

    0.70000  0.80000  0.90000  1.00000

}

li = get(line) gives

li =
{
  BusyAction = queue
  ButtonDownFcn =
  Children = [](0x0)
  Clipping = on
  Color =

    0  1  0

  CreateFcn =
  DeleteFcn =
  EraseMode = normal
  HandleVisibility = on
  HitTest = on
  Interruptible = yes
  LineStyle = -
  LineWidth = 0
  Marker = none
  MarkerSize = 0
  Parent = 146.41
  Selected = off
  SelectionHighlight = no
  Tag =
  Type = Line
  UserData =
  Visible = on
  XData =

    0  1

  YData =

    0  1

  ZData = [](1x0)
}

himage = get(image) gives:

himage =
{
  AlphaData = [](0x0)
  AlphaDataMapping = none
  BusyAction = queue
  ButtonDownFcn =
  CData = [](0x0x0)
  CDataMapping = direct
  Children = [](0x0)
  Clipping = on
  CreateFcn =
  DeleteFcn =
  HandleVisibility = on
  HitTest = on
  Interruptible = yes
  Parent = 146.41
  Selected = off
  SelectionHighlight = no
  Tag =
  Type = Image
  UserData =
  Visible = on
  XData =

    0  2

  YData =

    0  3

}

htxt = get(text) gives:

htxt =
{
  BusyAction = queue
  ButtonDownFcn =
  Children = [](0x0)
  Clipping = on
  Color =

    0  0  0

  CreateFcn =
  DeleteFcn =
  FontAngle = normal
  FontName =
  FontSize = 10
  FontUnits = data
  HandleVisibility = on
  HitTest = on
  HorizontalAlignment = left
  Interruptible = yes
  Parent = 146.41
  Position =

    0  0  0

  Rotation = 0
  Selected = off
  SelectionHighlight = no
  String =
  Tag =
  Type = Text
  Units = data
  UserData =
  VerticalAlignment = middle
  Visible = on
}







reply via email to

[Prev in Thread] Current Thread [Next in Thread]