This example shows how to design a workflow step that lets the user choose whether or not to skip that step. Use the CALLBACK_SKIP_STEP property of ENVIWorkflowStep to do this. Make sure the next step (after the skipped step) gets the data it needs.

Copy and paste this code into the IDL Editor. Save the file as allow_skip_step.pro. Then compile and run the program.

; This is the routine to invoke using the skip step callback.
; It accepts the workflow as an argument.
 
PRO allow_skip_step_callback_skip_step, workflow, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
 
; Store the input to this step as the task output so the current wiring
; will pass the data to the next task.
workflow.current_step.task.output_raster = workflow.current_step.task.input_raster
 
END
 
; This is the workflow routine.
PRO allow_skip_step
COMPILE_OPT IDL2
 
; Start the application
e = ENVI()
 
; Create and customize a workflow
workflow = ENVIWorkflow()
workflow.TITLE = 'Example of Optional Step'
 
; Add a step for ISODATA classification
step1 = ENVIWorkflowStep()
step1.TASK = ENVITask('IsodataClassification')
step1.TITLE = 'Classify'
 
; Add a step for classification smoothing and
; let the user decide whether or not to skip it
step2 = ENVIWorkflowStep()
step2.TASK = ENVITask('ClassificationSmoothing')
step2.TITLE = 'Smooth'
step2.CALLBACK_SKIP_STEP = 'allow_skip_step_callback_skip_step'
 
; Add a step to convert the class result to a shapefile
step3 = ENVIWorkflowStep()
step3.TASK = ENVITask('ClassificationToShapefile')
step3.TITLE = 'Vectorize'
 
; Connect the steps
workflow.Connect, step1, 'OUTPUT_RASTER', step2, 'INPUT_RASTER'
workflow.Connect, step2, 'OUTPUT_RASTER', step3, 'INPUT_RASTER'
 
; Run and display the workflow
envi.UI.CreateWorkflowDialog, workflow
END

Result:

See Also


Customize Workflows