private void AreaResizeMenuItem_Click(object sender, RoutedEventArgs e) { MenuItem item = (MenuItem)sender; Feature feature = (Feature)item.Tag; AreaBaseShape areaShape = (AreaBaseShape)feature.GetShape(); AreaResizeWindow window = new AreaResizeWindow(areaShape); window.Owner = Application.Current.MainWindow; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; if (window.ShowDialog().GetValueOrDefault()) { double orignalAcreage = window.OriginalAcreage; double acreage = window.ResultAcreage; double difference = 1; while (difference > 0.05) { if (acreage > orignalAcreage) { double percentage = (Math.Sqrt(acreage) / Math.Sqrt(orignalAcreage) * 100) % 100; areaShape.ScaleUp(percentage); } else if (acreage == orignalAcreage) { } else { double percentage = (Math.Sqrt(orignalAcreage) / Math.Sqrt(acreage) * 100) % 100; areaShape.ScaleDown(percentage); } orignalAcreage = areaShape.GetArea(GisEditor.ActiveMap.MapUnit, AreaResizeWindow.DefaultAreaUnit); difference = Math.Abs(orignalAcreage - acreage) / acreage; } Feature tempfeature = GisEditor.ActiveMap.FeatureLayerEditOverlay.EditShapesLayer.InternalFeatures.FirstOrDefault(f => f.Id.Equals(feature.Id)); if (tempfeature != null) { GisEditor.ActiveMap.FeatureLayerEditOverlay.EditShapesLayer.InternalFeatures.Remove(tempfeature); GisEditor.ActiveMap.FeatureLayerEditOverlay.EditShapesLayer.InternalFeatures.Add(tempfeature.Id, new Feature(areaShape, tempfeature.ColumnValues)); GisEditor.ActiveMap.FeatureLayerEditOverlay.TakeSnapshot(); GisEditor.ActiveMap.FeatureLayerEditOverlay.Refresh(); } } }