The IDLgrPolygon::Init function method initializes the polygons object.

Note: Init methods are special lifecycle methods, and as such cannot be called outside the context of object creation. This means that in most cases, you cannot call the Init method directly. There is one exception to this rule: if you write your own subclass of this class, you can call the Init method from within the Init method of the subclass.

Syntax


Obj = OBJ_NEW('IDLgrPolygon' [, X [, Y[, Z]]] [, PROPERTY=value])

or

Result = Obj->[IDLgrPolygon::]Init([X, [Y, [Z]]] [, PROPERTY=value])     (In a lifecycle method only.)

Return Value


When this method is called indirectly, as part of the call to the OBJ_NEW function, the return value is an object reference to the newly-created object.

When called directly within a subclass Init method, the return value is 1 if initialization was successful, or zero otherwise.

Arguments


Note: The values specified by the X, Y, and Z arguments are used to initialize the value of the DATA property of the IDLgrPolygon object.

X

A vector argument providing the X coordinates of the vertices. The vector must contain at least three elements. If the Y and Z arguments are not provided, X must be an array of either two or three vectors (i.e., [2,*] or [3,*]), in which case, X[0,*] specifies the X values, X[1,*] specifies the Y values, and X[2,*] specifies the Z values.

This argument is stored as double precision floating point values if the argument variable is of type DOUBLE or if the DOUBLE property is non-zero, otherwise it is converted to single precision floating point.

Y

A vector argument providing the Y coordinates of the vertices. The vector must contain at least three elements. This argument is stored as double precision floating point values if the argument variable is of type DOUBLE or if the DOUBLE property is non-zero, otherwise it is converted to single precision floating point.

Z

A vector argument providing the Z coordinates of the vertices. The vector must contain at least three elements. This argument is stored as double precision floating point values if the argument variable is of type DOUBLE or if the DOUBLE property is non-zero, otherwise it is converted to single precision floating point.

Keywords


Any property listed under IDLgrPolygon Properties that contains the word “Yes” in the “Init” column of the properties table can be initialized during object creation using this method. To initialize the value of a property, specify the property name as a keyword set equal to the appropriate property value.

All other keywords are passed to the superclass of this object.

Examples


To create and display a unit square:

square = OBJ_NEW('IDLgrPolygon', [[0,0],[1,0],[1,1],[0,1]])
XOBJVIEW, square

Similarly, to create and display a blue circle:

X = 2*!PI/100 * FINDGEN(100)
circle = OBJ_NEW('IDLgrPolygon', SIN(x), COS(x), COLOR=[0,0,255])
XOBJVIEW, circle

See also: "Mapping an Image onto a Sphere" (Chapter 3, Image Processing in IDL in the help/pdf directory of your IDL installation).

Version History


5.0

Introduced