user manual

Chapter 6: Creating a Visualization 129
iTool Developer’s Guide Creating a New Visualization Type
/INPUT, TYPES='IDLVECTOR', /OPTARGET
; Add a plotting symbol object and aggregate its properties
; into the visualization.
self._oSymbol = OBJ_NEW('IDLitSymbol', PARENT = self)
self->Aggregate, self._oSymbol
; Create an IDLitVisPlot object, setting its SYMBOL property to
; the symbol object we just created. Add the plot object to the
; visualization, and aggregate its properties.
self._oPlot = OBJ_NEW('IDLitVisPlot', /REGISTER_PROPERTIES, $
SYMBOL = self._oSymbol->GetSymbol())
self->Add, self._oPlot, /AGGREGATE
; Register an example property that holds a string value.
self->RegisterProperty, 'ExampleProperty', $
/STRING, DESCRIPTION='An example property', $
NAME='Example Property', SENSITIVE = 1
; Pass any extra keyword parameters through to the SetProperty
; method.
IF (N_ELEMENTS(_extra) GT 0) THEN $
self->ExampleVis::SetProperty, _EXTRA = _extra
; Return success
RETURN, 1
END
Discussion
The
ExampleVis class is based on the IDLitVisualization class (discussed in
“Subclassing from the IDLitVisualization Class” on page 121). As a result, all of the
standard features of an iTool visualization class are already present. We don’t define
any keyword values to be handled explicitly in the Init method, but we do use the
keyword inheritance mechanism to pass keyword values through to methods called
within the Init method. The
ExampleVis Init method does the following things:
1. Calls the Init method of the superclass, IDLitVisualization. We use the
REGISTER_PROPERTIES keyword to ensure that all registrable properties of
the superclass are exposed in the ExampleVis object’s property sheet. We also
set the visualization type to be an “ExampleVis,” provide a Name for the object
instance, and provide an icon. Finally, we use the _EXTRA keyword
inheritance mechanism to pass through any keywords provided when the
ExampleVis Init method is called.
2. Registers an input parameter called Y that must be a vector. The OPTARGET
keyword specifies that the Y parameter can be the target for iTool operations.