IMapDataAdapter.Data

Syntax

Data(Attribute: Variant): Variant;

Parameters

Attribute - parameter determines, which data should be returned by the data adapter.

Description

The Data property returns adapter data.

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 data adapter for the label of the Regions map layer is determined. The labels of all the layer areas are displayed in the console window.

See also:

IMapDataAdapter