[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Graphics properties implementation
From: |
Shai Ayal |
Subject: |
Re: Graphics properties implementation |
Date: |
Thu, 17 Jan 2008 21:55:41 +0200 |
On Jan 17, 2008 6:00 PM, Michael Goffioul <address@hidden> wrote:
> On 1/14/08, Kai Habel <address@hidden> wrote:
> > Hello Michael,
> >
> > yes I will look into the additional method needed, but it will take some
> > time. After a first look into the respective jhandles file [1] it seems
> > straightforward to translate the methods for face/vertex <--> X/Y/Z
> > conversion and normals computation into C++.
> >
> > I assume these functions should be called (if needed) from a not yet
> > existing validate method as well.
>
> Indeed, that's a possible solution. Actually, IMO there's a need for a
> built-in self-listener mechanism in the properties classes (the one
> derived from base_properties); this mechanism would be responsible
> for calling the appropriate update function. In practice, I mean something
> like the following (I just included the relevant code):
>
> class base_properties
> {
> public:
> virtual void validate (const std::string& pname) { }
> };
>
> class patch
> {
> public:
> class properties : public base_properties
> {
> public:
> void update_xyz_data (void);
> void validate (const std::string& pname)
> {
> if (pname == "faces" || pname == "vertices")
> update_xyz ();
> }
>
> BEGIN_PROPERTIES(patch)
> array_property faces v , Matrix ()
> END_PROPERTIES
> };
> };
>
> The 'v' modifier would expand set_faces as
>
> void set_faces (const octave_value& v)
> {
> if (! error_state)
> {
> faces = v;
> validate ("faces");
> mark_modified ();
> }
> }
>
> This should fit pretty easy in the code generation. Shai, John: comments?
This is similar to the postset checks I suggested. Maybe we should
make it more generic and add a preset & postset functions which would
be called from set (with the "v" modifier):
void set_faces (const octave_value& v)
{
if (! error_state)
{
preset ("faces", v);
if (! error_state)
{
faces = v;
postset ("faces");
mark_modified ();
}
}
}
this allows for further checks of the input before setting the value
-- I'm sure it will come in handy sometime ...
Shai
- Re: Graphics properties implementation, (continued)
- Re: Graphics properties implementation, Ben Abbott, 2008/01/13
- Re: Graphics properties implementation, Ben Abbott, 2008/01/13
- Re: Graphics properties implementation, Kai Habel, 2008/01/13
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/13
- Re: Graphics properties implementation, John W. Eaton, 2008/01/14
- Re: Graphics properties implementation, Kai Habel, 2008/01/14
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/17
- Re: Graphics properties implementation,
Shai Ayal <=
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/17
- Re: Graphics properties implementation, Shai Ayal, 2008/01/17
- Re: Graphics properties implementation, John W. Eaton, 2008/01/17
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/17
- Re: Graphics properties implementation, John W. Eaton, 2008/01/14