NCL Home > Documentation > HLUs > API


The Fortran name of this function is NhlFNDCPolygon.

Given arrays containing the X and Y coordinates of points in NDC space, this function outputs an immediate-mode polygon connecting each of the points.

C Synopsis

#include <ncarg/hlu/hlu.h>
#include <hfile for Transform class object>

NhlErrorTypes NhlNDCPolygon(
		int	pid,
		int     gsid,
		float 	*x,
		float	*y,
		int	n,

Fortran Synopsis

      subroutine NhlFNDCPolygon(pid, gsid, x, y, n, ierr)
      integer pid, gsid, n, ierr
      float x(n), y(n)


pid (input)
Id of a Transform or Workstation object.
gsid (input)
Id of a GraphicStyle object.
x (input)
Array of X-Axis coordinate values in NDC space.
y (input)
Array of Y-Axis coordinate values in NDC space.
n (input)
Number of elements in the coordinate arrays x and y.
ierr (output, Fortran only)
Error code.


Type name:		NhlTErrorTypes
typedef enum _NhlErrType{
	NhlFATAL	= -4,	/* "FATAL"	*/
	NhlWARNING	= -3,	/* "WARNING"	*/
	NhlINFO		= -2,	/* "INFO"	*/
	NhlNOERROR	= -1	/* "NOERROR"	*/
} NhlErrorTypes;


This function draws an immediate-mode polygon in NDC space. If the parameter pid specifies a transform (a plot object) the polygon is clipped to the object's viewport. If the parameter pid specifies a workstation, the polygon is clipped only at the boundaries of the NDC viewspace. An immediate-mode polygon appears as soon as the low-level point buffer is flushed after the function is called. It is not drawn when the object's Draw method is invoked.

You specify the polygon's attributes by passing in a GraphicStyle object using the parameter gsid. If gsid is set to NhlNULLOBJID (0) then the polygon attributes are determined by the current settings of the Workstation default GraphicStyle object. Retrieve the id of the default GraphicStyle object by getting the value of the read-only Workstation resource wkDefGraphicStyleId.

Return Values

The NhlNDCPolygon C function returns a value of type NhlErrorTypes, and the NhlFNDCPolygon Fortran subroutine returns the error in ierr. The following table indicates what the various return Error Values mean:
Value	|			Meaning
NOERROR	|	function successful
INFO	|	minor recoverable error
WARNING	|	recoverable error
FATAL	|	function failed; continuing the program
	|       may result in core dump

See Also