Chapter 5: Creating an iTool 109
iTool Developer’s Guide Example: Simple iTool
;*** Visualizations
; Here we register a custom visualization type described in
; the "Creating Visualizations" chapter of this manual.
self->RegisterVisualization, 'Image-Contour', $
'example1_visImageContour', ICON = 'image', /DEFAULT
;*** Operations menu
; Here we register a custom operation described in the "Creating
; Operations" chapter of this manual.
self->RegisterOperation, 'Example Resample', $
'example1_opResample', $
IDENTIFIER = 'Operations/Examples/Resample'
;*** File Readers
; Here we register a custom file reader described in the
; "Creating File Readers" chapter of this manual.
self->RegisterFileReader, 'Example TIFF Reader', $
'example1_readTIFF', ICON='demo', /DEFAULT
;*** File Writers
; Here we unregister one of the standard file writers used
; by the iTools, replacing it with a custom file writer
; described in the "Creating File Writers" chapter of this
; manual.
self->UnRegisterFileWriter, 'Tag Image File Format'
self->RegisterFileWriter, 'Example TIFF Writer', $
'example1_writetiff', ICON='demo', /DEFAULT
RETURN, 1
END
Discussion
The first item in our class definition file is the Init method. The Init method’s
function signature is defined first, using the class name example1tool. Note the use of
the _REF_EXTRA keyword inheritance mechanism; this allows any keywords
specified in a call to the Init method to be passed through to routines that are called
within the Init method even if we do not know the names of those keywords in
advance.
Next, we call the Init method of the superclass. In this case, we are creating a subclass
of the IDLitToolbase class; this provides us with all of the standard iTool
Comments to this Manuals