IMapLayer.TextDataAdapter

Syntax

TextDataAdapter: Object;

Description

The TextDataAdapter property determines the data source for map layer labels.

Example

Executing the example requires a form with a button named Button1, the UiMap component named UiMap1 and the MapBox component. The map must be connected to the UiMap1 component.

Class TextDataAdapter: Object, IMapDataAdapter

 

Public Str: String;

 

Function Get_Data(Attribute: Variant): Variant;

Var

shape: IMapTopobaseShape;

Begin

shape := Attribute As IMapTopobaseShape;

Return Str + shape.Name;

End Function Get_Data;

 

End Class TextDataAdapter;

 

Class TestForm: Form

 

Button1: Button;

UiMap1: UiMap;

MapBox1: MapBox;

 

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Da: TextDataAdapter;

MapDa: IMapDataAdapter;

M: IMap;

mLayers: IMapLayers;

mLayer: IMapLayer;

mShapes: IMapTopobaseShapes;

mShape: IMapTopobaseShape;

i: integer;

Begin

Da := New TextDataAdapter.Create;

Da.Str := "This ";

MapDa := Da As IMapDataAdapter;

M := UiMap1.Map;

mLayers := M.Layers;

mLayer := mLayers.FindByName("Regions");

mShapes := mLayer.Shapes;

For i := 0 To mShapes.Count - 1 Do

mShape := mShapes.Item(i);

Debug.WriteLine(MapDa.Data(mShape));

End For;

mLayer.TextDataAdapter := MapDa;

mLayer.TextVisible := True;

End Sub Button1OnClick;

 

End Class TestForm;

After executing the example the labels source is determined for the Regions map layer. The labels of all the layer areas are displayed in the console window.

See also:

IMapLayer