
Chapter 8: Creating a Manipulator 227
iTool Developer’s Guide Example: Color Table Manipulator
This example creates three files:
• Manipulator Class Definition (
example3_manippalette__define.pro) –
defines the characteristics and actions of the manipulator in response to mouse
and keyboard events. See “Color Table Manipulator Class Definition” below.
• iTool Class Definition (
example3tool__define.pro) – defines this tool’s
inheritance of the IDLitToolImage tool and registers the custom manipulator.
See “Custom Tool Class Definition for the Color Table Manipulator” on
page 227.
• iTool Launch Routine (
example3tool.pro) – accepts and initializes any
image arguments by creating the necessary data and adding it to the tool’s
parameter set. The launch routine registers the tool using ITREGISTER and
then creates an instance of the tool using IDLITSYS_CREATETOOL
function. See “Tool Launch Routine for Custom Color Table Manipulator” on
page 228.
Once you have created and compiled the necessary files, see “Running the Color
Table Manipulator Example” on page 228 for instructions on how to recreate the
display shown in the previous figure.
Color Table Manipulator Class Definition
Define the color table manipulator (example3_manippalette__define.pro).
This class definition file initializes the manipulator, creates a cursor, and defines the
manipulator actions in response to mouse and keyboard events.
Example Code
The class definition code for this example manipulator is included in the file
example3_manippalette__define.pro in the examples/doc/itools
subdirectory of the IDL distribution. Run the example procedure by entering
example3_manippalette__define at the IDL command prompt or view the
file in an IDL Editor window by entering
.EDIT
example3_manippalette__define.pro.
Custom Tool Class Definition for the Color Table Manipulator
Create the class definition for the tool containing the custom manipulator
(
example3tool__define.pro). This example inherits the IDLitToolImage class
functionality. In the tool initialization, register the custom manipulator. The
DESCRIPTION string appears in the status area when the manipulator is activated.