diff options
Diffstat (limited to 'inst/shapedraw.m')
-rw-r--r-- | inst/shapedraw.m | 60 |
1 files changed, 9 insertions, 51 deletions
diff --git a/inst/shapedraw.m b/inst/shapedraw.m index d0221c0..dfeb0fb 100644 --- a/inst/shapedraw.m +++ b/inst/shapedraw.m @@ -1,4 +1,4 @@ -## Copyright (C) 2014,2015 Philip Nienhuis +## Copyright (C) 2014-2020 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by @@ -68,48 +68,6 @@ ## Author: Philip Nienhuis <prnienhuis@users.sf.net> ## Created: 2014-11-15 -## Updates: -## 2014-11-15 First draft -## 2014-11-17 Add support for geostructs -## 2014-11-29 Solid fill (patches) -## 2014-12-16 Solid fill (polygons) with holes -## 2014-12-17 MultiPatch plots (3D) -## 2014-12-18 3D Points/Polylines/-gons -## 2014-12-30 Transpose npr values for MultiPatch prior to drawing patches -## 2015-01-01 Fix function name in error message -## 2015-01-06 Improve plotting of polygons with holes - optimize branch cuts -## 2015-01-07 Largely rewritten; -## - Combined line and patch sections into one switch -## - More rigorous checks on input parameters -## 2015-01-08 More rewrites, better input checks -## '' Allow marker indicators for (multi)point -## 2015-01-09 Add code to check if individual polygon parts are holes (not all) -## '' Improve code for single color code/stle arguments -## 2015-01-10 Renamed to shapedraw.m (shapeplot is already in OF-geometry) -## '' Fixed argument checking for "color" property (swapping if checks) -## 2015-01-20 Change "color" to "edgecolor" for multipatch -## '' Add undocumented "center" argument to cope with large coordinates -## (OpenGL chokes there as it only works with single precision) -## 2015-01-21 Apply varargin to 3D-patches using "set" command -## '' Simplify input args, eliminate "clr" arg -## '' Support for extended mapstructs -## 2015-01-24 Restructured a bit, debugged MultiPatch drawing -## 2015-01-27 Texinfo header, check on Z-values -## 2015-01-30 Simplify ML style struct test; allow Point types (no BoundingBox) -## 2015-01-31 Fix wrong indexing in MultiPatch-triangle processing -## 2015-02-03 Swap checks for first color arg and graphics properties -## 2015-02-04 Check for Z and make it a column vector before calling plot3 -## '' Morefixes for color argument checks -## 2015-02-11 Eliminate duplicate code, move to subfunc chk_props -## 2015-02-17 Markerstyle => Marker in point draw switch stmt -## '' Don't reshape back args in chk_props subfuc -## '' Improve checks for default color -## 2015-04-19 Make warning state changes local -## 2015-07-10 Add try-catch around varargin reshape to catch wrong input -## '' Simplify polygon plot code -## '' Fix 3D-plotting for "extended" map/geostructs -## 2015-12-27 Improve speed of drawing many polygons -## 2015-12-30 Improve multipatch drawing speed function [h] = shapedraw (shpf, varargin) @@ -140,11 +98,6 @@ function [h] = shapedraw (shpf, varargin) ## Nothing to plot return; - if (isempty (varargin)) - ## Supply default color - varargin = {[0.6, 0.6, 0.6]}; - endif - elseif (isstruct (shpf)) ## Yep. Find out what type fldn = fieldnames (shpf); @@ -183,6 +136,11 @@ function [h] = shapedraw (shpf, varargin) error ("struct name of file name expected"); endif + if (isempty (varargin)) + ## Supply default color + varargin = {[0.6, 0.6, 0.6]}; + endif + ## 2. Morph XY[Z} data in a suitable form for fastest plotting ## Prepare XY plot. Get vertices & prepare some geometry data @@ -389,7 +347,7 @@ function [h] = shapedraw (shpf, varargin) endif varargin = {"edgecolor", varargin{1}(1, :) "facecolor" varargin{1}(2, :)}; else - varargin = {"color" clr(1, :) varargin{:}}; + varargin = {"color", varargin{:}}; endif endif endif @@ -421,7 +379,7 @@ function [h] = shapedraw (shpf, varargin) ## Check for some marker style or marker color code (latter always arg #1) if (! ismember ("marker", lower (varargin(1, :))) && ... ! ismember (varargin(1), color_codes)) - varargin = { "marker", "." varargin{:} }; + varargin = { "marker", ".", "linestyle", "none" varargin{:} }; endif plot (X, Y, varargin{:}); @@ -430,7 +388,7 @@ function [h] = shapedraw (shpf, varargin) ## Check for some marker style or marker color code (latter always arg #1) if (! ismember ("marker", lower (varargin(1, :))) && ... ! ismember (varargin(1), color_codes)) - varargin = {"marker", "." varargin{:} }; + varargin = {"marker", ".", "linestyle", "none" varargin{:} }; endif plot3 (X, Y, Z, varargin{:}); |