source: trunk/SRC/ToBeReviewed/PLOTS/style.pro @ 325

Last change on this file since 325 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1;+
2;
3; @hidden
4;
5;-
6PRO thresholdstyle, limit, ltlstyle, gtlstyle, level_z2d, linestyle, thick
7;
8  compile_opt idl2, strictarrsubs
9;
10  dummy = where(level_z2d lt limit, n)
11  IF n GT 0 THEN BEGIN
12    IF limit EQ level_z2d[n < (n_elements(level_z2d) -1)] THEN BEGIN
13      thick     = [replicate(1,        n), 2, replicate(1,        1 > (n_elements(level_z2d)-1-n))]
14      linestyle = [replicate(ltlstyle, n), 0, replicate(gtlstyle, 1 > (n_elements(level_z2d)-1-n))]
15    ENDIF ELSE BEGIN
16      thick = [0]
17      linestyle = [replicate(ltlstyle, n), replicate(gtlstyle, 1 > (n_elements(level_z2d) -n))]
18    ENDELSE
19  ENDIF ELSE BEGIN
20    IF limit EQ level_z2d[n] THEN BEGIN
21      thick = [2, replicate(1, 1 > (n_elements(level_z2d)-1))]
22      linestyle = [0, replicate(gtlstyle, 1 > (n_elements(level_z2d)-1))]
23    ENDIF ELSE BEGIN
24      thick = [1]
25      linestyle = [gtlstyle]
26    ENDELSE
27  ENDELSE
28return
29end
30;+
31;
32; @file_comments
33; Choose the linestyle to trace iso-contour
34; (Will define the keywords c_linestyle and c_thick)
35;
36; @categories
37; Graphics
38;
39; @param LABSTYLE {in}{required}
40;
41; Two kind of labelstyle are accepted:
42;
43; 1) A number referring to the existing choices:
44;    0 : Two thin continuous lines, one bold continuous line...
45;    1 : before the middle of levels: thin dash. Then thin continuous
46;        line. and bold for the middle
47;    2 : Same as case 1 but threshold value is defined by the user
48;        by answering a question
49;    3 : Solid-Bold, solid-thin, dash Dot-thin, solid-thin, Solid-Bold...
50;    4 : Solid-very-thin, except for contour O, that is solid-bold
51; 2) for the labelstyle based on a threshold value (with a style
52;before and after the threshold value and a bold solid line for the
53;value itself, a more general definition can be given with a scalar
54;string with the following structure: 'xxNN...NNyy' with 
55; xx and yy correspondind to one the following choices (with the corresponding meaning)
56;               so -> Solid     
57;               do -> Dotted   
58;               da -> Dashed   
59;               dd -> Dash Dot 
60;               ld -> Long Dashes
61; and NN...NN any kind of number that will define the threshold value.
62; for example 'do-6.6so' will do dotted line until -6.6 and solid line after.
63;       
64; @param LEVEL_Z2D {in}{required}
65; Vector containing values of isolignes to be traced.
66;
67; @param LINESTYLE {out}
68; Used interbally by plt(z)(t) to define c_linestyle when calling pltbase.
69; Vector used to define the isocontour's style.
70;
71; @param THICK {out}
72; Used interbally by plt(z)(t) to define c_thick when calling pltbase.
73; Vector used to define the isocontour's thickness.
74;
75; @history
76; Sebastien Masson (smasson\@lodyc.jussieu.fr)
77; Oct 2007 revisiting...
78;
79; @version
80; $Id$
81;
82;-
83PRO style, labstyle, level_z2d, linestyle, thick
84;
85  compile_opt idl2, strictarrsubs
86;
87; Just to remember.. there is the codes for c_linestyle
88;               0       Solid   
89;               1       Dotted 
90;               2       Dashed 
91;               3       Dash Dot       
92;               4       Dash Dot Dot Dot       
93;               5       Long Dashes
94;       
95  IF size(labstyle, /type) EQ 7 THEN BEGIN
96    CASE strlowcase(strmid(labstyle, 0, 2)) OF
97      'so':ltlstyle = 0
98      'do':ltlstyle = 1
99      'da':ltlstyle = 2
100      'dd':ltlstyle = 3
101      'ld':ltlstyle = 5
102    ENDCASE
103    CASE strlowcase(strmid(labstyle, 1, 2, /reverse_offset)) OF
104      'so':gtlstyle = 0
105      'do':gtlstyle = 1
106      'da':gtlstyle = 2
107      'dd':gtlstyle = 3
108      'ld':gtlstyle = 5
109    ENDCASE
110    limit = float(strmid(labstyle, 2, strlen(labstyle)-4))
111    thresholdstyle, limit, ltlstyle, gtlstyle, level_z2d, linestyle, thick
112  ENDIF ELSE BEGIN
113    CASE labstyle OF
114      0: BEGIN
115; Two thin continuous lines, one bold continuous line
116        thick = [1, 1, 2]
117        linestyle = [0]
118      END
119      1: BEGIN
120; Before the middle of levels: thin dash. Then thin continuous line.
121; If the middle of the drawing is drawn, it is in bold continuous line.
122        odd = n_elements(level_z2d)-2*fix(n_elements(level_z2d)/2)
123        zero = replicate(0, fix(n_elements(level_z2d)/2))
124        one = replicate(1, fix(n_elements(level_z2d)/2))
125        two = replicate(2, fix(n_elements(level_z2d)/2))
126        IF odd THEN BEGIN
127          thick = [one, 2, one]
128          linestyle = [two, 0, zero]
129        ENDIF ELSE BEGIN
130          thick = [0]
131          linestyle = [two, zero]
132        ENDELSE
133      END
134      2: BEGIN
135; Before the threshold (defined by answering to a question): thin dash.
136; Then thin continuous trait. If the sill is drawn, it is in boldface continuous trait.
137        limit = xquestion('What is the threshold value between dashed and continues line? ', '0')
138        limit = float(limit)
139        thresholdstyle, limit, 2, 0, level_z2d, linestyle, thick
140      END
141; Solid-Bold, solid-thin, dash Dot-thin, solid-thin, Solid-Bold...   
142      3: begin
143        n = n_elements(level_z2d)
144        limit = level_z2d[1+n/2]
145        thick = intarr(n)
146        thick[indgen(n/4)*4] = 1
147        thick[indgen(n/4)*4+1] = 1
148        thick[indgen(n/4)*4+2] = 2
149        thick[indgen(n/4)*4+3] = 1
150        linestyle = intarr(n)
151        linestyle[indgen(n/4)*4] = 3
152        linestyle[indgen(n/4)*4+1] = 0
153        linestyle[indgen(n/4)*4+2] = 0
154        linestyle[indgen(n/4)*4+3] = 0
155      end
156      4: begin
157; Boldface continuous trait.
158        limit = 1.e-6
159        thick = replicate(.5,  n_elements(level_z2d))
160        linestyle = [0]
161        rien = where(abs(level_z2d)/max(abs(level_z2d)) LT limit)
162        if rien[0] NE -1 then thick[rien[0]] = 3
163      end
164      else: begin
165        ras = report('Bab value of the style (can be from 0 to 4 or a scalar string)')
166        stop
167      end
168    endcase
169  ENDELSE
170
171
172  return
173end
Note: See TracBrowser for help on using the repository browser.