Index: src/Deltares.DSoilModel.Forms/DSoilModelMapEditor.cs =================================================================== diff -u -r85 -r86 --- src/Deltares.DSoilModel.Forms/DSoilModelMapEditor.cs (.../DSoilModelMapEditor.cs) (revision 85) +++ src/Deltares.DSoilModel.Forms/DSoilModelMapEditor.cs (.../DSoilModelMapEditor.cs) (revision 86) @@ -10,16 +10,15 @@ using Deltares.Geotechnics; using Deltares.Geotechnics.ConePenetrationTest; using Deltares.Standard; -using Deltares.Standard.Maps; using Deltares.Standard.EventPublisher; using Deltares.Standard.Extensions; using Deltares.Standard.Forms.DExpress; using Deltares.Standard.Forms.Maps; using Deltares.Standard.Language; +using Deltares.Standard.Maps; using Deltares.Standard.Reflection; using DevExpress.XtraBars; using DotSpatial.Controls; -using DotSpatial.Data; using DotSpatial.Symbology; using DotSpatial.Topology; @@ -30,21 +29,20 @@ /// public class DSoilModelMapEditor : IVisibleEnabled, IDisposable { + private const int labelFontSize = 9; private readonly MapEditor mapEditor; - private DSoilModelProject project; - private const int labelFontSize = 9; + private readonly List mappedSoilProfiles1D = new List(); + private readonly List mappedSoilProfiles2D = new List(); private readonly Panel panel = new Panel(); - private BarButtonItem splitSegmentButton; // only one segment can be split at a time, but these need to be lists so we can add them to the map as layers private readonly List segmentSplitters = new List(); private readonly List splittingSegments = new List(); + private DSoilModelProject project; + private readonly BarButtonItem splitSegmentButton; - private readonly List mappedSoilProfiles1D = new List(); - private readonly List mappedSoilProfiles2D = new List(); - /// /// Initializes a new instance of the class, registers MapLayerDefinitions /// for CPT, Boring, SoilProfile1D, SoilProfile2D and Segments. @@ -169,7 +167,6 @@ } } - /// /// Zoom out the map to display all data. /// @@ -179,6 +176,46 @@ } /// + /// SnapRule method for splitting soil segments, snaps the splitter location to the segment geographically + /// + /// Point to be snapped + /// Snapped point + public IGeographic GetSnapPointSplitSegment(IGeographicPoint point) + { + var returnPoint = new GeographicPoint(point.X, point.Y); + + if (project != null && splittingSegments.Any()) + { + var nearest = splittingSegments[0].NearestPointOnGeographicString(point); + returnPoint.X = nearest.X; + returnPoint.Y = nearest.Y; + } + return returnPoint; + } + + public void ConfigureMainMenu(MainForm mainForm) + { + var linkButtonItem = new BarButtonItem(); + mainForm.EditMenu.ItemLinks.Add(linkButtonItem); + BindSupport.Bind(panel, linkButtonItem, ge => ge.LinkToNearestSegment()); + + var splitButtonItem = new BarButtonItem(); + mainForm.EditMenu.ItemLinks.Add(splitButtonItem); + BindSupport.Bind(panel, splitButtonItem, ge => ge.SplitSegment()); + } + + /// + /// Dispose of unmanaged resources and delegates + /// + public void Dispose() + { + DataEventPublisher.OnSelectionChanged -= DataEventPublisher_OnSelectionChanged; + DataEventPublisher.OnDataListModified -= DataEventPublisher_OnDataLisModified; + DataEventPublisher.OnAfterChange -= DataEventPublisher_OnAfterChange; + mapEditor.MapControl.LayerAdded -= MapControlOnLayerAdded; + } + + /// /// Determine visibility of properties /// /// @@ -202,7 +239,7 @@ if (mapEditor.SelectedObjects.Any(o => o is ConePenetrationTestData || o is Boring)) { return true; - } + } } return false; } @@ -238,35 +275,6 @@ } } - /// - /// SnapRule method for splitting soil segments, snaps the splitter location to the segment geographically - /// - /// Point to be snapped - /// Snapped point - public IGeographic GetSnapPointSplitSegment(IGeographicPoint point) - { - var returnPoint = new GeographicPoint(point.X, point.Y); - - if (project != null && splittingSegments.Any()) - { - var nearest = splittingSegments[0].NearestPointOnGeographicString(point); - returnPoint.X = nearest.X; - returnPoint.Y = nearest.Y; - } - return returnPoint; - } - - public void ConfigureMainMenu(MainForm mainForm) - { - var linkButtonItem = new BarButtonItem(); - mainForm.EditMenu.ItemLinks.Add(linkButtonItem); - BindSupport.Bind(panel, linkButtonItem, ge => ge.LinkToNearestSegment()); - - var splitButtonItem = new BarButtonItem(); - mainForm.EditMenu.ItemLinks.Add(splitButtonItem); - BindSupport.Bind(panel, splitButtonItem, ge => ge.SplitSegment()); - } - private void ConfigureContextMenu() { var splitSegmentMenuItem = new ToolStripMenuItem("Split segment"); @@ -340,7 +348,7 @@ foreach (var segment in segments) { double distance = DotSpatialGeographicAlgorithms.Distance(item, segment); - if (Math.Abs(distance - nearestDistance) < Geometry.GeometryConstants.Accuracy) + if (Math.Abs(distance - nearestDistance) < GeometryConstants.Accuracy) { if (segment.Mechanism != nearestSegment.Mechanism && segment.Points.Count == nearestSegment.Points.Count) { @@ -370,8 +378,8 @@ { segment.Cpts.Add(new ConePenetrationTestPerSegment { - ConePenetrationTestData = cpt, - Xlocal = xSegment + ConePenetrationTestData = cpt, + Xlocal = xSegment }); } } @@ -394,16 +402,24 @@ private bool CompareGeographicStrings(IGeographicString geographicString1, IGeographicString geographicString2) { - if (geographicString1.Points.Count != geographicString2.Points.Count) return false; + if (geographicString1.Points.Count != geographicString2.Points.Count) + { + return false; + } for (int i = 0; i < geographicString1.Points.Count; i++) { - if (Math.Abs(geographicString1.Points[i].X - geographicString2.Points[i].X) > GeometryConstants.Accuracy) return false; - if (Math.Abs(geographicString1.Points[i].Y - geographicString2.Points[i].Y) > GeometryConstants.Accuracy) return false; + if (Math.Abs(geographicString1.Points[i].X - geographicString2.Points[i].X) > GeometryConstants.Accuracy) + { + return false; + } + if (Math.Abs(geographicString1.Points[i].Y - geographicString2.Points[i].Y) > GeometryConstants.Accuracy) + { + return false; + } } return true; } - /// /// Selection change handler for specific interactions /// @@ -418,7 +434,7 @@ var splitLocation = sender as SoilSegmentSplitLocation; if (splitLocation != null) { - if (splitLocation != segmentSplitters.FirstOrDefault()) + if (splitLocation != segmentSplitters.FirstOrDefault()) { // initiate the same splitting operation in the map AddSegmentSplitter(splitLocation.SoilSegment, splitLocation); @@ -433,16 +449,19 @@ { if (segmentSplitters.Any() && segmentSplitters.First().SoilSegment != segment) { - ClearSegmentSplitter(); + ClearSegmentSplitter(); } } } } private void DataEventPublisher_OnDataLisModified(object sender, PublishEventArgs e) { - if (project == null) return; - + if (project == null) + { + return; + } + // update soil profiles ? if (sender == project.SoilProfiles1D) { @@ -529,7 +548,7 @@ featureLayer.LabelLayer.UseDynamicVisibility = true; featureLayer.ShowLabels = true; } - } + } } } @@ -567,12 +586,11 @@ { SoilSegment = segment }; - splitLocation.XCoordinate = segment.GetSegmentLength() / 2; + splitLocation.XCoordinate = segment.GetSegmentLength()/2; } segmentSplitters.Clear(); segmentSplitters.Add(splitLocation); mapEditor.AddLayer(segmentSplitters, true); - }); // event for length profile geometry editor @@ -598,7 +616,7 @@ BindSupport.Update(panel); } } - + private MapLayerDefinition SegmentSplitLocationLayerDefinition() { var scheme = new PointScheme(); @@ -617,19 +635,8 @@ AllowMoveFeature = true, AllowDeleteFeature = true, AllowAddNewFeature = false, - SnapRule = GetSnapPointSplitSegment, + SnapRule = GetSnapPointSplitSegment, }; } - - /// - /// Dispose of unmanaged resources and delegates - /// - public void Dispose() - { - DataEventPublisher.OnSelectionChanged -= DataEventPublisher_OnSelectionChanged; - DataEventPublisher.OnDataListModified -= DataEventPublisher_OnDataLisModified; - DataEventPublisher.OnAfterChange -= DataEventPublisher_OnAfterChange; - mapEditor.MapControl.LayerAdded -= MapControlOnLayerAdded; - } } } \ No newline at end of file Index: src/Deltares.DSoilModel.Forms/DSoilModelPlugin.cs =================================================================== diff -u -r85 -r86 --- src/Deltares.DSoilModel.Forms/DSoilModelPlugin.cs (.../DSoilModelPlugin.cs) (revision 85) +++ src/Deltares.DSoilModel.Forms/DSoilModelPlugin.cs (.../DSoilModelPlugin.cs) (revision 86) @@ -4,7 +4,6 @@ using System.Drawing; using System.IO; using System.Linq; -using System.Reflection; using System.Windows.Forms; using Deltares.DSoilModel.Data; using Deltares.Geographic; @@ -18,7 +17,6 @@ using Deltares.Probabilistic; using Deltares.Standard; using Deltares.Standard.Attributes; -using Deltares.Standard.Maps; using Deltares.Standard.EventPublisher; using Deltares.Standard.Forms; using Deltares.Standard.Forms.DExpress; @@ -27,6 +25,7 @@ using Deltares.Standard.IO; using Deltares.Standard.Language; using Deltares.Standard.Logging; +using Deltares.Standard.Maps; using Deltares.Standard.Units; using DevExpress.XtraBars; using DevExpress.XtraEditors.Controls; @@ -44,25 +43,23 @@ { private readonly SplitContainer filmStripContainer; private readonly Panel pluginPanel = new Panel(); + private readonly Dictionary previouslySelectedProfiles = new Dictionary(); private readonly Panel projectPanel = new Panel(); - private readonly List selectedObjects = new List(); private readonly SegmentControl segmentControl = new SegmentControl(); - private readonly Dictionary previouslySelectedProfiles = new Dictionary(); - - private GridViewControl materialsTable; + private readonly List selectedObjects = new List(); + private readonly GeometryEditor extraGeometryEditor = new GeometryEditor(); private FilmStrip filmStrip; - private DSoilModelGeometryEditor geometryEditor; private MainForm mainForm; + private readonly MapEditor mapControl = new MapEditor(); private DSoilModelMapEditor mapEditor; + + private GridViewControl materialsTable; private DSoilModelProject project; - private DSoilModelSegmentGeometryEditor segmentGeometryEditor; private bool use1DProfiles = true; private bool use2DProfiles = true; private bool useBorings = true; private bool useSoilSegments = true; private bool useSurfaceLines = true; - private GeometryEditor extraGeometryEditor = new GeometryEditor(); - private MapEditor mapControl = new MapEditor(); public DSoilModelPlugin() { @@ -79,13 +76,13 @@ // Create the container for the geometry editor and the film strip filmStripContainer = new SplitContainer - { - Dock = DockStyle.Fill, - Orientation = Orientation.Horizontal, - BorderStyle = BorderStyle.FixedSingle, - Panel1Collapsed = false, - Panel2Collapsed = true - }; + { + Dock = DockStyle.Fill, + Orientation = Orientation.Horizontal, + BorderStyle = BorderStyle.FixedSingle, + Panel1Collapsed = false, + Panel2Collapsed = true + }; filmStripContainer.SizeChanged += FilmStripContainer_OnSizeChanged; filmStripContainer.SplitterMoving += FilmStripContainer_OnSplitterMoving; filmStripContainer.SplitterMoved += FilmStripContainer_OnSplitterMoved; @@ -113,32 +110,12 @@ /// /// The geometry editor for this DSoilModel plugin. /// - public DSoilModelGeometryEditor GeometryEditor - { - get - { - return geometryEditor; - } - set - { - geometryEditor = value; - } - } + public DSoilModelGeometryEditor GeometryEditor { get; set; } /// /// The segment geometry editor for this DSoilModel plugin. /// - public DSoilModelSegmentGeometryEditor SegmentGeometryEditor - { - get - { - return segmentGeometryEditor; - } - set - { - segmentGeometryEditor = value; - } - } + public DSoilModelSegmentGeometryEditor SegmentGeometryEditor { get; set; } /// /// Gets or sets whether Soil Segments are used in the D-Soil Model plugin. @@ -219,16 +196,16 @@ { ; // added to hide some toolbarbuttons in the validation table } - + public void Dispose() { - if (null != geometryEditor) + if (null != GeometryEditor) { - geometryEditor.Dispose(); + GeometryEditor.Dispose(); } - if (null != segmentGeometryEditor) + if (null != SegmentGeometryEditor) { - segmentGeometryEditor.Dispose(); + SegmentGeometryEditor.Dispose(); } if (null != project) { @@ -253,7 +230,7 @@ DataEventPublisher.OnDataListModified += DataEventPublisherOnDataListModified; DataEventPublisher.OnAfterChange += DataEventPublisherOnAfterChange; DataEventPublisher.OnSelectionChanged += DataEventPublisherOnSelectionChanged; - + mainForm.RegisterNewFileHandler(CreateNewFile); mainForm.RegisterOpenFileHandler("soil", "Soilbase files (*.soil)|*.soil", DSoilModelIO.OpenSoilDatabase); @@ -275,9 +252,9 @@ mainForm.AddControl(extraGeometryEditor); var context = new DSoilModelContext - { - ParameterView = ParameterViewSettings.AllParameters - }; + { + ParameterView = ParameterViewSettings.AllParameters + }; Context.CurrentContext = context; ConfigureMenus(); @@ -299,7 +276,6 @@ // by loading the settings dialog here, we can prevent it from showing the units tab page (temporary for WTI) mainForm.CreateSettingsDialog(true, false); - } public void Assign(object source) @@ -343,29 +319,6 @@ } } - private bool UpdateForNewSoilSurfaceProfiles(List stochasticSoilProfiles) - { - DataEventPublisher.BeforeChange(project.SoilProfiles2D); - - foreach (var stochasticSoilProfile in stochasticSoilProfiles) - { - if (stochasticSoilProfile != null && stochasticSoilProfile.Profile is SoilProfile2D) - { - var prof = project.SoilProfiles2D.Find(x => x.Name == stochasticSoilProfile.Profile.Name); - if (prof != null) - { - prof = (SoilProfile2D) stochasticSoilProfile.Profile; - } - else - { - project.SoilProfiles2D.Add((SoilProfile2D)stochasticSoilProfile.Profile); - } - } - } - - return true; - } - public bool IsVisible(string property) { switch (property) @@ -401,6 +354,29 @@ } } + private bool UpdateForNewSoilSurfaceProfiles(List stochasticSoilProfiles) + { + DataEventPublisher.BeforeChange(project.SoilProfiles2D); + + foreach (var stochasticSoilProfile in stochasticSoilProfiles) + { + if (stochasticSoilProfile != null && stochasticSoilProfile.Profile is SoilProfile2D) + { + var prof = project.SoilProfiles2D.Find(x => x.Name == stochasticSoilProfile.Profile.Name); + if (prof != null) + { + prof = (SoilProfile2D) stochasticSoilProfile.Profile; + } + else + { + project.SoilProfiles2D.Add((SoilProfile2D) stochasticSoilProfile.Profile); + } + } + } + + return true; + } + private object CreateNewFile() { return new DSoilModelProject(); @@ -413,7 +389,7 @@ try { - selectedFilterValue = (UserColumnFilters)Enum.Parse(typeof(UserColumnFilters), selectedFilterText); + selectedFilterValue = (UserColumnFilters) Enum.Parse(typeof(UserColumnFilters), selectedFilterText); } catch (ArgumentException) { @@ -473,7 +449,7 @@ { DataEventPublisher.DataListModified(soilProfile2D.PreconsolidationStresses); } - UpdatePropertyControl(); + UpdatePropertyControl(); } if (publishEventArgs.Property.Equals("CurrentFailureMechanism")) @@ -485,7 +461,7 @@ } else { - EnableSoilUserFilterForMaterialTable(true); + EnableSoilUserFilterForMaterialTable(true); } UpdatePropertyControl(); } @@ -500,7 +476,7 @@ if (dSoilModelContext != null) { dSoilModelContext.SoilUserFilter = GetSoilUserFilterFromMaterialTable(); - UpdatePropertyControl(); + UpdatePropertyControl(); } } } @@ -514,7 +490,7 @@ if (sender is IGeographic) { selectedObjects.Clear(); - selectedObjects.Add(sender); + selectedObjects.Add(sender); } } else @@ -573,32 +549,32 @@ // Add CurrentMechanism dropdown to Toolbar var mechanismComboBox = new RepositoryItemComboBox - { - TextEditStyle = TextEditStyles.DisableTextEditor, DropDownRows = 10 - }; + { + TextEditStyle = TextEditStyles.DisableTextEditor, DropDownRows = 10 + }; var mechanismBarItem = new BarEditItem - { - Caption = "MechanismSelector", - Width = 100, Edit = mechanismComboBox - }; + { + Caption = "MechanismSelector", + Width = 100, Edit = mechanismComboBox + }; mainForm.ToolBar.AddItem(mechanismBarItem); LocalizationSupport.RegisterAndTranslate(typeof(DSoilModelPlugin), mechanismBarItem); BindSupport.Bind(projectPanel, mechanismBarItem, x => x.CurrentFailureMechanism); // Add ParameterView dropdown to Toolbar var parameterViewComboBox = new RepositoryItemComboBox - { - TextEditStyle = TextEditStyles.DisableTextEditor, - DropDownRows = 3 - }; + { + TextEditStyle = TextEditStyles.DisableTextEditor, + DropDownRows = 3 + }; var parameterViewBarItem = new BarEditItem - { - Caption = "ParameterViewSelector", - Width = 150, - Edit = parameterViewComboBox - }; + { + Caption = "ParameterViewSelector", + Width = 150, + Edit = parameterViewComboBox + }; mainForm.ToolBar.AddItem(parameterViewBarItem); LocalizationSupport.RegisterAndTranslate(typeof(DSoilModelPlugin), parameterViewBarItem); @@ -616,95 +592,95 @@ { // Save selection as var saveSelectionAsMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "SaveSelectedDataAs"), - Name = "SaveSelection", - ItemShortcut = new BarShortcut(Keys.F11) - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "SaveSelectedDataAs"), + Name = "SaveSelection", + ItemShortcut = new BarShortcut(Keys.F11) + }; var beforeLink = mainForm.FileMenu.ItemLinks[4]; mainForm.FileMenu.InsertItem(beforeLink, saveSelectionAsMenuItem); BindSupport.Bind(pluginPanel, saveSelectionAsMenuItem, p => p.SaveSelectedDataAs()); // Soil database importer var importSoilsItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "SoilsImport"), - Name = "SoilsImportItem" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "SoilsImport"), + Name = "SoilsImportItem" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importSoilsItemMenuItem - }); + { + importSoilsItemMenuItem + }); BindSupport.Bind(pluginPanel, importSoilsItemMenuItem, p => p.SoilsImport()); // Profile1D file importer (CSV) if (Use1DProfiles) { var importSoilProfile1DItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "SoilProfile1DImport"), - Name = "SoilProfile1DImportMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "SoilProfile1DImport"), + Name = "SoilProfile1DImportMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importSoilProfile1DItemMenuItem - }); + { + importSoilProfile1DItemMenuItem + }); BindSupport.Bind(pluginPanel, importSoilProfile1DItemMenuItem, p => p.SoilProfile1DImport()); } // Geometry file importer if (use2DProfiles) { var importGeometryItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "GeometryImport"), - Name = "GeometryImportMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "GeometryImport"), + Name = "GeometryImportMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importGeometryItemMenuItem - }); + { + importGeometryItemMenuItem + }); BindSupport.Bind(pluginPanel, importGeometryItemMenuItem, p => p.GeometryImport()); } // Surface line & characteristic points CSV file importer if (useSurfaceLines) { var importSurfaceLineItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "SurfaceLineImport"), - Name = "SurfaceLineImportMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "SurfaceLineImport"), + Name = "SurfaceLineImportMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importSurfaceLineItemMenuItem - }); + { + importSurfaceLineItemMenuItem + }); BindSupport.Bind(pluginPanel, importSurfaceLineItemMenuItem, p => p.SurfaceLineImport()); var importCharacteristicPointsItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "CharacteristicPointsImport"), - Name = "CharacteristicPointsImportMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "CharacteristicPointsImport"), + Name = "CharacteristicPointsImportMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importCharacteristicPointsItemMenuItem - }); + { + importCharacteristicPointsItemMenuItem + }); BindSupport.Bind(pluginPanel, importCharacteristicPointsItemMenuItem, p => p.CharacteristicPointsImport()); } if (useSoilSegments) { // Csv soil segments importer var importSoilSegmentsCsvItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "SoilSegmentsCsvImport"), - Name = "SoilSegmentsImportCsvMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "SoilSegmentsCsvImport"), + Name = "SoilSegmentsImportCsvMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importSoilSegmentsCsvItemMenuItem - }); + { + importSoilSegmentsCsvItemMenuItem + }); BindSupport.Bind(pluginPanel, importSoilSegmentsCsvItemMenuItem, p => p.SoilSegmentsCsvImport()); // Shape soil segments importer @@ -714,60 +690,60 @@ Name = "SoilSegmentsImportShapeMenu" }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importSoilSegmentsShapeItemMenuItem - }); + { + importSoilSegmentsShapeItemMenuItem + }); BindSupport.Bind(pluginPanel, importSoilSegmentsShapeItemMenuItem, p => p.SoilSegmentsShapeImport()); } // GEF CPT file importer var importGefCptItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "GefCptImport"), - Name = "GefCptImportMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "GefCptImport"), + Name = "GefCptImportMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importGefCptItemMenuItem - }); + { + importGefCptItemMenuItem + }); BindSupport.Bind(pluginPanel, importGefCptItemMenuItem, p => p.GefCptImport()); // GEF Boring file importer var importGefBoringItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "GefBoringImport"), - Name = "GefBoringImportMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "GefBoringImport"), + Name = "GefBoringImportMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importGefBoringItemMenuItem - }); + { + importGefBoringItemMenuItem + }); BindSupport.Bind(pluginPanel, importGefBoringItemMenuItem, p => p.GefBoringImport()); // Old project / DAM defx importer if (use1DProfiles && use2DProfiles && useSoilSegments) { var importDamItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "DamDefxImport"), - Name = "DamImportMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "DamDefxImport"), + Name = "DamImportMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importDamItemMenuItem - }); + { + importDamItemMenuItem + }); BindSupport.Bind(pluginPanel, importDamItemMenuItem, p => p.DamDefxImport()); var importOldProjectItemMenuItem = new BarButtonItem - { - Caption = LocalizationManager.GetTranslatedText(this, "OldProjectImport"), - Name = "OldProjectImportMenu" - }; + { + Caption = LocalizationManager.GetTranslatedText(this, "OldProjectImport"), + Name = "OldProjectImportMenu" + }; mainForm.ImportMenu.AddItems(new BarItem[] - { - importOldProjectItemMenuItem - }); + { + importOldProjectItemMenuItem + }); BindSupport.Bind(pluginPanel, importOldProjectItemMenuItem, p => p.OldProjectImport()); } } @@ -803,8 +779,8 @@ LocalizationSupport.Unregister(mainForm.GeometryDockPanel); // Initialize the main Geometry Editor - geometryEditor = new DSoilModelGeometryEditor(mainForm); - + GeometryEditor = new DSoilModelGeometryEditor(mainForm); + // Add a container for the film strip control below the main Geometry Editor var parent = mainForm.GeometryEditor.Parent; filmStripContainer.Panel1.Controls.Add(mainForm.GeometryEditor); @@ -819,7 +795,7 @@ private void ConfigureSegmentGeometryEditor() { // Initialize the Segment Geometry Editor - segmentGeometryEditor = new DSoilModelSegmentGeometryEditor(extraGeometryEditor); + SegmentGeometryEditor = new DSoilModelSegmentGeometryEditor(extraGeometryEditor); // Add a container for the film strip control below the Extra Geometry Editor //var parent = mainForm.ExtraGeometryEditor.Parent; @@ -841,7 +817,7 @@ mapControl.EnableZoomToSelection = true; mapControl.EnableZoomRectangle = true; - mapEditor.ConfigureMainMenu(this.mainForm); + mapEditor.ConfigureMainMenu(mainForm); // default coordinate system for features generated from lists like CPT, Boring, SoilProfile MapProjectionManager.Instance.SetActiveMapProjection(MapProjection.DutchRD); @@ -852,7 +828,7 @@ // Todo can be moved to GeotechnicsPlugin later when editors are approved. if (UseSoilSegments) { - mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => segmentControl, typeof(SoilSegment)); + mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => segmentControl, typeof(SoilSegment)); } // override MaterialEditorDialog which is registered in geotechnics plugin, replace with automatic (factory) control @@ -874,11 +850,11 @@ mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => new GeometryPointControl(), typeof(GeometryPoint)); mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => new GeometryCurveControl(), typeof(GeometryCurve)); mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => new SpecificMechanismPointLocationControl(), - typeof(SpecificMechanismPointLocation)); + typeof(SpecificMechanismPointLocation)); mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => new SoilSegmentSplitLocationControl(), - typeof(SoilSegmentSplitLocation)); + typeof(SoilSegmentSplitLocation)); mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => new CenterCrestLocationPropertyControl(), - typeof(CenterCrestLocation)); + typeof(CenterCrestLocation)); mainForm.DynamicPropertyControl.BuildDelayedPropertyControlsForType(typeof(ConePenetrationTestData), () => new CPTControl()); mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => new CPTLookupControl(), typeof(ConePenetrationTestLookup2D)); @@ -896,31 +872,30 @@ mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => new PreconsolidationStressControl(), typeof(SoilProfile2D)); mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => PropertyControlFactory.GetPropertyControl(), typeof(PreConsolidationStress)); - } private void ConfigureTables() { materialsTable = new GridViewControl - { - Name = "MaterialsGridViewControl", - CurrentContext = Context.CurrentContext, - AllowedUserColumnFilters = Soil.AllowedUserColumnFilters, - AllowInserts = true, - HideUnusedColumns = true - }; + { + Name = "MaterialsGridViewControl", + CurrentContext = Context.CurrentContext, + AllowedUserColumnFilters = Soil.AllowedUserColumnFilters, + AllowInserts = true, + HideUnusedColumns = true + }; mainForm.RegisterTableControl(typeof(Soil), materialsTable, "Materials"); BindSupport.Bind(projectPanel, materialsTable, typeof(DSoilModelProject), "Soils.Soils"); var cptsTable = new GridViewControl - { - CurrentContext = Context.CurrentContext, - HideUnusedColumns = true, - AllowInserts = false, - AllowAddDeleteOnly = true, - ShowToolbar = true, - Name = "CPTsTable" - }; + { + CurrentContext = Context.CurrentContext, + HideUnusedColumns = true, + AllowInserts = false, + AllowAddDeleteOnly = true, + ShowToolbar = true, + Name = "CPTsTable" + }; mainForm.RegisterTableControl(typeof(ConePenetrationTestData), cptsTable, "CPTs"); BindSupport.Bind(projectPanel, cptsTable, x => x.CPTs); BarButtonItem cptAddButton = FindBarButtonItem(cptsTable, "AddBarItem"); @@ -933,13 +908,13 @@ if (UseBorings) { var boringsTable = new GridViewControl - { - CurrentContext = Context.CurrentContext, - HideUnusedColumns = true, - AllowInserts = false, - AllowAddDeleteOnly = true, - ShowToolbar = true - }; + { + CurrentContext = Context.CurrentContext, + HideUnusedColumns = true, + AllowInserts = false, + AllowAddDeleteOnly = true, + ShowToolbar = true + }; mainForm.RegisterTableControl(typeof(Boring), boringsTable, "Borings"); BindSupport.Bind(projectPanel, boringsTable, x => x.Borings); BarButtonItem boringAddButton = FindBarButtonItem(boringsTable, "AddBarItem"); @@ -953,71 +928,71 @@ if (Use1DProfiles) { var soilProfilesTable = new GridViewControl - { - CurrentContext = Context.CurrentContext, - HideUnusedColumns = true - }; + { + CurrentContext = Context.CurrentContext, + HideUnusedColumns = true + }; mainForm.RegisterTableControl(typeof(SoilProfile1D), soilProfilesTable, "SoilProfiles1D"); BindSupport.Bind(projectPanel, soilProfilesTable, x => x.SoilProfiles1D); } if (Use2DProfiles) { var soilProfiles2DTable = new GridViewControl - { - CurrentContext = Context.CurrentContext, - HideUnusedColumns = true, - Name = "2DProfiles" - }; + { + CurrentContext = Context.CurrentContext, + HideUnusedColumns = true, + Name = "2DProfiles" + }; mainForm.RegisterTableControl(typeof(SoilProfile2D), soilProfiles2DTable, "2D Geometries"); BindSupport.Bind(projectPanel, soilProfiles2DTable, x => x.SoilProfiles2D); } if (UseSurfaceLines) { var surfaceLinesTable = new GridViewControl - { - EnableMasterViewMode = false, - CurrentContext = Context.CurrentContext, - HideUnusedColumns = true - }; + { + EnableMasterViewMode = false, + CurrentContext = Context.CurrentContext, + HideUnusedColumns = true + }; mainForm.RegisterTableControl(typeof(SurfaceLine2), surfaceLinesTable, "SurfaceLines"); BindSupport.Bind(projectPanel, surfaceLinesTable, x => x.SurfaceLines); } if (UseSoilSegments) { var segmentsTable = new GridViewControl - { - CurrentContext = Context.CurrentContext, - HideUnusedColumns = true - }; + { + CurrentContext = Context.CurrentContext, + HideUnusedColumns = true + }; mainForm.RegisterTableControl(typeof(DSoilModelProject), segmentsTable, "SoilSegments"); BindSupport.Bind(projectPanel, segmentsTable, x => x.CurrentSoilSegments); } // (bond)stress tables always visible as these are referenced from materials table var stressCurvesTable = new GridViewControl - { - CurrentContext = Context.CurrentContext, - HideUnusedColumns = true - }; + { + CurrentContext = Context.CurrentContext, + HideUnusedColumns = true + }; mainForm.RegisterTableControl(typeof(StressCurve), stressCurvesTable, "StressCurves"); BindSupport.Bind(projectPanel, stressCurvesTable, x => x.StressCurves); var bondStressCurvesTable = new GridViewControl - { - CurrentContext = Context.CurrentContext, - HideUnusedColumns = true - }; + { + CurrentContext = Context.CurrentContext, + HideUnusedColumns = true + }; mainForm.RegisterTableControl(typeof(BondStressCurve), bondStressCurvesTable, "BondStressCurves"); BindSupport.Bind(projectPanel, bondStressCurvesTable, x => x.BondStressCurves); // validator messages, add repair all button to toolbar var newButton = new BarButtonItem - { - Glyph = Resources.accept - }; + { + Glyph = Resources.accept + }; var gridView = mainForm.MessagesControl.UserMessagesGridViewControl; gridView.ShowToolbar = true; gridView.Toolbar.LinksPersistInfo.Add(new LinkPersistInfo(newButton)); @@ -1069,21 +1044,21 @@ // The Soil.Mechanisms list is the list of the currently used mechanisme filter(s) and should be updated // with the selected CurrentMechanism of the project. Soil.Mechanisms = new[] - { + { // Mechanism.AnchorLoading, // Mechanism.AssessmentLevel, // Mechanism.DAM, // Mechanism.Koswat, - Mechanism.None, + Mechanism.None, // Mechanism.Overtopping, - Mechanism.Piping, + Mechanism.Piping, // Mechanism.BlockRevetment, // Mechanism.Settlement, - Mechanism.Stability, - Mechanism.FlowSlide + Mechanism.Stability, + Mechanism.FlowSlide // Mechanism.Structures, // Mechanism.Dunes - }; + }; // The MechanismSupport.Mechanisms list is the list of available mechanisme filter(s) for this program and should NEVER // be altered elsewhere in the program. MechanismSupport.Mechanisms = Soil.Mechanisms; @@ -1092,24 +1067,24 @@ private void ConfigureSoilUserFilters() { Soil.AllowedUserColumnFilters = new[] - { - UserColumnFilters.DGeoStability, + { + UserColumnFilters.DGeoStability, // UserColumnFilters.DGeoStabilityCPhiModel, // UserColumnFilters.DGeoStabilitySuCalculated, // UserColumnFilters.DGeoStabilitySuMeasured, // UserColumnFilters.DGeoStabilitySuGradient, // UserColumnFilters.ShearStrengthParameters, // UserColumnFilters.ShearStrengthInput, // UserColumnFilters.ShearStrengthModel, - UserColumnFilters.Piping, - UserColumnFilters.FlowSlideGlobalDetailed, + UserColumnFilters.Piping, + UserColumnFilters.FlowSlideGlobalDetailed, // UserColumnFilters.UnitWeightFilter, // UserColumnFilters.Probabilistic, // UserColumnFilters.StiffnessParameters, // UserColumnFilters.BishopProbabilistic, - UserColumnFilters.FlowSlideAdvancedLiquefaction, - UserColumnFilters.FlowSlideAdvancedBreaching - }; + UserColumnFilters.FlowSlideAdvancedLiquefaction, + UserColumnFilters.FlowSlideAdvancedBreaching + }; } private void SaveSelectedDataAs() @@ -1177,9 +1152,9 @@ } var saveDialog = new SaveFileDialog - { - Filter = "Soilbase files (*.soil)|*.soil" - }; + { + Filter = "Soilbase files (*.soil)|*.soil" + }; if (saveDialog.ShowDialog() == DialogResult.OK) { var fileName = saveDialog.FileName; @@ -1195,12 +1170,12 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "CSV file|*.csv" - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "CSV file|*.csv" + }; openDialog.FileName = "soilprofiles.csv"; openDialog.FilterIndex = 0; openDialog.AutoUpgradeEnabled = false; @@ -1237,15 +1212,15 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "2D Profile files|*.sti;*.geo;*.dsx|Stability files (*.sti, *.dsx)|*.sti;*.dsx|Geometry files(*.geo)|*.geo|All files|*.*", - FilterIndex = 0, - AutoUpgradeEnabled = false, - Multiselect = true - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "2D Profile files|*.sti;*.geo;*.dsx|Stability files (*.sti, *.dsx)|*.sti;*.dsx|Geometry files(*.geo)|*.geo|All files|*.*", + FilterIndex = 0, + AutoUpgradeEnabled = false, + Multiselect = true + }; if (openDialog.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; @@ -1281,12 +1256,12 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "Soil database (access)|*.mdb|Geobase database (Firebird)|*.gdb" - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "Soil database (access)|*.mdb|Geobase database (Firebird)|*.gdb" + }; openDialog.FileName = "soilmaterials.mdb"; openDialog.FilterIndex = 0; openDialog.AutoUpgradeEnabled = false; @@ -1322,14 +1297,14 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "Dam data definition(*.defx)|*.defx", - FilterIndex = 0, - AutoUpgradeEnabled = false - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "Dam data definition(*.defx)|*.defx", + FilterIndex = 0, + AutoUpgradeEnabled = false + }; if (openDialog.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; @@ -1339,10 +1314,7 @@ string defxFile = openDialog.FileName; string locationsShpFile = ""; - DataEventPublisher.InvokeWithoutPublishingEvents(() => - { - DSoilModelIO.ReadDamDefinitionsFromFileAndAddToProject(defxFile, project, ref locationsShpFile); - }); + DataEventPublisher.InvokeWithoutPublishingEvents(() => { DSoilModelIO.ReadDamDefinitionsFromFileAndAddToProject(defxFile, project, ref locationsShpFile); }); // reset project mapEditor.Project = project; @@ -1385,14 +1357,14 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "Old project database (access)|*.mdb|Old project database (Firebird)|*.gdb", - FilterIndex = 0, - AutoUpgradeEnabled = false - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "Old project database (access)|*.mdb|Old project database (Firebird)|*.gdb", + FilterIndex = 0, + AutoUpgradeEnabled = false + }; if (openDialog.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; @@ -1426,15 +1398,15 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "GEF CPT file|*.gef", - FilterIndex = 0, - Multiselect = true, - AutoUpgradeEnabled = false - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "GEF CPT file|*.gef", + FilterIndex = 0, + Multiselect = true, + AutoUpgradeEnabled = false + }; if (openDialog.ShowDialog() == DialogResult.OK) { //User can choose several files at once. @@ -1483,15 +1455,15 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "GEF Boring file|*.gef", - FilterIndex = 0, - Multiselect = true, - AutoUpgradeEnabled = false - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "GEF Boring file|*.gef", + FilterIndex = 0, + Multiselect = true, + AutoUpgradeEnabled = false + }; if (openDialog.ShowDialog() == DialogResult.OK) { //User can choose several files at once. @@ -1539,13 +1511,13 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "Surface line files|*.csv", - FilterIndex = 0 - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "Surface line files|*.csv", + FilterIndex = 0 + }; openDialog.FileName = "surfacelines.csv"; openDialog.Multiselect = true; openDialog.AutoUpgradeEnabled = false; @@ -1583,13 +1555,13 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true, - Filter = "Characteristic point files|*.csv", - FilterIndex = 0 - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true, + Filter = "Characteristic point files|*.csv", + FilterIndex = 0 + }; openDialog.FileName = "characteristicpoints.csv"; openDialog.Multiselect = true; openDialog.AutoUpgradeEnabled = false; @@ -1626,11 +1598,11 @@ try { var openDialog = new OpenFileDialog - { - FileName = "", - CheckFileExists = true, - CheckPathExists = true - }; + { + FileName = "", + CheckFileExists = true, + CheckPathExists = true + }; openDialog.Filter = "CSV|*.csv"; openDialog.FilterIndex = 0; openDialog.FileName = "segments.csv"; @@ -1647,7 +1619,7 @@ { DSoilModelIO.ReadCsvSegmentsFromFileAndAddToProject(fileName, project); project.CurrentFailureMechanism = Mechanism.None; - } + } } } catch (Exception ex) @@ -1667,7 +1639,7 @@ DataEventPublisher.DataListModified(project.SoilSegments); BindSupport.UpdateAll(); project.CurrentFailureMechanism = Mechanism.None; - } + } } private void SoilSegmentsShapeImport() @@ -1801,7 +1773,7 @@ filmStrip.SelectedStochasticSoilModel = selectedSoilModel; filmStrip.SelectedStochasticSoilProfile = selectedSoilProfile; } - geometryEditor.ShowSoilSegment(currentSoilSegment, selectedSoilProfile); + GeometryEditor.ShowSoilSegment(currentSoilSegment, selectedSoilProfile); } } @@ -1828,7 +1800,7 @@ filmStrip.SelectedStochasticSoilModel = selectedSoilModel; filmStrip.SelectedStochasticSoilProfile = currentSoilProfile; } - geometryEditor.ShowSoilSegment(soilSegment, currentSoilProfile); + GeometryEditor.ShowSoilSegment(soilSegment, currentSoilProfile); } }