Polyline Object Class


Overview

The Polyline object class can display a series of points connected by line segments. The end points can be connected in such a way to form an open or closed polyline or filled polygon. In addition, symbols can be drawn at each point location.

Creation

A Polyline object can be created as a child of any widget class derived from the EditObject class. Resources are provided to specify the point values and the number of points. A Polyline object can also be created interactively using function XintEditObjectInsert.

Editing

Like any Graphic object, a Polyline object can be edited interactively. Editing operations include move, shape (to move a point), add point and delete point. Editing is specified by installing the proper translation table or by setting resource XmNobjectEditMode from the EditObject class.

Optimization

For applications that create a large number of Polyline objects, it is possible to create a single Polyline object composed of multiple discontinuous segments which appear as discrete objects. This is done by defining resource XmNnullValue and inserting null points between the sets of points that represent each discrete segment. It is recommended that the programmer only combine segments which are located close together to minimize the object bounding box. This will avoid excessive redrawing when it becomes necessary to repaint a portion of the parent window.

Graphic Class and MultPoint Class Inherited Resources

Resources to specify the line color, the line thickness, and fill options are inherited from the Graphic class. Resources to specify a point symbol and a point size are inherited from the MultiPoint class.

Inherited Behavior and Resources

Polyline object class inherits behavior and resources from the Xt Object, Graphic and MultiPoint classes.
The following resources are defined by the Polyline object class:
NameTypeDefaultAccess
XmNcloseEndPointsBooleanFalseCSG
XmNnullValuefloat *NULLCSG
XmNpointArrayXintPolylinePoint *{ {10., 10.}, {20., 20.} {30., 30.}}CSG
XmNpointCountint3CSG
XmNdrawSymbolCallbackXtCallbackListNULLCSG


XmNcloseEndPoints

Specifies that the Polyline first and last points are connected with a line to make a closed polygon (True).

XmNnullValue

Specifies a pointer to a floating point value that is used to represent null or missing values. Missing values introduce discontinuities in the polyline. For filled polygons, the segments between null values are filled separately. You only need to set one of the polyline coordinates (x or y) to the null value to specify a missing value.

XmNpointArray

Specifies the coordinates of the points contained in the Polyline object. The polyline is specified as an array of points, where each point is specified using a structure of type XintPolylinePoint which takes the following form:

    typedef struct {
        float x;
        float y;
    } XintPolylinePoint;


XmNpointCount

Specifies the number of points passed in resource XmNpointArray.

XmNdrawSymbolCallback

Specifies a list of callbacks called each time a point symbol is drawn. This callback can be used to draw polylines where point symbols can have different sizes, colors, and symbol types. The callback structure is XintPolylineDrawSymbolCallbackStruct and the callback reason is XintCR_DRAW_SYMBOL.

Polyline Callbacks

The following ordered table lists the members of the callback structure, XintPolylineDrawSymbolCallbackStruct, returned to each procedure in the callback list specified by the resource XmNdrawSymbolCallback.

Data TypeMemberDescription
intreasonIndicates why the callback was invoked.
XEvent *eventPoints to the XEvent that triggered the callback.
BooleandoitSet this flag to False to prevent the symbol from being drawn.
intindexIndex of the point which symbol is being drawn.
doublex,yLocation of the symbol.
doublesymbol_sizeSymbol size (can be changed).
Pixelsymbol_colorSymbol color (can be changed).
intsymbol_typeSymbol type (can be changed).

Structure member symbol_type can be set to one of the following constants:

Member ValueDescription
XintSYMBOL_XDraws an "X".
XintSYMBOL_PLUSDraws a "+".
XintSYMBOL_SQUAREDraws a square.
XintSYMBOL_CIRCLEDraws a circle.
XintSYMBOL_TRIANGLEDraws a triangle.
XintSYMBOL_DIAMONDDraws a diamond.
XintSYMBOL_FILLED_SQUAREDraws a filled square.
XintSYMBOL_FILLED_CIRCLEDraws a filled circle.
XintSYMBOL_FILLED_TRIANGLEDraws a filled triangle.
XintSYMBOL_FILLED_DIAMONDDraws a filled diamond.


Polyline Functions

Function XintCreatePolyline creates a polyline object.

     Object XintCreatePolyline (...)

WidgetparentParent of new Polyline object.
char *nameName of new Polyline object.
ArgListarglistList of resource/value items.
CardinalargcountNumber of items in arglist.


Macros

Macro XintIsPolyline returns True if the specified object is a Polyline object.

     Boolean XintIsPolyline (Object object)