user manual

124 Chapter 6: Creating a Visualization
Creating a New Visualization Type iTool Developers Guide
where MyVisualization is the name of your visualization class and the MYKEYWORD
parameters are keywords handled explicitly by your Init function.
Always use keyword inheritance (the _REF_EXTRA keyword) to pass keyword
parameters through to any called routines. See Keyword Inheritance” (Chapter 5,
Application Programming) for details on IDLs keyword inheritance mechanism.
Superclass Initialization
The visualization class Init method should call the Init method of any required
superclass. For example, if your visualization class is based on an existing
visualization, you would call that visualization’s Init method:
success = self->
SomeVisualizationClass
::Init(_EXTRA = _extra)
where SomeVisualizationClass is the class definition file for the visualization on
which your new visualization is based. The variable
success will contain a 1 if the
initialization is successful.
Note
Your visualization class may have multiple superclasses. In general, each
superclass’ Init method should be invoked by your class’ Init method.
Error Checking
Rather than simply calling the superclass Init method, it is a good idea to check
whether the call to the superclass Init method succeeded. The following statement
checks the value returned by the superclass Init method; if the returned value is 0
(indicating failure), the current Init method also immediately returns with a value of
0:
IF (self->
SomeVisualizationClass
::Init(_EXTRA = _extra) EQ 0) THEN
$
RETURN, 0
This convention is used in all visualization classes included with IDL. We strongly
suggest that you include similar checks in your own class definition files.
Keywords to the Init Method
Properties of the visualization type class can be set in the Init method by specifying
the property names and values as IDL keyword-value pairs. In addition to any
keywords implemented directly in the Init method of the superclass on which you
base your class, the properties of the IDLitVisualization class are available to any
visualization class. See “IDLitVisualization Properties” (IDL Reference Guide).