Polyline Output


Discussed here is the polyline output primitive GPL and the functions that are used to set polyline attributes and retrieve current attribute settings.

Polyline Output Primitive


The polyline output primitive GPL causes a series of N-1 straight line segments to be drawn connecting successive points specified by the coordinate pairs (X(I),Y(I)) for I=1,N.
------------------------------------------------
          Argument | Type    |  Mode | Dimension
------------------------------------------------
CALL GPL  (N,      | Integer | Input |
           X,      | Real    | Input |   N
           Y)      | Real    | Input |   N
------------------------------------------------
N
The number of points in the line to be drawn. (N > 1)
X
An array of dimension N containing the X coordinates of N points to be connected by line segments. These values are in world coordinates.
Y
An array of dimension N containing the Y coordinates of N points to be connected by line segments. These values are in world coordinates.
Defaults:
none
Errors:
5, 100
------------------------------------------------------------------------
C Synopsis

#include <ncarg/gks.h>

void gpolyline(
               const Gpoint_list  *point_list  /*  list of points  */
);
------------------------------------------------------------------------

Figure 6 - Examples of polylines

Setting Polyline Output Attributes


Before generating output you can change various polyline attributes from the default values. You can set polyline type and width attributes using GSLN and GSLWSC, respectively.

Set Line Type

-------------------------------------------------
           Argument | Type    |  Mode | Dimension
-------------------------------------------------
CALL GSLN  (LTYPE)  | Integer | Input |
-------------------------------------------------
LTYPE
The type of polyline to be drawn. Options are:
< 0 - implementation dependent (not used in NCAR GKS)
1 - solid line
2 - dashed line
3 - dotted line
4 - dashed dotted line
>= 5 - reserved for future standardization (not used in NCAR GKS)
Default:
The default linetype is 1 (solid line).
Errors:
8, 63
--------------------------------------------------------------
C Synopsis

#include <ncarg/gks.h>

void gset_linetype(
                   Gint  linetype  /*  linetype  */
);
--------------------------------------------------------------

Set Linewidth Scale Factor

-------------------------------------------------
             Argument | Type | Mode  |  Dimension
-------------------------------------------------
CALL GSLWSC  (LWIDTH) | Real | Input |
-------------------------------------------------
LWIDTH
A scale factor to control the linewidth of the polyline to be drawn. It must be greater than or equal to 0. LWIDTH is applied to the nominal linewidth on a given device and the linewidths are mapped to the nearest available linewidth representable on that device. See Figure 6 for examples of polylines drawn with different widths. If an output device does not support differing linewidths, then you will see no effect on that device from setting this value.
Default:
The default linewidth scale factor is 1.0.
Errors:
8, 65
--------------------------------------------------------------------------
C Synopsis

#include <ncarg/gks.h>

void gset_linewidth(
                    Gdouble  linewidth  /*  linewidth scale factor  */
);
--------------------------------------------------------------------------

Polyline Inquiry Functions


Get the Line Type

----------------------------------------------------
           Argument |  Type   |   Mode  |  Dimension
----------------------------------------------------
CALL GQLN  (ERRIND, | Integer |  Output |
            LTYPE)  | Integer |  Output |
----------------------------------------------------
ERRIND
Error flag. Gives an integer error number from the Errors list in Appendix D, or a 0 if no error occurred.
LTYPE
Gives the type of polyline to be drawn as set by GSLN.
Errors:
8
----------------------------------------------------------------------
C Synopsis

#include <ncarg/gks.h>

void ginq_linetype(
                  Gint  *err_ind,  /*  error indicator  */
                  Gint  *linetype  /*  linetype         */
);
----------------------------------------------------------------------

Get the Linewidth Scale Factor

----------------------------------------------------
             Argument | Type    | Mode   | Dimension
----------------------------------------------------
CALL GQLWSC  (ERRIND, | Integer | Output |
              LWIDTH) | Real    | Output |
----------------------------------------------------
ERRIND
Error flag. Gives an integer error number from the Errors list in Appendix D, or a 0 if no error occurred.
LWIDTH
Gives the line width scale factor as set by GSLWSC.
Errors:
8
--------------------------------------------------------------------------
C Synopsis

#include <ncarg/gks.h>

void ginq_linewidth(
                    Gint     *err_ind,   /*  error indicator         */
                    Gdouble  *linewidth  /*  linewidth scale factor  */
);
--------------------------------------------------------------------------

Links: GKS Index, GKS Home