Re: Oplot
Shai Ayal <[email protected]> Tue, 30 Nov 2004 18:37:32 +0200
| Newsgroups | gmane.comp.gnu.octave.graphics |
|---|---|
| Message-ID | <[email protected]> |
Ole,
looking through the code in oplot/props/octave I see you have already
done what I have proposed in my previous email: mainly you have
implemented a minimal set of "core functions" -- set, get, etc... on top
of these you could in theory used my plot.m file instead of the oplot.cc
you use now.
All this without going into elaborate explanations of callbacks etc...,
using m-files only.
Shai
Ole Jacob Hagen wrote:
> Hi, Shai.
>
>
> Yes, thanks to Shai, we have contour-plot in Oplot. ;-)
>
>
> Have you looked at Props-source? And it's usage in the following classes :
> OpFigureManager (Props::Root), OpFigureWindow (Props::Figure),
> OpAxesObject (Props::Axes), OpLineObject (Props::Line)? These four
> classes represents each a graphics object. And the virtual method
> property_changed is run, when a property has changed. This is due to a
> callback setup.
>
> Actually, Prop-package is the heart in Oplot.
>
> Root::instance().setRootCallbackInterface(this) inside ctor of
> OpFigureManager says that every callbacks regarding a property change in
> root-object is controlled to OpFigureManager.
>
> In Octave: f = figure; will make this code run.
> % snip of code %
>
>> int OpFigureManager::new_figure( Figure* fig) {
>> OpFigureWindow* fw = new OpFigureWindow(fig, this);
>> fig->setCallbackInterface(fw);
>> this->addFigureWindow(fw, (int) fig->getHandle());
>> return 0;
>> }
>
>
> % end snip of code %
> We create a new OpFigureWindows, and connects the Figure-callbacks to
> our newly created OpFigureWindow instance. And we adds this figure
> window into a QPtrList.
>
> When we create a line-object, by using h = plot(x,y) will run this code,
> since Line is a child of Axes
> % snip of code %
>
>> int OpAxesObject::new_child( Object* p, Object* child) {
>> if((*child->get_string("Type") == "Line")) {
>> Line* line = static_cast<Line*>(child);
>> OpLineObject *lineobject = new OpLineObject(line, this);
>> line->setCallbackInterface(lineobject);
>> }
>> return 0;
>> }
>>
> % end snip of code %
> We create a OpLineObject and connects the callbacks of line-object into
> our OpLineObject.
> So every change in a line-object in octave, e.g set(h, 'color',[0 1 0])
> will make property_change inside OpLineObject be executed.
>
>
> Could this be used by visualisation applications, if we convience Paul
> Kienzle to merge it into octave-forge?
> This means that Octave has a common library for handling graphics
> objects, which can be used by many visualisation applications. The
> visualisation application will be responsible of communication interface
> to and from Octave. And Props will be a layer that handles graphics
> objects, and properties within the visualisation application. Octave
> doesn't need duplicate copies of datas.
>
> Can I test the possibility to use Props inside OctPlot? Or will you Shai?
> It would be interesting if it's feasible. ;-) It should be.
>
> The code needs some refactoring, I guess. But refactoring is good, not
> evil.
>
> If more people are interested in Props-package and how it really works,
> then send me an email, and I will send you some more documentation about
> it.
>
> Cheers,
>
> Ole J.
>
>
>
>
>
>
>
>
>