Count: Integer;
The Count property returns the number of collection indicators.
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 UiMap1 component should be linked to a map containing indicators on the Regions layer.
The example is a handler of the OnClick event for the Button1 component.
Add links to the ExtCtrls, Forms, and Map system assemblies.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Map: IMap;
Layer: IMapLayer;
Visuals: IMapLayerVisuals;
Vis: IMapVisual;
Count, i: Integer;
Begin
Map := UiMap1.Map;
Layer := Map.Layers.FindByName("Regions");
Visuals := Layer.Visuals;
Count := Visuals.Count;
For i := 0 To Visuals.Count - 1 Do
Vis := Visuals.Item(i);
Debug.WriteLine("Total indicators:" + Count.ToString);
Debug.WriteLine("Indicator names:");
Debug.WriteLine((i+1).ToString + ". " + Vis.Name);
End For;
End Sub Button1OnClick;
After executing the example the console window displays the number and names of indicators located in the Regions layer.
See also: