1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2004-2006 - INRIA - Fabrice Leray
3 // Copyright (C) 2012 - 2016 - Scilab Enterprises
5 // This file is hereby licensed under the terms of the GNU GPL v2.0,
6 // pursuant to article 5.3.4 of the CeCILL v.2.1.
7 // This file was originally licensed under the terms of the CeCILL v2.1,
8 // and continues to be available under such terms.
9 // For more information, see the COPYING file which you should have received
10 // along with this program.
12 function [Color,Line,LineStyle,Marker,MarkerStyle,MarkerSize,fail]=getLineSpec(str,current_figure,cur_draw_mode)
21 //conversion to lower format
25 // Line type modifiers
28 str=strsubst(str,"--","");
31 elseif strindex(str,"-.")
32 str=strsubst(str,"-.","");
35 elseif strindex(str,":")
36 str=strsubst(str,":","");
39 elseif strindex(str,"-")
40 str=strsubst(str,"-","");
47 //disp("str vaut:::::::: 1/2")
50 // 2) COLORS + MARKS STYLE
55 Table = [ "+" "o" "*" "." "x" "square" "diamond" "^" "v" ">" "<" "pentagram"];
56 MarksStyleVal=[1 9 10 0 2 11 5 6 7 12 13 14];
57 //MarksSizeVal =[4 3 7 1 3 3 4 3 3 3 3 3];
58 //MarksSizeVal =[6 6 6 6 6 6 6 6 6 6 6 6]; // size is given in points now (25.02.05)
61 Table= [Table "red" "green" "blue" "cyan" "magenta" "yellow" "black" "k" "white"]
62 ColorVal = ["red" "green" "blue" "cyan" "magenta" "yellow" "black" "black" "white"]
65 //difficulty here since we have to allow every kind of writings:
67 //magenta can be set by: 'm' 'ma' 'mag' 'mage' 'magen' 'magent' or at least 'magenta'
74 c1 = part(str,1); // We get the first character
75 k=find(part(Table,1)==c1);
77 if (k == [] | (size(k,"*") > 1 & c1 <> "b"))
78 ResetFigureDDM(current_figure, cur_draw_mode);
79 error(msprintf(gettext("%s: Wrong type for input argument.\n"), "getLineSpec"));
82 if c1=="b" // special case here : we have to distinguish between black and blue colors
87 k=19; // k is set to black color
89 k=15; // k is set to blue color
92 k=15; // k is set to blue color
98 if part(opt,i) <> part(str,i)
105 str = part(str,i:length(str));
110 // LineSpec is parsed now
114 for i=1:size(opt1,"*")
118 MarkerStyle = MarksStyleVal(opt1(i));
120 //MarkerSize = MarksSizeVal (opt1(i));
121 // disp("MarkerSize =");
124 Color = color(ColorVal(opt1(i)-12));
131 // end of getLineSpec