Справочник Пользователя для ITT Rule IDL Version 7.0
Chapter 8: Creating a Manipulator
205
iTool Developer’s Guide
Using Manipulator Public Instance Data
Using the nSelectionList Field
The
nSelectionList
field contains the number of currently selected items in the
window associated with the current manipulator. This corresponds to the number of
visualizations contained within the
visualizations contained within the
pSelectionList
pointer, described in the
following section. If no visualizations have been selected, the
nSelectionList
value equals 0 and the
pSelectionList
will contain an undefined IDL variable.
The
nSelectionList
can be used to ensure the user has made a selection. For
example, in an OnMouseDown method, you may use a statement similar to the
following to ensure a selection has been made:
following to ensure a selection has been made:
; If nothing selected we are done.
IF (self.nSelectionList EQ 0) THEN $
RETURN
The
nSelectionList
field value can also be used to loop through the collection of
selected visualizations as shown in the following section.
Using the pSelectionList Pointer Field
The
pSelectionList
field is a pointer to an array of visualizations currently
selected in the window. Use the
nSelectionList
value to cycle through this array.
If a manipulator only acts upon visualizations of a certain type you can verify the
type of each selected item in
type of each selected item in
pSelectionList
before attempting to modify the
visualization. The
nSelectionList
and
pSelectionList
public instance data
fields are available from any manipulator object’s predefined or custom methods.
; Loop through all selected visualizations.
FOR i=0, self.nSelectionList-1 DO BEGIN
oVis = (*self.pSelectionList)[i]
; Verify type of visualization or manipulate it.
; ...
ENDFOR
Note
The
pSelectionList
field is a pointer. You must use IDL pointer syntax to
access items in the field.
See
on page 226 for a complete example that
uses these public instance data fields.