Beispiel #1
0
 // 编辑绘制图层
 private void EditVertexMenuItem_Click(object sender, RoutedEventArgs e)
 {
     if (curSelGraphic != null)//检查当前是否有选择图形
     {
         operation = OperateType.EditVertex;
         if (curSelGraphic.Geometry.GeometryType == GeometryType.Point) //所选图形为点
         {
             selVertexLayer.Graphics.Clear();                           //清空顶点图层
             MapPoint pt = (MapPoint)curSelGraphic.Geometry;
             Graphic  pg = new Graphic(pt, vertexSymbol);               //创建新的点图形
             selVertexLayer.Graphics.Add(pg);
         }
         else if (curSelGraphic.Geometry.GeometryType == GeometryType.Polyline)//所选图形为线
         {
             if (pointCollection != null)
             {
                 pointCollection.Clear();//清空点集
             }
             else
             {
                 pointCollection = new Esri.ArcGISRuntime.Geometry.PointCollection(myMapView.Map.SpatialReference);
             }
             Esri.ArcGISRuntime.Geometry.Polyline ln = (Esri.ArcGISRuntime.Geometry.Polyline)curSelGraphic.Geometry;
             pointCollection.AddPoints(ln.Parts[0].Points);  //将线的所有顶点加入点集
             selVertexLayer.Graphics.Clear();
             for (int i = 0; i < pointCollection.Count; i++) //将所有点以顶点图形样式显示
             {
                 MapPoint pt = pointCollection[i];
                 Graphic  pg = new Graphic(pt, vertexSymbol);
                 selVertexLayer.Graphics.Add(pg);
             }
         }
         else if (curSelGraphic.Geometry.GeometryType == GeometryType.Polygon)//所选图形为多边形
         {
             if (pointCollection != null)
             {
                 pointCollection.Clear();
             }
             else
             {
                 pointCollection = new Esri.ArcGISRuntime.Geometry.PointCollection(myMapView.Map.SpatialReference);
             }
             Esri.ArcGISRuntime.Geometry.Polygon pg = (Esri.ArcGISRuntime.Geometry.Polygon)curSelGraphic.Geometry;
             pointCollection.AddPoints(pg.Parts[0].Points);
             selVertexLayer.Graphics.Clear();
             for (int i = 0; i < pointCollection.Count; i++)
             {
                 MapPoint pt = pointCollection[i];
                 Graphic  gg = new Graphic(pt, vertexSymbol);
                 selVertexLayer.Graphics.Add(gg);
             }
         }
         EditVertexMenuItem.IsEnabled   = false;
         UneditVertexMenuItem.IsEnabled = true;
     }
 }
        private async Task ChangeMission(string mission)
        {
            // Stop animating the current mission
            _animationTimer.Stop();

            // Get mission data
            _missionData = GetMissionData(mission);

            // Draw mission route on the inset
            // Create a collection of points to hold the mission
            PointCollection points = new PointCollection(SpatialReferences.Wgs84);

            // Add all of the points from the mission to the point collection
            points.AddPoints(_missionData.Select(m => m.ToMapPoint()));
            // Create a polyline to symbolize the route from the point collection
            Polyline route = new Polyline(points);

            // Update the route graphic's geometry with the newly created route polyline
            _routeGraphic.Geometry = route;
            // Update the inset map's scale
            await InsetMapView.SetViewpointScaleAsync(100000);

            // Update animation parameters
            _frameCount = _missionData.Length;
            _keyframe   = 0;

            // Set the MissionPlayPause button back to the currently 'playing' state
            MissionPlayPause.Content = "Pause";

            // Restart the animation
            _animationTimer.Start();
        }