IMapTopobaseShapes.ItemByKey

Syntax

ItemByKey(Key: Integer): IMapTopobaseShape;

Parameters

Key. Area key.

Description

The ItemByKey method returns area parameters by key.

Comments

The method returns Null if the area with the specified key is missing.

Example

Executing the example requires a form with a button named Button1, the UiMap component named UiMap1 and the MapBox component. A map containing the Regions layer should be linked to the UiMap1 component. This layer should contain an area with the 1001 identifier.

Add a link to the Map system assembly.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Map: IMap;
    Layer: IMapLayer;
    Shape: IMapTopobaseShape;
Begin
    Map := UiMap1.Map;
    Layer := Map.Layers.FindByName("Regions");
    Shape := Layer.Shapes.ItemByKey(1001);
    If Not IsNull(Shape) Then
        Debug.WriteLine("Region: " + Shape.Name + " (ID=" + Shape.Id.ToString + ')');
        Debug.WriteLine("Description: " + Shape.Description);
        Debug.WriteLine("Label: " + Shape.Text);
        Debug.WriteLine("Number of primitives that form region image: " + Shape.Primitives.Count.ToString);
    End If;
End Sub Button1OnClick;

After executing the example the development environment console displays information about the area with the specified identifier.

See also:

IMapTopobaseShapes