[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[299] | 3 | ; @hidden |
---|
| 4 | ; |
---|
| 5 | ;- |
---|
| 6 | PRO 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 |
---|
| 28 | return |
---|
| 29 | end |
---|
| 30 | ;+ |
---|
| 31 | ; |
---|
[231] | 32 | ; @file_comments |
---|
[299] | 33 | ; Choose the linestyle to trace iso-contour |
---|
| 34 | ; (Will define the keywords c_linestyle and c_thick) |
---|
[2] | 35 | ; |
---|
[142] | 36 | ; @categories |
---|
[157] | 37 | ; Graphics |
---|
[2] | 38 | ; |
---|
[142] | 39 | ; @param LABSTYLE {in}{required} |
---|
[299] | 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. |
---|
[142] | 63 | ; |
---|
| 64 | ; @param LEVEL_Z2D {in}{required} |
---|
| 65 | ; Vector containing values of isolignes to be traced. |
---|
[2] | 66 | ; |
---|
[142] | 67 | ; @param LINESTYLE {out} |
---|
[299] | 68 | ; Used interbally by plt(z)(t) to define c_linestyle when calling pltbase. |
---|
| 69 | ; Vector used to define the isocontour's style. |
---|
[231] | 70 | ; |
---|
[142] | 71 | ; @param THICK {out} |
---|
[299] | 72 | ; Used interbally by plt(z)(t) to define c_thick when calling pltbase. |
---|
| 73 | ; Vector used to define the isocontour's thickness. |
---|
[2] | 74 | ; |
---|
[142] | 75 | ; @history |
---|
[157] | 76 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[299] | 77 | ; Oct 2007 revisiting... |
---|
[2] | 78 | ; |
---|
[142] | 79 | ; @version |
---|
| 80 | ; $Id$ |
---|
[2] | 81 | ; |
---|
| 82 | ;- |
---|
[262] | 83 | PRO style, labstyle, level_z2d, linestyle, thick |
---|
[231] | 84 | ; |
---|
[114] | 85 | compile_opt idl2, strictarrsubs |
---|
| 86 | ; |
---|
[299] | 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. |
---|
[142] | 136 | ; Then thin continuous trait. If the sill is drawn, it is in boldface continuous trait. |
---|
[299] | 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... |
---|
[2] | 142 | 3: begin |
---|
[299] | 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 |
---|
[2] | 155 | end |
---|
| 156 | 4: begin |
---|
[142] | 157 | ; Boldface continuous trait. |
---|
[299] | 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 |
---|
[2] | 163 | end |
---|
| 164 | else: begin |
---|
[299] | 165 | ras = report('Bab value of the style (can be from 0 to 4 or a scalar string)') |
---|
| 166 | stop |
---|
[2] | 167 | end |
---|
[299] | 168 | endcase |
---|
| 169 | ENDELSE |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | return |
---|
[2] | 173 | end |
---|