NCL Website header
NCL Home > Documentation > HLUs > Classes

Primitive class

The Primitive class allows graphics primitives to be stored for subsequent possibly repeated drawing through various transformations.

Synopsis

Header file:		ncarg/hlu/Primitive.h
Class name:		primitiveClass
Class pointer:		NhlprimitiveClass
Fortran class function:	NHLFPRIMITIVECLASS
Superclass:		Base
Composite classes:	<None>

Class-defined types

Type name:		NhlTPolyType
Definition:
typedef enum _NhlPolyType {
	NhlPOLYLINE		= 0,	/* "Polyline" 	*/
	NhlPOLYGON		= 1,	/* "Polygon"  	*/
	NhlPOLYMARKER		= 2	/* "Polymarker"	*/
} NhlPolyType;


Resources

Local resources

+---------------------------------------------------------------+
|			Primitive Resource Set		|
|---------------------------------------------------------------|
| NAME				TYPE			ACCESS	|
|	CLASS				DEFAULT			|
|===============================================================|
| prXArray                      NhlTGenArray            RCSG    |
|       PrXArray                        NULL                    |
|---------------------------------------------------------------|
| prYArray                      NhlTGenArray            RCSG    |
|       PrYArray                        NULL                    |
|---------------------------------------------------------------|
| prPolyType                    NhlTPolyType            RCSG    |
|       prPolyType                      "Polyline"              |
|---------------------------------------------------------------|
| prGraphicStyle                NhlTObjId               RCSG    |
|       PrGraphicStyle                  NULL                    |
+---------------------------------------------------------------+

Composite resources

The Primitive object class has no composite class objects.

Superclass resources

Currently, no superclasses of the Primitive object class define any resources.


Description

The Primitive class encapsulates the properties and shape of a graphics primitive into an object. Note that it is not a View subclass, and therefore you may not draw a primitive directly. Instead, once you have created the primitive you add it to a list of graphics primitive objects that may be maintained by any object belonging to the Transform class (any plot object). Then, when you draw the transform, all the primitives in its list will be drawn along with whatever graphics it would normally draw on its own. Essentially the graphics primitives become a part of the transform with which they are associated.

You define a primitive by setting resources to specify its X and Y coordinates (prXArray and prYArray) and to specify its type (prPolyType).

You add a primitive to a Transform object's primitive list by invoking the method NhlAddPrimitive. Or you can create a complete list in one operation by directly setting the value of the Transform array resource tfPolyDrawList. You remove a primitive from the transform's list by invoking the NhlRemovePrimitive method.

A primitive always has an associated graphicstyle that specifies a set of attributes to use when rendering. It can be set explicitly by setting the resource prGraphicStyle. Otherwise, its graphicstyle is determined from context.


See also