ITT Rule IDL Version 7.0 User Manual Page 273

  • Download
  • Add to my manuals
  • Print
  • Page
    / 430
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 272
Chapter 10: Creating a File Writer 273
iTool Developer’s Guide Example: TIFF File Writer
IF (self->IDLitWriter::Init('tiff', $
TYPES=['IDLIMAGE', 'IDLIMAGEPIXELS', 'IDLARRAY2D'], $
NAME="Tag Image File Format", $
DESCRIPTION="Tag Image File Format (TIFF)", $
_EXTRA = _extra) EQ 0) THEN $
RETURN, 0
RETURN, 1
END
Discussion
The first item in our class definition file is the Init method. The Init method’s
function signature is defined first, using the class name example1_writetiff. Note the
use of the _REF_EXTRA keyword inheritance mechanism; this allows any keywords
specified in a call to the Init method to be passed through to routines that are called
within the Init method even if we do not know the names of those keywords in
advance.
Next, we call the Init method of the superclass. In this case, we are creating a subclass
of the IDLitWriter class; this provides us with all of the standard iTool file writer
functionality automatically. Any “extra” keywords specified in the call to our Init
method are passed to the IDLitWriter::Init method via the keyword inheritance
mechanism.
We specify a list of accepted filename extensions (
tiff, in this case) via the
Extensions argument, and set the TYPES keyword equal to the iTool data type of data
that can be written using this file writer. (The iTool data types specified by the
TYPES keyword must match the iTool data type of the data selected in the iTool
Export Wizard in order for the file writer to be available for selection.)
We specify a value for the NAME property of the writer object (this is displayed in
the system preferences dialog) and include a description of the writer via the
DESCRIPTION keyword. Finally, we use the _EXTRA keyword inheritance
mechanism to pass through any keywords provided when the Init method is called.
Finally, we return the value 1 to indicate successful initialization.
SetData Method
FUNCTION example1_writetiff::SetData, oImageData
; We need a filename for the file we are about to write.
strFilename = self->GetFilename()
IF (strFilename EQ '') THEN $
Page view 272
1 2 ... 268 269 270 271 272 273 274 275 276 277 278 ... 429 430

Comments to this Manuals

No comments