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