Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
GeoMapPopup.xaml.cs
1using System.Threading.Tasks;
2using Mapsui;
3using Mapsui.Extensions;
4using Mapsui.Projections;
5using Mapsui.Tiling;
8
10{
14 public partial class GeoMapPopup : BasePopup
15 {
16 public GeoMapPopup(GeoMapViewModel viewModel)
17 {
18 InitializeComponent();
19 viewModel.MapControl = this.GeoMapControl;
20 this.BindingContext = viewModel;
21 this.GeoMapControl.Map.Navigator.RotationLock = true;
22 this.GeoMapControl.Map?.Layers.Add(OpenStreetMap.CreateTileLayer());
23 }
24
25 public override Task OnAppearingAsync()
26 {
27 if (this.BindingContext is GeoMapViewModel viewModel && viewModel.InitialCoordinate is not null)
28 {
29 MPoint mercator = SphericalMercator.FromLonLat(viewModel.InitialCoordinate.Longitude, viewModel.InitialCoordinate.Latitude).ToMPoint();
30 this.GeoMapControl.Map?.Navigator.CenterOn(mercator);
31 this.GeoMapControl.Map?.Navigator.ZoomTo(1000);
32 }
33 return base.OnAppearingAsync();
34 }
35 }
36}
Compatibility wrapper so old Mopups based popups work using the new popup infrastructure.
Definition: BasePopup.cs:10
Displays an interactive map to pick a geographic coordinate.
override Task OnAppearingAsync()
Method called when view is appearing on the screen.
GeoPosition? InitialCoordinate
Optional initial coordinate to center the map on.
double Longitude
Longitude in degrees.
Definition: GeoPosition.cs:85
double Latitude
Latitude in degrees.
Definition: GeoPosition.cs:70