
142 Chapter 6: Creating a Visualization
Example: Image-Contour Visualization iTool Developer’s Guide
We register two parameters used by our visualization: IMAGEPIXELS and PALETTE.
Both parameters are input parameters (meaning they are used to create the
visualization), and both can be the target of an operation. The
IMAGEPIXELS
parameter can contain data of two iTool data types:
IDLIMAGEPIXELS or
IDLARRAY2D. When data are assigned to the visualization’s parameter set, only data
that matches one of these two types can be assigned to the
IMAGEPIXELS parameter.
Similarly, the
PALETTE parameter can contain data of type IDLPALETTE or
IDLARRAY2D.
Next, we create the two visualization components that make up the
example1_visImageContour visualization type: an IDLitVisImage object and an
IDLitVisContour object. Each object is created by a call to the OBJ_NEW function;
the newly-created object reference is placed in a field of the
example1_visImageContour object’s instance data structure. We set the PRIVATE
property to prevent the IDLitVisImage and IDLitVisContour objects from showing
up in the visualization browser as separate items. The new visualization objects are
then added to the example1_visImageContour object using the Add method; the
AGGREGATE keyword specifies that the properties of each of the component
visualization objects will be displayed as properties of the
example1_visImageContour object itself.
Finally, we return 1, indicating a successful initialization.
OnDataChangeUpdate Method
The OnDataChangeUpdate method is called whenever the data associated with the
example1_visImageContour visualization object changes. This may include the
initial creation of the visualization, if data parameters are specified in the call to the
iTool launch routine that creates the visualization.
PRO example1_visImageContour::OnDataChangeUpdate, oSubject, $
parmName, _REF_EXTRA = _extra
; Branch based on the value of the parmName string.
CASE STRUPCASE(parmName) OF
; The method was called with a paramter set as the argument.
'<PARAMETER SET>': BEGIN
oParams = oSubject->Get(/ALL, COUNT = nParam, $
NAME = paramNames)
FOR i = 0, nParam-1 DO BEGIN
IF (paramNames[i] EQ '') THEN CONTINUE
oData = oSubject->GetByName(paramNames[i])
IF (OBJ_VALID(oData)) THEN $
self->OnDataChangeUpdate, oData, paramNames[i]
ENDFOR