private void WpfMap_Loaded(object sender, RoutedEventArgs e) { WorldMapKitWmsWpfOverlay a = new WorldMapKitWmsWpfOverlay(); wpfMap1.Overlays.Add(a); InMemoryFeatureLayer inmLayer = new InMemoryFeatureLayer(); inmLayer.InternalFeatures.Add(new Feature("LINESTRING (-20 0, 20 0)")); inmLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Canal1; inmLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay ov = new LayerOverlay(); ov.Layers.Add(inmLayer); wpfMap1.Overlays.Add(ov); wpfMap1.MapUnit = GeographyUnit.DecimalDegree; wpfMap1.CurrentExtent = new RectangleShape(-133.2515625, 89.2484375, 126.9046875, -88.290625); wpfMap1.TrackOverlay.TrackShapeLayer.Open(); wpfMap1.TrackOverlay.TrackShapeLayer.Columns.Add(new FeatureSourceColumn("Area")); wpfMap1.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Area", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), 2, 0, -8); wpfMap1.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; wpfMap1.TrackOverlay.Drawing += new EventHandler(TrackOverlay_Drawing); wpfMap1.EditOverlay.EditShapesLayer.Open(); wpfMap1.EditOverlay.EditShapesLayer.Columns.Add(new FeatureSourceColumn("Area")); wpfMap1.EditOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Area", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), 2, 0, -8); wpfMap1.EditOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; wpfMap1.EditOverlay.EditsInProcessLayer.DrawingFeatures += new EventHandler(EditsInProcessLayer_DrawingFeatures); wpfMap1.EditOverlay.EditsInProcessLayer.Open(); wpfMap1.EditOverlay.EditsInProcessLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.CreateSimpleTextStyle("Area", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), 2, 0, -8)); wpfMap1.EditOverlay.EditsInProcessLayer.Close(); wpfMap1.MapClick += new EventHandler(wpfMap1_MapClick); wpfMap1.Refresh(); } void wpfMap1_MapClick(object sender, MapClickWpfMapEventArgs e) { System.Diagnostics.Debug.WriteLine(wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetWellKnownText()); } void EditsInProcessLayer_DrawingFeatures(object sender, DrawingFeaturesEventArgs e) { if (!wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures[0].ColumnValues.ContainsKey("state")) { wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures[0].ColumnValues.Add("state", "fillBlankToForbidException"); PolygonShape polygonShape = wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures[0].GetShape() as PolygonShape; wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures[0].ColumnValues["Area"] = polygonShape.GetArea(GeographyUnit.DecimalDegree, AreaUnit.SquareKilometers).ToString(); e.FeaturesToDraw.Add(wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures[0]); } } private int a = 0; void TrackOverlay_Drawing(object sender, DrawingOverlayEventArgs e) { if (a == 1) { PolygonShape polygonShape = new PolygonShape(wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetWellKnownBinary()); if (polygonShape != null) { wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].ColumnValues["Area"] = "Area is:" + polygonShape.GetArea(GeographyUnit.DecimalDegree, AreaUnit.SquareKilometers).ToString(); } } else { a++; } } void EditOverlay_FeatureEdited(object sender, FeatureEditedEditInteractiveOverlayEventArgs e) { PolygonShape polygonShape = new PolygonShape(wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures[0].GetWellKnownBinary()); if (polygonShape != null) { wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures[0].ColumnValues["Area"] = "Area is:" + polygonShape.GetArea(GeographyUnit.DecimalDegree, AreaUnit.SquareKilometers).ToString(); } }