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:
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 that you provide methods to store values before and after the operation is executed.
- Override methods used to get or set properties, react to changes in the underlying data, and clean up, as necessary.
This chapter describes the process of creating new operations based on the IDLitDataOperation and IDLitOperation classes.