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

Last change on this file since 314 was 299, checked in by smasson, 17 years ago

update the use of style

  • 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;-
83;
84PRO style, labstyle, level_z2d, linestyle, thick
85;
86  compile_opt idl2, strictarrsubs
87;
88; Just to remember.. there is the codes for c_linestyle
89;               0       Solid   
90;               1       Dotted 
91;               2       Dashed 
92;               3       Dash Dot       
93;               4       Dash Dot Dot Dot       
94;               5       Long Dashes
95;       
96  IF size(labstyle, /type) EQ 7 THEN BEGIN
97    CASE strlowcase(strmid(labstyle, 0, 2)) OF
98      'so':ltlstyle = 0
99      'do':ltlstyle = 1
100      'da':ltlstyle = 2
101      'dd':ltlstyle = 3
102      'ld':ltlstyle = 5
103    ENDCASE
104    CASE strlowcase(strmid(labstyle, 1, 2, /reverse_offset)) OF
105      'so':gtlstyle = 0
106      'do':gtlstyle = 1
107      'da':gtlstyle = 2
108      'dd':gtlstyle = 3
109      'ld':gtlstyle = 5
110    ENDCASE
111    limit = float(strmid(labstyle, 2, strlen(labstyle)-4))
112    thresholdstyle, limit, ltlstyle, gtlstyle, level_z2d, linestyle, thick
113  ENDIF ELSE BEGIN
114    CASE labstyle OF
115      0: BEGIN
116; Two thin continuous lines, one bold continuous line
117        thick = [1, 1, 2]
118        linestyle = [0]
119      END
120      1: BEGIN
121; Before the middle of levels: thin dash. Then thin continuous line.
122; If the middle of the drawing is drawn, it is in bold continuous line.
123        odd = n_elements(level_z2d)-2*fix(n_elements(level_z2d)/2)
124        zero = replicate(0, fix(n_elements(level_z2d)/2))
125        one = replicate(1, fix(n_elements(level_z2d)/2))
126        two = replicate(2, fix(n_elements(level_z2d)/2))
127        IF odd THEN BEGIN
128          thick = [one, 2, one]
129          linestyle = [two, 0, zero]
130        ENDIF ELSE BEGIN
131          thick = [0]
132          linestyle = [two, zero]
133        ENDELSE
134      END
135      2: BEGIN
136; Before the threshold (defined by answering to a question): thin dash.
137; Then thin continuous trait. If the sill is drawn, it is in boldface continuous trait.
138        limit = xquestion('What is the threshold value between dashed and continues line? ', '0')
139        limit = float(limit)
140        thresholdstyle, limit, 2, 0, level_z2d, linestyle, thick
141      END
142; Solid-Bold, solid-thin, dash Dot-thin, solid-thin, Solid-Bold...   
143      3: begin
144        n = n_elements(level_z2d)
145        limit = level_z2d[1+n/2]
146        thick = intarr(n)
147        thick[indgen(n/4)*4] = 1
148        thick[indgen(n/4)*4+1] = 1
149        thick[indgen(n/4)*4+2] = 2
150        thick[indgen(n/4)*4+3] = 1
151        linestyle = intarr(n)
152        linestyle[indgen(n/4)*4] = 3
153        linestyle[indgen(n/4)*4+1] = 0
154        linestyle[indgen(n/4)*4+2] = 0
155        linestyle[indgen(n/4)*4+3] = 0
156      end
157      4: begin
158; Boldface continuous trait.
159        limit = 1.e-6
160        thick = replicate(.5,  n_elements(level_z2d))
161        linestyle = [0]
162        rien = where(abs(level_z2d)/max(abs(level_z2d)) LT limit)
163        if rien[0] NE -1 then thick[rien[0]] = 3
164      end
165      else: begin
166        ras = report('Bab value of the style (can be from 0 to 4 or a scalar string)')
167        stop
168      end
169    endcase
170  ENDELSE
171
172
173  return
174end
Note: See TracBrowser for help on using the repository browser.