|
From: | Shai Ayal |
Subject: | Re: problem with radio values in color_property |
Date: | Thu, 5 Jul 2007 07:00:42 +0300 |
On 7/4/07, Kai Habel <address@hidden> wrote:
Now we can create a line object in octave: octave:1> line([1 2],[1 2]) octave:2> h=line([1 2],[1 2]) h = -7 octave:3> get(h,'color') ans = none Fine, 'none' is chosen as default value, but if we try to change the color to 'flat', this happens. octave:4> set(h,'color','flat') warning: invalid color specification octave:5> get(h,'color') ans = 2.1220e-314 4.9407e-324 2.7025e-310 Apperently the set command fails, but I have no idea why. So, maybe you can help here. (Setting a color value e.g. 'r', 'red', [10 0] works fine.)
For all properties which are not based on a radio_value, the set of allowable values is fixed at compile time, and so a constructor with an octave_value as it's only argument can define the property. For radio value based properties, the set of allowable values is defined at run time, so we cannot construct such an object with just an octave_value -- we need to specify the set of allowable values. If you look at graphics.cc line 1567: color = color_property (val); you see that set works by assigning a new object to color. This in effect removes the set of allowable values and you are left with a pure color properties. My solution is to add color_property& operator = (const octave_value& val) which will check val as you do in your patch and then use color = val in line 1567. This would keep the set of allowable values, defined in line_properties intact. I am sorry not to be sending this as a patch -- I will have time later hopefully Shai
[Prev in Thread] | Current Thread | [Next in Thread] |