1 | pro cw_slide_slice_set_value, id, value |
---|
2 | ; |
---|
3 | compile_opt idl2, strictarrsubs |
---|
4 | ; |
---|
5 | @common |
---|
6 | topid = findtopid(id) |
---|
7 | domainid = widget_info(topid, find_by_uname = 'domain') |
---|
8 | widget_control, domainid, get_value = boxzoom |
---|
9 | if boxzoom[1]-boxzoom[0] LT boxzoom[3]-boxzoom[2] then type = 'y' ELSE type = 'x' |
---|
10 | thickid = widget_info(topid, find_by_uname = 'thickness') |
---|
11 | widget_control, thickid, get_uvalue = thicknessuval |
---|
12 | widget_control, thickid, get_value = thickness |
---|
13 | thickness = thicknessuval.choix[thickness.droplist_select] |
---|
14 | sliderid = widget_info(topid, find_by_uname = 'slider') |
---|
15 | if type EQ 'y' then BEGIN |
---|
16 | mini = floor(min([glamt, glamf], max = maxi)) |
---|
17 | maxi = ceil(maxi)-thickness |
---|
18 | widget_control, sliderid, set_value = {slider_min:mini, slider_max:maxi, value:boxzoom[0]<maxi} |
---|
19 | thickness = boxzoom[1]-boxzoom[0] |
---|
20 | ENDIF ELSE BEGIN |
---|
21 | mini = floor(min([gphit, gphif], max = maxi)) |
---|
22 | maxi = ceil(maxi)-thickness |
---|
23 | widget_control, sliderid, set_value = {slider_min:mini, slider_max:maxi, value:boxzoom[2]<maxi} |
---|
24 | thickness = boxzoom[3]-boxzoom[2] |
---|
25 | ENDELSE |
---|
26 | thicknessval = thicknessuval.choix |
---|
27 | index = where(thicknessval EQ thickness) & index = index[0] |
---|
28 | if index EQ -1 then BEGIN |
---|
29 | index = 20 |
---|
30 | thicknessval[20] = strtrim(thickness, 1) |
---|
31 | widget_control, thickid, set_value = thicknessval |
---|
32 | widget_control, thickid, set_uvalue ={name:'thickness', choix:thicknessval} |
---|
33 | endif |
---|
34 | widget_control, thickid, set_value = {droplist_select:index} |
---|
35 | return |
---|
36 | end |
---|
37 | ;---------------------------------------------------------------------- |
---|
38 | FUNCTION cw_slide_slice_event, event |
---|
39 | ; |
---|
40 | compile_opt idl2, strictarrsubs |
---|
41 | ; |
---|
42 | @common |
---|
43 | widget_control, event.id, get_uvalue=uval |
---|
44 | domainid = widget_info(event.top, find_by_uname = 'domain') |
---|
45 | thickid = widget_info(event.handler, find_by_uname = 'thickness') |
---|
46 | sliderid = widget_info(event.handler, find_by_uname = 'slider') |
---|
47 | ; uniteid = widget_info(event.handler, find_by_uname = 'unite') |
---|
48 | widget_control, domainid, get_value = boxzoom |
---|
49 | if boxzoom[1]-boxzoom[0] LT boxzoom[3]-boxzoom[2] then type = 'y' ELSE type = 'x' |
---|
50 | widget_control, thickid, get_uvalue = thicknessuval |
---|
51 | widget_control, thickid, get_value = thickness |
---|
52 | thickness = thicknessuval.choix[thickness.droplist_select] |
---|
53 | widget_control, sliderid, get_value = slider & slider = slider.value |
---|
54 | |
---|
55 | if uval.name EQ 'thickness' then begin |
---|
56 | if boxzoom[1]-boxzoom[0] LT boxzoom[3]-boxzoom[2] then type = 'y' ELSE type = 'x' |
---|
57 | if type EQ 'y' then BEGIN |
---|
58 | mini = floor(min([glamt, glamf], max = maxi)) |
---|
59 | maxi = ceil(maxi)-thickness |
---|
60 | ENDIF ELSE BEGIN |
---|
61 | mini = floor(min([gphit, gphif], max = maxi)) |
---|
62 | maxi = ceil(maxi)-thickness |
---|
63 | ENDELSE |
---|
64 | slider = slider<maxi |
---|
65 | widget_control, sliderid, set_value = {slider_min:mini, slider_max:maxi, value:slider} |
---|
66 | endif |
---|
67 | |
---|
68 | ; widget_control, uniteid, get_value = unite |
---|
69 | ; |
---|
70 | ; |
---|
71 | ; if uval.name EQ 'unite' then begin |
---|
72 | ; domdef, boxzoom, gridtype = 'T' |
---|
73 | ; if unite EQ 'degre' then BEGIN |
---|
74 | ; if strpos(type,'y') NE -1 then begin |
---|
75 | ; mini = floor(min([glamt, glamf], max = maxi)) |
---|
76 | ; maxi = ceil(maxi) |
---|
77 | ; print, lon1, mini, maxi |
---|
78 | ; widget_control, sliderid, set_value = {value:lon1, slider_min_max:[mini, maxi]} |
---|
79 | ; ENDIF ELSE BEGIN |
---|
80 | ; mini = floor(min([gphit, glamf], max = maxi)) |
---|
81 | ; maxi = ceil(maxi) |
---|
82 | ; widget_control, sliderid, set_value = {value:lat1, slider_min_max:[mini, maxi]} |
---|
83 | ; ENDELSE |
---|
84 | ; ENDIF ELSE BEGIN |
---|
85 | ; if strpos(type,'y') NE -1 then BEGIN |
---|
86 | ; print, 'ds if',firstxt, 0, jpi-1 |
---|
87 | ; widget_control, sliderid, set_value = {value:firstxt, slider_min_max:[0, jpi-1]} |
---|
88 | ; ENDIF ELSE BEGIN |
---|
89 | ; widget_control, sliderid, set_value = {value:firstyt, slider_min_max:[0, jpj-1]} |
---|
90 | ; ENDELSE |
---|
91 | ; ENDELSE |
---|
92 | ; endif |
---|
93 | ; |
---|
94 | ; if unite EQ 'degre' then BEGIN |
---|
95 | if type EQ 'y' then begin |
---|
96 | boxzoom[0] = slider & boxzoom[1] = slider+thickness |
---|
97 | ENDIF ELSE BEGIN |
---|
98 | boxzoom[2] = slider & boxzoom[3] = slider+thickness |
---|
99 | ENDELSE |
---|
100 | ; ENDIF ELSE BEGIN |
---|
101 | ; if strpos(type,'y') NE -1 then begin |
---|
102 | ; boxzoom[0] = glamt[slider, 0] & boxzoom[1] = glamf[slider+thickness, 0] |
---|
103 | ; ENDIF ELSE BEGIN |
---|
104 | ; boxzoom[2] = gphit[0, slider] & boxzoom[3] = gphif[0, slider+thickness] |
---|
105 | ; ENDELSE |
---|
106 | ; ENDELSE |
---|
107 | widget_control, domainid, set_value = boxzoom |
---|
108 | return, {CW_SLIDE_SLICE, ID:event.handler, TOP:event.top, HANDLER:0L} |
---|
109 | end |
---|
110 | ;-------------------------------------------------------------------------------- |
---|
111 | ;+ |
---|
112 | ; @file_comments |
---|
113 | ; |
---|
114 | ; |
---|
115 | ; @categories |
---|
116 | ; |
---|
117 | ; @param PARENT {in}{required} |
---|
118 | ; The widget ID of the parent widget. |
---|
119 | ; |
---|
120 | ; @keyword BOXZOOM |
---|
121 | ; Vector indicating the geographic zone on which we want to cut the map. |
---|
122 | ; If BOXZOOM has : |
---|
123 | ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] |
---|
124 | ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] |
---|
125 | ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] |
---|
126 | ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] |
---|
127 | ; 6 elements: The extraction is made on Boxzoom |
---|
128 | ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! |
---|
129 | ; |
---|
130 | ; @keyword COLUMN |
---|
131 | ; Buttons will be arranged in the number of columns |
---|
132 | ; specified by this keyword. |
---|
133 | ; |
---|
134 | ; @keyword FRAME |
---|
135 | ; Specifies the width of the frame to be drawn around the base. |
---|
136 | ; |
---|
137 | ; @keyword ROW |
---|
138 | ; Buttons will be arranged in the number of rows |
---|
139 | ; specified by this keyword. |
---|
140 | ; |
---|
141 | ; @keyword UVALUE |
---|
142 | ; The user value to be associated with the widget. |
---|
143 | ; |
---|
144 | ; @keyword UNAME |
---|
145 | ; The user name to be associated with the widget. |
---|
146 | ; |
---|
147 | ; @keyword _EXTRA |
---|
148 | ; Used to pass your keywords |
---|
149 | ; |
---|
150 | ; @returns |
---|
151 | ; |
---|
152 | ; |
---|
153 | ; @uses |
---|
154 | ; |
---|
155 | ; |
---|
156 | ; @restrictions |
---|
157 | ; |
---|
158 | ; |
---|
159 | ; @examples |
---|
160 | ; |
---|
161 | ; |
---|
162 | ; @history |
---|
163 | ; |
---|
164 | ; |
---|
165 | ; @version |
---|
166 | ; $Id$ |
---|
167 | ; |
---|
168 | ; @todo |
---|
169 | ; seb: documenter |
---|
170 | ; |
---|
171 | ;- |
---|
172 | FUNCTION cw_slide_slice, parent, boxzoom = boxzoom, UVALUE = uvalue, UNAME = uname, FRAME = frame, ROW = row, COLUMN = column, _extra = ex |
---|
173 | ; |
---|
174 | compile_opt idl2, strictarrsubs |
---|
175 | ; |
---|
176 | @common |
---|
177 | ;------------------------------------------------ |
---|
178 | ; cheking exclusive keywords |
---|
179 | column = keyword_set(column)*(1-keyword_set(row)) |
---|
180 | row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) |
---|
181 | if NOT keyword_set(uvalue) then uvalue = '' |
---|
182 | if NOT keyword_set(uname) then uname = '' |
---|
183 | ; |
---|
184 | base = widget_base(parent, ROW = row, COLUMN = column $ |
---|
185 | , EVENT_FUNC = 'cw_slide_slice_event' $ |
---|
186 | , FUNC_GET_VALUE='cw_slide_slice_get_value' $ |
---|
187 | , PRO_SET_VALUE='cw_slide_slice_set_value' $ |
---|
188 | , ROW = row, COLUMN = column, UVALUE = uvalue, UNAME = uname $ |
---|
189 | , FRAME = frame, _extra = ex) |
---|
190 | ;------------------------------------------------ |
---|
191 | if NOT keyword_set(boxzoom) then boxzoom = [lon1, lon2, lat1, lat2] |
---|
192 | ; rien = cw_bgroup(base, ['degre', 'points'],/exclusive, /column, uname = 'unite', uvalue = {name:'unite'}, /return_name, set_value = 0, /no_release) |
---|
193 | thicknessval = indgen(21)+1 |
---|
194 | thicknessval = string(thicknessval) |
---|
195 | for i = 0, n_elements(thicknessval)-1 do thicknessval[i] = strtrim(thicknessval[i], 1) |
---|
196 | droplistid = cw_droplist_pm(base, value = thicknessval, uname = 'thickness', uvalue = {name:'thickness', choix:thicknessval}) |
---|
197 | ; |
---|
198 | if boxzoom[1]-boxzoom[0] LT boxzoom[3]-boxzoom[2] then type = 'y' ELSE type = 'x' |
---|
199 | if type EQ 'y' then BEGIN |
---|
200 | mini = floor(min([glamt, glamf], max = maxi)) |
---|
201 | thickness = boxzoom[1]-boxzoom[0] |
---|
202 | maxi = ceil(maxi)-thickness |
---|
203 | rien = cw_slider_pm(base, minimum = mini, maximum = (mini+1) > maxi $ |
---|
204 | , value = mini > boxzoom[0] < maxi, /column, uname = 'slider' $ |
---|
205 | , uvalue = {name:'slider'}) |
---|
206 | ENDIF ELSE BEGIN |
---|
207 | mini = floor(min([gphit, gphif], max = maxi)) |
---|
208 | thickness = boxzoom[3]-boxzoom[2] |
---|
209 | maxi = ceil(maxi)-thickness |
---|
210 | rien = cw_slider_pm(base, minimum = mini, maximum = (mini+1) > maxi $ |
---|
211 | , value = mini > boxzoom[2] < maxi, /column, uname = 'slider' $ |
---|
212 | , uvalue = {name:'slider'}) |
---|
213 | ENDELSE |
---|
214 | index = where(thicknessval EQ thickness) & index = index[0] |
---|
215 | if index EQ -1 then BEGIN |
---|
216 | index = 20 |
---|
217 | thicknessval[20] = strtrim(thickness, 1) |
---|
218 | widget_control, droplistid, set_value = thicknessval |
---|
219 | widget_control, droplistid, set_uvalue ={name:'thickness', choix:thicknessval} |
---|
220 | endif |
---|
221 | widget_control, droplistid, set_value = {droplist_select:index} |
---|
222 | |
---|
223 | ; if type EQ 'xt' then begin |
---|
224 | ; mini = floor(min([glamt,glamf], max = maxi)) |
---|
225 | ; maxi = ceil(maxi) |
---|
226 | ; ENDIF ELSE BEGIN |
---|
227 | ; mini = floor(min([gphit,gphif], max = maxi)) |
---|
228 | ; maxi = ceil(maxi) |
---|
229 | ; ENDELSE |
---|
230 | |
---|
231 | ;------------------------------------------------ |
---|
232 | return, base |
---|
233 | end |
---|