A SERVICE OF

logo

Chapter 10: Creating a File Writer 265
iTool Developer’s Guide Creating a New File Writer
Note
Any property registered with a call to the RegisterProperty method must be listed as
a keyword to the GetProperty method either of the visualization class or one of its
superclasses.
Note
A file writer need not register any properties at all, if the write operation is simple.
Many of the standard iTool image file writers work without registering any
properties.
See “IDLitWriter::GetProperty” (IDL Reference Guide) for additional details.
Example GetProperty Method
PRO ExampleWriter::GetProperty, _REF_EXTRA = _extra
IF (N_ELEMENTS(_extra) GT 0) THEN $
self->IDLitWriter::GetProperty, _EXTRA = _extra
END
Discussion
The GetProperty method first defines the keywords it will accept. There must be a
keyword for each property of the file writer. Since the file writer we are creating has
no properties of its own, there are no keywords explicitly defined. Note the use of the
keyword inheritance mechanism to allow us to get properties from the
ExampleWriter class’ superclasses without knowing the names of the properties.
Since our
ExampleWriter class has no properties of its own, we simply call the
superclass’ GetProperty method, passing in all of the keywords stored in the
_extra
structure.
Creating a SetProperty Method
The file writer SetProperty method stores property values in the file writer object’s
instance data. It should set the specified property value, either by storing the value
directly in the visualization object’s instance data or by calling another class’
SetProperty method.