Ejemplo n.º 1
0
        /// <summary>
        /// Updates the m_Polyline and MeasureItemsCollection based on the progress
        /// reported by <see cref="Esri.ArcGISRuntime.Controls.Editor"/>
        /// </summary>
        /// <param name="status"></param>
        private void OnStatusReported(GeometryEditStatus status)
        {
            var polyline = status.NewGeometry as Polyline;

            // Only reset display when first vertex is committed.
            if (polyline != null && polyline.Parts != null && polyline.Parts.Count > 0)
            {
                var vertices = polyline.Parts[0].GetPoints();
                if (vertices != null && vertices.Count() == 1)
                {
                    ResetDisplay();
                }
            }

            switch (status.GeometryEditAction)
            {
            case GeometryEditAction.AddedVertex:
            {
                MeasureItemCollection.Insert(status.VertexPosition.CoordinateIndex,
                                             new MeasureItem()
                    {
                        Location         = status.NewVertex,
                        LinearUnitType   = LinearUnitType,
                        CoordinateFormat = CoordinateFormat
                    });
                break;
            }

            case GeometryEditAction.DeletedVertex:
            {
                MeasureItemCollection.RemoveAt(status.VertexPosition.CoordinateIndex);
                break;
            }

            default:
            {
                MeasureItemCollection.Clear();
                if (polyline != null && polyline.Parts != null)
                {
                    foreach (var p in polyline.Parts[0].GetPoints())
                    {
                        MeasureItemCollection.Add(new MeasureItem()
                            {
                                Location         = p,
                                LinearUnitType   = LinearUnitType,
                                CoordinateFormat = CoordinateFormat
                            });
                    }
                }
                break;
            }
            }
            UpdateDisplay(polyline);
        }
Ejemplo n.º 2
0
 private void ResetDisplay()
 {
     MeasureItemCollection.Clear();
     MeasureSummary.TotalLength = 0;
     MeasureSummary.Area        = 0;
     if (Editor != null && Editor.IsActive)
     {
         if (Editor.Cancel.CanExecute(null))
         {
             Editor.Cancel.Execute(null);
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the m_Polyline and MeasureItemsCollection based on the progress
        /// reported by <see cref="Esri.ArcGISRuntime.Controls.Editor"/>
        /// </summary>
        /// <param name="status"></param>
        private void OnStatusReported(GeometryEditStatus status)
        {
            var polyline = status.NewGeometry as Polyline;

            switch (status.GeometryEditAction)
            {
            case GeometryEditAction.AddedVertex:
            {
                MeasureItemCollection.Insert(status.VertexPosition.CoordinateIndex,
                                             new MeasureItem()
                    {
                        Location         = status.NewVertex,
                        LinearUnitType   = LinearUnitType,
                        CoordinateFormat = CoordinateFormat
                    });
                break;
            }

            case GeometryEditAction.DeletedVertex:
            {
                MeasureItemCollection.RemoveAt(status.VertexPosition.CoordinateIndex);
                break;
            }

            default:
            {
                MeasureItemCollection.Clear();
                if (polyline != null)
                {
                    foreach (var p in polyline.Paths[0])
                    {
                        MeasureItemCollection.Add(new MeasureItem()
                            {
                                Location         = new MapPoint(p, polyline.SpatialReference),
                                LinearUnitType   = LinearUnitType,
                                CoordinateFormat = CoordinateFormat
                            });
                    }
                }
                break;
            }
            }
            UpdateDisplay(polyline);
        }
Ejemplo n.º 4
0
 private void ResetDisplay()
 {
     MeasureItemCollection.Clear();
     MeasureSummary.TotalLength = 0;
     MeasureSummary.Area        = 0;
 }