IMapTopobaseShape.Text

Syntax

Text: String;

Description

The Text property determines an area label.

Comments

To output area value as label, use a data adapter:

  1. In data adaptor description, add a field to work with map indicators of the IMapAreaVisual type, for example:

Public visual: IMapAreaVisual;

  1. In the work procedure of map area label, set value of this field.

  2. Set a data adapter for map indicators.

  3. Set an area label using the data adapter.

For example:

Sub UserProc;
Var
    M: IMap;
    Layer: IMapLayer;
    Shape: IMapTopobaseShape;
    da: VisualDataAdapter;
Begin
    M := UiMap1.Map;
    Layer := M.Layers.FindByName("Regions");
    Shape := Layer.Shapes.Item(0);
    da := New VisualDataAdapter.Create;
    Layer.Visuals.AddAreaVisual;
    da.visual := Layer.Visuals.Item(0As IMapAreaVisual;
    da.visual.DataAdapter := da;
    Shape.Text := (da.visual.DataAdapter As IMapDynamicDataAdapter).Data(shape.Id, 1);
End Sub UserProc;

Example

Executing the example requires a form with the following components: the Button component named Button1, the MapBox component named MapBox1, and the UiMap component named UiMap1. UiMap1 is a data source for MapBox1. The map must be connected to the UiMap1 component.

Sub UserProc;
Var
    M: IMap;
    Layer: IMapLayer;
    Shape: IMapTopobaseShape;
Begin
    M := UiMap1.Map;
    Layer := M.Layers.FindByName("Regions");
    Shape := Layer.Shapes.Item(0);
    Shape.Text := "Region";
    Layer.TextVisible := True;
End Sub UserProc;

After executing the example on clicking the button the first area label Volga Region is displayed on the map.

See also:

IMapTopobaseShape