ITT Rule IDL Version 7.0 User Manual Page 141

  • Download
  • Add to my manuals
  • Print
  • Page
    / 430
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 140
Chapter 6: Creating a Visualization 141
iTool Developer’s Guide Example: Image-Contour Visualization
Init Method
The Init method is called when the example1_visImageContour visualization is
created.
FUNCTION example1_visImageContour::Init, _REF_EXTRA = _extra
; Initialize the superclass
IF (~self->IDLitVisualization::Init($
NAME='example1_visImageContour', $
ICON = 'image', _EXTRA = _extra)) THEN RETURN, 0
; Register the parameters we are using for data
self->RegisterParameter, 'IMAGEPIXELS', $
DESCRIPTION = 'Image Data', /INPUT, $
TYPES = ['IDLIMAGEPIXELS', 'IDLARRAY2D'], /OPTARGET
self->RegisterParameter, 'PALETTE', $
DESCRIPTION = 'Palette', /INPUT, /OPTIONAL, $
TYPES = ['IDLPALETTE','IDLARRAY2D'], /OPTARGET
; Create objects and add to this Visualization
self._oImage = OBJ_NEW('IDLitVisImage', /PRIVATE)
self->Add, self._oImage, /AGGREGATE
self._oContour = OBJ_NEW('IDLitVisContour', /PRIVATE)
self->Add, self._oContour, /AGGREGATE
; Return success
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
example1_visImageContour. 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.
First, we call the Init method of the superclass. In this case, we are creating a subclass
of the IDLitVisualization class; this provides us with all of the standard iTool
visualization methods automatically. Any “extra” keywords specified in the call to
our Init method are passed to the IDLitVisualization::Init method via the keyword
inheritance mechanism. If the call to the superclass Init method fails, we return
immediately with a value of 0.
Page view 140
1 2 ... 136 137 138 139 140 141 142 143 144 145 146 ... 429 430

Comments to this Manuals

No comments