user manual

132 Chapter 6: Creating a Visualization
Creating a New Visualization Type iTool Developers Guide
Finally, the method calls the superclass’ GetProperty method, passing in all of the
keywords stored in the
_extra structure.
Creating a SetProperty Method
The visualization class SetProperty method stores property values in the visualization
object’s instance data or in properties of associated objects. It sets the specified
property value either by storing the value directly in the visualization objects
instance data or by calling another class’ SetProperty method.
Note
Any property registered with a call to the RegisterProperty method must be listed as
a keyword to the SetProperty method either of the visualization class or one of its
superclasses.
See “IDLitVisualization::SetProperty” (IDL Reference Guide) for additional details.
Example SetProperty Method
The following example code shows a very simple SetProperty method for the
ExampleVis visualization type:
PRO ExampleVis::SetProperty, $
EXAMPLEPROPERTY = exampleProperty, $
_REF_EXTRA = _extra
IF (N_ELEMENTS(exampleProperty) GT 0) THEN BEGIN
self._exampleProperty = exampleProperty
ENDIF
IF (N_ELEMENTS(_extra) GT 0) THEN $
self->IDLitVisualization::SetProperty, _EXTRA = _extra
END
Discussion
The SetProperty method first defines the keywords it will accept. There must be a
keyword for each property of the visualization type. The keyword inheritance
mechanism allows properties to be set on the
ExampleVis class’ superclasses
without knowing the names of the properties.
Using the N_ELEMENTS function, we check to see whether a value was specified
for each keyword. If a value is detected, we set the value of the associated property.
In this example, only one property (ExampleProperty) is specific to the
ExampleVis