Справочник Пользователя для ITT Rule IDL Version 7.0

Скачать
Страница из 430
272
Chapter 10: Creating a File Writer
Example: TIFF File Writer
iTool Developer’s Guide
Example: TIFF File Writer
This example creates a file writer to write TIFF format files. 
Example Code
The code for this example file writer is included in the file 
example1_writetiff__define.pro
 in the 
examples/doc/itools
 
subdirectory of the IDL distribution. Run the example procedure by entering 
 at the IDL command prompt or view the file in 
an IDL Editor window by entering 
.
Note
The standard TIFF file writer included with the iTools contains additional features 
not included in this example. In most cases, if a file writer is included in the 
standard iTool distribution, there is no need to create your own writer for files of the 
same type.
Class Definition File
The class definition for 
example1_writetiff
 consists of an Init method, a SetData 
method, 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 Discussion
PRO example1_writetiff__Define
struct = {example1_writetiff,
$
inherits IDLitWriter
$
}
END
Discussion
Our class definition routine is very simple. We create an IDL structure variable with 
the name 
example1_writetiff
, specifying that the structure inherits from the 
IDLitWriter class. The object has no instance data, and thus no instance data fields.
Init Method
FUNCTION example1_writetiff::Init, _REF_EXTRA = _extra