Latitude: IMapVisualNumericProperty;
Latitude: Prognoz.Platform.Interop.Map.IMapVisualNumericProperty;
The Latitude property returns latitude parameters for a geolocation marker.
To work with longitude parameters of geolocation marker, use the IMapMarkerVisual.Longitude property.
Executing the example requires a form containing the MapBox component with the MapBox1 identifier and the UiMap component with the UiMap1 identifier. The UiMap1 component must contain a connected map and must be a data source for the MapBox1 component.
The example also uses the VisualDynamicDataAdapter class, which is described in IMapTimeDynamicDataAdapter.Data.
Add links to the Drawing, Metabase system assemblies.
Sub UserProc;
Var
Map: IMap;
Layer: IMapLayer;
MarkerVis: IMapMarkerVisual;
Color: IMapVisualColorProperty;
ColorCollection: IMapColorCollection;
NumProp: IMapVisualNumericProperty;
ItemsNames: Array[1] Of string;
Begin
// Get map
Map := UiMap1.Map;
// Get the "Regions" layer
Layer := Map.Layers.FindByName("Regions");
// Add a geolocation marker
MarkerVis := Layer.Visuals.AddMarkerVisual;
MarkerVis.BeginUpdate;
// Set data source for marker
MarkerVis.DataAdapter := New VisualDynamicDataAdapter.Create As IMapTimeDynamicDataAdapter;
MarkerVis.Visible := True;
// Set marker color
Color := MarkerVis.Color;
Color.Dependent := False;
ColorCollection := Color.Values;
ColorCollection.Count := 1;
ColorCollection.Item(0) := GxColor.FromName("Blue");
// Set marker longitude
NumProp := MarkerVis.Longitude;
NumProp.Dependent := False;
NumProp.Value := 41.850033;
// Set marker latitude
NumProp := MarkerVis.Latitude;
NumProp.Dependent := False;
NumProp.Value := -87.6500523;
// Set marker name
ItemsNames[0] := "Geolocation marker";
MarkerVis.ItemsNames := ItemsNames;
MarkerVis.EndUpdate;
End Sub UserProc;
After executing the example a geolocation marker is added to 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.
Public Sub UserProc();
Var
Map: IMap;
Layer: IMapLayer;
MarkerVis: IMapMarkerVisual;
Color: IMapVisualColorProperty;
ColorCollection: IMapColorCollection;
GxColor: GxColorClass = New GxColorClass();
NumProp: IMapVisualNumericProperty;
ItemsNames: Array[1] Of string;
Begin
// Get map
Map := uiMapNet1.Map;
// Get the "Regions" layer
Layer := Map.Layers.FindByName["Regions"];
// Add a geolocation marker
MarkerVis := Layer.Visuals.AddMarkerVisual();
MarkerVis.BeginUpdate();
// Set data source for marker
MarkerVis.DataAdapter := New VisualDynamicDataAdapter.Create() As IMapTimeDynamicDataAdapter;
MarkerVis.Visible := True;
// Set marker color
Color := MarkerVis.Color;
Color.Dependent := False;
ColorCollection := Color.Values;
ColorCollection.Count := 1;
ColorCollection.Item[0] := GxColor.FromName("Blue");
// Set marker longitude
NumProp := MarkerVis.Longitude;
NumProp.Dependent := False;
NumProp.Value := 41.850033;
// Set marker latitude
NumProp := MarkerVis.Latitude;
NumProp.Dependent := False;
NumProp.Value := -87.6500523;
// Set marker name
ItemsNames[0] := "Geolocation marker";
MarkerVis.ItemsNames := ItemsNames;
MarkerVis.EndUpdate();
End Sub UserProc;
See also: