public Task <Camera> ProjectCamera(Camera camera, ArcGIS.Core.Geometry.SpatialReference spatialReference) { return(QueuedTask.Run(() => { var mapPoint = MapPointBuilder.CreateMapPoint(camera.X, camera.Y, camera.Z, camera.SpatialReference); var newPoint = GeometryEngine.Instance.Project(mapPoint, spatialReference) as MapPoint; var newCamera = new Camera() { X = newPoint.X, Y = newPoint.Y, Z = newPoint.Z, Scale = camera.Scale, Pitch = camera.Pitch, Heading = camera.Heading, Roll = camera.Roll, Viewpoint = camera.Viewpoint, SpatialReference = spatialReference }; return newCamera; })); }
public async Task <bool> ZoomToExtentAsync(double xMin, double yMin, double xMax, double yMax, ArcGIS.Core.Geometry.SpatialReference spatialReference) { //Get the active map view. var mapView = MapView.Active; if (mapView == null) { return(false); } //Create the envelope var envelope = await QueuedTask.Run( () => ArcGIS.Core.Geometry.EnvelopeBuilder.CreateEnvelope(xMin, yMin, xMax, yMax, spatialReference)); //Zoom the view to a given extent. return(await mapView.ZoomToAsync(envelope, TimeSpan.FromSeconds(2))); }