Справочник Пользователя для ITT Rule IDL Version 7.0

Скачать
Страница из 430
146
Chapter 7: Creating an Operation
Overview of Creating an iTool Operation
iTool Developer’s Guide
Overview of Creating an iTool Operation
An operation is an iTool component object class that can be used to modify selected 
data, change the way a visualization is displayed in the iTool window, or otherwise 
affect the state of the iTool. Some examples of iTool operations are:
performing the IDL SMOOTH operation on selected data,
rotating a selected visualization by a specified angle,
displaying data statistics.
A number of standard operations are predefined and included in the IDL iTools 
package; if none of the predefined operations suits your needs, you can create your 
own operation by subclassing either from the base IDLitOperation class on which all 
of the predefined operations are based, from the IDLitDataOperation class, or from 
one of the predefined operations.
The Operation Creation Process
To create a new iTool operation, you will do the following:
Choose an iTool operation class on which your new operation will be based. In 
most cases, the operation will act on the data underlying a visualization; in 
these cases, you will base your new operation on the IDLitDataOperation 
class. If your operation will affect something other than data — the appearance 
of visualizations in the iTool window, or the value of some property — you 
will base your new class on the IDLitOperation class. Both classes provide 
support for the iTool undo/redo system, but operations that do not deal directly 
with data require additional code to properly allow for undoing and redoing the 
operations.
Define the properties of the operation, and set default property values.
If the new operation acts directly on data (that is, if it is based on the 
IDLitDataOperation class), provide an Execute method that performs the 
operation using the current property values. Similarly, if the new operation is 
more general and is based on the IDLitOperation class, provide a DoAction 
method.
Optionally provide a DoExecuteUI method to display a user interface for 
operations that act directly on data.
For generalized operations, provide UndoOperation and RedoOperation 
methods to undo and redo the operation. These methods may in turn require