user manual
186 Chapter 7: Creating an Operation
Example: Data Resample Operation iTool Developer’s Guide
Example: Data Resample Operation
This example creates a data operation to resample data in a dataset using the IDL
CONGRID function.
Example Code
The code for this example operation is included in the file
example1_opresample__define.pro in the examples/doc/itools
subdirectory of the IDL distribution. Run the example procedure by entering
example1_opresample__define at the IDL command prompt or view the file
in an IDL Editor window by entering
.EDIT
example1_opresample__define.pro.
Class Definition File
The class definition for example1_opresample consists of an Init method, an
Execute method, GetProperty and SetProperty methods, and a class structure
definition routine. As with all object class definition files, the class structure
definition routine is the last routine in the file, and the file is given the same name as
the class definition routine (with the suffix
.pro appended).
Class Definition
PRO example1_opresample__define
struc = {example1_opresample, $
inherits IDLitDataOperation, $
_x: 0d, $
_y: 0d, $
_z: 0d, $
_method: 0b $
}
END
Discussion
Our class definition routine is very simple. We create an IDL structure variable with
the name
example1_opresample, specifying that the structure inherits from the
IDLitDataOperation class. The structure has three instance data fields named
_x, _y,
and
_z, which contain double-precision floating point values, and a single instance
data field named
_method which contains a byte value.