octave-maintainers
[Top][All Lists]
Advanced

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

Re: Graphics properties implementation


From: Michael Goffioul
Subject: Re: Graphics properties implementation
Date: Thu, 17 Jan 2008 17:00:29 +0100

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?

Michael.


reply via email to

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