Text: String;
Text: string;
The Text property determines an area label.
To output area value as label, use a data adapter:
In data adaptor description, add a field to work with map factors of the IMapAreaVisual type, for example:
Public visual: IMapAreaVisual;
In the work procedure of map area label, set value of this field.
Set a data adapter for map factors.
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(0) As IMapAreaVisual;
da.visual.DataAdapter := da;
Shape.Text := (da.visual.DataAdapter As IMapDynamicDataAdapter).Data(shape.Id, 1);
End Sub UserProc;
Executing the example requires a form containing a button with the Button1 identifier, the UiMap component with the UiMap1 identifier and the MapBox component containing a loaded map and being a data source for 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.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Map;
…
Private Sub UserProc();
Var
M: IMap;
Layer: IMapLayer;
Shape: IMapTopobaseShape;
Begin
M := uiMapNet1.Map;
Layer := M.Layers.FindByName["Regions"];
Shape := Layer.Shapes.Item[0];
Shape.Text := "Region";
Layer.TextVisible := True;
End Sub;
See also: