Index: src/Deltares.DSoilModel.Forms/Translations.xml =================================================================== diff -u -r222 -r223 --- src/Deltares.DSoilModel.Forms/Translations.xml (.../Translations.xml) (revision 222) +++ src/Deltares.DSoilModel.Forms/Translations.xml (.../Translations.xml) (revision 223) @@ -86,6 +86,6 @@ - - + + \ No newline at end of file Index: src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs =================================================================== diff -u -r222 -r223 --- src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs (.../DSoilModelGeometryEditor.cs) (revision 222) +++ src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs (.../DSoilModelGeometryEditor.cs) (revision 223) @@ -323,6 +323,8 @@ return dataObjectEmptySelectionIsFilledSoilProfile1D && project.SurfaceLines.Count > 0; case "Add1DProfileToCreate2DProfile": return dataObjectEmptySelectionIsFilledSurfaceLine2 && project.SoilProfiles1D.Count > 0; + case "ExecuteClearSoilProfile2DCommand": + return SpatialEditor.EmptySelection != null && SpatialEditor.EmptySelection.DataObject is SoilProfile2D; default: return true; } @@ -332,8 +334,6 @@ { switch (property) { - case "ExecuteClearGeometryCommand": - return SpatialEditor.EmptySelection != null; default: return true; } @@ -522,36 +522,35 @@ BindSupport.Bind(panel, addSurfaceLineToCreateNew2DProfileMenuItem, ge => ge.AddSurfaceLineToCreateNew2DProfile()); BindSupport.Bind(panel, addSurfaceLineToCreate2DProfileMenuItem, ge => ge.AddSurfaceLineToCreate2DProfile()); BindSupport.Bind(panel, add1DProfileToCreate2DProfileMenuItem, ge => ge.Add1DProfileToCreate2DProfile()); - BindSupport.Bind(panel, clearGeometryMenuItem, ge => ge.ExecuteClearGeometryCommand()); + BindSupport.Bind(panel, clearGeometryMenuItem, ge => ge.ExecuteClearSoilProfile2DCommand()); BindSupport.Assign(panel, this); } - private bool AskUserWantsToClearGeometry() + private bool AskUserWantsToClearSoilProfile2D() { - var msg = LocalizationManager.GetTranslatedText(this, "ExecuteClearGeometryCommandUserConfirm"); - var caption = LocalizationManager.GetTranslatedText(this, "ExecuteClearGeometryCommand"); + var msg = LocalizationManager.GetTranslatedText(this, "ExecuteClearSoilProfile2DCommandUserConfirm"); + var caption = LocalizationManager.GetTranslatedText(this, "ExecuteClearSoilProfile2DCommand"); return MessageBox.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; } - private void ExecuteClearGeometryCommand() + private void ExecuteClearSoilProfile2DCommand() { - var selected = (SpatialEditor.EmptySelection.DataObject as SoilProfile2D); - if (selected == null) + if (!AskUserWantsToClearSoilProfile2D()) { return; } - if (!AskUserWantsToClearGeometry()) - { - return; - } - - selected.Geometry.Clear(); - selected.Surfaces.Clear(); + ClearSoilProfile2D(SpatialEditor.EmptySelection.DataObject as SoilProfile2D); + } - DataEventPublisher.DataListModified(selected.Geometry.Points); - DataEventPublisher.DataListModified(selected.Geometry.Curves); - DataEventPublisher.DataListModified(selected.Surfaces); + private void ClearSoilProfile2D(SoilProfile2D profile) + { + profile.Geometry.Clear(); + profile.Surfaces.Clear(); + + DataEventPublisher.DataListModified(profile.Geometry.Points); + DataEventPublisher.DataListModified(profile.Geometry.Curves); + DataEventPublisher.DataListModified(profile.Surfaces); } private void spatialEditor_ShapeRemoved(object sender, ShapeEventArgs e)