changeset 12068:6624d0ac6a52 release-3-2-x

Fix test for setting of datasource properties. Add the edgecolor property to contours
author David Bateman <dbateman@free.fr>
date Mon, 24 Aug 2009 10:02:47 +0200
parents 310063a87407
children c87030dce4d9
files scripts/ChangeLog scripts/plot/__add_datasource__.m scripts/plot/__contour__.m
diffstat 3 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-22  David Bateman  <dbateman@free.fr>
+
+	* plot/__add_datasource__.m: Correct test for "datasource" argument
+	* plot/__countour__.m: Add edgecolor properties and make it an alias
+	for linecolor with the value "auto" being "flat" for the edgecolor.
+
 2009-08-04  Pieter Eendebak <pieter.eendebak@gmail.com> 
 
 	* set/setxor.m: Support cell arrays of strings.
--- a/scripts/plot/__add_datasource__.m
+++ b/scripts/plot/__add_datasource__.m
@@ -40,7 +40,7 @@
   while (i < numel (varargin))
     arg = varargin{++i};
     if (i != numel(varargin) && ischar (arg)
-	&& length (arg) > 1 && strcmpi (arg(end-9:end), "datasource"))
+	&& length (arg) > 9 && strcmpi (arg(end-9:end), "datasource"))
       arg = tolower (arg);
       val = varargin{++i};
       if (ischar (val))
--- a/scripts/plot/__contour__.m
+++ b/scripts/plot/__contour__.m
@@ -28,6 +28,7 @@
 
   linespec.linestyle = "-";
   linespec.color = "auto";
+  edgecolor = "flat";
   for i = 3 : nargin
     arg = varargin {i};
     if ((ischar (arg) || iscell (arg)))
@@ -52,6 +53,17 @@
 	varargin(i:i+1) = [];
       elseif (strcmpi (varargin{i}, "linecolor"))
 	linespec.color = varargin {i + 1};
+	edgecolor = linespec.color;
+	if (ischar (edgecolor) && strcmpi (edgecolor, "auto"))
+	  edgecolor = "flat";
+	endif
+	varargin(i:i+1) = [];
+      elseif (strcmpi (varargin{i}, "edgecolor"))
+	linespec.color = varargin {i + 1};
+	edgecolor = linespec.color;
+	if (ischar (edgecolor) && strcmpi (edgecolor, "flat"))
+	  linespec.color = "auto";
+	endif
 	varargin(i:i+1) = [];
       else
 	opts{end+1} = varargin{i};
@@ -164,6 +176,10 @@
   addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle);
   addproperty ("linewidth", hg, "linelinewidth", 0.5);
 
+  ## FIXME It would be good to hide this property which is just an undocumented
+  ## alias for linecolor
+  addproperty ("edgecolor", hg, "color", edgecolor, "{flat}|none");
+
   addlistener (hg, "fill", @update_data);
 
   addlistener (hg, "zlevelmode", @update_zlevel);
@@ -185,6 +201,8 @@
   addlistener (hg, "linestyle", @update_line);
   addlistener (hg, "linewidth", @update_line);
 
+  addlistener (hg, "edgecolor", @update_edgecolor);
+
   add_patch_children (hg);
 
   if (!isempty (opts))
@@ -366,11 +384,27 @@
   endswitch
 endfunction
 
+function update_edgecolor (h, d)
+  ec = get (h, "edgecolor");
+  lc = get (h, "linecolor");
+  if (ischar (ec) && strcmpi (ec, "flat"))
+    if (! strcmpi (lc, "auto"))
+      set (h, "linecolor", "auto");
+    endif
+  elseif (! isequal (ec, lc))
+    set (h, "linecolor", ec);
+  endif
+endfunction
+
 function update_line (h, d)
   lc = get (h, "linecolor");
+  ec = get (h, "edgecolor");
   if (strcmpi (lc, "auto"))
     lc = "flat";
   endif
+  if (! isequal (ec, lc))
+    set (h, "edgecolor", lc);
+  endif
   set (findobj (h, "type", "patch"), "edgecolor", lc,
        "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"));
 endfunction