source: trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_domain.pro @ 226

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

corrections of some misspellings in some *.pro

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 24.8 KB
Line 
1; IDL> testwid
2; PRO testwid_event, event
3; ; help,  event, /struct
4;    Id = widget_info(event.top,find_by_uname = 'c''est lui')
5;    widget_control, event.id, get_uvalue=uval
6;    if n_elements(uval) EQ 0 then return
7;    case uval of
8;       'done':widget_control, event.top, /destroy
9;       'set':BEGIN
10;          widget_control, event.id, get_value = value & value = value[0]
11;          nothing = execute('boxzoom ='+value)
12;          widget_control, Id, set_value = boxzoom
13;       END
14;       'get':BEGIN
15;          widget_control, Id, get_value = value
16;          print,  value
17;       END
18;       ELSE:
19;    endcase
20;    return
21; end
22; PRO testwid, _extra = ex
23;    base=widget_base(/COLUMN)
24;    print, 'base=', base
25;    nothing = widget_label(base, value = 'beginning of the test')
26; ;
27;    nothing = cw_domain(base,_extra = ex, uname = 'c''est lui', uvalue = 'c''est lui')
28;    print, 'cw_domain ID =', nothing
29; ;
30;    nothing = widget_label(base, value = 'end of the test')
31;    nothing = widget_text(base, value = '[40, 100, -10, 10]', uvalue = 'set', /editable)
32;    nothing = widget_button(base, value = 'get', uvalue = 'get')
33;    nothing = widget_button(base, value = 'done', uvalue = 'done')
34;    widget_control, base, /REALIZE
35;    xmanager,'testwid', base
36;    return
37; end
38;
39;
40;*********************************************************************
41;+
42; @file_comments
43;
44;
45; @categories
46; Compound widget
47;
48; @param ID
49;
50;
51; @param VALUE
52; It is the default tick mark value (a floating-point number).
53;
54; @returns
55;
56; @uses
57;
58; @restrictions
59;
60; @examples
61;
62; @history
63;
64; @version
65; $Id$
66;-
67pro cw_domain_set_value, id, value
68;
69  compile_opt idl2, strictarrsubs
70;
71@cm_4mesh
72;
73   topid = findtopid(id)
74   widget_control, topid, get_uvalue = top_uvalue
75;------------------------------------------------
76; make sure that we have the good grid stored in the cm_4mesh common parameters.
77   currentfile = extractatt(top_uvalue, 'currentfile')
78   currentgrid = *(extractatt(top_uvalue, 'meshparameters'))[currentfile]
79   change = changegrid(currentgrid)
80;------------------------------------------------
81; What is the type of boxzoom ?
82   currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1
83   options = extractatt(top_uvalue, 'options')
84   flags = extractatt(top_uvalue, 'optionsflag')
85   flags = flags[*, currentplot]
86   IF (flags[where(options EQ 'Longitude / x index')])[0] EQ 0 THEN $
87    xtype = 'geographic' ELSE xtype = 'index'
88   IF (flags[where(options EQ 'Latitude / y index')])[0] EQ 0 THEN $
89    ytype = 'geographic' ELSE ytype = 'index'
90;------------------------------------------------
91; How to complete the boxzoom ?
92   IF xtype EQ  'geographic' then begin
93      lonn1 = lon1
94      lonn2 = lon2
95      xtitle = 'lon'
96   ENDIF ELSE BEGIN
97      lonn1 = firstxt
98      lonn2 = lastxt
99      xtitle = 'x ind'
100   ENDELSE
101   IF ytype EQ  'geographic' then begin
102      latt1 = lat1
103      latt2 = lat2
104      ytitle = 'lat'
105   ENDIF ELSE BEGIN
106      latt1 = firstyt
107      latt2 = lastyt
108      ytitle = 'y ind'
109   ENDELSE
110;------------------------------------------------
111   vertf1 = floor(min([gdepw[0], gdept[0]]))
112   vertf2 = ceil(max([gdepw[0], gdept[0]]))
113;------------------------------------------------
114   Case N_Elements(Value) OF
115      0:boxzoom = [lonn1, lonn2, latt1, latt2, vertf1, vertf2]
116      1:BEGIN
117         if value EQ -1 then boxzoom = [lonn1, lonn2, latt1, latt2, vertf1, vertf2] $
118         ELSE boxzoom=[lonn1, lonn2, latt1, latt2, 0.,value[0]]
119      END
120      2:boxzoom=[lonn1, lonn2, latt1, latt2, value[0],value[1]]
121      4:boxzoom=[Value]
122      5:boxzoom=[Value[0:3], 0, Value[4]]
123      6:boxzoom = Value
124      Else:BEGIN
125         rien = report('Wrong Definition of Boxzoom')
126      END
127   ENDCASE
128;------------------------------------------------
129   boxzoom[0] = floor(boxzoom[0])
130   boxzoom[1] = ceil(boxzoom[1])
131   boxzoom[2] = floor(boxzoom[2])
132   boxzoom[3] = ceil(boxzoom[3])
133   if n_elements(boxzoom GE 5) then begin
134      boxzoom[4] = floor(boxzoom[4])
135      boxzoom[5] = ceil(boxzoom[5])
136   endif
137;------------------------------------------------
138;------------------------------------------------
139   widget_control,widget_info(id,find_by_uname = 'lon1'), get_uvalue = uvalue
140   strict = uvalue.strict
141;
142; Longitudes
143;
144; Possible min and max
145   if xtype EQ 'geographic' then BEGIN
146      min = floor(min([glamt,glamf], max = max))
147      max = ceil(max)
148   ENDIF ELSE BEGIN
149      min = 0
150      max = jpi-1
151   ENDELSE
152; widgets's id
153   lon1id = widget_info(id,find_by_uname = 'lon1')
154   lon2id = widget_info(id,find_by_uname = 'lon2')
155; Do we have to change the type of x axis: longitude/index
156   lonbase = widget_info(id,find_by_uname = 'lonbase')
157   widget_control, lonbase,  get_uvalue = lonbase_uvalue
158   if lonbase_uvalue.name NE xtype then BEGIN
159      widget_control, lonbase, update = 0
160; We break everything
161      widget_control, lon1id, /destroy
162      widget_control, lon2id, /destroy
163; We reconstruct
164      lon1id = cw_slider_pm(lonbase,value=min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $
165                            , uvalue={name:'lon1', strict:keyword_set(strict)},uname ='lon1' $
166                            , title = xtitle+'1', minimum = min $
167                            , maximum = (boxzoom[1] < max)-keyword_set(strict))
168      lon2id = cw_slider_pm(lonbase,value=((min > boxzoom[0])+keyword_set(strict)) > boxzoom[1] < max $
169                            , uvalue={name:'lon2', strict:keyword_set(strict)} $
170                            , uname='lon2', title = xtitle+'2', maximum = max $
171                            , minimum = (min > boxzoom[0])+keyword_set(strict))
172      widget_control, lonbase, set_uvalue = {name:xtype}
173      widget_control, lonbase, update = 1
174   ENDIF ELSE BEGIN
175; The new value  they will have
176      cursorvalue1 = min > boxzoom[0] < ((boxzoom[1] < max)-strict)
177      cursorvalue2 = ((min > boxzoom[0])+strict) > boxzoom[1] < max
178; We change slider's boundaries
179      widget_control, lon1id, set_value = {slider_min:min, slider_max:cursorvalue2-strict}
180      widget_control, lon2id, set_value = {slider_min:cursorvalue1+strict, slider_max:max}
181; We attribute the new value
182      widget_control, lon1id , set_value = cursorvalue1
183      widget_control, lon2id, set_value = cursorvalue2
184   ENDELSE
185;
186; Latitudes
187;
188; Possible min and max
189   if ytype EQ 'geographic' then begin
190      min = floor(min([gphit,gphif], max = max))
191      max = ceil(max)
192   ENDIF ELSE BEGIN
193      min = 0
194      max = jpj-1
195   ENDELSE
196; Do we have to change the type of y axis: latitude/index
197   latbase = widget_info(id,find_by_uname = 'latbase')
198   widget_control, latbase,  get_uvalue = latbase_uvalue
199   lat1id = widget_info(id,find_by_uname = 'lat1')
200   lat2id = widget_info(id,find_by_uname = 'lat2')
201   if latbase_uvalue.name NE ytype then BEGIN
202      widget_control, latbase, update = 0
203      widget_control, lat1id, /destroy
204      widget_control, lat2id, /destroy
205      lat1id = cw_slider_pm(latbase,value=min > boxzoom[2] < ((boxzoom[3] < max)-keyword_set(strict)) $
206                            , uvalue={name:'lat1', strict:keyword_set(strict)},uname ='lat1' $
207                            , title = ytitle+'1', minimum =min $
208                            , maximum = ((boxzoom[3] < max)-keyword_set(strict)))
209      lat2id = cw_slider_pm(latbase,value=((min > boxzoom[2])+keyword_set(strict)) > boxzoom[3] < max $
210                            , uvalue={name:'lat2', strict:keyword_set(strict)} $
211                            , uname ='lat2', title = ytitle+'2' ,maximum =  max $
212                            , minimum =(min > boxzoom[2])+keyword_set(strict))
213      widget_control, latbase, set_uvalue = {name:ytype}
214      widget_control, latbase, update = 1
215   ENDIF ELSE BEGIN
216      cursorvalue1 = min > boxzoom[2] < ((boxzoom[3] < max)-strict)
217      cursorvalue2 = ((min > boxzoom[2])+strict) > boxzoom[3] < max
218      widget_control, lat1id, set_value = {slider_min:min, slider_max:cursorvalue2-strict}
219      widget_control, lat2id, set_value = {slider_min:cursorvalue1+strict, slider_max:max}
220      widget_control, lat1id, set_value = cursorvalue1
221      widget_control, lat2id, set_value = cursorvalue2
222   ENDELSE
223;
224   if n_elements(boxzoom) EQ 4 then return
225;
226; depth
227;
228   dthlv1id = widget_info(id, find_by_uname = 'dthlv1')
229   dthlv2id = widget_info(id, find_by_uname = 'dthlv2')
230   depth1id = widget_info(id, find_by_uname = 'depth1')
231   depth2id = widget_info(id, find_by_uname = 'depth2')
232; which type of point?
233   widget_control, dthlv1id, get_uvalue = dthlv1_uval
234; get the new axis
235   if dthlv1_uval.grid_t EQ 1 then gdep = gdept ELSE gdep = gdepw
236 ; Did we change the vertical axis?
237   widget_control, dthlv1id, get_value = dthlv1_value
238   gdep1 = floor(fix(dthlv1_value.combobox_value))
239   IF array_equal(gdep1, floor(gdep)) NE 1 THEN BEGIN
240      gdep1 = floor(gdep)
241      gdep2 = ceil(gdep)
242;;       same = where(gdep2-gdep1 EQ 0)
243;;       if same[0] NE -1 then gdep2[same] = gdep2[same] + 1
244      widget_control, dthlv1id, set_value = {value:strtrim(gdep1, 1)}
245      widget_control, dthlv2id, set_value = {value:strtrim(gdep2, 1)}
246   ENDIF ELSE gdep2 = gdep1+1
247; We make sure that given depths contains at least one level.
248   if boxzoom[4] GT boxzoom[5] then begin
249      rien = boxzoom[4]
250      boxzoom[4] = boxzoom[5]
251      boxzoom[5] = rien
252   endif
253;
254   rien = where(gdep1 LT boxzoom[4], indice1)
255   indice1 = indice1 < (jpk-1)
256   rien = where(gdep2 LE boxzoom[5], indice2)
257   indice2 = indice1 > (indice2-1)
258;
259   if indice1 EQ indice2 then BEGIN
260      if (where(gdep1 GE boxzoom[4] AND gdep2 LE boxzoom[5]))[0]  EQ -1 then begin
261         indice1 = 0 > (indice1-(dthlv1_uval.grid_t EQ 1))
262         indice2 = indice1
263      endif
264      boxzoom[4] = gdep1[indice1]
265      boxzoom[5] = boxzoom[4]+1
266   endif
267; Now, values and indexes are proprely defined.
268; So we can apply them
269   widget_control, dthlv1id, set_value = {combobox_select:indice1}
270   widget_control, dthlv2id, set_value = {combobox_select:indice2}
271; control mins and maxs of sliders...
272   if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1]
273   max1 = (min1+1) > gdep1[indice2]
274   widget_control, depth1id, set_value = {slider_min:min1, slider_max:max1, value:boxzoom[4]}
275   min2 = gdep2[indice1]
276   if indice2 EQ jpk-1 then BEGIN
277      max2 = max([gdept, gdepw])
278      max2 = strtrim(string(max2,format='(e8.0)'), 1)
279      max2 = float('1'+strmid(max2, 1))+float(max2)
280   ENDIF ELSE max2 = gdep1[indice2+1]
281   widget_control, depth2id, set_value = {slider_min:min2, slider_max:max2, value:boxzoom[5]}
282;
283   return
284end
285;*********************************************************************
286;+
287; @file_comments
288;
289;
290; @categories
291; Compound widget
292;
293; @param ID
294;
295;
296; @returns
297;
298; @uses
299;
300; @restrictions
301;
302; @examples
303;
304; @history
305;
306; @version
307; $Id$
308;-
309FUNCTION cw_domain_get_value, id
310;
311  compile_opt idl2, strictarrsubs
312;
313   box = fltarr(6)
314   possiblecase = ['lon1', 'lon2', 'lat1', 'lat2', 'depth1', 'depth2']
315   for i = 0, 5 do begin
316      widget_control, widget_info(id, find_by_uname = possiblecase[i]) $
317       , get_value = value
318      box[i] = value.value
319    ENDFOR
320   return, box
321end
322;*********************************************************************
323;+
324; @file_comments
325;
326;
327; @categories
328; Compound widget
329;
330; @param EVENT
331;
332;
333; @returns
334;
335; @uses
336;
337; @restrictions
338;
339; @examples
340;
341; @history
342;
343; @version
344; $Id$
345;-
346FUNCTION cw_domain_event, event
347;
348  compile_opt idl2, strictarrsubs
349;
350@common
351; help,  /struct, event
352   if (where(tag_names(event) EQ 'OUT'))[0] NE -1 then if event.out NE 0 then return,  -1
353   widget_control, event.id, get_uvalue = uval
354   case uval.name of
355      'lon1':widget_control,widget_info(event.handler,find_by_uname = 'lon2') $
356       , set_value = {slider_min:event.value+uval.strict}
357      'lon2':widget_control,widget_info(event.handler,find_by_uname = 'lon1') $
358       , set_value = {slider_max:event.value-uval.strict}
359      'lat1':widget_control,widget_info(event.handler,find_by_uname = 'lat2') $
360       , set_value = {slider_min:event.value+uval.strict}
361      'lat2':widget_control,widget_info(event.handler,find_by_uname = 'lat1') $
362       , set_value = {slider_max:event.value-uval.strict}
363      'unzoom':BEGIN
364         id = widget_info(event.handler,find_by_uname = 'lon1')
365         widget_control, id, get_value = value
366         widget_control, id, set_value = {slider_min:value.slider_min_max[0]}
367         widget_control, id, set_value = value.slider_min_max[0]
368         id = widget_info(event.handler,find_by_uname = 'lat1')
369         widget_control, id, get_value = value
370         widget_control, id, set_value = {slider_min:value.slider_min_max[0]}
371         widget_control, id, set_value = value.slider_min_max[0]
372         id = widget_info(event.handler,find_by_uname = 'lon2')
373         widget_control, id, get_value = value
374         widget_control, id, set_value = {slider_max:value.slider_min_max[1]}
375         widget_control, id, set_value = value.slider_min_max[1]
376         id = widget_info(event.handler,find_by_uname = 'lat2')
377         widget_control, id, get_value = value
378         widget_control, id, set_value = {slider_max:value.slider_min_max[1]}
379         widget_control, id, set_value = value.slider_min_max[1]
380      END
381      'dthlv1':BEGIN
382; ids...
383         depth1id = widget_info(event.handler,find_by_uname = 'depth1')
384         depth2id = widget_info(event.handler,find_by_uname = 'depth2')
385         dthlv2id = widget_info(event.handler,find_by_uname = 'dthlv2')
386; Do we have to change dthlv2 ?
387         widget_control, event.id, get_value = dthlv1_value
388         gdep1 = fix(dthlv1_value.combobox_value)
389         widget_control, dthlv2id, get_value = dthlv2_value
390         gdep2 = fix(dthlv2_value.combobox_value)
391         if dthlv2_value.combobox_index LT event.index then BEGIN
392; We redefine the dthlv2id's value
393            widget_control, dthlv2id, set_value = {combobox_select:event.index}
394; So we redefine the value and the max of the slider 2
395            if event.index EQ jpk-1 then BEGIN
396               max = max([gdept, gdepw])
397               max = strtrim(string(max,format='(e8.0)'), 1)
398               max = float('1'+strmid(max, 1))+float(max)
399            ENDIF ELSE max = gdep2[event.index+1]-1
400            widget_control, depth2id $
401             , set_value = {slider_max:max, value:gdep2[event.index]}
402; So we redefine the max of the slider 1
403            widget_control, depth1id, set_value = {slider_max:gdep1[event.index]}
404         END
405; We redefine the value and the min of the slider depth1
406         if event.index EQ 0 then min = 0 ELSE min = gdep1[event.index-1]+1
407         widget_control, depth1id, set_value = {slider_min:min, value:gdep1[event.index]}
408; S we change the value of the min of the slider depth 2
409         widget_control, depth2id, set_value = {slider_min:gdep1[event.index]+1}
410      END
411      'dthlv2':BEGIN
412; ids...
413         depth1id = widget_info(event.handler,find_by_uname = 'depth1')
414         depth2id = widget_info(event.handler,find_by_uname = 'depth2')
415         dthlv1id = widget_info(event.handler,find_by_uname = 'dthlv1')
416; Do we have to change dthlv1 ?
417         widget_control, dthlv1id, get_value = dthlv1_value
418         gdep1 = fix(dthlv1_value.combobox_value)
419         widget_control, event.id, get_value = dthlv2_value
420         gdep2 = fix(dthlv2_value.combobox_value)
421         if dthlv1_value.combobox_index GT event.index then BEGIN
422; We redfine the value of dthlv1id
423            widget_control, dthlv1id, set_value = {combobox_select:event.index}
424; So we redefine the value and the min of the slider 1
425            if event.index EQ 0 then min = 0 ELSE min = gdep2[event.index-1]
426            widget_control, depth1id $
427             , set_value = {slider_min:min, value:gdep1[event.index]}
428; Se we redefine the min of the slider 2
429            widget_control, depth2id, set_value = {slider_min:gdep2[event.index]}
430         END
431; We redefine the value and the max of the slider depth 2
432         if event.index EQ jpk-1 then BEGIN
433            max = max([gdept, gdepw])
434            max = strtrim(string(max,format='(e8.0)'), 1)
435            max = float('1'+strmid(max, 1))+float(max)
436         ENDIF ELSE max = gdep2[event.index+1]-1
437         widget_control, depth2id, set_value = {slider_max:max, value:gdep2[event.index]}
438; So we change the value of the max of the slider depth 1
439         widget_control, depth1id, set_value = {slider_max:gdep2[event.index]-1}
440      END
441      'depth1':BEGIN
442; ids...
443         depth2id = widget_info(event.handler,find_by_uname = 'depth2')
444         dthlv1id = widget_info(event.handler,find_by_uname = 'dthlv1')
445; Do we have to change dthlv1 ?
446         widget_control, dthlv1id, get_value = dthlv1_value
447         gdep1 = fix(dthlv1_value.combobox_value)
448         rien = where(gdep1 LT event.value, indice)
449         indice = indice < (jpk-1)
450         if indice NE dthlv1_value.combobox_index then begin
451; We change the min of depth2
452            widget_control, depth2id, set_value = {slider_min:gdep1[indice]+1}
453; We redefine the value of dthlv1id
454            widget_control, dthlv1id, set_value = {combobox_select:indice}
455; So we redefine the min of the slider 1
456            if indice EQ 0 then min = 0 ELSE min = gdep1[indice-1]+1
457            widget_control, event.id, set_value = {slider_min:min}
458         endif
459      END
460      'depth2':BEGIN
461; ids...
462         depth1id = widget_info(event.handler,find_by_uname = 'depth1')
463         dthlv2id = widget_info(event.handler,find_by_uname = 'dthlv2')
464; Do we have to change dthlv2 ?
465         widget_control, dthlv2id, get_value = dthlv2_value
466         gdep2 = fix(dthlv2_value.combobox_value)
467         rien = where(gdep2 LE event.value, indice)
468         indice = 0 > (indice-1)
469         if indice NE dthlv2_value.combobox_index then begin
470; We change the min of depth1
471            widget_control, depth1id, set_value = {slider_max:gdep2[indice]-1}
472; We redefine the value of dthlv2id
473            widget_control, dthlv2id, set_value = {combobox_select:indice}
474; So we redefine the min of the slider 2
475            if indice EQ jpk-1 then BEGIN
476               max = max([gdept, gdepw])
477               max = strtrim(string(max,format='(e8.0)'), 1)
478               max = float('1'+strmid(max, 1))+float(max)
479            ENDIF ELSE max = gdep2[indice+1]-1
480            widget_control, event.id, set_value = {slider_max:max}
481         endif
482      END
483      ELSE:
484   ENDCASE
485;    slidesliceid = widget_info(event.top, find_by_uname = 'slide_slice')
486;    if slidesliceid NE 0 then widget_control, slidesliceid, set_value = 1
487   return,{ID:event.handler, TOP:event.top, HANDLER:0L $
488           , BOX:cw_domain_get_value(event.handler)}
489end
490;*********************************************************************
491;+
492; @file_comments
493;
494;
495; @categories
496; Compound widget
497;
498; @param PARENT {in}{required}
499; The widget ID of the parent widget.
500;
501; @keyword UVALUE
502; The user value to be associated with the widget.
503;
504; @keyword UNAME
505; The user name to be associated with the widget.
506;
507; @keyword STRICT
508;
509;
510; @keyword UNZOOM
511;
512;
513; @keyword BOXZOOM
514; Vector indicating the geographic zone on which we want to cut the map.
515; If BOXZOOM has :
516;   1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]]
517;   2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]]
518;   4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])]
519;   5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]]
520;   6 elements: The extraction is made on Boxzoom
521; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef!
522;
523; @keyword _EXTRA
524; Used to pass your keywords
525;
526; @returns
527;
528; @uses
529;
530; @restrictions
531;
532; @examples
533;
534; @history
535;
536; @version
537; $Id$
538;
539; @todo
540; seb: Documenter
541;
542;-
543FUNCTION cw_domain, parent, BOXZOOM = boxzoom, STRICT = strict, UVALUE = uvalue, UNAME = uname, UNZOOM = unzoom, _extra = ex
544;
545;
546  compile_opt idl2, strictarrsubs
547;
548@cm_4mesh
549@cm_4data
550;
551; Definition of the boxzoom
552  Case N_Elements(Boxzoom) OF
553    0:boxzoom = [lon1, lon2, lat1, lat2 $
554                 , min([gdepw[0], gdept[0]]), max([gdepw[0], gdept[0]]) ]
555    1:boxzoom = [lon1, lon2, lat1, lat2, 0., boxzoom[0]]
556    2:boxzoom = [lon1, lon2, lat1, lat2, boxzoom[0], boxzoom[1]]
557    4:boxzoom = [Boxzoom, vert1, vert2]
558    5:boxzoom = [Boxzoom[0:3], 0, Boxzoom[4]]
559    6:
560    Else: return, report('Mauvaise Definition de Boxzoom')
561  ENDCASE
562  IF total(Boxzoom) EQ 0 THEN $
563     boxzoom = [lon1, lon2, lat1, lat2, min([gdepw[0], gdept[0]]), max([gdepw[0], gdept[0]])]
564;
565  boxzoom[0] = floor(boxzoom[0])
566  boxzoom[1] = ceil(boxzoom[1])
567  boxzoom[2] = floor(boxzoom[2])
568  boxzoom[3] = ceil(boxzoom[3])
569  boxzoom[4] = floor(boxzoom[4])
570  boxzoom[5] = ceil(boxzoom[5])
571;------------------------------------------------
572  if NOT keyword_set(uvalue) then uvalue = ''
573  if NOT keyword_set(uname) then uname = ''
574  base = widget_base(parent, row = 2, space = 0 $
575                     , EVENT_FUNC = 'cw_domain_event' $
576                     , FUNC_GET_VALUE = 'cw_domain_get_value' $
577                     , PRO_SET_VALUE = 'cw_domain_set_value' $
578                     , UVALUE = uvalue, UNAME = uname, _extra = ex)
579;------------------------------------------------
580  baseh = widget_base(base, column = 1+keyword_set(unzoom), space = 0)
581;------------------------------------------------
582  baseh1 = widget_base(baseh, row = 2, space = 0)
583;-------------longitude---------------------------
584  min = floor(min([glamt, glamf], max = max))
585  max = ceil(max)
586  IF max-min GT 360 AND keyword_set(key_periodic) THEN max = min+360
587  lonbase = widget_base(baseh1, column = 2, space = 0, uname = 'lonbase', uvalue = {name:'geographic'})
588  lon1id = cw_slider_pm(lonbase, value = min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $
589                        , uvalue = {name:'lon1', strict:keyword_set(strict)}, uname = 'lon1' $
590                        , title = 'lon1', minimum = min $
591                        , maximum = (boxzoom[1] < max)-keyword_set(strict))
592  lon2id = cw_slider_pm(lonbase, value = ((min > boxzoom[0])+keyword_set(strict)) > boxzoom[1] < max $
593                        , uvalue = {name:'lon2', strict:keyword_set(strict)} $
594                        , uname = 'lon2', title = 'lon2', maximum = max $
595                        , minimum = (min > boxzoom[0])+keyword_set(strict))
596;---------------latitude-------------------------
597  min = floor(min([gphit, gphif], max = max))
598  max = ceil(max)
599  latbase = widget_base(baseh1, column = 2, space = 0, uname = 'latbase', uvalue = {name:'geographic'})
600  lat1id = cw_slider_pm(latbase, value = min > boxzoom[2] < ((boxzoom[3] < max)-keyword_set(strict)) $
601                        , uvalue = {name:'lat1', strict:keyword_set(strict)}, uname = 'lat1' $
602                        , title = 'lat1', minimum = min $
603                        , maximum = ((boxzoom[3] < max)-keyword_set(strict)))
604  lat2id = cw_slider_pm(latbase, value = ((min > boxzoom[2])+keyword_set(strict)) > boxzoom[3] < max $
605                        , uvalue = {name:'lat2', strict:keyword_set(strict)} $
606                        , uname = 'lat2', title = 'lat2', maximum =  max $
607                        , minimum = (min > boxzoom[2])+keyword_set(strict))
608;----------------unzoom------------------------
609  if keyword_set(unzoom) then rien = widget_button(baseh, value = 'unzoom', uvalue = {name:'unzoom'}, xsize = 60, ysize = 110)
610;----------------depth------------------------
611  basez = widget_base(base, column = 3, space = 0, /base_align_center)
612;------------------------------------------------
613  basezdrp = widget_base(basez, row = 2, space = 0)
614;
615  if strupcase(vargrid) EQ 'W' then gdep = gdepw ELSE gdep = gdept
616  gdep1 = floor(gdep)
617  gdep2 = ceil(gdep)
618;;   same = where(gdep2-gdep1 EQ 0)
619;;   if same[0] NE -1 then gdep2[same] = gdep2[same] +1
620  sgdep1 = strtrim(gdep1, 1)
621  sgdep2 = strtrim(gdep2, 1)
622;
623  dephtid = cw_combobox_pm(basezdrp, value = ''+sgdep1, uvalue = {name:'dthlv1', grid_t:strupcase(vargrid) NE 'W'}, uname = 'dthlv1')
624  rien = where(gdep1 LT boxzoom[4], indice1)
625  indice1 = indice1 < (jpk-1)
626  widget_control, dephtid, set_value = {combobox_select:indice1}
627;
628  dephtid = cw_combobox_pm(basezdrp, value = ''+sgdep2, uvalue = {name:'dthlv2'}, uname = 'dthlv2')
629  rien = where(gdep2 LE boxzoom[5], indice2)
630  indice2 = indice1 > (indice2-1)
631  widget_control, dephtid, set_value = {combobox_select:indice2}
632;
633;------
634;   basedepthslid = widget_base(base, column = 2, space = 0)
635  strminlen = max(strlen(strtrim(round([gdept, gdepw]), 1)))
636;
637  if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1]
638  max1 = (min1+1) > gdep1[indice2]
639  rien = cw_slider_pm(basez, value = min1 > boxzoom[4] < (boxzoom[5] < max1) $
640                      , uvalue = {name:'depth1'}, uname = 'depth1', strminlen = strminlen $
641                      , title = 'z1', minimum = min1, maximum = max1)
642;
643  min2 = gdep2[indice1]
644  if indice2 EQ jpk-1 then max2 = ceil(max([gdept, gdepw])) $
645  ELSE max2 = gdep1[indice2+1]
646  if floor(max2) LE floor(min2) then max2 = min2+1
647  rien = cw_slider_pm(basez, value = (min2 > boxzoom[4]) > boxzoom[5] < max2 $
648                      , uvalue = {name:'depth2'}, minimum = min2, maximum =  max2 $
649                      , uname = 'depth2', title = 'z2', strminlen = strminlen)
650;--------------------------------------------
651;
652  return, base
653end
Note: See TracBrowser for help on using the repository browser.