Functions | Properties
Labels generation
Labels modules

Functions

void Labels.AddLabel (string Text, double x, double y, double Rotation, int Category)
 Adds a new label as the last one in the list.
void Labels.AddPart (int Index, string Text, double x, double y, double Rotation, int Category)
 Adds a part to the label with specified index.
void Labels.Clear ()
 Removes all the labels and parts but not the visualization categories.
int Labels.Generate (string Expression, tkLabelPositioning Method, bool LargestPartOnly)
 Generates labels for each shape of the parent shapefile.
Label Labels.get_Label (int Index, int Part)
 Gets label with the specified index.
int Labels.get_NumParts (int Index)
 Gets the number of parts for the label with specified index.
bool Labels.InsertLabel (int Index, string Text, double x, double y, double Rotation, int Category)
 Inserts a new label at the given position.
bool Labels.InsertPart (int Index, int Part, string Text, double x, double y, double Rotation, int Category)
 Inserts a new part for the specified label.
bool Labels.RemoveLabel (int Index)
 Removes a label with the specified index. If the label is multipart then all its parts will be removed.
bool Labels.RemovePart (int Index, int Part)
 Removes a part of label with the specified index.

Properties

int Labels.Count [get]
 Gets the number of labels.
bool Labels.Synchronized [get, set]
 Gets or sets a boolean value which indicates whether labels should be synchronized with the parent shapefile.

Detailed Description

Here is a list of properties and methods for adding labels (or their parts) to the map or removing them. This module is a part of the documentation of Labels class.

dot_inline_dotgraph_19.png

Graph description


Function Documentation

void Labels.AddLabel ( string  Text,
double  x,
double  y,
double  Rotation,
int  Category 
)

Adds a new label as the last one in the list.

All the parameters passed to the method can be changed afterwards using Labels.get_Label() property.

Parameters:
TextThe text of the new label.
xThe x coordinate of the new label.
yThe y coordinate of the new label.
RotationThe rotation of the label in degrees. Positive values set clockwise rotation, negative - counter-clockwise.
CategoryThe index of visualization category to be used for the label drawing. Default value is -1, which means the default drawing options will be used.
Examples:
GenerateLabelsManually.cs, ImageLabels.cs, and ToolTip.cs.
void Labels.AddPart ( int  Index,
string  Text,
double  x,
double  y,
double  Rotation,
int  Category 
)

Adds a part to the label with specified index.

According to the shapefile specification shapes such as polylines or polygons can have multiple parts. Use this method to add a separate label for each part of the parent shape.

Parameters:
IndexThe index of label to add a part to.
TextThe text to be displayed.
xThe x coordinate of the part.
yThe y coordinate of the part.
RotationThe rotation of the label's part.
CategoryThe index of visualization category to be used for the label drawing. Default value is -1, which means the default drawing options will be used.
void Labels.Clear ( )

Removes all the labels and parts but not the visualization categories.

Examples:
ToolTip.cs.
int Labels.Generate ( string  Expression,
tkLabelPositioning  Method,
bool  LargestPartOnly 
)

Generates labels for each shape of the parent shapefile.

Applicable for the instances of Labels class associated with shapefile, i.e. returned by Shapefile.Labels property.

Parameters:
ExpressionThe expression to be used for generation of the text for labels.
MethodThe method to calculate position of each label.
LargestPartOnlyA value which indicates whether labels should be created for each part of the multipart shape or for the largest part only.
Returns:
The number of generated labels.
Examples:
CalculateArea.cs, EditAttributes.cs, LabelSelection.cs, MinimalDistance.cs, RemoveShape.cs, SelectBox.cs, SelectByQuery.cs, ToolTip.cs, Tracking.cs, and ZoomToValues.cs.
Label Labels.get_Label ( int  Index,
int  Part 
)

Gets label with the specified index.

Parameters:
IndexThe index of label to return.
PartThe part of the label to return. In case of single part labels 0 should be used.
Returns:
A reference to the label or null reference in case of incorrect index.
Examples:
LabelSelection.cs, and RemoveShape.cs.
int Labels.get_NumParts ( int  Index)

Gets the number of parts for the label with specified index.

Parameters:
IndexThe index of the label.
Returns:
The number of parts or -1 in case of incorrect index
bool Labels.InsertLabel ( int  Index,
string  Text,
double  x,
double  y,
double  Rotation,
int  Category 
)

Inserts a new label at the given position.

Parameters:
IndexThe index to insert the label at.
TextThe text of the label.
xThe x coordinate of the label.
yThe y coordinate of the label.
RotationThe angle of label rotation.
CategoryThe index of the visualization category for the label. Use -1 if the label doesn't belong to any category.
Returns:
True on success and false otherwise.
bool Labels.InsertPart ( int  Index,
int  Part,
string  Text,
double  x,
double  y,
double  Rotation,
int  Category 
)

Inserts a new part for the specified label.

Labels can have several parts which correspond to the parts of shapes they belong to.

Parameters:
IndexThe index of the label.
PartThe index to insert the new part at.
TextThe text of the label.
xThe x coordinate of the label.
yThe y coordinate of the label.
RotationThe rotation of the label in degrees.
CategoryThe index of visualization category. Use -1 if the label doesn't belong to any category.
Returns:
True on success or false otherwise.
bool Labels.RemoveLabel ( int  Index)

Removes a label with the specified index. If the label is multipart then all its parts will be removed.

Parameters:
IndexThe index of the label to be removed.
Returns:
True on success and false otherwise.
bool Labels.RemovePart ( int  Index,
int  Part 
)

Removes a part of label with the specified index.

Parameters:
IndexThe index of the label.
PartThe index of part to be removed.
Returns:
True on success and false otherwise.

Properties

int Labels.Count [get]

Gets the number of labels.

Each label can have more then one part.

Examples:
RemoveShape.cs.
bool Labels.Synchronized [get, set]

Gets or sets a boolean value which indicates whether labels should be synchronized with the parent shapefile.

Synchronization means that labels will be automatically added or removed simultaneously with the corresponding operation in the shapefile. Labels can be synchronized only if their number is equal to the number of shapes.

See also:
Labels.Count, Shapefile.NumShapes
Examples:
GenerateLabelsManually.cs, and RemoveShape.cs.
 All Classes Files Functions Enumerations Properties