Draw d = new Draw(MyMap){DrawMode= ESRI.ArcGIS.Client.DrawMode.Polygon, IsEnabled = true}; d.DrawBegin += (s, e) => { }; d.DrawComplete += (s, e) => { }; d.VertexAdded += (s, e) => { };
private void drawObjectVertexAdded(object sender, VertexAddedEventArgs args) { _drawingObjectMapPointCollection.Add(args.Vertex.Extent.GetCenter()); _drawingObjectSpatialReferenceCollection.Add(args.Vertex.SpatialReference); }
PointCollection pnts = (_graphic.Geometry as Polyline).Paths[0]; MapPoint endPoint = pnts[pnts.Count - 1];
private void EditGeometry_GeometryEdit(object sender, EditGeometry.GeometryEditEventArgs e) { if (e.Action == EditGeometry.Action.VertexAdded) { var graphic = e.Graphic as Graphic; var polyline = graphic.Geometry as Polyline; var distance = double.NaN; var vertex = e.NewItems[0] as MapPoint; foreach (var p in polyline.Paths[0]) { if (!double.IsNaN(distance)) break; var d = Math.Sqrt(Math.Pow(Math.Abs(vertex.X - p.X), 2) + Math.Pow(Math.Abs(vertex.Y - p.Y), 2)); if (double.IsNaN(distance) || d < distance) distance = d; } if (distance > maxDistance) editGeometry.UndoLastEdit(); }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.