📄 ndvi_803_eventcb.bak
字号:
;
; IDL Event Callback Procedures
; NDVI_803_eventcb
;
; Generated on: 03/14/2008 13:08.05
;
;-----------------------------------------------------------------
; Notify Realize Callback Procedure.
; Argument:
; wWidget - ID number of specific widget.
;
;
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnRealize_NDVI_803, wWidget
InitTable_NDVI,wWidget ;初始化表格
SetRatioStatus_456, wWidget, 'WID_BUTTON_DefaultSavePath', 1 ;初始的时候默认使用默认存储方式
SetComponentSensitive_456, wWidget, 'WID_TEXT_SavePath', 0 ;初始的时候使用于显示保存文件路径的Text为不可用
SetComponentSensitive_456, wWidget, 'WID_BUTTON_SelectSavePath_NDVI', 0 ;初始时使打开指定保存路径的按钮为不可用
SetCheckBoxStatus_456, wWidget, 'WID_BUTTON_AddResult', 0 ;初始时不选中添加结果到图层管理器中
System_LogOn_401;用于启动Envi的批处理程序
end
;-----------------------------------------------------------------
pro InitTable_NDVI, inTopBaseID
;;说明:需要在创建Table的时候手工添加/NO_ROW_HEADERS参数,删除行标题
idTable=WIDGET_INFO(inTopBaseID, FIND_BY_UNAME = 'WID_TABLE_InputFiles'); 获取表格的ID号
;set table infos
GetComponentGeometry_456, inTopBaseID, 'WID_TABLE_InputFiles', otGeometry & iSXSize = otGeometry.SCR_XSIZE
arrColumnLabels = ['MODIS输入文件', '状态'] ;设置表头
arrColumnWidths = [0.8 * iSXSize,0.2 * iSXSize];设置表格各列的宽度
;;在设计时除下述参数外还需要设置以下参数:, /COLUMN_MAJOR
WIDGET_CONTROL, idTable, COLUMN_LABELS = arrColumnLabels, COLUMN_WIDTHS = arrColumnWidths
ClearTable_456, inTopBaseID, 'WID_TABLE_InputFiles'
end
;-----------------------------------------------------------------
; Post Create Widget Procedure.
; Argument:
; wWidget - ID number of specific widget.
;
; Any keywords passed into the generated widget creation procedure
; are passed into this procudure.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro PostCreation_NDVI_803, wWidget, _EXTRA=_VWBExtra_
COMPILE_OPT idl2
FORWARD_FUNCTION ENVIVersionRight_401;判断ENVI的版本
IF ENVIVersionRight_401() NE 1 THEN BEGIN;如果不是ENVI4.3或4.4版本的则提示错误
rr = DIALOG_MESSAGE('ENVI版本错误,请用4.3及以上版本', /INFORMATION, TITLE = '初始化错误')
OnDestroy_Main, wWidget
RETURN
ENDIF
SetTLBPosition_400, wWidget, /inCenterWindow ;设置窗体显示位置
end
;-----------------------------------------------------------------
; Kill Notify Callback Procedure.
; Argument:
; wWidget - ID number of specific widget.
;
;
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnDestroy_NDVI_803, wWidget
COMPILE_OPT idl2
System_LogOff_401;退出系统,关闭Envi的批处理程序
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_OpenFiles_NDVI_803, Event
wDTIF = WIDGET_INFO(Event.top, FIND_BY_UNAME = 'WID_TABLE_InputFiles')
WIDGET_CONTROL, wDTIF, GET_VALUE = OldFiles
;获取文件路径名称
SelectHdfPathFromDialog_456, otFiles, otPath & IF StrLen(otFiles[0]) LT 1 THEN RETURN
;判断是否为MOD02数据
MatchMOD02Files_803, Event.Top, otFiles, otPath, OldFiles
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_RemoveFiles_NDVI_803, Event
RemoveSelectedRowsFromTable_456, Event.Top, 'WID_TABLE_InputFiles';从表格中去除选中的行
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_FilterFiles_NDVI_803, Event
GetArrayFromTable_456, Event.Top, 'WID_TABLE_InputFiles', otArray
RemoveBadRowsFromTable_456, Event.Top, 'WID_TABLE_InputFiles' ;从表格中去除状态为无效的行
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_DefaultSavePath_NDVI_803, Event
SetComponentSensitive_456, Event.Top, 'WID_TEXT_SavePath', 0 ;使显示保存路径的Text不可用
SetComponentSensitive_456, Event.Top, 'WID_BUTTON_SelectSavePath_NDVI', 0;使指定打开存储路径的按钮不可用
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_SpecifySavePath_NDVI_803, Event
SetComponentSensitive_456, Event.Top, 'WID_TEXT_SavePath', 1 ;使显示保存路径的Text可用
SetComponentSensitive_456, Event.Top, 'WID_BUTTON_SelectSavePath_NDVI', 1 ;使指定打开存储路径的按钮可用
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_SelectSavePath_NDVI_803, Event
SelectDirectoryFromDialog_456, otDirectory, inTitle = '选择归一化植被指数NDVI产品保存位置'
IF N_ELEMENTS(otDirectory[0]) EQ 0 THEN RETURN
SetTextCaption_456, Event.Top, 'WID_TEXT_SavePath', otDirectory[0];将保存路径显示在text当中
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_Cancel_NDVI_803, Event
idTLB = WIDGET_INFO(Event.top, FIND_BY_UNAME = 'WID_BASE_NDVI')
WIDGET_CONTROL, idTLB, /DESTROY
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_OK_NDVI_803, Event
idTable = WIDGET_INFO(Event.top, FIND_BY_UNAME = 'WID_TABLE_InputFiles') & IF idTable EQ 0 THEN RETURN
WIDGET_CONTROL, idTable, Get_UValue = pUVale ;获取表格当中的输入文件
IF pUVale.RowCount EQ 0 THEN BEGIN ;如果无输入文件则提示输入文件消息
rr = Dialog_message('请设置正确的输入文件', /ERROR) & RETURN
ENDIF
GetRatioStatus_456, Event.top, 'WID_BUTTON_SpecifySavePath', otStatus
IF otStatus EQ 1 THEN BEGIN ;如果使用指定路径进行保存的话
GetTextCaption_456, Event.top, 'WID_TEXT_SavePath', otTextCaption ;则从text当中获取保存的路径
IF N_ELEMENTS(otTextCaption) EQ 0 THEN BEGIN
rr = Dialog_message('请设置保存路径', /ERROR) & RETURN
ENDIF ELSE savePath = otTextCaption
ENDIF
GetArrayFromTable_456, Event.top, 'WID_TABLE_InputFiles', otTableArray
RemoveBadRowsFromArray_456, otTableArray, otGoodCount
IF otGoodCount EQ 0 THEN BEGIN
rr = Dialog_message('当前输入文件没有可执行的文件', /ERROR) & RETURN
ENDIF
;计算归一化植被指数NDVI
NDVIMulti_803, otTableArray[*, 0], inSavePath = savePath, otSaveNames
success = dialog_message( '归一化植被指数NDVI计算完成!', TITLE = '处理结果', /INFORMATION)
end
;-----------------------------------------------------------------
; Activate Button Callback Procedure.
; Argument:
; Event structure:
;
; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0}
;
; ID is the widget ID of the component generating the event. TOP is
; the widget ID of the top level widget containing ID. HANDLER
; contains the widget ID of the widget associated with the
; handler routine.
; SELECT is set to 1 if the button was set, and 0 if released.
; Normal buttons do not generate events when released, so
; SELECT will always be 1. However, toggle buttons (created by
; parenting a button to an exclusive or non-exclusive base)
; return separate events for the set and release actions.
; Retrieve the IDs of other widgets in the widget hierarchy using
; id=widget_info(Event.top, FIND_BY_UNAME=name)
;-----------------------------------------------------------------
pro OnButtonPress_ImportFiles_NDVI_803, Event
end
;
; Empty stub procedure used for autoloading.
;
pro NDVI_803_eventcb
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -