Insert_Text_Leader

Functions

Key DInsert_Text_Leader (Key ownerkey, double x, double y, double z, char const *options)
 Inserts a leader line with double precision parameters. Unlike Insert_Text_Leader, these parameters will not be truncated. More...
 
Key Insert_Text_Leader (Key ownerkey, double x, double y, double z, char const *options)
 Inserts a leader line. More...
 

Detailed Description

Function Documentation

◆ DInsert_Text_Leader()

Key DInsert_Text_Leader ( Key  ownerkey,
double  x,
double  y,
double  z,
char const *  options 
)

Inserts a leader line with double precision parameters. Unlike Insert_Text_Leader, these parameters will not be truncated.

Parameters
ownerkey- the key of the owning segment text; this will typically be the key returned from a call to Insert_Text.
x- x-position where the leader line points.
y- y-position where the leader line points.
z- z-position where the leader line points.
options- a pointer to an argument string containing various options. Adding a 'w' flag indicates the coordinate parameters are in world space. An empty string indicates object space.

DETAILS

◆ Insert_Text_Leader()

Key Insert_Text_Leader ( Key  ownerkey,
double  x,
double  y,
double  z,
char const *  options 
)

Inserts a leader line.

Parameters
ownerkey- the key of the owning segment text; this will typically be the key returned from a call to Insert_Text.
x- x-position where the leader line points.
y- y-position where the leader line points.
z- z-position where the leader line points.
options- a pointer to an argument string containing various options. Adding a 'w' flag indicates the coordinate parameters are in world space. An empty string indicates object space.

DETAILS

ellipse_with_anchors.png

This snippet shows how to define an ellipse with four anchor points, each with a leader line attached:

#define SQ2 1.4142
const float ellipse_shape[] = {
3,
-1,
0, 0, 0, 0, 0, 0,
SQ2, 0, SQ2, 0, 0, 0,
0, 0, 0, 0, SQ2, SQ2,
-15,
SQ2, 0, SQ2, 0, 0, 0,
-1,
SQ2, 0, SQ2 + 1.5, 0, 0, 0,
-15,
0, 0, 0, 0, SQ2, SQ2,
1,
0, 0, 0, 0, SQ2, SQ2 + 1.5,
-15,
-SQ2, 0, -SQ2, 0, 0, 0,
-1,
-SQ2, 0, -SQ2 - 1.5, 0, 0, 0,
-15,
0, 0, 0, 0, -SQ2, -SQ2,
1,
0, 0, 0, 0, -SQ2, -SQ2 - 1.5,
0
};
HC_Define_Shape("ellipse 4", countof(ellipse_shape), ellipse_shape);
HC_Set_Color("window = (r=1 g=0.9 b=0.8), faces=orange, edges=dark orange, text=dark orange");
HC_Set_Text_Alignment("|");
HC_Define_Line_Style("arrowed", "end arrow = 12 pixels ^/*\\");
HC_Set_Line_Pattern("arrowed");
HC_Set_Text_Font("size=24 pt, backgrounds");
HC_KEY text;
HC_Open_Segment("ellipse 4");
HC_Translate_Object(0.5, 0.5, 0);
HC_Set_Text_Font("background=shape=ellipse 4");
text = HC_Insert_Text(0, 0, 0, "ellipse with 4 anchors\n and 4 intermediate\npoints");
HC_Insert_Text_Leader(text, 0.25, 0.25 * 1, 0, "");
HC_Insert_Text_Leader(text, 0.65 * 1, 0.5 * 0, 0, "");
HC_Insert_Text_Leader(text, -0.25, 0.25 * -1, 0, "");
HC_Insert_Text_Leader(text, 0.65 * -1, 0.5 * 0, 0, "");
HC_Close_Segment();

The shape is defined as a format 3, meaning that each coordinate is defined with three values: x-bounding, y-bounding, and a margin. (For a more detailed look at how shapes are defined, please see the Define_Shape function.)

The -1 shape code is an ellipse with a center point, a major point, and a minor point. Next, the shape code -15 indicates an anchor point. The optional 1 that follows begins the definition for an intermediate point; if a -1 is used instead of 1, then the line between the anchor point and the intermediate point isn't drawn.

The leader line attaches to the anchor point nearest to its target.

In this example, there are a total of four anchor points (defined with the -15 shape code), four intermediate points (defined with either 1 or -1 immediately after the anchor point definition), and four leader lines inserted via Insert_Text_Leader. Two of the leader lines are invisible between their anchor points and intermediate points (defined with a -1), and two are visible between their anchor points and intermediate points (defined with a 1).

Finally, a zero terminates the definition.