user manual

128 Chapter 6: Creating a Visualization
Creating a New Visualization Type iTool Developers Guide
/PRIVATE)
self->Add, self._oPlot, /AGGREGATE
Here, we create a new IDLitVisPlot object instance and place the object reference in
the
_oPlot field of the visualization’s class structure. The
REGISTER_PROPERTIES keyword ensures that all of the registrable IDLitVisPlot
properties are registered with the visualization automatically. Next, we use the Add
method to add the object instance to our visualization; this inserts the object into the
visualization’s graphics hierarchy. Finally, we use the AGGREGATE keyword to
include all of the IDLitVisPlot object’s registered properties in the visualization’s
property sheet.
Passing Through Caller-Supplied Property Settings
If you have included the _REF_EXTRA keyword in your function definition, you can
use IDLs keyword inheritance mechanism to pass any “extra” keyword values
included in the call to the Init method through to other routines. One of the things this
allows you to do is specify property settings when the Init method is called; simply
include each property’s keyword/value pair when calling the Init method, and include
the following in the body of the Init method:
IF (N_ELEMENTS(_extra) GT 0) THEN $
self->
MyVisualization
::SetProperty, _EXTRA = _extra
where MyVisualization is the name of your visualization class. This line has the effect
of passing any “extra” keyword values to your visualization class’ SetProperty
method, where the keyword can either be handled directly or passed through to the
SetProperty methods of the superclasses of your class. See “Creating a SetProperty
Method” on page 132 for details.
Example Init Method
The following example code shows a very simple Init method for a visualization type
named
ExampleVis. This function would be included (along with the class structure
definition routine and any other methods defined by the class) in a file named
examplevis__define.pro.
FUNCTION ExampleVis::Init, _REF_EXTRA = _extra
; Initialize the superclass.
IF (self->IDLitVisualization::Init(/REGISTER_PROPERTIES, $
TYPE='ExampleVis', NAME='Example Visualization Type', $
ICON='plot', /PRIVATE, _EXTRA = _extra) NE 1) THEN $
RETURN, 0
; Register a parameter
self->RegisterParameter, 'Y', DESCRIPTION='Y Plot Data', $