Changeset 69 for trunk/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_domain.pro
- Timestamp:
- 05/11/06 12:35:53 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_domain.pro
r51 r69 40 40 ;********************************************************************* 41 41 pro cw_domain_set_value, id, value 42 @common 42 @cm_4mesh 43 ; 44 topid = findtopid(id) 45 widget_control, topid, get_uvalue = top_uvalue 46 ;------------------------------------------------ 47 ; make sure that we have the good grid stored in the cm_4mesh common parameters. 48 currentfile = extractatt(top_uvalue, 'currentfile') 49 currentgrid = *(extractatt(top_uvalue, 'meshparameters'))[currentfile] 50 change = changegrid(currentgrid) 43 51 ;------------------------------------------------ 44 52 ; quel est le type de boxzoom? 45 topid = findtopid(id)46 widget_control, topid, get_uvalue=top_uvalue47 53 currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1 48 54 options = extractatt(top_uvalue, 'options') … … 62 68 lonn1 = firstxt 63 69 lonn2 = lastxt 64 xtitle = 'x ind ex'70 xtitle = 'x ind' 65 71 ENDELSE 66 72 IF ytype EQ 'geographic' then begin … … 71 77 latt1 = firstyt 72 78 latt2 = lastyt 73 ytitle = 'y ind ex'79 ytitle = 'y ind' 74 80 ENDELSE 75 81 ;------------------------------------------------ … … 88 94 6:boxzoom = Value 89 95 Else:BEGIN 90 rien = report(' Mauvaise Definition deBoxzoom')96 rien = report('Wrong Definition of Boxzoom') 91 97 END 92 98 ENDCASE … … 187 193 ENDELSE 188 194 ; 189 ;190 195 if n_elements(boxzoom) EQ 4 then return 191 196 ; 192 ; la profondeur 193 ; 194 depthlev1id = widget_info(id,find_by_uname = 'depthlev1') 195 depthlev2id = widget_info(id,find_by_uname = 'depthlev2') 196 depth1id = widget_info(id,find_by_uname = 'depth1') 197 depth2id = widget_info(id,find_by_uname = 'depth2') 198 widget_control, depthlev1id, get_uvalue = depthlev1_uval 199 ; a-t-on change de type de grille ?, faut=il changerl''axe verticale? 200 widget_control, findtopid(id), get_uvalue = top_uvalue 201 zgrid = extractatt(top_uvalue, 'zgrid') 202 grid_t = zgrid EQ 'T' 203 if grid_t NE depthlev1_uval.grid_t then BEGIN 204 widget_control, depthlev2id, get_uvalue = depthlev2_uval 205 depthlev1_uval.grid_t = grid_t 206 depthlev2_uval.grid_t = grid_t 207 ; 208 if grid_t then gdep = gdept ELSE gdep = gdepw 197 ; depth 198 ; 199 dthlv1id = widget_info(id, find_by_uname = 'dthlv1') 200 dthlv2id = widget_info(id, find_by_uname = 'dthlv2') 201 depth1id = widget_info(id, find_by_uname = 'depth1') 202 depth2id = widget_info(id, find_by_uname = 'depth2') 203 ; which type of point? 204 widget_control, dthlv1id, get_uvalue = dthlv1_uval 205 ; get the new axis 206 if dthlv1_uval.grid_t EQ 1 then gdep = gdept ELSE gdep = gdepw 207 ; Did we change the vertical axis? 208 widget_control, dthlv1id, get_value = dthlv1_value 209 gdep1 = floor(fix(dthlv1_value.combobox_value)) 210 IF array_equal(gdep1, floor(gdep)) NE 1 THEN BEGIN 209 211 gdep1 = floor(gdep) 210 212 gdep2 = ceil(gdep) 211 identique = where(gdep2-gdep1 EQ 0) 212 if identique[0] NE -1 then gdep2[identique] = gdep2[identique] +1 213 depthlev1_uval.value = gdep1 214 depthlev2_uval.value = gdep2 215 ; 216 widget_control, depthlev1id, set_value = {value:strtrim(gdep1, 1)} 217 widget_control, depthlev2id, set_value = {value:strtrim(gdep2, 1)} 218 ; 219 widget_control, depthlev1id, set_uvalue = depthlev1_uval 220 widget_control, depthlev2id, set_uvalue = depthlev2_uval 221 ENDIF ELSE BEGIN 222 gdep1 = depthlev1_uval.value 223 gdep2 = gdep1+1 224 ENDELSE 213 same = where(gdep2-gdep1 EQ 0) 214 if same[0] NE -1 then gdep2[same] = gdep2[same] + 1 215 widget_control, dthlv1id, set_value = {value:strtrim(gdep1, 1)} 216 widget_control, dthlv2id, set_value = {value:strtrim(gdep2, 1)} 217 ENDIF ELSE gdep2 = gdep1+1 225 218 ; on s''assure que les profs donnees contiennent bien au moins un 226 219 ; niveau. … … 238 231 if indice1 EQ indice2 then BEGIN 239 232 if (where(gdep1 GE boxzoom[4] AND gdep2 LE boxzoom[5]))[0] EQ -1 then begin 240 indice1 = 0 > (indice1-( grid_t EQ 1))233 indice1 = 0 > (indice1-(dthlv1_uval.grid_t EQ 1)) 241 234 indice2 = indice1 242 235 endif … … 246 239 ; maintenant que les values et les indexes sont definis proprement, 247 240 ; on peut les appliquer 248 widget_control, d epthlev1id, set_value = {droplist_select:indice1}249 widget_control, d epthlev2id, set_value = {droplist_select:indice2}241 widget_control, dthlv1id, set_value = {combobox_select:indice1} 242 widget_control, dthlv2id, set_value = {combobox_select:indice2} 250 243 ; controler les min et les max des sliders... 251 244 if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1] … … 265 258 FUNCTION cw_domain_get_value, id 266 259 box = lonarr(6) 267 possiblecase = ['lon1', 'lon2', 'lat1', 'lat2','depth1','depth2']260 possiblecase = ['lon1', 'lon2', 'lat1', 'lat2', 'depth1', 'depth2'] 268 261 for i = 0, 5 do begin 269 widget_control, widget_info(id,find_by_uname = possiblecase[i]) $262 widget_control, widget_info(id, find_by_uname = possiblecase[i]) $ 270 263 , get_value = value 271 264 box[i] = value.value … … 278 271 ; help, /struct, event 279 272 if (where(tag_names(event) EQ 'OUT'))[0] NE -1 then if event.out NE 0 then return, -1 280 widget_control, event.id, get_uvalue =uval273 widget_control, event.id, get_uvalue = uval 281 274 case uval.name of 282 275 'lon1':widget_control,widget_info(event.handler,find_by_uname = 'lon2') $ … … 306 299 widget_control, id, set_value = value.slider_min_max[1] 307 300 END 308 'd epthlev1':BEGIN301 'dthlv1':BEGIN 309 302 ; ids... 310 303 depth1id = widget_info(event.handler,find_by_uname = 'depth1') 311 304 depth2id = widget_info(event.handler,find_by_uname = 'depth2') 312 depthlev2id = widget_info(event.handler,find_by_uname = 'depthlev2') 313 ; faut-il changer depthlev2 ? 314 widget_control, depthlev2id, get_value = depthlev2_value 315 if depthlev2_value.droplist_select LT event.index then BEGIN 316 ; on redefinie la valeur de depthlev2id 317 widget_control, depthlev2id, set_value = {droplist_select:event.index} 305 dthlv2id = widget_info(event.handler,find_by_uname = 'dthlv2') 306 ; faut-il changer dthlv2 ? 307 widget_control, event.id, get_value = dthlv1_value 308 gdep1 = fix(dthlv1_value.combobox_value) 309 widget_control, dthlv2id, get_value = dthlv2_value 310 gdep2 = fix(dthlv2_value.combobox_value) 311 if dthlv2_value.combobox_index LT event.index then BEGIN 312 ; on redefinie la valeur de dthlv2id 313 widget_control, dthlv2id, set_value = {combobox_select:event.index} 318 314 ; donc on redefinit la valeur et le max du slider 2 319 widget_control, depthlev2id, get_uvalue = depthlev2_uval320 315 if event.index EQ jpk-1 then BEGIN 321 316 max = max([gdept, gdepw]) 322 317 max = strtrim(string(max,format='(e8.0)'), 1) 323 318 max = float('1'+strmid(max, 1))+float(max) 324 ENDIF ELSE max = depthlev2_uval.value[event.index+1]-1319 ENDIF ELSE max = gdep2[event.index+1]-1 325 320 widget_control, depth2id $ 326 , set_value = {slider_max:max, value: depthlev2_uval.value[event.index]}321 , set_value = {slider_max:max, value:gdep2[event.index]} 327 322 ; du coup on redefinie donc le max du slider 1 328 widget_control, depth1id, set_value = {slider_max: uval.value[event.index]}323 widget_control, depth1id, set_value = {slider_max:gdep1[event.index]} 329 324 END 330 325 ; on redefinie la valeur et le min du slider depth 1 331 if event.index EQ 0 then min = 0 ELSE min = uval.value[event.index-1]+1332 widget_control, depth1id, set_value = {slider_min:min, value: uval.value[event.index]}326 if event.index EQ 0 then min = 0 ELSE min = gdep1[event.index-1]+1 327 widget_control, depth1id, set_value = {slider_min:min, value:gdep1[event.index]} 333 328 ; du coup on change aussi la valeur du min du slider depth 2 334 widget_control, depth2id, set_value = {slider_min: uval.value[event.index]+1}335 END 336 'd epthlev2':BEGIN329 widget_control, depth2id, set_value = {slider_min:gdep1[event.index]+1} 330 END 331 'dthlv2':BEGIN 337 332 ; ids... 338 333 depth1id = widget_info(event.handler,find_by_uname = 'depth1') 339 334 depth2id = widget_info(event.handler,find_by_uname = 'depth2') 340 depthlev1id = widget_info(event.handler,find_by_uname = 'depthlev1') 341 ; faut-il changer depthlev1 ? 342 widget_control, depthlev1id, get_value = depthlev1_value 343 if depthlev1_value.droplist_select GT event.index then BEGIN 344 ; on redefinie la valeur de depthlev1id 345 widget_control, depthlev1id, set_value = {droplist_select:event.index} 335 dthlv1id = widget_info(event.handler,find_by_uname = 'dthlv1') 336 ; faut-il changer dthlv1 ? 337 widget_control, dthlv1id, get_value = dthlv1_value 338 gdep1 = fix(dthlv1_value.combobox_value) 339 widget_control, event.id, get_value = dthlv2_value 340 gdep2 = fix(dthlv2_value.combobox_value) 341 if dthlv1_value.combobox_index GT event.index then BEGIN 342 ; on redefinie la valeur de dthlv1id 343 widget_control, dthlv1id, set_value = {combobox_select:event.index} 346 344 ; donc on redefinit la valeur et le min du slider 1 347 widget_control, depthlev1id, get_uvalue = depthlev1_uval 348 if event.index EQ 0 then min = 0 ELSE min = uval.value[event.index-1] 345 if event.index EQ 0 then min = 0 ELSE min = gdep2[event.index-1] 349 346 widget_control, depth1id $ 350 , set_value = {slider_min:min, value: depthlev1_uval.value[event.index]}347 , set_value = {slider_min:min, value:gdep1[event.index]} 351 348 ; du coup on redefinie donc le min du slider 2 352 widget_control, depth2id, set_value = {slider_min: uval.value[event.index]}349 widget_control, depth2id, set_value = {slider_min:gdep2[event.index]} 353 350 END 354 351 ; on redefinie la valeur et le max du slider depth 2 … … 357 354 max = strtrim(string(max,format='(e8.0)'), 1) 358 355 max = float('1'+strmid(max, 1))+float(max) 359 ENDIF ELSE max = uval.value[event.index+1]-1360 widget_control, depth2id, set_value = {slider_max:max, value: uval.value[event.index]}356 ENDIF ELSE max = gdep2[event.index+1]-1 357 widget_control, depth2id, set_value = {slider_max:max, value:gdep2[event.index]} 361 358 ; du coup on change aussi la valeur du max du slider depth 1 362 widget_control, depth1id, set_value = {slider_max: uval.value[event.index]-1}359 widget_control, depth1id, set_value = {slider_max:gdep2[event.index]-1} 363 360 END 364 361 'depth1':BEGIN 365 362 ; ids... 366 363 depth2id = widget_info(event.handler,find_by_uname = 'depth2') 367 d epthlev1id = widget_info(event.handler,find_by_uname = 'depthlev1')368 ; doit-on changer d epthlev1 ?369 widget_control, d epthlev1id, get_value = depthlev1_value370 widget_control, depthlev1id, get_uvalue = depthlev1_uval371 rien = where( depthlev1_uval.valueLT event.value, indice)364 dthlv1id = widget_info(event.handler,find_by_uname = 'dthlv1') 365 ; doit-on changer dthlv1 ? 366 widget_control, dthlv1id, get_value = dthlv1_value 367 gdep1 = fix(dthlv1_value.combobox_value) 368 rien = where(gdep1 LT event.value, indice) 372 369 indice = indice < (jpk-1) 373 if indice NE d epthlev1_value.droplist_selectthen begin370 if indice NE dthlv1_value.combobox_index then begin 374 371 ; on change le min de depth2 375 widget_control, depth2id, set_value = {slider_min: depthlev1_uval.value[indice]+1}376 ; on redefinie la valeur de d epthlev1id377 widget_control, d epthlev1id, set_value = {droplist_select:indice}372 widget_control, depth2id, set_value = {slider_min:gdep1[indice]+1} 373 ; on redefinie la valeur de dthlv1id 374 widget_control, dthlv1id, set_value = {combobox_select:indice} 378 375 ; donc on redefinit le min du slider 1 379 if indice EQ 0 then min = 0 ELSE min = depthlev1_uval.value[indice-1]+1376 if indice EQ 0 then min = 0 ELSE min = gdep1[indice-1]+1 380 377 widget_control, event.id, set_value = {slider_min:min} 381 378 endif … … 384 381 ; ids... 385 382 depth1id = widget_info(event.handler,find_by_uname = 'depth1') 386 d epthlev2id = widget_info(event.handler,find_by_uname = 'depthlev2')387 ; doit-on changer d epthlev2 ?388 widget_control, d epthlev2id, get_value = depthlev2_value389 widget_control, depthlev2id, get_uvalue = depthlev2_uval390 rien = where( depthlev2_uval.valueLE event.value, indice)383 dthlv2id = widget_info(event.handler,find_by_uname = 'dthlv2') 384 ; doit-on changer dthlv2 ? 385 widget_control, dthlv2id, get_value = dthlv2_value 386 gdep2 = fix(dthlv2_value.combobox_value) 387 rien = where(gdep2 LE event.value, indice) 391 388 indice = 0 > (indice-1) 392 if indice NE d epthlev2_value.droplist_selectthen begin389 if indice NE dthlv2_value.combobox_index then begin 393 390 ; on change le max de depth1 394 widget_control, depth1id, set_value = {slider_max: depthlev2_uval.value[indice]-1}395 ; on redefinie la valeur de d epthlev2id396 widget_control, d epthlev2id, set_value = {droplist_select:indice}391 widget_control, depth1id, set_value = {slider_max:gdep2[indice]-1} 392 ; on redefinie la valeur de dthlv2id 393 widget_control, dthlv2id, set_value = {combobox_select:indice} 397 394 ; donc on redefinit le max du slider 2 398 395 if indice EQ jpk-1 then BEGIN … … 400 397 max = strtrim(string(max,format='(e8.0)'), 1) 401 398 max = float('1'+strmid(max, 1))+float(max) 402 ENDIF ELSE max = depthlev2_uval.value[indice+1]-1399 ENDIF ELSE max = gdep2[indice+1]-1 403 400 widget_control, event.id, set_value = {slider_max:max} 404 401 endif … … 412 409 end 413 410 ;********************************************************************* 414 FUNCTION cw_domain, parent, BOXZOOM = boxzoom, STRICT = strict, UVALUE = uvalue, UNAME = uname, ROW = row, COLUMN = column, UNZOOM = unzoom, _extra = ex 415 ; 416 @common 417 ; cheking exclusive keywords 418 column = keyword_set(column)*(1-keyword_set(row)) 419 row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) 411 FUNCTION cw_domain, parent, BOXZOOM = boxzoom, STRICT = strict, UVALUE = uvalue, UNAME = uname, UNZOOM = unzoom, _extra = ex 412 ; 413 @cm_4mesh 414 @cm_4data 415 ; 420 416 ; def de la boxzoom 421 if NOT keyword_set(boxzoom) then boxzoom = [lon1, lon2, lat1, lat2 $ 422 , min([gdepw[0], gdept[0]]), max([gdepw[0], gdept[0]]) ] 423 Case N_Elements(Boxzoom) OF 424 0:boxzoom = [lon1, lon2, lat1, lat2, vert1, vert2] 425 1:boxzoom=[lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 426 2:boxzoom=[lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 427 4:boxzoom=[Boxzoom, vert1, vert2] 428 5:boxzoom=[Boxzoom[0:3], 0, Boxzoom[4]] 429 6: 430 Else: return, report('Mauvaise Definition de Boxzoom') 431 ENDCASE 432 ; 433 boxzoom[0] = floor(boxzoom[0]) 434 boxzoom[1] = ceil(boxzoom[1]) 435 boxzoom[2] = floor(boxzoom[2]) 436 boxzoom[3] = ceil(boxzoom[3]) 437 boxzoom[4] = floor(boxzoom[4]) 438 boxzoom[5] = ceil(boxzoom[5]) 439 ;------------------------------------------------ 440 if NOT keyword_set(uvalue) then uvalue = '' 441 if NOT keyword_set(uname) then uname = '' 442 base = widget_base(parent, /row $ 443 , space = 1, xpad = 1, ypad = 1 $ 444 , EVENT_FUNC = 'cw_domain_event' $ 445 , FUNC_GET_VALUE='cw_domain_get_value' $ 446 , PRO_SET_VALUE='cw_domain_set_value' $ 447 , UVALUE = uvalue, UNAME = uname, _extra = ex) 417 Case N_Elements(Boxzoom) OF 418 0:boxzoom = [lon1, lon2, lat1, lat2 $ 419 , min([gdepw[0], gdept[0]]), max([gdepw[0], gdept[0]]) ] 420 1:boxzoom = [lon1, lon2, lat1, lat2, 0., boxzoom[0]] 421 2:boxzoom = [lon1, lon2, lat1, lat2, boxzoom[0], boxzoom[1]] 422 4:boxzoom = [Boxzoom, vert1, vert2] 423 5:boxzoom = [Boxzoom[0:3], 0, Boxzoom[4]] 424 6: 425 Else: return, report('Mauvaise Definition de Boxzoom') 426 ENDCASE 427 IF total(Boxzoom) EQ 0 THEN $ 428 boxzoom = [lon1, lon2, lat1, lat2, min([gdepw[0], gdept[0]]), max([gdepw[0], gdept[0]])] 429 ; 430 boxzoom[0] = floor(boxzoom[0]) 431 boxzoom[1] = ceil(boxzoom[1]) 432 boxzoom[2] = floor(boxzoom[2]) 433 boxzoom[3] = ceil(boxzoom[3]) 434 boxzoom[4] = floor(boxzoom[4]) 435 boxzoom[5] = ceil(boxzoom[5]) 436 ;------------------------------------------------ 437 if NOT keyword_set(uvalue) then uvalue = '' 438 if NOT keyword_set(uname) then uname = '' 439 base = widget_base(parent, row = 2, space = 0 $ 440 , EVENT_FUNC = 'cw_domain_event' $ 441 , FUNC_GET_VALUE = 'cw_domain_get_value' $ 442 , PRO_SET_VALUE = 'cw_domain_set_value' $ 443 , UVALUE = uvalue, UNAME = uname, _extra = ex) 444 ;------------------------------------------------ 445 baseh = widget_base(base, column = 1+keyword_set(unzoom), space = 0) 446 ;------------------------------------------------ 447 baseh1 = widget_base(baseh, row = 2, space = 0) 448 448 ;-------------longitude--------------------------- 449 basehori = widget_base(base, ROW = row, COLUMN = column) 450 ;-------------longitude--------------------------- 451 min = floor(min([glamt,glamf], max = max)) 452 max = ceil(max) 453 lonbase = widget_base(basehori, /ROW, space = 1, xpad = 1, ypad = 1, uname = 'lonbase') 454 lon1id = cw_slider_pm(lonbase,value=min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $ 455 , uvalue={name:'lon1', strict:keyword_set(strict)},uname ='lon1' $ 456 , title = 'lon1', minimum = min $ 457 , maximum = (boxzoom[1] < max)-keyword_set(strict)) 458 lon2id = cw_slider_pm(lonbase,value=((min > boxzoom[0])+keyword_set(strict)) > boxzoom[1] < max $ 459 , uvalue={name:'lon2', strict:keyword_set(strict)} $ 460 , uname='lon2', title = 'lon2', maximum = max $ 461 , minimum = (min > boxzoom[0])+keyword_set(strict)) 462 widget_control, lonbase, set_uvalue = {name:'geographic'} 449 min = floor(min([glamt, glamf], max = max)) 450 max = ceil(max) 451 IF max-min EQ 361 AND keyword_set(key_periodic) THEN max = max-1 452 lonbase = widget_base(baseh1, column = 2, space = 0, uname = 'lonbase', uvalue = {name:'geographic'}) 453 lon1id = cw_slider_pm(lonbase, value = min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $ 454 , uvalue = {name:'lon1', strict:keyword_set(strict)}, uname = 'lon1' $ 455 , title = 'lon1', minimum = min $ 456 , maximum = (boxzoom[1] < max)-keyword_set(strict)) 457 lon2id = cw_slider_pm(lonbase, value = ((min > boxzoom[0])+keyword_set(strict)) > boxzoom[1] < max $ 458 , uvalue = {name:'lon2', strict:keyword_set(strict)} $ 459 , uname = 'lon2', title = 'lon2', maximum = max $ 460 , minimum = (min > boxzoom[0])+keyword_set(strict)) 463 461 ;---------------latitude------------------------- 464 min = floor(min([gphit,gphif], max = max)) 465 max = ceil(max) 466 latbase = widget_base(basehori, /ROW, space = 1, xpad = 1, ypad = 1, uname = 'latbase') 467 lat1id = cw_slider_pm(latbase,value=min > boxzoom[2] < ((boxzoom[3] < max)-keyword_set(strict)) $ 468 , uvalue={name:'lat1', strict:keyword_set(strict)},uname ='lat1' $ 469 , title = 'lat1', minimum =min $ 470 , maximum = ((boxzoom[3] < max)-keyword_set(strict))) 471 lat2id = cw_slider_pm(latbase,value=((min > boxzoom[2])+keyword_set(strict)) > boxzoom[3] < max $ 472 , uvalue={name:'lat2', strict:keyword_set(strict)} $ 473 , uname ='lat2', title = 'lat2' ,maximum = max $ 474 , minimum =(min > boxzoom[2])+keyword_set(strict)) 475 widget_control, latbase, set_uvalue = {name:'geographic'} 462 min = floor(min([gphit, gphif], max = max)) 463 max = ceil(max) 464 latbase = widget_base(baseh1, column = 2, space = 0, uname = 'latbase', uvalue = {name:'geographic'}) 465 lat1id = cw_slider_pm(latbase, value = min > boxzoom[2] < ((boxzoom[3] < max)-keyword_set(strict)) $ 466 , uvalue = {name:'lat1', strict:keyword_set(strict)}, uname = 'lat1' $ 467 , title = 'lat1', minimum = min $ 468 , maximum = ((boxzoom[3] < max)-keyword_set(strict))) 469 lat2id = cw_slider_pm(latbase, value = ((min > boxzoom[2])+keyword_set(strict)) > boxzoom[3] < max $ 470 , uvalue = {name:'lat2', strict:keyword_set(strict)} $ 471 , uname = 'lat2', title = 'lat2', maximum = max $ 472 , minimum = (min > boxzoom[2])+keyword_set(strict)) 476 473 ;----------------unzoom------------------------ 477 if keyword_set(unzoom) then rien = widget_button(basehori,value='unzoom', uvalue={name:'unzoom'})474 if keyword_set(unzoom) then rien = widget_button(baseh, value = 'unzoom', uvalue = {name:'unzoom'}, xsize = 60, ysize = 110) 478 475 ;----------------depth------------------------ 479 basevert = widget_base(base, ROW = row, COLUMN = column) 480 basedepth = widget_base(basevert, /row) 481 ; 482 if strupcase(vargrid) EQ 'W' then gdep = gdepw ELSE gdep = gdept 483 gdep1 = floor(gdep) 484 gdep2 = ceil(gdep) 485 identique = where(gdep2-gdep1 EQ 0) 486 if identique[0] NE -1 then gdep2[identique] = gdep2[identique] +1 487 sgdep1 = strtrim(gdep1, 1) 488 sgdep2 = strtrim(gdep2, 1) 489 ; 490 basedepthdrop = widget_base(basedepth, column = column, row = row) 491 ; 492 dephtid=cw_droplist_pm(basedepthdrop,value=''+sgdep1, uvalue={name:'depthlev1', value:gdep1, grid_t:strupcase(vargrid) NE 'W'}, uname='depthlev1') 493 rien = where(gdep1 LT boxzoom[4], indice1) 494 indice1 = indice1 < (jpk-1) 495 widget_control, dephtid, set_value = {droplist_select:indice1} 496 ; 497 dephtid=cw_droplist_pm(basedepthdrop,value=''+sgdep2, uvalue={name:'depthlev2', value:gdep2, grid_t:strupcase(vargrid) NE 'W'}, uname='depthlev2') 498 rien = where(gdep2 LE boxzoom[5], indice2) 499 indice2 = indice1 > (indice2-1) 500 widget_control, dephtid, set_value = {droplist_select:indice2} 501 ; 502 basedepthslid = widget_base(basedepth, column = column, row = row) 503 ; 504 if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1] 505 max1 = (min1+1) > gdep1[indice2] 506 rien = cw_slider_pm(basedepthslid, value= min1 > boxzoom[4] < (boxzoom[5] < max1) $ 507 , uvalue = {name:'depth1'}, uname = 'depth1' $ 508 , title = 'depth1', minimum = min1, maximum = max1) 509 ; 510 min2 = gdep2[indice1] 511 if indice2 EQ jpk-1 then BEGIN 512 max2 = max([gdept, gdepw]) 513 max2 = strtrim(string(max2,format='(e8.0)'), 1) 514 max2 = float('1'+strmid(max2, 1))+float(max2) 515 ENDIF ELSE max2 = gdep1[indice2+1] 516 if max2 EQ min2 then max2 = min2+1 517 rien = cw_slider_pm(basedepthslid, value= (min2 > boxzoom[4]) > boxzoom[5] < max2 $ 518 , uvalue={name:'depth2'}, minimum = min2 $ 519 , uname = 'depth2', title = 'depth2' ,maximum = max2) 476 basez = widget_base(base, column = 3, space = 0, /base_align_center) 477 ;------------------------------------------------ 478 basezdrp = widget_base(basez, row = 2, space = 0) 479 ; 480 if strupcase(vargrid) EQ 'W' then gdep = gdepw ELSE gdep = gdept 481 gdep1 = floor(gdep) 482 gdep2 = ceil(gdep) 483 same = where(gdep2-gdep1 EQ 0) 484 if same[0] NE -1 then gdep2[same] = gdep2[same] +1 485 sgdep1 = strtrim(gdep1, 1) 486 sgdep2 = strtrim(gdep2, 1) 487 ; 488 dephtid = cw_combobox_pm(basezdrp, value = ''+sgdep1, uvalue = {name:'dthlv1', grid_t:strupcase(vargrid) NE 'W'}, uname = 'dthlv1') 489 rien = where(gdep1 LT boxzoom[4], indice1) 490 indice1 = indice1 < (jpk-1) 491 widget_control, dephtid, set_value = {combobox_select:indice1} 492 ; 493 dephtid = cw_combobox_pm(basezdrp, value = ''+sgdep2, uvalue = {name:'dthlv2'}, uname = 'dthlv2') 494 rien = where(gdep2 LE boxzoom[5], indice2) 495 indice2 = indice1 > (indice2-1) 496 widget_control, dephtid, set_value = {combobox_select:indice2} 497 ; 498 ;------ 499 ; basedepthslid = widget_base(base, column = 2, space = 0) 500 strminlen = max(strlen(strtrim(round([gdept, gdepw]), 1))) 501 ; 502 if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1] 503 max1 = (min1+1) > gdep1[indice2] 504 rien = cw_slider_pm(basez, value = min1 > boxzoom[4] < (boxzoom[5] < max1) $ 505 , uvalue = {name:'depth1'}, uname = 'depth1', strminlen = strminlen $ 506 , title = 'z1', minimum = min1, maximum = max1) 507 ; 508 min2 = gdep2[indice1] 509 if indice2 EQ jpk-1 then BEGIN 510 max2 = max([gdept, gdepw]) 511 max2 = strtrim(string(max2, format = '(e8.0)'), 1) 512 max2 = float('1'+strmid(max2, 1))+float(max2) 513 ENDIF ELSE max2 = gdep1[indice2+1] 514 if max2 EQ min2 then max2 = min2+1 515 rien = cw_slider_pm(basez, value = (min2 > boxzoom[4]) > boxzoom[5] < max2 $ 516 , uvalue = {name:'depth2'}, minimum = min2, maximum = max2 $ 517 , uname = 'depth2', title = 'z2', strminlen = strminlen) 520 518 ;-------------------------------------------- 521 519 ; 522 ; 523 ; 524 return, base 520 return, base 525 521 end
Note: See TracChangeset
for help on using the changeset viewer.