Пример #1
0
        private void ZoomToExtent()
        {
            var vm = DataContext as PatrolDetailsViewModel;

            if (vm == null)
            {
                return;
            }

            ObservableCollection <Graphic> layerCol = vm.GetLayerObservable();

            if (layerCol.Count == 0)
            {
                return;
            }

            List <double> Xs = new List <double>();
            List <double> Ys = new List <double>();

            for (int i = 0; i < layerCol.Count; i++)
            {
                if (!(layerCol[i].Geometry is Esri.ArcGISRuntime.Geometry.Polygon))
                {
                    Xs.Add(((MapPoint)layerCol[i].Geometry).X);
                    Ys.Add(((MapPoint)layerCol[i].Geometry).Y);
                }
            }

            if (layerCol.Count > 1 && Xs.Count > 0 && Ys.Count > 0)
            {
                Envelope myEnvelope = new Envelope(Xs.Min(), Ys.Min(), Xs.Max(), Ys.Max(), new SpatialReference(4326));
                EsriMapView.SetViewAsync(myEnvelope.GetCenter(), 70000);
            }
            else
            {
                if (!(layerCol[0].Geometry is Esri.ArcGISRuntime.Geometry.Polygon))
                {
                    ZoomOnMap(((MapPoint)layerCol[0].Geometry).Y, ((MapPoint)layerCol[0].Geometry).X, 50000);
                }
            }
        }
Пример #2
0
 private void btnZoomOut_Click(object sender, RoutedEventArgs e)
 {
     EsriMapView.ZoomAsync(0.9);
 }
Пример #3
0
 private void ZoomOnMap(double Latitude, double Longitude, int Scale)
 {
     EsriMapView.SetView(new MapPoint(Longitude, Latitude, new SpatialReference(4326)), Scale);
 }
Пример #4
0
 private void btnZoomIn_Click(object sender, RoutedEventArgs e)
 {
     EsriMapView.ZoomAsync(1.1);
 }