Fix test for setting of datasource properties. Add the edgecolor property to contours
1 --- a/scripts/ChangeLog Sun Aug 23 11:12:35 2009 +0200
2 +++ b/scripts/ChangeLog Mon Aug 24 10:02:47 2009 +0200
3 @@ -1,3 +1,9 @@
4 +2009-08-22 David Bateman <dbateman@free.fr>
5 +
6 + * plot/__add_datasource__.m: Correct test for "datasource" argument
7 + * plot/__countour__.m: Add edgecolor properties and make it an alias
8 + for linecolor with the value "auto" being "flat" for the edgecolor.
9 +
10 2009-08-04 Pieter Eendebak <pieter.eendebak@gmail.com>
11
12 * set/setxor.m: Support cell arrays of strings.
1.1 --- a/scripts/plot/__add_datasource__.m Sun Aug 23 11:12:35 2009 +0200
1.2 +++ b/scripts/plot/__add_datasource__.m Mon Aug 24 10:02:47 2009 +0200
1.3 @@ -40,7 +40,7 @@
1.4 while (i < numel (varargin))
1.5 arg = varargin{++i};
1.6 if (i != numel(varargin) && ischar (arg)
1.7 - && length (arg) > 1 && strcmpi (arg(end-9:end), "datasource"))
1.8 + && length (arg) > 9 && strcmpi (arg(end-9:end), "datasource"))
1.9 arg = tolower (arg);
1.10 val = varargin{++i};
1.11 if (ischar (val))
2.1 --- a/scripts/plot/__contour__.m Sun Aug 23 11:12:35 2009 +0200
2.2 +++ b/scripts/plot/__contour__.m Mon Aug 24 10:02:47 2009 +0200
2.3 @@ -28,6 +28,7 @@
2.4
2.5 linespec.linestyle = "-";
2.6 linespec.color = "auto";
2.7 + edgecolor = "flat";
2.8 for i = 3 : nargin
2.9 arg = varargin {i};
2.10 if ((ischar (arg) || iscell (arg)))
2.11 @@ -52,6 +53,17 @@
2.12 varargin(i:i+1) = [];
2.13 elseif (strcmpi (varargin{i}, "linecolor"))
2.14 linespec.color = varargin {i + 1};
2.15 + edgecolor = linespec.color;
2.16 + if (ischar (edgecolor) && strcmpi (edgecolor, "auto"))
2.17 + edgecolor = "flat";
2.18 + endif
2.19 + varargin(i:i+1) = [];
2.20 + elseif (strcmpi (varargin{i}, "edgecolor"))
2.21 + linespec.color = varargin {i + 1};
2.22 + edgecolor = linespec.color;
2.23 + if (ischar (edgecolor) && strcmpi (edgecolor, "flat"))
2.24 + linespec.color = "auto";
2.25 + endif
2.26 varargin(i:i+1) = [];
2.27 else
2.28 opts{end+1} = varargin{i};
2.29 @@ -164,6 +176,10 @@
2.30 addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle);
2.31 addproperty ("linewidth", hg, "linelinewidth", 0.5);
2.32
2.33 + ## FIXME It would be good to hide this property which is just an undocumented
2.34 + ## alias for linecolor
2.35 + addproperty ("edgecolor", hg, "color", edgecolor, "{flat}|none");
2.36 +
2.37 addlistener (hg, "fill", @update_data);
2.38
2.39 addlistener (hg, "zlevelmode", @update_zlevel);
2.40 @@ -184,6 +200,8 @@
2.41 addlistener (hg, "linecolor", @update_line);
2.42 addlistener (hg, "linestyle", @update_line);
2.43 addlistener (hg, "linewidth", @update_line);
2.44 +
2.45 + addlistener (hg, "edgecolor", @update_edgecolor);
2.46
2.47 add_patch_children (hg);
2.48
2.49 @@ -366,10 +384,26 @@
2.50 endswitch
2.51 endfunction
2.52
2.53 +function update_edgecolor (h, d)
2.54 + ec = get (h, "edgecolor");
2.55 + lc = get (h, "linecolor");
2.56 + if (ischar (ec) && strcmpi (ec, "flat"))
2.57 + if (! strcmpi (lc, "auto"))
2.58 + set (h, "linecolor", "auto");
2.59 + endif
2.60 + elseif (! isequal (ec, lc))
2.61 + set (h, "linecolor", ec);
2.62 + endif
2.63 +endfunction
2.64 +
2.65 function update_line (h, d)
2.66 lc = get (h, "linecolor");
2.67 + ec = get (h, "edgecolor");
2.68 if (strcmpi (lc, "auto"))
2.69 lc = "flat";
2.70 + endif
2.71 + if (! isequal (ec, lc))
2.72 + set (h, "edgecolor", lc);
2.73 endif
2.74 set (findobj (h, "type", "patch"), "edgecolor", lc,
2.75 "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"));