private void Mapview1_ExtentChanged(object sender, EventArgs e) { Esri.ArcGISRuntime.Geometry.Geometry ext = GeometryEngine.NormalizeCentralMeridian(Mapview1.Extent); var vp = new Esri.ArcGISRuntime.Controls.Viewpoint(ext); SceneView1.SetViewAsync(vp); }
//When location changes, push this location to the route datasource private void LocationDisplay_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "CurrentLocation") { if (LocationDisplay.CurrentLocation != null && !LocationDisplay.CurrentLocation.Location.IsEmpty) { if (Route != null) { Route.SetCurrentLocation(LocationDisplay.CurrentLocation.Location); } if (firstLocation) { var accuracy = double.IsNaN(LocationDisplay.CurrentLocation.HorizontalAccuracy) ? 0 : LocationDisplay.CurrentLocation.HorizontalAccuracy; ViewpointRequested = new Esri.ArcGISRuntime.Controls.Viewpoint( GeometryEngine.GeodesicBuffer(LocationDisplay.CurrentLocation.Location, accuracy + 500, LinearUnits.Meters) ); firstLocation = false; if (Route == null && m_routeTaskCancellationToken == null && !string.IsNullOrWhiteSpace(RouteToAddress)) //calculate route now //Calculate a route from the address { GenerateRoute(RouteToAddress); } } } } }
//When location changes, push this location to the route datasource private void LocationDisplay_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "CurrentLocation") { if (LocationDisplay.CurrentLocation != null && !LocationDisplay.CurrentLocation.Location.IsEmpty) { if (Route != null) Route.SetCurrentLocation(LocationDisplay.CurrentLocation.Location); if (firstLocation) { var accuracy = double.IsNaN(LocationDisplay.CurrentLocation.HorizontalAccuracy) ? 0 : LocationDisplay.CurrentLocation.HorizontalAccuracy; ViewpointRequested = new Esri.ArcGISRuntime.Controls.Viewpoint( GeometryEngine.GeodesicBuffer(LocationDisplay.CurrentLocation.Location, accuracy + 500, LinearUnits.Meters) ); firstLocation = false; if (Route == null && m_routeTaskCancellationToken == null && !string.IsNullOrWhiteSpace(RouteToAddress)) //calculate route now //Calculate a route from the address GenerateRoute(RouteToAddress); } } } }