Shape Sub-Package
This sub-package contains functions that allow you to define shapes for inclusion in a shapeset. A shape is a basic geometric object such as line, rectangle, or text. Unlike annotations, shapes cannot be directly inserted and displayed in a network model. Instead, shapes are added to a shapeset model (via the Shapeset Sub-Package) and the shapeset is then displayed in a slice (using the Slice Sub-Package).
There are eight types of shapes: arc, ellipse, icon, label, polygon, region, rectangle, and round rectangle. You create a shape with the Ets_Shape_<type>_Create() function. You can also create an invisible shape, generally used to hold attributes, with Ets_Shape_Empty_Create(). To get the specifications for a specific shape, use the corresponding Ets_Shape_<type>_Info_Get() function.
You can get the type of an existing shape with Ets_Shape_Type_Get(). To deallocate the memory used by a shape, use Ets_Shape_Destroy().
Shapes can have an arbitrary number of simple, named attributes associated with them. The supported attribute types are int, double, string, and toggle. To attach a new attribute to a shape, use Ets_Shape_Attr_Add(). You can get the type of an attribute with Ets_Shape_Attr_Type_Get() and obtain its value with Ets_Shape_Attr_Get(). To determine if a shape has a specific attribute, use Ets_Shape_Attr_Exists(). For a list of all named attributes installed on a shape, use Ets_Shape_Attr_Names_Get().
Shape Colors
You can define the colors used in shapes using either the RGB or HLS color system. To define a color, use one of the following functions:
Shape Data Types
Several shapes are defined by either a box or a collection of line segments, using the data types described here. The points in these data types use units of either degrees, meters, or feet.
Boxes use EtsT_Shape_Rect, which defines a box by its lower left (minx, miny) and upper right (maxx, maxy) corners in the coordinate system. The values of minx and miny must always be less than the values of maxx and maxy, respectively. (Note, however, that the lower left corner may actually display above the upper right corner, depending on the type of the coordinate system.)
Figure 4: EtsT_Shape_Rect Type Definition
typedef struct EtsT_Shape_Rect
{
double minx;
double miny;
double maxx;
double maxy;
} EtsT_Shape_Rect;
Irregular shapes, such as polygons and regions, are defined by a list of line segments of type EtsT_Shape_Line_Section. The xy_array holds x and y coordinate pairs, with x coordinates in positions with even indexes and y coordinates with odd indexes. The size of the memory block that must be allocated for a line with N segments is (sizeof (EtsT_Shape_Line_Section) + (N-1) * sizeof (double) * 2).
Figure 5: EtsT_Shape_Line_Section Type Definition
typedef struct EtsT_Shape_Line_Section
{
unsigned int num_points;
double xy_array [2];
/* actual storage to be dynamically allocated */
} EtsT_Shape_Line_Section;