Exemple #1
0
        private void MappingMap(EsriMapView xfMapView, CusMapView cusMapView)
        {
            Basemap baseMap = GetBaseMap(cusMapView);

            xfMapView.Map = new Map(baseMap);
            SetInitialViewpoint(xfMapView, cusMapView);
        }
Exemple #2
0
        // 数据/导入shapefile文件;
        private async void AddSHP_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog ofdlg = new System.Windows.Forms.OpenFileDialog();
            ofdlg.Multiselect = true;
            ofdlg.Filter      = "Shapefile文件(*.shp)|*.shp";
            ofdlg.Title       = "打开Shapefile文件";
            if (ofdlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                for (int i = 0; i < ofdlg.FileNames.Length; i++)
                {
                    String fPath = ofdlg.FileNames.GetValue(i).ToString();
                    // 新建图层
                    ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(fPath);

                    FeatureLayer newFeaturelayer = new FeatureLayer(myShapefile)
                    {
                        SelectionColor = System.Drawing.Color.Cyan,
                        SelectionWidth = 5
                    };
                    Esri.ArcGISRuntime.UI.Controls.MapView mapView = (Esri.ArcGISRuntime.UI.Controls.MapView) this.FindName("myMapView");
                    if (mapView != null)
                    {
                        myMapLayersList.Add(newFeaturelayer);
                        mapView.Map.OperationalLayers.Add(newFeaturelayer);
                        await mapView.SetViewpointGeometryAsync(newFeaturelayer.FullExtent);

                        // 获取文件名
                        String layerName = System.IO.Path.GetFileName(fPath);
                        // 新建checkbox并入栈
                        myTableOfContent.addLayersList(layerName);
                    }
                }
            }
        }
        public EsriMapView Adapter(CusMapView cusMapView)
        {
            EsriMapView XFMapView = new EsriMapView();

            MappingMap(XFMapView, cusMapView);
            //TODO: Attach custom property
            return(XFMapView);
        }
Exemple #4
0
 // 实验二:显示ArcGIS Online地图 (废弃)
 private async void AddArcGISOnlineMap_Click(object sender, RoutedEventArgs e)
 {
     // 找到myMapView控件
     Esri.ArcGISRuntime.UI.Controls.MapView mapView = (Esri.ArcGISRuntime.UI.Controls.MapView) this.FindName("myMapView");
     if (mapView.Map != null)
     {
         mapView.Map = null;
         Uri uri = new Uri(@"https://www.arcgis.com/home/webmap/viewer.html?webmap=2cc6d640d36d465ca32f1a20767d7d39");
         mapView.Map = await Map.LoadFromUriAsync(uri);
     }
 }
Exemple #5
0
        public void SetInitialViewpoint(EsriMapView xfMapView, CusMapView cusMapView)
        {
            if (cusMapView.Map.InitialViewpoint?.Envelope != null)
            {
                var envelope = cusMapView.Map.InitialViewpoint.Envelope;
                SpatialReference spatialReference = SpatialReferences.WebMercator;
                if (SpatialReferenceType.Wgs84 == envelope.SpatialReferenceType)
                {
                    spatialReference = SpatialReferences.Wgs84;
                }

                xfMapView.Map.InitialViewpoint = new Viewpoint(new Envelope(envelope.XMin, envelope.YMin,
                                                                            envelope.XMax, envelope.YMax, spatialReference));
                xfMapView.SetViewpoint(xfMapView.Map.InitialViewpoint);
                Task.Run(async() =>
                {
                    await xfMapView.SetViewpointCenterAsync(34.3177313608, 108.9576703038);
                });
            }
        }
        private void MappingMap(EsriMapView xfMapView, CusMapView cusMapView)
        {
            Basemap baseMap = GetBaseMap(cusMapView.Map.MapType);

            xfMapView.Map = new Map(baseMap);
        }
Exemple #7
0
 public static void Init(MapView mapView)
 {
     _currentMapView = mapView;
 }