?? 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 + -