[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Graphics properties as objects
From: |
Michael Goffioul |
Subject: |
Re: Graphics properties as objects |
Date: |
Tue, 8 Jan 2008 10:57:30 +0100 |
Hi,
I thought again about possible implementation, trying to consider everything.
So I'd like to propose the following scheme. Would this be acceptable?
Note: I decided to write the direct access get_xxx methods such that they
return the property value; the reason is that those accessors will mostly be
used by the C++ backend, which is mainly interested in the values; this makes
the code of the backend more intuitive.
class base_property
{
public:
...
void set_name (const std::string& name);
void set_parent (const graphics_handle& h);
};
class matrix_property : public base_property
{
public:
matrix_property (Matrix m)
: base_property (), data (m) { }
...
Matrix matrix_value (void) const { return data; }
private:
Matrix data;
};
class property
{
public:
property (base_property *p, bool persist = false);
...
};
class base_properties
{
public:
...
// this method is to add dynamic properties into the map
void insert_property (const std::string& name, property p)
{
p.set_name (name);
p.set_parent (__myhandle__);
all_props[name] = p;
}
// this method is to add fixed properties into the map
// (could probably be "protected")
void insert_static_property (const std::string& name, base_property& p)
{
p.set_name (name);
p.set_parent (__myhandle__);
all_props[name] = property (&p, true);
}
};
class axes : public graphics_object
{
public:
class properties : public base_properties
{
public:
properties (...)
: base_properties (...) ,
position (Matrix ()),
...
{
insert_static_property ("position", position);
...
}
Matrix get_position (void) const { return position.matrix_value (); }
void set_position (const octave_value& v) { position.set (v); }
...
private:
matrix_property position;
...
};
};
- Re: Graphics properties as objects, (continued)
- Re: Graphics properties as objects, Michael Goffioul, 2008/01/05
- Re: Graphics properties as objects, John Swensen, 2008/01/05
- Re: Graphics properties as objects, John W. Eaton, 2008/01/05
- Re: Graphics properties as objects, John W. Eaton, 2008/01/05
- Re: Graphics properties as objects, Michael Goffioul, 2008/01/06
- Re: Graphics properties as objects, John W. Eaton, 2008/01/06
- Re: Graphics properties as objects, Michael Goffioul, 2008/01/06
- Re: Graphics properties as objects,
Michael Goffioul <=
- Re: Graphics properties as objects, John W. Eaton, 2008/01/08
- Re: Graphics properties as objects, Michael Goffioul, 2008/01/08
- Re: Graphics properties as objects, Shai Ayal, 2008/01/08
- Re: Graphics properties as objects, Michael Goffioul, 2008/01/08
- Re: Graphics properties as objects, John W. Eaton, 2008/01/08
- Re: Graphics properties as objects, Michael Goffioul, 2008/01/08
- Re: Graphics properties as objects, Michael Goffioul, 2008/01/09
- Re: Graphics properties as objects, Shai Ayal, 2008/01/09
- Re: Graphics properties as objects, Michael Goffioul, 2008/01/09
- Re: Graphics properties as objects, Shai Ayal, 2008/01/09