ITT Rule IDL Version 7.0 User Manual Page 263

  • Download
  • Add to my manuals
  • Print
  • Page
    / 430
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 262
Chapter 10: Creating a File Writer 263
iTool Developer’s Guide Creating a New File Writer
Passing Through Caller-Supplied Property Settings
If you have included the _REF_EXTRA keyword in your function definition, you can
use IDLs keyword inheritance mechanism to pass any “extra” keyword values
included in the call to the Init method through to other routines. One of the things this
allows you to do is specify property settings when the Init method is called; simply
include each property’s keyword/value pair when calling the Init method, and include
the following in the body of the Init method:
IF (N_ELEMENTS(_extra) GT 0) THEN $
self->
MyWriter
::SetProperty, _EXTRA = _extra
where MyWriter is the name of your file writer class. This line has the effect of
passing any “extra” keyword values to your file writer class’ SetProperty method,
where they can either be handled directly or passed through to the SetProperty
methods of the superclasses of your class. See “Creating a SetProperty Method” on
page 265 for details.
Example Init Method
FUNCTION ExampleWriter::Init, _REF_EXTRA = _extra
IF (self->IDLitWriter::Init('ppm', TYPE='IDLIMAGE', $
NAME='Portable Pixmap (PPM) File', $
DESCRIPTION="PPM File Writer", $
_EXTRA = _extra) EQ 0) THEN $
RETURN, 0
RETURN, 1
END
Discussion
The
ExampleWriter class is based on the IDLitWriter class (discussed in
“Subclassing from the IDLitWriter Class on page 258). As a result, all of the
standard features of an iTool file writer class are already present. We don’t define any
keyword values to be handled explicitly in the Init method, but we do use the
keyword inheritance mechanism to pass keyword values through to methods called
within the Init method. The
ExampleWriter Init method does the following things:
1. Calls the Init method of the superclass, IDLitWriter. We specify a list of
accepted filename extensions (only
ppm, in this case) via the Extensions
argument, and set the TYPES keyword. We include a description of the writer
via the DESCRIPTION keyword. Finally, we use the _EXTRA keyword
Page view 262
1 2 ... 258 259 260 261 262 263 264 265 266 267 268 ... 429 430

Comments to this Manuals

No comments