Public Member Functions | Properties
Labels Class Reference

Represents a list of labels of the map layer and their visualization options. More...

List of all members.

Public Member Functions

LabelCategory AddCategory (string Name)
 Adds a visualization category for labels.
void AddLabel (string Text, double x, double y, double Rotation, int Category)
 Adds a new label as the last one in the list.
void AddPart (int Index, string Text, double x, double y, double Rotation, int Category)
 Adds a part to the label with specified index.
void ApplyCategories ()
 Maps labels to the visualization categories.
void ApplyColorScheme (tkColorSchemeType Type, ColorScheme ColorScheme)
 Applies color scheme to the visualization categories.
void ApplyColorScheme2 (tkColorSchemeType Type, ColorScheme ColorScheme, tkLabelElements Element)
 Applies color scheme to the visualization categories.
void ApplyColorScheme3 (tkColorSchemeType Type, ColorScheme ColorScheme, tkLabelElements Element, int CategoryStartIndex, int CategoryEndIndex)
 Applies color scheme to the visualization categories.
void Clear ()
 Removes all the labels and parts but not the visualization categories.
void ClearCategories ()
 Removes all the visualization categories.
void Deserialize (string newVal)
 Restores the state of the Labels class from the string.
void ForceRecalculateExpression ()
 For labels attached to shapefile layer updates the text of each label based on Expression property.
int Generate (string Expression, tkLabelPositioning Method, bool LargestPartOnly)
 Generates labels for each shape of the parent shapefile.
bool GenerateCategories (int FieldIndex, tkClassificationType ClassificationType, int numClasses)
 Generates visualization categories for labels based on certain field from the attribute table of the parent shapefile.
LabelCategory get_Category (int Index)
 Gets the visualization category (LabelCategory) with the specified index.
string get_ErrorMsg (int ErrorCode)
 Gets the description of the specific error code.
Label get_Label (int Index, int Part)
 Gets label with the specified index.
int get_NumParts (int Index)
 Gets the number of parts for the label with specified index.
LabelCategory InsertCategory (int Index, string Name)
 Inserts a new visualization category at the given position of the list.
bool InsertLabel (int Index, string Text, double x, double y, double Rotation, int Category)
 Inserts a new label at the given position.
bool InsertPart (int Index, int Part, string Text, double x, double y, double Rotation, int Category)
 Inserts a new part for the specified label.
bool LoadFromDbf (bool loadText, bool loadCategory)
 Loads text and position of labels from the attribute table of the parent shapefile.
bool LoadFromDbf2 (string xField, string yField, string angleField, string textField, string categoryField, bool loadText, bool loadCategory)
 Loads text and position of labels from the attribute table of the parent shapefile.
bool LoadFromXML (string Filename)
 Restores the state of the labels from the specified XML file.
bool MoveCategoryDown (int Index)
 Moves a specified label category down in the list.
bool MoveCategoryUp (int Index)
 Moves a specified label category up in the list.
bool RemoveCategory (int Index)
 Removes a visualization category with specified index.
bool RemoveLabel (int Index)
 Removes a label with the specified index. If the label is multipart then all its parts will be removed.
bool RemovePart (int Index, int Part)
 Removes a part of label with the specified index.
bool SaveToDbf (bool saveText, bool saveCategory)
 Saves position and text of the labels to the attribute table (dbf file).
bool SaveToDbf2 (string xField, string yField, string angleField, string textField, string categoryField, bool saveText, bool saveCategory)
 Saves positions and text of the labels to the attribute table (dbf file).
bool SaveToXML (string Filename)
 Saves the text, positions and visualization options of the labels to the XML file.
bool Select (Extents BoundingBox, int Tolerance, SelectMode SelectMode, ref object LabelIndices, ref object PartIndices)
 Returns the indices of all labels which are displayed in the given part of the map.
string Serialize ()
 Saves the state of the labels.
void set_Category (int Index, LabelCategory pVal)
 Sets the visualization category at the given position in the list.
void UpdateSizeField ()
 Marks that values of size field have changed and the size of labels should be recalculated on the next redraw.

Properties

tkLabelAlignment Alignment [get, set]
 Sets horizontal and vertical alignment of labels.
bool AutoOffset [get, set]
 Turns on or off the auto offset behaviour.
bool AvoidCollisions [get, set]
 Gets or sets the value which indicates whether a routine for preventing of label overlaps will be used.
double BasicScale [get, set]
 Map scale for which the size of labels will be equal to value set in Labels.FontSize property.
int ClassificationField [get, set]
 Gets a classification field used by unique values classification.
int CollisionBuffer [get, set]
 Gets or sets the value which affects the collision avoidance routine. Two labels are considered overlapping when the distance between their bounding rectangles is less then this value.
int Count [get]
 Gets the number of labels.
bool DynamicVisibility [get, set]
 Gets or sets the value which turns the dynamic visibility on or off.
string Expression [get, set]
 Gets or sets the expression used to generate text of labels from the attribute table of the shapefile.
string FloatNumberFormat [get, set]
 Gets or sets the formatting to be used for floating point numbers during generation of labels.
bool FontBold [get, set]
 Gets or sets the value which indicates whether the font of labels is bold.
uint FontColor [get, set]
 Gets or sets the color of the label font.
uint FontColor2 [get, set]
 Gets or sets the second color of the label font. It is used to set color gradient for the font.
tkLinearGradientMode FontGradientMode [get, set]
 Gets or sets the gradient mode for the labels.
bool FontItalic [get, set]
 Gets or sets the value which indicates whether the font of labels is italic.
string FontName [get, set]
 Gets or sets the name of the font to draw labels with, e.g. Arial.
uint FontOutlineColor [get, set]
 Sets the color of the font outline.
bool FontOutlineVisible [get, set]
 Gets or sets the value which indicates whether font outline is visible. The default value is false.
int FontOutlineWidth [get, set]
 Gets or sets the width of the font outline. The default value is 1.
int FontSize [get, set]
 Gets or sets the size of the font to draw labels with.
int FontSize2 [get, set]
 Gets or sets the maximum font size for labels (when size field is used).
bool FontStrikeOut [get, set]
 Gets or sets the value which indicates whether the font of labels is struck out.
int FontTransparency [get, set]
 Gets or sets the transparency of the font. A values between 0 (transparent) to 255 (opaque) can be used.
bool FontUnderline [get, set]
 Gets or sets the value which indicates whether the font of labels is struck out.
uint FrameBackColor [get, set]
 Gets or sets the color of the frame's background.
uint FrameBackColor2 [get, set]
 Gets or sets the second color of the frame's background.
tkLinearGradientMode FrameGradientMode [get, set]
 Gets or sets the type of gradient for the frame of the label.
uint FrameOutlineColor [get, set]
 Gets or sets the outline color of the label's frame.
tkDashStyle FrameOutlineStyle [get, set]
 Gets or sets the outline style of the label's frame.
int FrameOutlineWidth [get, set]
 Gets or sets the width of the outline of the label's frame.
int FramePaddingX [get, set]
 Gets or sets the horizontal distance between the text of the label and its frame.
int FramePaddingY [get, set]
 Gets or sets the vertical distance between the text of the label and its frame.
int FrameTransparency [get, set]
 Gets or sets the transparency of the label's frame. A values between 0 (transparent) to 255 (opaque) can be used.
tkLabelFrameType FrameType [get, set]
 Gets or sets the shape of the label's frame.
bool FrameVisible [get, set]
 Gets or sets the values which indicates whether label's frame is visible.
ICallback GlobalCallback [get, set]
 Gets or sets the global callback object which is used for passing to the client an information about progress and errors.
uint HaloColor [get, set]
 Gets or sets the color of the halo around label's text.
int HaloSize [get, set]
 Gets or sets the size of the halo drawn around label's text.
bool HaloVisible [get, set]
 Gets or sets the value which indicates whether label's halo is visible.
tkLabelAlignment InboxAlignment [get, set]
 Gets or sets the value which defines an alignment of text within label's frame.
string Key [get, set]
 A text string associated with the instance of the class. Any value can be stored by developer in this property.
int LastErrorCode [get]
 Returns the code of the last error which has occurred within the instance of class.
tkLineLabelOrientation LineOrientation [get, set]
 Gets or sets the type of the label's orientation relative to the direction of the labelled shape.
bool LogScaleForSize [get, set]
 Gets or sets a value indicating whether logarithmic scale will be used to calculate the size of labels.
double MaxVisibleScale [get, set]
 Gets or sets the maximum scale at which labels are visible on the map.
int MaxVisibleZoom [get, set]
 Gets or sets the maximum zoom at which labels are visible on the map.
int MinDrawingSize [get, set]
 Gets or sets the minimum size of the shape in pixels to be labelled at the current map scale.
double MinVisibleScale [get, set]
 Get or sets the minimum scale at which labels are visible on the map.
int MinVisibleZoom [get, set]
 Gets or sets the minimum zoom at which labels are visible on the map.
int NumCategories [get]
 Number of visualization categories associated with this instance of class.
double OffsetX [get, set]
 Gets or sets the horizontal offset in pixels which is used to draw labels.
double OffsetY [get, set]
 Gets or sets the vertical offset in pixels which is used to draw labels.
LabelCategory Options [get, set]
 Gets or sets the list of visualization options of labels. For inner use only.
tkLabelPositioning Positioning [get, set]
 Gets or sets the method of label positioning.
bool RemoveDuplicates [get, set]
 Gets or sets the value which indicates whether labels with the same text should be drawn.
tkSavingMode SavingMode [get, set]
 Gets or sets the method to save and restore the state labels.
bool ScaleLabels [get, set]
 Gets or sets the value which indicates whether the labels will change their size depending upon map scale. The default value is false.
uint ShadowColor [get, set]
 Gets or sets the color of the label's shadow.
int ShadowOffsetX [get, set]
 Gets or sets the horizontal offset of the label's shadow.
int ShadowOffsetY [get, set]
 Gets or sets the vertical offset of the label's shadow.
bool ShadowVisible [get, set]
 Gets or sets the value which indicates whether label's shadow is visible.
bool Synchronized [get, set]
 Gets or sets a boolean value which indicates whether labels should be synchronized with the parent shapefile.
tkTextRenderingHint TextRenderingHint [get, set]
 Gets or sets rendering hint to be used during GDI+ rendering.
bool UseGdiPlus [get, set]
 Gets or sets the values indicating whether GDI+ library should be used to draw labels.
bool UseVariableSize [get, set]
 Gets or sets a value indicating whether variable size for labels should be used (in the range between Labels.FontSize, Labels.FontSize2).
bool UseWidthLimits [get, set]
 Is not implemented.
tkVerticalPosition VerticalPosition [get, set]
 Gets or sets the value which affects the sequence of labels drawing relative to the map layers.
string VisibilityExpression [get, set]
 Gets or sets an expression which defines what shapes should be labelled on the map.
bool Visible [get, set]
 Gets or sets the value which indicates whether the labels will be visible on the map.

Detailed Description

Represents a list of labels of the map layer and their visualization options.

dot_inline_dotgraph_48.png

Graph description

Here is a diagram with groups of API members of Labels class.

dot_labelsgroups.png
Graph description

New API 4.8:
Added in version 4.8
Examples:
ImageLabels.cs, SplitByAttribute.cs, and ToolTip.cs.

Member Function Documentation

For labels attached to shapefile layer updates the text of each label based on Expression property.

The method is necessary when the values in underlying DBF table have changed, since Labels class doesn't track these changes automatically.

string Labels.get_ErrorMsg ( int  ErrorCode)

Gets the description of the specific error code.

Parameters:
ErrorCodeThe error code returned by Labels.LastErrorCode.
Returns:
The string with the description.

Marks that values of size field have changed and the size of labels should be recalculated on the next redraw.

New API 4.9.4:
Added in version 4.9.4

Property Documentation

Gets a classification field used by unique values classification.

The property is used internally in couple with LabelCategory.MinValue and LabelCategory.MaxValue to avoid the parsing of expressions for the categories in case unique values classification was applied.

string Labels.Expression [get, set]

Gets or sets the expression used to generate text of labels from the attribute table of the shapefile.

Applicable for the instances of Labels class associated with shapefile (obtained by Shapefile.Labels).

Examples:
EditAttributes.cs, and RemoveShape.cs.
int Labels.FontSize2 [get, set]

Gets or sets the maximum font size for labels (when size field is used).

New API 4.9.4:
Added in version 4.9.4

Gets or sets the global callback object which is used for passing to the client an information about progress and errors.

An instance of the class which implements ICallback interface should be passed. The class should be implemented by caller.

Deprecated:
v4.9.3 Use GlobalSettings.ApplicationCallback instead.
string Labels.Key [get, set]

A text string associated with the instance of the class. Any value can be stored by developer in this property.

Returns the code of the last error which has occurred within the instance of class.

bool Labels.LogScaleForSize [get, set]

Gets or sets a value indicating whether logarithmic scale will be used to calculate the size of labels.

See also:
Labels.UseVariableSize
New API 4.9.4:
Added in version 4.9.4

Gets or sets the list of visualization options of labels. For inner use only.

bool Labels.UseGdiPlus [get, set]

Gets or sets the values indicating whether GDI+ library should be used to draw labels.

The default value is true. When set to false, GDI will be used for drawing. In GDI mode no gradients and transparency is supported, while in some cases it can be somewhat faster then GDI+.

bool Labels.UseVariableSize [get, set]

Gets or sets a value indicating whether variable size for labels should be used (in the range between Labels.FontSize, Labels.FontSize2).

New API 4.9.4:
Added in version 4.9.4
 All Classes Files Functions Enumerations Properties Events