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

Last change on this file since 378 was 378, checked in by pinsard, 16 years ago

improvements of headers (typo, links, paragraphes, etc)

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