
208 Chapter 8: Creating a Manipulator
Creating a New Manipulator iTool Developer’s Guide
INHERITS IDLitManipulator, $ Superclass
oImage: OBJ_NEW(), $ Target image
}
END
Discussion
The purpose of the structure definition routine is to define a named IDL structure
with structure fields that will contain the manipulator object instance data. The
structure name should be the same as the manipulator’s class name — in this case,
ExampleManip.
Like many iTool manipulators,
ExampleManip is created as a subclass of the
IDLitManipulator class. The
ExampleManip manipulator class includes one
instance data field that will contain a reference to the target image object being
manipulated.
Note
This example is intended to demonstrate how simple it can be to create a new
manipulator class definition. While the class definition for a manipulator class with
significant extra functionality will likely define additional structure fields, and may
inherit from other iTool classes, the basic principles are the same. See “Example:
Color Table Manipulator” on page 226 for a more complex class structure
definition.
Creating a Manipulator Init Method
The manipulator class Init method handles any initialization required by the
manipulator object, and should do the following:
• Define the Init function method
• Call the Init methods of any superclasses
• Register any manipulator properties and set property attributes as necessary
• Perform other initialization steps as necessary
• Return a value of 1 if the initialization steps are successful, or 0 otherwise
The Manipulator Init Function
Begin by defining the argument and keyword list for your Init method. The argument
and keyword list defines positional parameters (arguments) accepted by your method,
defines any keywords that will be handled directly by your method, and specifies