private void WpfMap_Loaded(object sender, RoutedEventArgs e) { wpfMap1.MapUnit = GeographyUnit.DecimalDegree; wpfMap1.CurrentExtent = new RectangleShape(-133.2515625, 89.2484375, 126.9046875, -88.290625); WorldMapKitWmsWpfOverlay worldMapKitOverlay = new WorldMapKitWmsWpfOverlay(); wpfMap1.Overlays.Add(worldMapKitOverlay); wpfMap1.Refresh(); } private void button_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; if (button != null) { switch (button.Name) { case "btnTrackLine": wpfMap1.TrackOverlay.TrackMode = TrackMode.Line; break; case "btnTrackEdit": wpfMap1.TrackOverlay.TrackMode = TrackMode.None; foreach (Feature feature in wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures) { wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures.Add(feature); } wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear(); wpfMap1.EditOverlay.CalculateAllControlPoints(); EditPointControl(); wpfMap1.EditOverlay.FeatureEdited += new System.EventHandler(EditOverlay_FeatureEdited); wpfMap1.Refresh(new Overlay[] { wpfMap1.EditOverlay, wpfMap1.TrackOverlay }); break; case "btnTrackDelete": int lastIndex = wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures.Count - 1; if (lastIndex >= 0) { wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures.RemoveAt(lastIndex); wpfMap1.EditOverlay.CalculateAllControlPoints(); EditPointControl(); } wpfMap1.Refresh(wpfMap1.EditOverlay); break; default: wpfMap1.TrackOverlay.TrackMode = TrackMode.None; break; } } } void EditOverlay_FeatureEdited(object sender, FeatureEditedEditInteractiveOverlayEventArgs e) { EditPointControl(); } private void EditPointControl() { ControlPoints.Clear(); GeoCollection editFeatures = wpfMap1.EditOverlay.ExistingControlPointsLayer.InternalFeatures; foreach (Feature shapeFeature in wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures) { ExEditInteractiveOverlay exEditOverLay = new ExEditInteractiveOverlay(); IEnumerable pointFeatures = exEditOverLay.GetPointShapeFeaturesFormFeature(shapeFeature); GetEditPoint(editFeatures, pointFeatures); } editFeatures.Clear(); foreach (Feature f in ControlPoints) { editFeatures.Add(f); } } private void GetEditPoint(GeoCollection editFeatures, IEnumerable pointFeatures) { int count = 0; foreach (Feature feature in pointFeatures) { if (count == 2) break; else { foreach (Feature f in editFeatures) { if (f.GetWellKnownText() == feature.GetWellKnownText()) { ControlPoints.Add(f); count++; } } } } }