Index: Core/Common/src/Core.Common.Controls/Dialogs/DialogBase.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Core/Common/src/Core.Common.Controls/Dialogs/DialogBase.cs (.../DialogBase.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Controls/Dialogs/DialogBase.cs (.../DialogBase.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -71,6 +71,23 @@
/// The minimum height of the dialog.
/// Thrown when or is null.
/// Thrown when or is not greater than 0.
+ protected DialogBase(IWin32Window dialogParent, Bitmap icon, int minWidth, int minHeight) :
+ this(dialogParent, BitmapToIcon(icon), minWidth, minHeight) { }
+
+ private static Icon BitmapToIcon(Bitmap icon)
+ {
+ return (icon == null) ? null : Icon.FromHandle(icon.GetHicon());
+ }
+
+ ///
+ /// Constructs a new .
+ ///
+ /// The owner of the dialog.
+ /// The icon to show in the control box.
+ /// The minimum width of the dialog.
+ /// The minimum height of the dialog.
+ /// Thrown when or is null.
+ /// Thrown when or is not greater than 0.
protected DialogBase(IWin32Window dialogParent, Icon icon, int minWidth, int minHeight)
{
InitializeComponent();
Index: Core/Common/test/Core.Common.Controls.Test/Dialogs/DialogBaseTest.cs
===================================================================
diff -u -r0358065f73923af6b8ca6566ee1e210c78c55e44 -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Core/Common/test/Core.Common.Controls.Test/Dialogs/DialogBaseTest.cs (.../DialogBaseTest.cs) (revision 0358065f73923af6b8ca6566ee1e210c78c55e44)
+++ Core/Common/test/Core.Common.Controls.Test/Dialogs/DialogBaseTest.cs (.../DialogBaseTest.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -35,7 +35,7 @@
var mocks = new MockRepository();
var window = mocks.Stub();
- TestDelegate test = () => new TestDialog(window, null, 1, 2);
+ TestDelegate test = () => new TestDialog(window, (Icon) null, 1, 2);
// Call
var message = Assert.Throws(test).Message;
@@ -44,6 +44,22 @@
StringAssert.EndsWith("icon", message);
}
+ [Test]
+ public void Constructor_BitmapEqualsNull_ArgumentNullExceptionIsThrown()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var window = mocks.Stub();
+
+ TestDelegate test = () => new TestDialog(window, (Bitmap) null, 1, 2);
+
+ // Call
+ var message = Assert.Throws(test).Message;
+
+ // Assert
+ StringAssert.EndsWith("icon", message);
+ }
+
[TestCase(-1)]
[TestCase(0)]
public void Constructor_IncorrectMinWidth_ArgumentExceptionIsThrown(int minWidth)
@@ -166,6 +182,9 @@
private class TestDialog : DialogBase
{
+ public TestDialog(IWin32Window dialogParent, Bitmap icon, int minWidth, int minHeight)
+ : base(dialogParent, icon, minWidth, minHeight) { }
+
public TestDialog(IWin32Window dialogParent, Icon icon, int minWidth, int minHeight)
: base(dialogParent, icon, minWidth, minHeight) {}
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -0,0 +1,56 @@
+using System.Collections.Generic;
+using System.Linq;
+
+using Core.Common.Base.Geometry;
+
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Forms
+{
+ ///
+ /// Class holds methods to help views when dealing with
+ ///
+ public static class PipingCalculationConfigurationHelper
+ {
+ ///
+ /// Gets the piping soil profiles matching the input of a calculation.
+ ///
+ /// The surface line used to match a .
+ /// The available soil models.
+ /// The (sub)set of soil profiles from
+ /// or empty if no matching instances can be found
+ /// or when there is not enough information to associate soil profiles to the calculation.
+ public static IEnumerable GetPipingSoilProfilesForSurfaceLine(RingtoetsPipingSurfaceLine surfaceLine, IEnumerable availableSoilModels)
+ {
+ if (surfaceLine == null)
+ {
+ return Enumerable.Empty();
+ }
+
+ Segment2D[] surfaceLineSegments = Math2D.ConvertLinePointsToLineSegments(surfaceLine.Points.Select(p => new Point2D(p.X, p.Y))).ToArray();
+
+ var soilProfileObjectsForCalculation = new List();
+ foreach (StochasticSoilModel stochasticSoilModel in availableSoilModels.Where(sm => sm.StochasticSoilProfiles.Any()))
+ {
+ if (DoesSoilModelGeometryIntersectWithSurfaceLineGeometry(stochasticSoilModel, surfaceLineSegments))
+ {
+ soilProfileObjectsForCalculation.AddRange(stochasticSoilModel.StochasticSoilProfiles.Select(ssp => ssp.SoilProfile));
+ }
+ }
+ return soilProfileObjectsForCalculation;
+ }
+
+ private static bool DoesSoilModelGeometryIntersectWithSurfaceLineGeometry(StochasticSoilModel stochasticSoilModel, Segment2D[] surfaceLineSegments)
+ {
+ IEnumerable soilProfileGeometrySegments = Math2D.ConvertLinePointsToLineSegments(stochasticSoilModel.Geometry);
+ return soilProfileGeometrySegments.Any(s => DoesSegmentIntersectWithSegmentArray(s, surfaceLineSegments));
+ }
+
+ private static bool DoesSegmentIntersectWithSegmentArray(Segment2D segment, Segment2D[] segmentArray)
+ {
+ // Consider intersections and overlaps similarly
+ return segmentArray.Any(sls => Math2D.GetIntersectionBetweenSegments(segment, sls).IntersectionType != Intersection2DType.DoesNotIntersect);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag bff183a6d323111affe69f3afa19b9ada02c9375 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationHelper.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.Designer.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.Designer.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.Designer.cs (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -0,0 +1,76 @@
+namespace Ringtoets.Piping.Forms
+{
+ partial class PipingSurfaceLineSelectionDialog
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PipingSurfaceLineSelectionDialog));
+ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+ this.OkButton = new System.Windows.Forms.Button();
+ this.CancelButton = new System.Windows.Forms.Button();
+ this.flowLayoutPanel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // flowLayoutPanel1
+ //
+ this.flowLayoutPanel1.Controls.Add(this.CancelButton);
+ this.flowLayoutPanel1.Controls.Add(this.OkButton);
+ resources.ApplyResources(this.flowLayoutPanel1, "flowLayoutPanel1");
+ this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+ //
+ // OkButton
+ //
+ resources.ApplyResources(this.OkButton, "OkButton");
+ this.OkButton.Name = "OkButton";
+ this.OkButton.UseVisualStyleBackColor = true;
+ this.OkButton.Click += new System.EventHandler(this.OkButtonOnClick);
+ //
+ // CancelButton
+ //
+ resources.ApplyResources(this.CancelButton, "CancelButton");
+ this.CancelButton.Name = "CancelButton";
+ this.CancelButton.UseVisualStyleBackColor = true;
+ this.CancelButton.Click += new System.EventHandler(this.CancelButtonOnClick);
+ //
+ // PipingSurfaceLineSelectionDialog
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.flowLayoutPanel1);
+ this.Name = "PipingSurfaceLineSelectionDialog";
+ this.flowLayoutPanel1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
+ private System.Windows.Forms.Button CancelButton;
+ private System.Windows.Forms.Button OkButton;
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.cs (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using Core.Common.Controls.Dialogs;
+using Ringtoets.Piping.Forms.Properties;
+using Ringtoets.Piping.Forms.Views;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Forms
+{
+ public partial class PipingSurfaceLineSelectionDialog : DialogBase
+ {
+ public PipingSurfaceLineSelectionDialog(IWin32Window dialogParent, IEnumerable surfaceLines)
+ : base(dialogParent, Resources.GeneratePipingCalculationsIcon, 300, 600)
+ {
+ InitializeComponent();
+
+ PipingSurfaceLineSelectionView = new PipingSurfaceLineSelectionView(surfaceLines)
+ {
+ Dock = DockStyle.Fill
+ };
+ Controls.Add(PipingSurfaceLineSelectionView);
+ }
+
+ private PipingSurfaceLineSelectionView PipingSurfaceLineSelectionView { get; set; }
+
+ public IEnumerable SelectedSurfaceLines { get; set; }
+
+ protected override Button GetCancelButton()
+ {
+ return CancelButton;
+ }
+
+ private void OkButtonOnClick(object sender, EventArgs e)
+ {
+ SelectedSurfaceLines = PipingSurfaceLineSelectionView.GetSelectedSurfaceLines();
+ Close();
+ }
+
+ private void CancelButtonOnClick(object sender, EventArgs eventArgs)
+ {
+ SelectedSurfaceLines = new List();
+ Close();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.resx
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.resx (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingSurfaceLineSelectionDialog.resx (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -0,0 +1,216 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ 293, 3
+
+
+ 75, 23
+
+
+
+ 1
+
+
+ Annuleren
+
+
+ CancelButton
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ flowLayoutPanel1
+
+
+ 0
+
+
+ 212, 3
+
+
+ 75, 23
+
+
+ 0
+
+
+ Genereren
+
+
+ OkButton
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ flowLayoutPanel1
+
+
+ 1
+
+
+
+ Bottom
+
+
+ 0, 297
+
+
+ Yes
+
+
+ 371, 30
+
+
+ 0
+
+
+ flowLayoutPanel1
+
+
+ System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 0
+
+
+ True
+
+
+ 6, 13
+
+
+ 371, 327
+
+
+ Selecteer profielschematisaties
+
+
+ PipingSurfaceLineSelectionDialog
+
+
+ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r5b575c7019f5ec9d0db2784fda5cb5c7b4df9a90 -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5b575c7019f5ec9d0db2784fda5cb5c7b4df9a90)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.18444
+// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -477,6 +477,16 @@
}
///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap GeneratePipingCalculationsIcon {
+ get {
+ object obj = ResourceManager.GetObject("GeneratePipingCalculationsIcon", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Importeer ondergrondschematiseringen.
///
public static string Import_SoilProfiles {
@@ -658,6 +668,24 @@
}
///
+ /// Looks up a localized string similar to Genereer scenario's.
+ ///
+ public static string PipingCalculationGroup_Generate_PipingCalculations {
+ get {
+ return ResourceManager.GetString("PipingCalculationGroup_Generate_PipingCalculations", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Genereer scenario's op basis van geselecteerde profielschematisaties..
+ ///
+ public static string PipingCalculationGroup_Generate_PipingCalculations_ToolTip {
+ get {
+ return ResourceManager.GetString("PipingCalculationGroup_Generate_PipingCalculations_ToolTip", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Naam van de berekeningsmap..
///
public static string PipingCalculationGroup_Name_Description {
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx
===================================================================
diff -u -r5b575c7019f5ec9d0db2784fda5cb5c7b4df9a90 -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 5b575c7019f5ec9d0db2784fda5cb5c7b4df9a90)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -712,4 +712,13 @@
Stochastisch ondergrondmodellen
+
+ ..\resources\wand-hat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Genereer scenario's
+
+
+ Genereer scenario's op basis van geselecteerde profielschematisaties.
+
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Resources/wand-hat.png
===================================================================
diff -u
Binary files differ
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj
===================================================================
diff -u -r0cc720a1127d4a67a8620e045eaed48d312f7972 -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 0cc720a1127d4a67a8620e045eaed48d312f7972)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -53,7 +53,13 @@
Properties\GlobalAssembly.cs
-
+
+
+ Form
+
+
+ PipingSurfaceLineSelectionDialog.cs
+
@@ -194,6 +200,9 @@
+
+ PipingSurfaceLineSelectionDialog.cs
+
PublicResXFileCodeGenerator
Resources.Designer.cs
@@ -243,6 +252,9 @@
+
+
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs
===================================================================
diff -u -r375428303ce2602d07cef6b01b4aaf9eaf1f4722 -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 375428303ce2602d07cef6b01b4aaf9eaf1f4722)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -346,7 +346,7 @@
{
return Enumerable.Empty();
}
- return PipingCalculationHelper.GetPipingSoilProfilesForCalculation(pipingCalculation, pipingFailureMechanism.StochasticSoilModels);
+ return PipingCalculationConfigurationHelper.GetPipingSoilProfilesForSurfaceLine(pipingCalculation.InputParameters.SurfaceLine, pipingFailureMechanism.StochasticSoilModels);
}
private static void SetItemsOnObjectCollection(DataGridViewComboBoxCell.ObjectCollection objectCollection, object[] comboBoxItems)
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.Designer.cs
===================================================================
diff -u -r1a0c6531ce4051b92eb6d2b770392f7c226159fa -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.Designer.cs (.../PipingSurfaceLineSelectionView.Designer.cs) (revision 1a0c6531ce4051b92eb6d2b770392f7c226159fa)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.Designer.cs (.../PipingSurfaceLineSelectionView.Designer.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -34,8 +34,8 @@
this.SelectAllButton = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.SurfaceLineDataGrid = new System.Windows.Forms.DataGridView();
- this.UseColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.SurfaceLineNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.UseColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SurfaceLineDataGrid)).BeginInit();
@@ -70,14 +70,26 @@
//
// SurfaceLineDataGrid
//
+ this.SurfaceLineDataGrid.AllowUserToAddRows = false;
+ this.SurfaceLineDataGrid.AllowUserToDeleteRows = false;
+ this.SurfaceLineDataGrid.AllowUserToResizeColumns = false;
+ this.SurfaceLineDataGrid.AllowUserToResizeRows = false;
this.SurfaceLineDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.SurfaceLineDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.UseColumn,
this.SurfaceLineNameColumn});
resources.ApplyResources(this.SurfaceLineDataGrid, "SurfaceLineDataGrid");
this.SurfaceLineDataGrid.Name = "SurfaceLineDataGrid";
this.SurfaceLineDataGrid.RowHeadersVisible = false;
+ this.SurfaceLineDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
//
+ // SurfaceLineNameColumn
+ //
+ this.SurfaceLineNameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.SurfaceLineNameColumn.DataPropertyName = "Name";
+ resources.ApplyResources(this.SurfaceLineNameColumn, "SurfaceLineNameColumn");
+ this.SurfaceLineNameColumn.Name = "SurfaceLineNameColumn";
+ //
// UseColumn
//
this.UseColumn.DataPropertyName = "Selected";
@@ -86,14 +98,6 @@
this.UseColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.UseColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
- // SurfaceLineNameColumn
- //
- this.SurfaceLineNameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.SurfaceLineNameColumn.DataPropertyName = "Name";
- resources.ApplyResources(this.SurfaceLineNameColumn, "SurfaceLineNameColumn");
- this.SurfaceLineNameColumn.Name = "SurfaceLineNameColumn";
- this.SurfaceLineNameColumn.ReadOnly = true;
- //
// PipingSurfaceLineSelectionView
//
resources.ApplyResources(this, "$this");
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.cs
===================================================================
diff -u -r1a0c6531ce4051b92eb6d2b770392f7c226159fa -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.cs (.../PipingSurfaceLineSelectionView.cs) (revision 1a0c6531ce4051b92eb6d2b770392f7c226159fa)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.cs (.../PipingSurfaceLineSelectionView.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -48,6 +48,7 @@
{
item.Selected = true;
}
+ SurfaceLineDataGrid.Invalidate();
}
private void OnSelectNoneClick(object sender, EventArgs e)
@@ -56,6 +57,7 @@
{
item.Selected = false;
}
+ SurfaceLineDataGrid.Invalidate();
}
private class SurfaceLineSelectionRow
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.resx
===================================================================
diff -u -r1a0c6531ce4051b92eb6d2b770392f7c226159fa -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.resx (.../PipingSurfaceLineSelectionView.resx) (revision 1a0c6531ce4051b92eb6d2b770392f7c226159fa)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSurfaceLineSelectionView.resx (.../PipingSurfaceLineSelectionView.resx) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -117,63 +117,14 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- SelectNoneButton
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- panel1
-
-
- 0
-
-
- SelectAllButton
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- panel1
-
-
- 1
-
-
-
- Top
-
-
- 0, 0
-
-
- 303, 29
-
-
-
- 0
-
-
- panel1
-
-
- System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
-
-
- 1
-
98, 3
100, 23
+
1
@@ -216,6 +167,31 @@
1
+
+
+ Top
+
+
+ 0, 0
+
+
+ 303, 29
+
+
+ 0
+
+
+ panel1
+
+
+ System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 1
+
True
@@ -288,18 +264,18 @@
303, 150
-
- UseColumn
-
-
- System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
SurfaceLineNameColumn
System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ UseColumn
+
+
+ System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
PipingSurfaceLineSelectionView
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingCalculationGenerator.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingCalculationGenerator.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingCalculationGenerator.cs (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -0,0 +1,52 @@
+using System.Collections.Generic;
+using System.Linq;
+using Ringtoets.Common.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Forms;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Plugin
+{
+ ///
+ /// This class provides helpers to generate based on
+ /// and a for given .
+ ///
+ public static class PipingCalculationGenerator
+ {
+ public static IEnumerable Generate(IEnumerable ringtoetsPipingSurfaceLines, IEnumerable soilModels)
+ {
+ if (ringtoetsPipingSurfaceLines == null)
+ {
+ return Enumerable.Empty();
+ }
+ var pipingCalculationGroups = ringtoetsPipingSurfaceLines.Select(sl => CreateCalculationGroup(sl, soilModels));
+ return pipingCalculationGroups;
+ }
+
+ private static IPipingCalculationItem CreateCalculationGroup(RingtoetsPipingSurfaceLine surfaceLine, IEnumerable soilModels)
+ {
+ var pipingCalculationGroup = new PipingCalculationGroup(surfaceLine.Name, true);
+ if (soilModels != null)
+ {
+ foreach (var profile in PipingCalculationConfigurationHelper.GetPipingSoilProfilesForSurfaceLine(surfaceLine, soilModels))
+ {
+ pipingCalculationGroup.Children.Add(CreatePipingCalculation(surfaceLine, profile));
+ }
+ }
+
+ return pipingCalculationGroup;
+ }
+
+ private static IPipingCalculationItem CreatePipingCalculation(RingtoetsPipingSurfaceLine surfaceLine, PipingSoilProfile profile)
+ {
+ return new PipingCalculation(new GeneralPipingInput(), new SemiProbabilisticPipingInput())
+ {
+ InputParameters =
+ {
+ SurfaceLine = surfaceLine,
+ SoilProfile = profile
+ }
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs
===================================================================
diff -u -r034b8b3af2065f21c18e7e08cba0e69055cfe6bf -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 034b8b3af2065f21c18e7e08cba0e69055cfe6bf)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -30,10 +30,12 @@
using Core.Common.Gui.Forms;
using Core.Common.Gui.Forms.ProgressDialog;
using Core.Common.Gui.Plugin;
+using Core.Common.Gui.Properties;
using Ringtoets.Common.Data;
using Ringtoets.Common.Forms.Helpers;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Forms;
using Ringtoets.Piping.Forms.PresentationObjects;
using Ringtoets.Piping.Forms.PropertyClasses;
using Ringtoets.Piping.Forms.Views;
@@ -657,6 +659,8 @@
nodeData.NotifyObservers();
});
+ var generateCalculationsItem = CreateGeneratePipingCalculationsItem(nodeData);
+
var validateAllItem = CreateValidateAllItem(group);
var calculateAllItem = CreateCalculateAllItem(group);
@@ -690,6 +694,8 @@
{
builder
.AddOpenItem()
+ .AddSeparator()
+ .AddCustomItem(generateCalculationsItem)
.AddSeparator();
}
@@ -730,6 +736,36 @@
.Build();
}
+ private StrictContextMenuItem CreateGeneratePipingCalculationsItem(PipingCalculationGroupContext nodeData)
+ {
+ var generateCalculationsItem = new StrictContextMenuItem(
+ PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations,
+ PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_ToolTip,
+ PipingFormsResources.GeneratePipingCalculationsIcon, (o, args) =>
+ {
+ ShowSurfaceLineSelectionDialog(nodeData);
+ });
+ return generateCalculationsItem;
+ }
+
+ private void ShowSurfaceLineSelectionDialog(PipingCalculationGroupContext nodeData)
+ {
+ var view = new PipingSurfaceLineSelectionDialog(Gui.MainWindow, nodeData.AvailablePipingSurfaceLines);
+ view.ShowDialog();
+
+ GeneratePipingCalculations(nodeData.WrappedData, view.SelectedSurfaceLines);
+
+ nodeData.NotifyObservers();
+ }
+
+ private void GeneratePipingCalculations(PipingCalculationGroup target, IEnumerable surfaceLines)
+ {
+ foreach (var group in PipingCalculationGenerator.Generate(surfaceLines, null))
+ {
+ target.Children.Add(group);
+ }
+ }
+
private StrictContextMenuItem CreateCalculateAllItem(PipingCalculationGroup group)
{
var menuItem = new StrictContextMenuItem(
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj
===================================================================
diff -u -r44055100aa3c3f382227becdaeae7d97c75d386c -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj (.../Ringtoets.Piping.Plugin.csproj) (revision 44055100aa3c3f382227becdaeae7d97c75d386c)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj (.../Ringtoets.Piping.Plugin.csproj) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -64,6 +64,7 @@
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PipingCalculationConfigurationHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PipingCalculationConfigurationHelperTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PipingCalculationConfigurationHelperTest.cs (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -0,0 +1,263 @@
+using System.Collections.Generic;
+using System.Linq;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Forms.Test
+{
+ [TestFixture]
+ public class PipingCalculationConfigurationHelperTest
+ {
+ [Test]
+ public void GetPipingSoilProfilesForSurfaceLine_SurfaceLineIntersectingSoilModel_ReturnSoilProfilesOfSoilModel()
+ {
+ // Setup
+ var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new []
+ {
+ new PipingSoilLayer(-5.0),
+ new PipingSoilLayer(-2.0),
+ new PipingSoilLayer(1.0)
+ }, 1);
+ var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[]
+ {
+ new PipingSoilLayer(-4.0),
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(4.0)
+ }, 2);
+
+ var soilModel = new StochasticSoilModel(1, "A", "B");
+ soilModel.Geometry.AddRange(new[]{ new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) });
+ soilModel.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(0.3, SoilProfileType.SoilProfile1D, 1)
+ {
+ SoilProfile = soilProfile1
+ },
+ new StochasticSoilProfile(0.7, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ }
+ });
+ var availableSoilModels = new[]
+ {
+ soilModel
+ };
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(3.0, 5.0, 0.0),
+ new Point3D(3.0, 0.0, 1.0),
+ new Point3D(3.0, -5.0, 0.0)
+ });
+
+ // Call
+ IEnumerable result = PipingCalculationConfigurationHelper.GetPipingSoilProfilesForSurfaceLine(surfaceLine, availableSoilModels);
+
+ // Assert
+ PipingSoilProfile[] expected = { soilProfile1, soilProfile2 };
+ CollectionAssert.AreEquivalent(expected, result);
+ }
+
+ [Test]
+ public void GetPipingSoilProfilesForSurfaceLine_NoSurfaceLine_ReturnEmpty()
+ {
+ // Setup
+ var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[]
+ {
+ new PipingSoilLayer(-5.0),
+ new PipingSoilLayer(-2.0),
+ new PipingSoilLayer(1.0)
+ }, 1);
+ var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[]
+ {
+ new PipingSoilLayer(-4.0),
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(4.0)
+ }, 2);
+
+ var soilModel = new StochasticSoilModel(1, "A", "B");
+ soilModel.Geometry.AddRange(new[] { new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) });
+ soilModel.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(0.3, SoilProfileType.SoilProfile1D, 1)
+ {
+ SoilProfile = soilProfile1
+ },
+ new StochasticSoilProfile(0.7, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ }
+ });
+ var availableSoilModels = new[]
+ {
+ soilModel
+ };
+
+ // Call
+ IEnumerable result = PipingCalculationConfigurationHelper.GetPipingSoilProfilesForSurfaceLine(null, availableSoilModels);
+
+ // Assert
+ CollectionAssert.IsEmpty(result);
+ }
+
+ [Test]
+ public void GetPipingSoilProfilesForSurfaceLine_NoSoilModels_ReturnEmpty()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(3.0, 5.0, 0.0),
+ new Point3D(3.0, 0.0, 1.0),
+ new Point3D(3.0, -5.0, 0.0)
+ });
+
+ // Call
+ IEnumerable result = PipingCalculationConfigurationHelper.GetPipingSoilProfilesForSurfaceLine(surfaceLine, Enumerable.Empty());
+
+ // Assert
+ CollectionAssert.IsEmpty(result);
+ }
+
+ [Test]
+ public void GetPipingSoilProfilesForSurfaceLine_NoSoilProfiles_ReturnEmpty()
+ {
+ // Setup
+ var soilModel = new StochasticSoilModel(1, "A", "B");
+ soilModel.Geometry.AddRange(new[] { new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) });
+
+ var availableSoilModels = new[]
+ {
+ soilModel
+ };
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(3.0, 5.0, 0.0),
+ new Point3D(3.0, 0.0, 1.0),
+ new Point3D(3.0, -5.0, 0.0)
+ });
+
+ // Call
+ IEnumerable result = PipingCalculationConfigurationHelper.GetPipingSoilProfilesForSurfaceLine(surfaceLine, availableSoilModels);
+
+ // Assert
+ CollectionAssert.IsEmpty(result);
+ }
+
+ [Test]
+ public void GetPipingSoilProfilesForSurfaceLine_SoilModelGeometryNotIntersecting_ReturnEmpty()
+ {
+ // Setup
+ var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[]
+ {
+ new PipingSoilLayer(-5.0),
+ new PipingSoilLayer(-2.0),
+ new PipingSoilLayer(1.0)
+ }, 1);
+ var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[]
+ {
+ new PipingSoilLayer(-4.0),
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(4.0)
+ }, 2);
+
+ var soilModel = new StochasticSoilModel(1, "A", "B");
+ soilModel.Geometry.AddRange(new[] { new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) });
+ soilModel.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(0.3, SoilProfileType.SoilProfile1D, 1)
+ {
+ SoilProfile = soilProfile1
+ },
+ new StochasticSoilProfile(0.7, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ }
+ });
+ var availableSoilModels = new[]
+ {
+ soilModel
+ };
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0.0, 1.0, 0.0),
+ new Point3D(2.5, 1.0, 1.0),
+ new Point3D(5.0, 1.0, 0.0)
+ });
+
+ // Call
+ IEnumerable result = PipingCalculationConfigurationHelper.GetPipingSoilProfilesForSurfaceLine(surfaceLine, availableSoilModels);
+
+ // Assert
+ CollectionAssert.IsEmpty(result);
+ }
+
+ [Test]
+ public void GetPipingSoilProfilesForSurfaceLine_SurfaceLineOverlappingSoilModel_ReturnSoilProfilesOfSoilModel()
+ {
+ // Setup
+ var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[]
+ {
+ new PipingSoilLayer(-5.0),
+ new PipingSoilLayer(-2.0),
+ new PipingSoilLayer(1.0)
+ }, 1);
+ var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[]
+ {
+ new PipingSoilLayer(-4.0),
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(4.0)
+ }, 2);
+
+ const double y = 1.1;
+ var soilModel1 = new StochasticSoilModel(1, "A", "B");
+ soilModel1.Geometry.AddRange(new[] { new Point2D(1.0, y), new Point2D(2.0, y) });
+ soilModel1.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 1)
+ {
+ SoilProfile = soilProfile1
+ },
+ });
+
+ var soilModel2 = new StochasticSoilModel(1, "A", "B");
+ soilModel2.Geometry.AddRange(new[] { new Point2D(3.0, y), new Point2D(4.0, y) });
+ soilModel2.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ }
+ });
+ var availableSoilModels = new[]
+ {
+ soilModel1, soilModel2
+ };
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(5.0, y, 0.0),
+ new Point3D(2.5, y, 1.0),
+ new Point3D(0.0, y, 0.0)
+ });
+
+ // Call
+ IEnumerable result = PipingCalculationConfigurationHelper.GetPipingSoilProfilesForSurfaceLine(surfaceLine, availableSoilModels);
+
+ // Assert
+ PipingSoilProfile[] expected = { soilProfile1, soilProfile2 };
+ CollectionAssert.AreEquivalent(expected, result);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag bff183a6d323111affe69f3afa19b9ada02c9375 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PipingCalculationHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj
===================================================================
diff -u -raff8fc48a43b93900f018a54864e2d36e4496c28 -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision aff8fc48a43b93900f018a54864e2d36e4496c28)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -59,7 +59,7 @@
-
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs
===================================================================
diff -u -r246217c799d79397354f304b4df013ef67bae07a -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 246217c799d79397354f304b4df013ef67bae07a)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -32,6 +32,8 @@
private PipingGuiPlugin plugin;
private TreeNodeInfo info;
+ private const int contextMenuAddGenerateCalculationsIndex = 2;
+
private const int contextMenuAddCalculationGroupIndex = 0;
private const int contextMenuAddCalculationIndex = 1;
private const int contextMenuValidateAllIndex = 3;
@@ -449,63 +451,69 @@
ContextMenuStrip menu = info.ContextMenuStrip(nodeData, parentData, treeViewControl);
// Assert
- Assert.AreEqual(16, menu.Items.Count);
- TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndex + 2,
+ var mainCalculationGroupContextMenuItemOffset = 4;
+ Assert.AreEqual(18, menu.Items.Count);
+ TestHelper.AssertContextMenuStripContainsItem(menu, 2,
+ PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations,
+ PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_ToolTip,
+ PipingFormsResources.GeneratePipingCalculationsIcon);
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndex + mainCalculationGroupContextMenuItemOffset,
PipingFormsResources.PipingCalculationGroup_Add_PipingCalculationGroup,
"Voeg een nieuwe berekeningsmap toe aan deze berekeningsmap.",
PipingFormsResources.AddFolderIcon);
- TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndex + 2,
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndex + mainCalculationGroupContextMenuItemOffset,
PipingFormsResources.PipingCalculationGroup_Add_PipingCalculation,
"Voeg een nieuwe berekening toe aan deze berekeningsmap.",
PipingFormsResources.PipingIcon);
- TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex + 2,
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex + mainCalculationGroupContextMenuItemOffset,
RingtoetsFormsResources.Validate_all,
"Valideer alle berekeningen binnen deze berekeningsmap.",
RingtoetsFormsResources.ValidateAllIcon);
- TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex + 2,
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex + mainCalculationGroupContextMenuItemOffset,
RingtoetsFormsResources.Calculate_all,
"Valideer en voer alle berekeningen binnen deze berekeningsmap uit.",
RingtoetsFormsResources.CalculateAllIcon);
- TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearOutputIndex + 2,
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearOutputIndex + mainCalculationGroupContextMenuItemOffset,
"&Wis alle uitvoer...",
"Wis de uitvoer van alle berekeningen binnen deze berekeningsmap.",
RingtoetsFormsResources.ClearIcon);
- TestHelper.AssertContextMenuStripContainsItem(menu, 9,
+ TestHelper.AssertContextMenuStripContainsItem(menu, 11,
CoreCommonGuiResources.Import,
CoreCommonGuiResources.Import_ToolTip,
CoreCommonGuiResources.ImportIcon,
false);
- TestHelper.AssertContextMenuStripContainsItem(menu, 10,
+ TestHelper.AssertContextMenuStripContainsItem(menu, 12,
CoreCommonGuiResources.Export,
CoreCommonGuiResources.Export_ToolTip,
CoreCommonGuiResources.ExportIcon,
false);
- TestHelper.AssertContextMenuStripContainsItem(menu, 12,
+ TestHelper.AssertContextMenuStripContainsItem(menu, 14,
CoreCommonGuiResources.Expand_all,
CoreCommonGuiResources.Expand_all_ToolTip,
CoreCommonGuiResources.ExpandAllIcon,
false);
- TestHelper.AssertContextMenuStripContainsItem(menu, 13,
+ TestHelper.AssertContextMenuStripContainsItem(menu, 15,
CoreCommonGuiResources.Collapse_all,
CoreCommonGuiResources.Collapse_all_ToolTip,
CoreCommonGuiResources.CollapseAllIcon,
false);
- TestHelper.AssertContextMenuStripContainsItem(menu, 15,
+ TestHelper.AssertContextMenuStripContainsItem(menu, 17,
CoreCommonGuiResources.Properties,
CoreCommonGuiResources.Properties_ToolTip,
CoreCommonGuiResources.PropertiesHS,
false);
CollectionAssert.AllItemsAreInstancesOfType(new[]
{
menu.Items[1],
- menu.Items[4],
- menu.Items[8],
- menu.Items[11],
- menu.Items[14]
+ menu.Items[3],
+ menu.Items[6],
+ menu.Items[10],
+ menu.Items[13],
+ menu.Items[16]
}, typeof(ToolStripSeparator));
mocks.VerifyAll();
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingCalculationGeneratorTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingCalculationGeneratorTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingCalculationGeneratorTest.cs (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -0,0 +1,412 @@
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Plugin.Test
+{
+ [TestFixture]
+ public class PipingCalculationGeneratorTest
+ {
+ [Test]
+ public void Generate_WithoutSurfaceLines_ReturnsEmptyCollection()
+ {
+ // Call
+ var result = PipingCalculationGenerator.Generate(null, null).ToList();
+
+ // Assert
+ Assert.AreEqual(0, result.Count);
+ }
+
+ [Test]
+ public void Generate_WithEmptySurfaceLines_ReturnsEmptyCollection()
+ {
+ // Call
+ var result = PipingCalculationGenerator.Generate(Enumerable.Empty(), null).ToList();
+
+ // Assert
+ Assert.AreEqual(0, result.Count);
+ }
+
+ [Test]
+ public void Generate_WithSurfaceLinesWithoutSoilModels_ReturnsFourEmptyGroups()
+ {
+ // Setup
+ var testName1 = "group1";
+ var testName2 = "group2";
+ var testName3 = "group3";
+ var testName4 = "group4";
+
+ var ringtoetsPipingSurfaceLines = new List
+ {
+ new RingtoetsPipingSurfaceLine {Name = testName1},
+ new RingtoetsPipingSurfaceLine {Name = testName2},
+ new RingtoetsPipingSurfaceLine {Name = testName3},
+ new RingtoetsPipingSurfaceLine {Name = testName4}
+ };
+
+ // Call
+ var result = PipingCalculationGenerator.Generate(ringtoetsPipingSurfaceLines, null).ToList();
+
+ // Assert
+ Assert.AreEqual(4, result.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(result, typeof(PipingCalculationGroup));
+ Assert.AreEqual(new[] { testName1, testName2, testName3, testName4 }, result.Select(g => g.Name));
+ Assert.AreEqual(new [] {0,0,0,0}, result.Select(g => ((PipingCalculationGroup)g).Children.Count));
+ }
+
+ [Test]
+ public void Generate_WithSurfaceLinesWithEmptySoilModels_ReturnsFourEmptyGroups()
+ {
+ // Setup
+ var testName1 = "group1";
+ var testName2 = "group2";
+ var testName3 = "group3";
+ var testName4 = "group4";
+
+ var ringtoetsPipingSurfaceLines = new List
+ {
+ new RingtoetsPipingSurfaceLine {Name = testName1},
+ new RingtoetsPipingSurfaceLine {Name = testName2},
+ new RingtoetsPipingSurfaceLine {Name = testName3},
+ new RingtoetsPipingSurfaceLine {Name = testName4}
+ };
+
+ // Call
+ var result = PipingCalculationGenerator.Generate(ringtoetsPipingSurfaceLines, Enumerable.Empty()).ToList();
+
+ // Assert
+ Assert.AreEqual(4, result.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(result, typeof(PipingCalculationGroup));
+ Assert.AreEqual(new[] { testName1, testName2, testName3, testName4 }, result.Select(g => g.Name));
+ Assert.AreEqual(new [] {0,0,0,0}, result.Select(g => ((PipingCalculationGroup)g).Children.Count));
+ }
+
+ [Test]
+ public void Generate_SurfaceLineIntersectingSoilModel_ReturnOneGroupWithTwoCalculations()
+ {
+ // Setup
+ var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[]
+ {
+ new PipingSoilLayer(-5.0),
+ new PipingSoilLayer(-2.0),
+ new PipingSoilLayer(1.0)
+ }, 1);
+ var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[]
+ {
+ new PipingSoilLayer(-4.0),
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(4.0)
+ }, 2);
+
+ var soilModel = new StochasticSoilModel(1, "A", "B");
+ soilModel.Geometry.AddRange(new[] { new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) });
+ soilModel.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(0.3, SoilProfileType.SoilProfile1D, 1)
+ {
+ SoilProfile = soilProfile1
+ },
+ new StochasticSoilProfile(0.7, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ }
+ });
+ var availableSoilModels = new[]
+ {
+ soilModel
+ };
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(3.0, 5.0, 0.0),
+ new Point3D(3.0, 0.0, 1.0),
+ new Point3D(3.0, -5.0, 0.0)
+ });
+
+ var surfaceLines = new[] { surfaceLine };
+
+ // Call
+ IEnumerable result = PipingCalculationGenerator.Generate(surfaceLines, availableSoilModels).ToList();
+
+ // Assert
+ Assert.AreEqual(1, result.Count());
+ var calculationGroup = result.First() as PipingCalculationGroup;
+ Assert.NotNull(calculationGroup);
+
+ Assert.AreEqual(2, calculationGroup.Children.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(calculationGroup.Children, typeof(PipingCalculation));
+
+ var calculationInput1 = ((PipingCalculation)calculationGroup.Children[0]).InputParameters;
+ Assert.AreSame(soilProfile1, calculationInput1.SoilProfile);
+ Assert.AreSame(surfaceLine, calculationInput1.SurfaceLine);
+
+ var calculationInput2 = ((PipingCalculation)calculationGroup.Children[1]).InputParameters;
+ Assert.AreSame(soilProfile2, calculationInput2.SoilProfile);
+ Assert.AreSame(surfaceLine, calculationInput2.SurfaceLine);
+ }
+
+ [Test]
+ public void Generate_NoSoilProfiles_ReturnOneEmptyGroup()
+ {
+ // Setup
+ var soilModel = new StochasticSoilModel(1, "A", "B");
+ soilModel.Geometry.AddRange(new[] { new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) });
+
+ var availableSoilModels = new[]
+ {
+ soilModel
+ };
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(3.0, 5.0, 0.0),
+ new Point3D(3.0, 0.0, 1.0),
+ new Point3D(3.0, -5.0, 0.0)
+ });
+
+ var surfaceLines = new[] { surfaceLine };
+
+ // Call
+ IEnumerable result = PipingCalculationGenerator.Generate(surfaceLines, availableSoilModels).ToList();
+
+ // Assert
+ Assert.AreEqual(1, result.Count());
+ var calculationGroup = result.First() as PipingCalculationGroup;
+ Assert.NotNull(calculationGroup);
+
+ Assert.IsEmpty(calculationGroup.Children);
+ }
+
+ [Test]
+ public void Generate_SoilModelGeometryNotIntersecting_ReturnOneEmptyGroup()
+ {
+ // Setup
+ var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[]
+ {
+ new PipingSoilLayer(-5.0),
+ new PipingSoilLayer(-2.0),
+ new PipingSoilLayer(1.0)
+ }, 1);
+ var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[]
+ {
+ new PipingSoilLayer(-4.0),
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(4.0)
+ }, 2);
+
+ var soilModel = new StochasticSoilModel(1, "A", "B");
+ soilModel.Geometry.AddRange(new[] { new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) });
+ soilModel.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(0.3, SoilProfileType.SoilProfile1D, 1)
+ {
+ SoilProfile = soilProfile1
+ },
+ new StochasticSoilProfile(0.7, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ }
+ });
+ var availableSoilModels = new[]
+ {
+ soilModel
+ };
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0.0, 1.0, 0.0),
+ new Point3D(2.5, 1.0, 1.0),
+ new Point3D(5.0, 1.0, 0.0)
+ });
+
+ var surfaceLines = new[] { surfaceLine };
+
+ // Call
+ IEnumerable result = PipingCalculationGenerator.Generate(surfaceLines, availableSoilModels).ToList();
+
+ // Assert
+ Assert.AreEqual(1, result.Count());
+ var calculationGroup = result.First() as PipingCalculationGroup;
+ Assert.NotNull(calculationGroup);
+
+ Assert.IsEmpty(calculationGroup.Children);
+ }
+
+ [Test]
+ public void Generate_SurfaceLineOverlappingSoilModel_ReturnOneGroupWithProfilesFromBothSoilModels()
+ {
+ // Setup
+ var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[]
+ {
+ new PipingSoilLayer(-5.0),
+ new PipingSoilLayer(-2.0),
+ new PipingSoilLayer(1.0)
+ }, 1);
+ var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[]
+ {
+ new PipingSoilLayer(-4.0),
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(4.0)
+ }, 2);
+
+ const double y = 1.1;
+ var soilModel1 = new StochasticSoilModel(1, "A", "B");
+ soilModel1.Geometry.AddRange(new[] { new Point2D(1.0, y), new Point2D(2.0, y) });
+ soilModel1.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 1)
+ {
+ SoilProfile = soilProfile1
+ },
+ });
+
+ var soilModel2 = new StochasticSoilModel(1, "A", "B");
+ soilModel2.Geometry.AddRange(new[] { new Point2D(3.0, y), new Point2D(4.0, y) });
+ soilModel2.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ }
+ });
+ var availableSoilModels = new[]
+ {
+ soilModel1, soilModel2
+ };
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(5.0, y, 0.0),
+ new Point3D(2.5, y, 1.0),
+ new Point3D(0.0, y, 0.0)
+ });
+
+ var surfaceLines = new[] { surfaceLine };
+
+ // Call
+ IEnumerable result = PipingCalculationGenerator.Generate(surfaceLines, availableSoilModels).ToList();
+
+ // Assert
+ Assert.AreEqual(1, result.Count());
+ var calculationGroup = result.First() as PipingCalculationGroup;
+ Assert.NotNull(calculationGroup);
+
+ Assert.AreEqual(2, calculationGroup.Children.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(calculationGroup.Children, typeof(PipingCalculation));
+
+ var calculationInput1 = ((PipingCalculation)calculationGroup.Children[0]).InputParameters;
+ Assert.AreSame(soilProfile1, calculationInput1.SoilProfile);
+ Assert.AreSame(surfaceLine, calculationInput1.SurfaceLine);
+
+ var calculationInput2 = ((PipingCalculation)calculationGroup.Children[1]).InputParameters;
+ Assert.AreSame(soilProfile2, calculationInput2.SoilProfile);
+ Assert.AreSame(surfaceLine, calculationInput2.SurfaceLine);
+ }
+
+ [Test]
+ public void Generate_SurfaceLinesEachIntersectingSoilModel_ReturnTwoGroupsWithProfilesFromIntersectingSoilModels()
+ {
+ // Setup
+ var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[]
+ {
+ new PipingSoilLayer(-5.0),
+ new PipingSoilLayer(-2.0),
+ new PipingSoilLayer(1.0)
+ }, 1);
+ var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[]
+ {
+ new PipingSoilLayer(-4.0),
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(4.0)
+ }, 2);
+
+ const double y = 1.1;
+ var soilModel1 = new StochasticSoilModel(1, "A", "B");
+ soilModel1.Geometry.AddRange(new[] { new Point2D(1.0, y), new Point2D(2.0, y) });
+ soilModel1.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 1)
+ {
+ SoilProfile = soilProfile1
+ },
+ new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ },
+ });
+
+ var soilModel2 = new StochasticSoilModel(1, "A", "B");
+ soilModel2.Geometry.AddRange(new[] { new Point2D(3.0, y), new Point2D(4.0, y) });
+ soilModel2.StochasticSoilProfiles.AddRange(new[]
+ {
+ new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 2)
+ {
+ SoilProfile = soilProfile2
+ }
+ });
+ var availableSoilModels = new[]
+ {
+ soilModel1, soilModel2
+ };
+
+ var surfaceLineName1 = "surface line 1";
+ var surfaceLineName2 = "surface line 2";
+ var surfaceLine1 = new RingtoetsPipingSurfaceLine
+ {
+ Name = surfaceLineName1
+ };
+ surfaceLine1.SetGeometry(new[]
+ {
+ new Point3D(2.5, y, 1.0),
+ new Point3D(0.0, y, 0.0)
+ });
+ var surfaceLine2 = new RingtoetsPipingSurfaceLine
+ {
+ Name = surfaceLineName2
+ };
+ surfaceLine2.SetGeometry(new[]
+ {
+ new Point3D(2.5, y, 1.0),
+ new Point3D(5.0, y, 0.0)
+ });
+
+ var surfaceLines = new[] { surfaceLine1, surfaceLine2 };
+
+ // Call
+ IEnumerable result = PipingCalculationGenerator.Generate(surfaceLines, availableSoilModels).ToList();
+
+ // Assert
+ Assert.AreEqual(2, result.Count());
+ var calculationGroup1 = result.First(g => g.Name == surfaceLineName1) as PipingCalculationGroup;
+ Assert.NotNull(calculationGroup1);
+
+ Assert.AreEqual(2, calculationGroup1.Children.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(calculationGroup1.Children, typeof(PipingCalculation));
+
+ var calculationInput1 = ((PipingCalculation)calculationGroup1.Children[0]).InputParameters;
+ Assert.AreSame(soilProfile1, calculationInput1.SoilProfile);
+ Assert.AreSame(surfaceLine1, calculationInput1.SurfaceLine);
+
+ var calculationInput2 = ((PipingCalculation)calculationGroup1.Children[1]).InputParameters;
+ Assert.AreSame(soilProfile2, calculationInput2.SoilProfile);
+ Assert.AreSame(surfaceLine1, calculationInput2.SurfaceLine);
+
+ var calculationGroup2 = result.First(g => g.Name == surfaceLineName2) as PipingCalculationGroup;
+ Assert.NotNull(calculationGroup2);
+
+ Assert.AreEqual(1, calculationGroup2.Children.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(calculationGroup2.Children, typeof(PipingCalculation));
+
+ var calculationInput3 = ((PipingCalculation)calculationGroup2.Children[0]).InputParameters;
+ Assert.AreSame(soilProfile2, calculationInput3.SoilProfile);
+ Assert.AreSame(surfaceLine2, calculationInput3.SurfaceLine);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj
===================================================================
diff -u -r08ab7af115b5bbad87eaffb9bc1b1c4379ec8738 -rbff183a6d323111affe69f3afa19b9ada02c9375
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 08ab7af115b5bbad87eaffb9bc1b1c4379ec8738)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision bff183a6d323111affe69f3afa19b9ada02c9375)
@@ -63,6 +63,7 @@
+