[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [unclassified] patch for color_properties assignment
From: |
Shai Ayal |
Subject: |
Re: [unclassified] patch for color_properties assignment |
Date: |
Wed, 11 Jul 2007 06:35:13 +0300 |
On 7/11/07, Kai Habel <address@hidden> wrote:
Hello,
I have some problems with this patch.
I think we have to modify the constructor
"color_property::color_property (const octave_value& val)" in the same
way. Because if I try to set the allowed radio_values (e.g. for line) with
xudata (Matrix ()),
color ("none|flat|interp"),
linestyle ("-"),
I get the following error:
octave:1> h=__go_line__ (gca)
error: invalid color specification
error: __goline__: unable to create graphics handle
error: evaluating assignment expression near line 1, column 2
The way it is written is too ambigious -- the std::string argument
could be converted to either a color_values, radio_values or
octave_value since all of them have std::string constructors.
In the case above, the following should work:
color(radio_values("none|flat|interp"));
Another problem is the radio_values::validate method. In your patch you
check first for valid radio values:
if (radio_val.validate (s))
+ {
+ current_val = s;
+ current_type = radio_t;
+ }
+ else
+ {
+ color_values col (s);
+ if (! error_state)
+ {
+ color_val = col;
+ current_type = color_t;
+ }
+ else
+ error ("invalid color specification");
+ }
but if 's' is a string color value (e.g. 'r' or 'red') validate calls
the error function and sets the error flag. This causes an error message
and octave terminates. I have turned off the error call in
radio_values::validate for test purposes. Then the creation of a line
object with:
h=__go_line__ (gca);
works as expected.
I think the issue here is that validate raises an error. I will send a
patch which will overcome this (e,g, replace radio_val.validate (s)
with
radio_val.possible_vals.find (val) != radio_val.possible_vals.end ()
Shai
p.s. How do you draw the patch in gnuplot?
patch for color_properties assignment, John W. Eaton, 2007/07/24