Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs
===================================================================
diff -u -rd1565906db90df7be4365d277d5ff22dc2d77a82 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d1565906db90df7be4365d277d5ff22dc2d77a82)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -108,9 +108,9 @@
///
/// Looks up a localized string similar to Vakindeling.
///
- public static string FailureMechanism_SectionDevisions_DisplayName {
+ public static string FailureMechanism_Sections_DisplayName {
get {
- return ResourceManager.GetString("FailureMechanism_SectionDevisions_DisplayName", resourceCulture);
+ return ResourceManager.GetString("FailureMechanism_Sections_DisplayName", resourceCulture);
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx
===================================================================
diff -u -rd1565906db90df7be4365d277d5ff22dc2d77a82 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision d1565906db90df7be4365d277d5ff22dc2d77a82)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -129,7 +129,7 @@
Locaties
-
+
Vakindeling
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionsContext.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionsContext.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionsContext.cs (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -0,0 +1,77 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+
+using Ringtoets.Common.Data;
+
+namespace Ringtoets.Common.Forms.PresentationObjects
+{
+ ///
+ /// This class is a presentation object for .
+ ///
+ public class FailureMechanismSectionsContext
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The failure mechanism whose sections to wrap.
+ /// The owning assessment section of .
+ /// When any input argument is null.
+ public FailureMechanismSectionsContext(IFailureMechanism failureMechanism, AssessmentSectionBase assessmentSection)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException("failureMechanism");
+ }
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException("assessmentSection");
+ }
+
+ ParentFailureMechanism = failureMechanism;
+ ParentAssessmentSection = assessmentSection;
+ }
+
+ ///
+ /// Gets the sequence of instances available
+ /// on the wrapped failure mechanism.
+ ///
+ public IEnumerable WrappedData
+ {
+ get
+ {
+ return ParentFailureMechanism.Sections;
+ }
+ }
+
+ ///
+ /// Gets failure mechanism that owns the sequence exposed by .
+ ///
+ public IFailureMechanism ParentFailureMechanism { get; private set; }
+
+ ///
+ /// Gets the assessment section that owns .
+ ///
+ public AssessmentSectionBase ParentAssessmentSection { get; private set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c6dd26c14af11a7e13f783f578466e46b463165a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.17929
+// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -240,6 +240,16 @@
}
///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap Sections {
+ get {
+ object obj = ResourceManager.GetObject("Sections", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
/// Looks up a localized string similar to &Valideren.
///
public static string Validate {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision c6dd26c14af11a7e13f783f578466e46b463165a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -193,4 +193,7 @@
..\resources\database.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\Sections.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Resources/Sections.png
===================================================================
diff -u
Binary files differ
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r69bae9f753011e0f962a3ffa9b3c696efe5852dd -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 69bae9f753011e0f962a3ffa9b3c696efe5852dd)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -47,6 +47,7 @@
Code
+
@@ -123,6 +124,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data;
+using Ringtoets.Common.Forms.PresentationObjects;
+
+namespace Ringtoets.Common.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class FailureMechanismSectionsContextTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ IEnumerable sectionsSequence = new[]
+ {
+ new FailureMechanismSection("A", new[]
+ {
+ new Point2D(1, 2),
+ new Point2D(3, 4)
+ }),
+ new FailureMechanismSection("B", new[]
+ {
+ new Point2D(3, 4),
+ new Point2D(5, 6)
+ })
+ };
+
+ var mocks = new MockRepository();
+ var failureMechanism = mocks.Stub();
+ failureMechanism.Stub(fm => fm.Sections).Return(sectionsSequence);
+
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ var context = new FailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.AreSame(sectionsSequence, context.WrappedData);
+ Assert.AreSame(failureMechanism, context.ParentFailureMechanism);
+ Assert.AreSame(assessmentSection, context.ParentAssessmentSection);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_FailureMechanismNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new FailureMechanismSectionsContext(null, assessmentSection);
+
+ // Assert
+ Assert.Throws(call);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var failureMechanism = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new FailureMechanismSectionsContext(failureMechanism, null);
+
+ // Assert
+ Assert.Throws(call);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -r69bae9f753011e0f962a3ffa9b3c696efe5852dd -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 69bae9f753011e0f962a3ffa9b3c696efe5852dd)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -57,6 +57,7 @@
+
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs
===================================================================
diff -u -r337f02d824bf5352ed8148dbda0ca6b2b61a20c1 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs (.../FailureMechanismPlaceholder.cs) (revision 337f02d824bf5352ed8148dbda0ca6b2b61a20c1)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs (.../FailureMechanismPlaceholder.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -37,18 +37,12 @@
/// The placeholder's name.
public FailureMechanismPlaceholder(string name) : base(name)
{
- SectionDivisions = new InputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_SectionDevisions_DisplayName);
Locations = new InputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_Locations_DisplayName);
BoundaryConditions = new InputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_BoundaryConditions_DisplayName);
AssessmentResult = new OutputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName);
}
///
- /// Gets the subdivision of the assessment section for which this failure mechanism is calculating.
- ///
- public InputPlaceholder SectionDivisions { get; private set; }
-
- ///
/// Gets the locations relevant for evaluating this failure mechanism.
///
public InputPlaceholder Locations { get; private set; }
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs
===================================================================
diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 7144ed9829e56a34e064267053216ffbcf6cff52)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -47,6 +47,7 @@
using RingtoetsDataResources = Ringtoets.Integration.Data.Properties.Resources;
using RingtoetsFormsResources = Ringtoets.Integration.Forms.Properties.Resources;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
using UtilsResources = Core.Common.Utils.Properties.Resources;
using BaseResources = Core.Common.Base.Properties.Resources;
@@ -152,6 +153,13 @@
ContextMenuStrip = FailureMechanismPlaceholderContextMenuStrip
};
+ yield return new TreeNodeInfo
+ {
+ Text = context => RingtoetsCommonDataResources.FailureMechanism_Sections_DisplayName,
+ Image = context => RingtoetsCommonFormsResources.Sections,
+ ContextMenuStrip = FailureMechanismSectionsContextMenuStrip
+ };
+
yield return new TreeNodeInfo
{
Text = placeholderWithReadonlyName => placeholderWithReadonlyName.Name,
@@ -270,19 +278,19 @@
return new object[]
{
new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName,
- GetInputs(nodeData.WrappedData),
+ GetInputs(nodeData.WrappedData, nodeData.Parent),
TreeFolderCategory.Input),
new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName,
GetOutputs(nodeData.WrappedData),
TreeFolderCategory.Output)
};
}
- private IList GetInputs(FailureMechanismPlaceholder nodeData)
+ private IList GetInputs(FailureMechanismPlaceholder nodeData, AssessmentSectionBase assessmentSection)
{
return new ArrayList
{
- nodeData.SectionDivisions,
+ new FailureMechanismSectionsContext(nodeData, assessmentSection),
nodeData.Locations,
nodeData.BoundaryConditions
};
@@ -331,6 +339,17 @@
# endregion
+ #region FailureMechanismSectionsContext
+
+ private ContextMenuStrip FailureMechanismSectionsContextMenuStrip(FailureMechanismSectionsContext nodeData, object parentData, TreeViewControl treeViewControl)
+ {
+ return Gui.Get(nodeData, treeViewControl)
+ .AddImportItem()
+ .Build();
+ }
+
+ #endregion
+
# region PlaceholderWithReadonlyName
private static Bitmap GetIconForPlaceholder(PlaceholderWithReadonlyName nodeData)
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs
===================================================================
diff -u -r0bfd1f4e2a179c8575045e5af70dce2930665626 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs (.../FailureMechanismPlaceholderTest.cs) (revision 0bfd1f4e2a179c8575045e5af70dce2930665626)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs (.../FailureMechanismPlaceholderTest.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -1,4 +1,6 @@
using NUnit.Framework;
+
+using Ringtoets.Common.Data;
using Ringtoets.Integration.Data.Placeholders;
namespace Ringtoets.Integration.Data.Test.Placeholders
@@ -16,8 +18,9 @@
var failureMechanism = new FailureMechanismPlaceholder(expectedName);
// Assert
+ Assert.IsInstanceOf(failureMechanism);
Assert.AreEqual(expectedName, failureMechanism.Name);
- Assert.AreEqual("Vakindeling", failureMechanism.SectionDivisions.Name);
+ CollectionAssert.IsEmpty(failureMechanism.Sections);
Assert.AreEqual("Locaties", failureMechanism.Locations.Name);
Assert.AreEqual("Randvoorwaarden", failureMechanism.BoundaryConditions.Name);
Assert.AreEqual("Oordeel", failureMechanism.AssessmentResult.Name);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 7144ed9829e56a34e064267053216ffbcf6cff52)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -67,6 +67,7 @@
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs
===================================================================
diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs (.../FailureMechanismPlaceholderTreeNodeInfoTest.cs) (revision 7144ed9829e56a34e064267053216ffbcf6cff52)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs (.../FailureMechanismPlaceholderTreeNodeInfoTest.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951)
@@ -1,5 +1,7 @@
using System.Drawing;
using System.Linq;
+
+using Core.Common.Base.Geometry;
using Core.Common.Controls.TreeView;
using Core.Common.Gui;
using Core.Common.Gui.ContextMenu;
@@ -105,6 +107,7 @@
mocks.ReplayAll();
var failureMechanism = new FailureMechanismPlaceholder("test");
+ failureMechanism.AddSection(new FailureMechanismSection("A", new[]{ new Point2D(1,2), new Point2D(5,6) }));
var failureMechanismContext = new FailureMechanismPlaceholderContext(failureMechanism, assessmentSection);
// Call
@@ -115,12 +118,16 @@
var inputFolder = (CategoryTreeFolder)children[0];
Assert.AreEqual("Invoer", inputFolder.Name);
Assert.AreEqual(TreeFolderCategory.Input, inputFolder.Category);
+
+ var failureMechanismSectionsContext = (FailureMechanismSectionsContext)inputFolder.Contents[0];
+ CollectionAssert.AreEqual(failureMechanism.Sections, failureMechanismSectionsContext.WrappedData);
+ Assert.AreSame(failureMechanism, failureMechanismSectionsContext.ParentFailureMechanism);
+ Assert.AreSame(assessmentSection, failureMechanismSectionsContext.ParentAssessmentSection);
CollectionAssert.AreEqual(new[]
{
- failureMechanism.SectionDivisions,
failureMechanism.Locations,
failureMechanism.BoundaryConditions
- }, inputFolder.Contents);
+ }, inputFolder.Contents.Cast