Registering an Operation

Before an operation can be performed by an iTool, the operation's class definition must be registered as being available to the iTool. Registering an operation with the iTool links the class definition file that contains the actual IDL code that defines the operation with a simple string that names the type. Code that performs an operation in an iTool uses the name string to specify which operation should be performed.

Using IDLitTool::RegisterOperation

In most cases, you will register an operation with the iTool in the iTool's class Init method. Registration ensures that the operation is available to the iTool. (See Creating a New iTool Class for details on the iTool class Init method.)

To register an operation, call the IDLitTool::RegisterOperation method:

self->RegisterOperation, OperationName, Operation_Class_Name 

where OperationName is the string you will use when referring to the operation, and Operation_Class_Name is a string that specifies the name of the class file that contains the operation's definition.

Note
The file Operation_Class_Name__define.pro must exist somewhere in IDL's path for the visualization type to be successfully registered.

See "IDLitTool::RegisterOperation" (IDL Reference Guide) for details.

Specifying Useful Properties

You can set any property of the IDLitOperation and IDLitComponent classes when registering an operation. The following properties may be of particular interest:

EXPENSIVE_COMPUTATION

A boolean value that indicates whether the operation is expensive. Expensive operations are those that require significant memory or processing time to execute. Individual operations should use the value of this property to determine whether the results of the operation should be cached to avoid re-execution when undoing or redoing.

ICON

A string value giving the name of an icon to be associated with this object. Typically, this property is the name of a bitmap file to be used when displaying the object in a tree view. See Icon Bitmaps for details on where bitmap icon files are located.

IDENTIFIER

A string that will be used as the identifier of the object. Identifier strings specify where within an iTool's object hierarchy an object is located; this, in turn, may affect whether and where the object is revealed in the iTool's graphical user interface. For example, to display a menu item for an operation named 'MyOperation' in the iTool Operations menu, you would specify the identifier string 'Operations/MyOperation'. See iTool Object Identifiers (iTool Developer's Guide) for details about how identifiers are named.

If this property is not specified, then the value of the OperationName argument is used as the identifier.

REVERSIBLE_OPERATION

A boolean value that indicates whether the operation is reversible. When an operation is reversible, it can be undone by applying an operation rather than restoring a stored value. Rotation by a specified angle is an example of an operation that is reversible, since applying another rotation by the same angle in the opposite direction returns the visualization to its original state. Individual operations should use the value of this property to determine how the operation should be undone.

SHOW_EXECUTION_UI

A boolean value that indicates whether the operation should display a user interface element such as a dialog when the operation is executed.

TYPES

A string or an array of strings indicating the types of data to which the operation can be applied. iTools data types are described in Data Management. Set this property to a null string ('') to specify that the operation can be applied to all types of data.