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

Last change on this file since 167 was 167, checked in by smasson, 18 years ago

clean div, curl, grad + minors bugfix

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