private void Window_Loaded(object sender, RoutedEventArgs e) { wpfMap1.MapUnit = GeographyUnit.DecimalDegree; wpfMap1.CurrentExtent = new RectangleShape(-133.2515625, 89.2484375, 126.9046875, -88.290625); InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer(); inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.Green, 3, GeoColor.SimpleColors.Black, 1, true); inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; WorldMapKitWmsWpfOverlay worldMapKitOverlay = new WorldMapKitWmsWpfOverlay(); wpfMap1.Overlays.Add(worldMapKitOverlay); LayerOverlay overlay = new LayerOverlay(); overlay.Layers.Add("mark", inMemoryLayer); wpfMap1.Overlays.Add("Maps", overlay); wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures.Add(new Feature(new RectangleShape(-50, 50, 50, -50))); wpfMap1.EditOverlay.VertexMoving += new System.EventHandler(EditOverlay_VertexMoving); wpfMap1.EditOverlay.CalculateAllControlPoints(); wpfMap1.Refresh(); } private void EditOverlay_VertexMoving(object sender, VertexMovingEditInteractiveOverlayEventArgs e) { e.TargetVertex.X += 5; //= new PointShape(e.MovingVertex.X + 5, e.MovingVertex.Y + 5); e.TargetVertex.Y += 5; LayerOverlay overlay = (LayerOverlay)wpfMap1.Overlays["Maps"]; ((InMemoryFeatureLayer)overlay.Layers["mark"]).InternalFeatures.Clear(); ScreenPointF point = ExtentHelper.ToScreenCoordinate(wpfMap1.CurrentExtent, e.TargetVertex, (float)wpfMap1.ActualWidth, (float)wpfMap1.ActualHeight); ScreenPointF point1 = new ScreenPointF(point.X, point.Y + 15); ScreenPointF point2 = new ScreenPointF(point.X, point.Y - 15); ScreenPointF point3 = new ScreenPointF(point.X + 15, point.Y); ScreenPointF point4 = new ScreenPointF(point.X - 15, point.Y); GeoCollection line1 = new GeoCollection(); GeoCollection line2 = new GeoCollection(); line1.Add(new Vertex(ExtentHelper.ToWorldCoordinate(wpfMap1.CurrentExtent, point1, (float)wpfMap1.ActualWidth, (float)wpfMap1.ActualHeight))); line1.Add(new Vertex(ExtentHelper.ToWorldCoordinate(wpfMap1.CurrentExtent, point2, (float)wpfMap1.ActualWidth, (float)wpfMap1.ActualHeight))); line2.Add(new Vertex(ExtentHelper.ToWorldCoordinate(wpfMap1.CurrentExtent, point3, (float)wpfMap1.ActualWidth, (float)wpfMap1.ActualHeight))); line2.Add(new Vertex(ExtentHelper.ToWorldCoordinate(wpfMap1.CurrentExtent, point4, (float)wpfMap1.ActualWidth, (float)wpfMap1.ActualHeight))); ((InMemoryFeatureLayer)overlay.Layers["mark"]).InternalFeatures.Add(new Feature(new LineShape(line1))); ((InMemoryFeatureLayer)overlay.Layers["mark"]).InternalFeatures.Add(new Feature(new LineShape(line2))); wpfMap1.Refresh(); }