private void btnPause_Click(object sender, System.EventArgs e) { (wpfMap1.TrackOverlay as MyInteractiveOverLay).MouseDoubleClick(); if (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() is LineShape) { LineShape lineShape = wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() as LineShape; lineShape.Vertices.RemoveAt(lineShape.Vertices.Count - 1); wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].WellKnownBinary = lineShape.GetWellKnownBinary(); } else if (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() is PolygonShape) { PolygonShape polygonShape = wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() as PolygonShape; polygonShape.OuterRing.Vertices.RemoveAt(polygonShape.OuterRing.Vertices.Count - 2); wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].WellKnownBinary = polygonShape.GetWellKnownBinary(); } wpfMap1.TrackOverlay.TrackMode = TrackMode.None; wpfMap1.Refresh(); } private void btnResume_Click(object sender, System.EventArgs e) { System.Collections.ObjectModel.Collection vertexes = new System.Collections.ObjectModel.Collection(); if (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() is LineShape) { wpfMap1.TrackOverlay.TrackMode = TrackMode.Line; vertexes = (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() as LineShape).Vertices; wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.RemoveAt(0); } else if (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() is PolygonShape) { wpfMap1.TrackOverlay.TrackMode = TrackMode.Polygon; vertexes = (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() as PolygonShape).OuterRing.Vertices; vertexes.RemoveAt(vertexes.Count - 1); wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.RemoveAt(0); } if (vertexes.Count > 0) { for (int i = 0; i < vertexes.Count; i++) { (wpfMap1.TrackOverlay as MyInteractiveOverLay).MouseDown(new InteractionArguments() { WorldX = vertexes[i].X, WorldY = vertexes[i].Y }); } (wpfMap1.TrackOverlay as MyInteractiveOverLay).MouseDown(new InteractionArguments() { WorldX = vertexes[vertexes.Count - 1].X, WorldY = vertexes[vertexes.Count - 1].Y }); } } private void btnDropLastPoint_Click(object sender, System.EventArgs e) { System.Collections.ObjectModel.Collection vertexes = new System.Collections.ObjectModel.Collection(); Feature newFeature; if (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() is LineShape) { vertexes = (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() as LineShape).Vertices; vertexes.RemoveAt(vertexes.Count - 1); newFeature = new Feature(new LineShape(vertexes)); wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.RemoveAt(0); wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Add(newFeature); } else if (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() is PolygonShape) { wpfMap1.TrackOverlay.TrackMode = TrackMode.Polygon; vertexes = (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape() as PolygonShape).OuterRing.Vertices; vertexes.RemoveAt(vertexes.Count - 2); if (vertexes.Count < 4) { return; } newFeature = new Feature(new PolygonShape(new RingShape(vertexes))); wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.RemoveAt(0); wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Add(newFeature); } wpfMap1.Refresh(); }