如何用IDL语言编写可视化界面,如ENVI等可视化工具
欢迎使用Markdown编辑器
效果图如图所示:里面没有填充功能函数,所以这个只是用于告诉大家如何编写界面
代码:
;传递参数,用结构体存储
;pState={winId:winID,$
;............}
;
;widget_control,total_gui,set_uvalue=pState
;
;
;
;
;
pro tete_v_event, ev
uname=widget_info(ev.id,/uname)
widget_control,ev.top,get_uvalue=pState
case uname of
'open':begin
im_file=dialog_pickfile();path='H:\西昌viirs\out_tiff_geo\png',filter='*.png')
;im_file=file_search(file,'*.png')
if ~file_test(im_file) then return
;wset,(*pState).draw_id
data=read_image(im_file)
tv,data;,/true
end
'save':begin
save_gui=widget_base(title='save',xsize=500,ysize=300,/column)
model6s_dir=widget_button(save_gui, value='save', uname='save')
widget_control,save_gui,/realize
xmanager,'tete_v_event',save_gui,/no_block
end
'preview':begin
end
'build LUT':begin
glt_gui=widget_base(title='BUILD LUT',xsize=500,ysize=300,/column)
;model6s_dir=widget_button(glt_gui, value='6s_dir', uname='6s_dir',xsize=40,ysize=25,/ALIGN_LEFT)
;out_dir_txt=widget_button(glt_gui, value='LUTout_dir', uname='LUTout_dir')
model6s_dir=widget_label(glt_gui,value='6s_dir:(eg:E:\dir\6s.exe)',xoffset=300,ysize=20,/ALIGN_LEFT)
model6s_dir_txt=widget_text(glt_gui,value='',/editable,xsize=2,ysize=1)
out_dir=widget_label(glt_gui,value='LUTout_dir:(eg:E:\dirout\)',xoffset=300,ysize=20,/ALIGN_LEFT)
out_dir_txt=widget_text(glt_gui,value='',/editable,xsize=2,ysize=1)
band_respo=widget_label(glt_gui,value='band_respo:(eg:0.13,0.15,0.38)',xoffset=300,/ALIGN_LEFT)
bandres_txt=widget_text(glt_gui,value='',/editable,xsize=2,ysize=1)
band_range=widget_label(glt_gui,value='band_range(2.5nm):(eg:Initial_wavelength,end_wavelength)',xoffset=500,/ALIGN_LEFT)
band_range_txt=widget_text(glt_gui,value='',/editable,xsize=2,ysize=1)
angle_set=widget_label(glt_gui,value='angle interval:(ps:the end angle eq 78 or 180)',xoffset=300,/ALIGN_LEFT)
angle_set_txt=widget_text(glt_gui,value='',/editable,xsize=2,ysize=1)
para_set=widget_label(glt_gui,value='parameter change:(ps:if the default parameters is unfittable,please change it by yourself.eg ideom:0;rapp:1)',xoffset=300,/ALIGN_LEFT)
para_set_txt=widget_text(glt_gui,value='',/editable,xsize=2,ysize=1)
Description=widget_label(glt_gui,value='if you use the band which is in the 6s model,please change the parameter setting,while you'+$
' can leave the band_respo and band_range(2.5nm) empty',/ALIGN_LEFT)
dir_6s=string(model6s_dir_txt)
out_dir=string(out_dir_txt)
band_response=bandres_txt
br=strsplit(band_response,';',/extract)
band_response=br
band_range=band_range_txt
brange=strsplit(band_range,';',/extract)
band_range=brange
; model_indir=widget_label(glt_gui,value='6S.exe dir:')
; out_dir_txt=widget_label(glt_gui,value='LUTout_dir:')
;;
run_button=widget_button(glt_gui,value='build LUT',uname='build LUT')
;;
pState1={modeldir:dir_6s,out_txt_dir:out_dir,$
bandres_txt:band_response,band_range_txt:band_range}
widget_control,glt_gui,/realize,set_uvalue=pState1
xmanager,'tete_v_event',glt_gui,/no_block
end
endcase
end
pro tete_v_event_event, ev1
;help,ev1
widget_control,ev1.top,get_value=pState1
uname=widget_info(ev1.id,/uname)
case uname of
; '6s_dir':begin
; dir_6s=dialog_pickfile()
; end
'build LUT':begin
widget_control,ev1.top,get_uvalue=pState1
widget_control,pState1.modeldir,get_value=modeldir
help,pState1
print,pState1.modeldir
print,pState1.band_range_txt
end
endcase
;widget_control,ev1.top,get_uvalue=pState1
;print,pState1
end
pro test_v
device, get_screen_size=ss
total_gui=widget_base(mbar=bar,title='VIIRS TOOLS',xsize=500,ysize=30,/column)
file_meau_1=widget_button(bar, value='advanced_operation', /menu)
file_meau_2=widget_button(bar, value='inversion_operation', /menu)
file_meau_3=widget_button(bar, value='post-processing', /menu)
in_para=widget_button(file_meau_1, value='pretreatment')
blut=widget_button(file_meau_1, value='build LUT',uname='build LUT')
TC=widget_button(file_meau_1, value='ture color show')
para_in=widget_button(file_meau_2, value='parameter setting')
inversion=widget_button(file_meau_2, value='inversion')
reprojection=widget_button(file_meau_3, value='reprojection')
image_out=widget_button(file_meau_3, value='save as image')
;file_b1=widget_button(file_meau,value='open image(hdf5)')
gui_1=widget_base(total_gui,/row,/frame)
wopen=widget_button(gui_1,value='open',uname='open')
wsave=widget_button(gui_1,value='save',uname='save')
wabout=widget_button(gui_1,value='about',uname='about')
preview=widget_button(gui_1,value='preview',uname='preview')
draw=widget_draw(total_gui,xsize=500,ysize=700,colors=1)
widget_control, draw ,get_value=draw_id
pState={draw_id:draw_id,$
draw:draw,$
curPath:''}
;build_6s=widget_button(advanced_op,value='build look up table')
widget_control,total_gui,/realize
widget_control,total_gui,set_uvalue=ptr_new(pState)
geo=widget_info(total_gui,/geometry)
xsize=geo.scr_xsize
ysize=geo.scr_ysize
offset=(ss - [xsize,ysize])/2
;widget_control,total_gui,xoffset=offset[0],yoffset=offset[1]
widget_control,gui_1,/realize
xmanager,'tete_v',total_gui,/no_block
end