Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructureProperties.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructureProperties.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructureProperties.cs (revision 44837ec463259677b2bc84d05e020de9fb5b782c)
@@ -0,0 +1,65 @@
+// 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 Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Utils.Attributes;
+using Ringtoets.StabilityPointStructures.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.StabilityPointStructures.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of for properties panel.
+ ///
+ public class StabilityPointStructureProperties : ObjectProperties
+ {
+ private const int namePropertyIndex = 1;
+ private const int locationPropertyIndex = 2;
+
+ [PropertyOrder(namePropertyIndex)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "Structure_Name_DisplayName")]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "Structure_Name_Description")]
+ public string Name
+ {
+ get
+ {
+ return data.Name;
+ }
+ }
+
+ [PropertyOrder(locationPropertyIndex)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "Structure_Location_DisplayName")]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "Structure_Location_Description")]
+ public Point2D Location
+ {
+ get
+ {
+ return new Point2D(new RoundedDouble(0, data.Location.X),
+ new RoundedDouble(0, data.Location.Y));
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj
===================================================================
diff -u -rc7cb9812ba255ba88d28b65f1a146dcf7454f63d -r44837ec463259677b2bc84d05e020de9fb5b782c
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj (.../Ringtoets.StabilityPointStructures.Forms.csproj) (revision c7cb9812ba255ba88d28b65f1a146dcf7454f63d)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj (.../Ringtoets.StabilityPointStructures.Forms.csproj) (revision 44837ec463259677b2bc84d05e020de9fb5b782c)
@@ -47,6 +47,7 @@
+
UserControl
@@ -68,6 +69,11 @@
Core.Common.Controls
False
+
+ {30E4C2AE-719E-4D70-9FA9-668A9767FBFA}
+ Core.Common.Gui
+ False
+
{F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
Core.Common.Utils
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs
===================================================================
diff -u -r98929f84fbf311bd19d8e61cc8499cdb40b22ea0 -r44837ec463259677b2bc84d05e020de9fb5b782c
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision 98929f84fbf311bd19d8e61cc8499cdb40b22ea0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision 44837ec463259677b2bc84d05e020de9fb5b782c)
@@ -36,6 +36,7 @@
using Ringtoets.HydraRing.IO;
using Ringtoets.StabilityPointStructures.Data;
using Ringtoets.StabilityPointStructures.Forms.PresentationObjects;
+using Ringtoets.StabilityPointStructures.Forms.PropertyClasses;
using Ringtoets.StabilityPointStructures.Forms.Views;
using Ringtoets.StabilityPointStructures.IO;
using Ringtoets.StabilityPointStructures.Plugin.Properties;
@@ -51,6 +52,11 @@
///
public class StabilityPointStructuresPlugin : PluginBase
{
+ public override IEnumerable GetPropertyInfos()
+ {
+ yield return new PropertyInfo();
+ }
+
public override IEnumerable GetViewInfos()
{
yield return new ViewInfo<
@@ -103,7 +109,10 @@
yield return new TreeNodeInfo
{
Text = structure => structure.Name,
- Image = structure => RingtoetsCommonFormsResources.StructuresIcon
+ Image = structure => RingtoetsCommonFormsResources.StructuresIcon,
+ ContextMenuStrip = (structure, parentData, treeViewControl) => Gui.Get(structure, treeViewControl)
+ .AddPropertiesItem()
+ .Build()
};
yield return RingtoetsTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructurePropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructurePropertiesTest.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructurePropertiesTest.cs (revision 44837ec463259677b2bc84d05e020de9fb5b782c)
@@ -0,0 +1,135 @@
+// 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.ComponentModel;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.Gui.PropertyBag;
+using NUnit.Framework;
+using Ringtoets.StabilityPointStructures.Data;
+using Ringtoets.StabilityPointStructures.Forms.PropertyClasses;
+
+namespace Ringtoets.StabilityPointStructures.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class StabilityPointStructurePropertiesTest
+ {
+ private const int namePropertyIndex = 0;
+ private const int locationPropertyIndex = 1;
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var properties = new StabilityPointStructureProperties();
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.IsNull(properties.Data);
+ }
+
+ [Test]
+ public void Data_SetNewStabilityPointStructureInstance_ReturnCorrectPropertyValues()
+ {
+ // Setup
+ StabilityPointStructure structure = CreateSimpleStabilityPointStructure();
+ var properties = new StabilityPointStructureProperties();
+
+ // Call
+ properties.Data = structure;
+
+ // Assert
+ Assert.AreEqual(structure.Name, properties.Name);
+ var expectedLocation = new Point2D(new RoundedDouble(0, structure.Location.X),
+ new RoundedDouble(0, structure.Location.Y));
+ Assert.AreEqual(expectedLocation, properties.Location);
+ }
+
+ [Test]
+ public void PropertyAttributes_ReturnExpectedValues()
+ {
+ // Setup
+ StabilityPointStructure structure = CreateSimpleStabilityPointStructure();
+
+ // Call
+ var properties = new StabilityPointStructureProperties
+ {
+ Data = structure
+ };
+
+ // Assert
+ var dynamicPropertyBag = new DynamicPropertyBag(properties);
+ PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(new Attribute[]
+ {
+ BrowsableAttribute.Yes
+ });
+ Assert.AreEqual(2, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+
+ PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
+ Assert.IsTrue(nameProperty.IsReadOnly);
+ Assert.AreEqual(generalCategory, nameProperty.Category);
+ Assert.AreEqual("Naam", nameProperty.DisplayName);
+ Assert.AreEqual("De naam van het kunstwerk.", nameProperty.Description);
+
+ PropertyDescriptor locationProperty = dynamicProperties[locationPropertyIndex];
+ Assert.IsTrue(locationProperty.IsReadOnly);
+ Assert.AreEqual(generalCategory, locationProperty.Category);
+ Assert.AreEqual("Locatie (RD) [m]", locationProperty.DisplayName);
+ Assert.AreEqual("De coördinaten van de locatie van het kunstwerk in het Rijksdriehoeksstelsel.", locationProperty.Description);
+
+ }
+
+ private static StabilityPointStructure CreateSimpleStabilityPointStructure()
+ {
+ return new StabilityPointStructure("Name", "Id", new Point2D(1.234, 2.3456),
+ 123.456,
+ 234.567, 0.234,
+ 345.678, 0.345,
+ 456.789, 0.456,
+ 567.890, 0.567,
+ 678.901, 0.678,
+ 789.012, 0.789,
+ 890.123, 0.890,
+ 901.234, 0.901,
+ 123.546, 0.123,
+ 234.567, 0.234,
+ 345.678, 0.345,
+ 555.555,
+ 456.789, 0.456,
+ 555.55,
+ 0.55,
+ 567.890, 0.567,
+ 7777777.777, 0.777,
+ 567.890, 0.567,
+ 42,
+ 0.55,
+ 678.901, 0.678,
+ 789.012, 0.789,
+ 890.123, 0.890,
+ 901.234, 0.901,
+ StabilityPointStructureType.FloodedCulvert
+ );
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj
===================================================================
diff -u -ra92d855b6fc9909bd631abaa16682e715a1d47c0 -r44837ec463259677b2bc84d05e020de9fb5b782c
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision a92d855b6fc9909bd631abaa16682e715a1d47c0)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision 44837ec463259677b2bc84d05e020de9fb5b782c)
@@ -68,6 +68,7 @@
+
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructureTreeNodeInfoTest.cs
===================================================================
diff -u -rb70abd70f1cd326d1a753c5879a065149ac2ae84 -r44837ec463259677b2bc84d05e020de9fb5b782c
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructureTreeNodeInfoTest.cs (.../StabilityPointStructureTreeNodeInfoTest.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructureTreeNodeInfoTest.cs (.../StabilityPointStructureTreeNodeInfoTest.cs) (revision 44837ec463259677b2bc84d05e020de9fb5b782c)
@@ -50,7 +50,7 @@
Assert.IsNull(info.CanRemove);
Assert.IsNull(info.CanRename);
Assert.IsNull(info.ChildNodeObjects);
- Assert.IsNull(info.ContextMenuStrip);
+ Assert.IsNotNull(info.ContextMenuStrip);
Assert.IsNull(info.EnsureVisibleOnCreate);
Assert.IsNull(info.ForeColor);
Assert.IsNotNull(info.Image);
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj
===================================================================
diff -u -rb70abd70f1cd326d1a753c5879a065149ac2ae84 -r44837ec463259677b2bc84d05e020de9fb5b782c
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision 44837ec463259677b2bc84d05e020de9fb5b782c)
@@ -82,6 +82,10 @@
{30E4C2AE-719E-4D70-9FA9-668A9767FBFA}
Core.Common.Gui
+
+ {26214BD0-DAFB-4CFC-8EB2-80C5D53C859E}
+ Core.Common.Gui.TestUtil
+
{D749EE4C-CE50-4C17-BF01-9A953028C126}
Core.Common.TestUtil
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs
===================================================================
diff -u -rb70abd70f1cd326d1a753c5879a065149ac2ae84 -r44837ec463259677b2bc84d05e020de9fb5b782c
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs (.../StabilityPointStructuresPluginTest.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs (.../StabilityPointStructuresPluginTest.cs) (revision 44837ec463259677b2bc84d05e020de9fb5b782c)
@@ -25,12 +25,14 @@
using Core.Common.Gui;
using Core.Common.Gui.Commands;
using Core.Common.Gui.Plugin;
+using Core.Common.Gui.TestUtil;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.StabilityPointStructures.Data;
using Ringtoets.StabilityPointStructures.Forms.PresentationObjects;
+using Ringtoets.StabilityPointStructures.Forms.PropertyClasses;
using Ringtoets.StabilityPointStructures.Forms.Views;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
@@ -51,6 +53,28 @@
}
[Test]
+ public void GetPropertyInfos_ReturnsSupportedPropertyClasses()
+ {
+ // Setup
+ using (var plugin = new StabilityPointStructuresPlugin())
+ {
+ // Call
+ PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray();
+
+ // Assert
+ Assert.AreEqual(1, propertyInfos.Length);
+
+ PropertyInfo failureMechanismContextProperties = PluginTestHelper.AssertPropertyInfoDefined(
+ propertyInfos,
+ typeof(StabilityPointStructure),
+ typeof(StabilityPointStructureProperties));
+ Assert.IsNull(failureMechanismContextProperties.AdditionalDataCheck);
+ Assert.IsNull(failureMechanismContextProperties.GetObjectPropertiesData);
+ Assert.IsNull(failureMechanismContextProperties.AfterCreate);
+ }
+ }
+
+ [Test]
public void GetTreeNodeInfos_ReturnsSupportedTreeNodeInfos()
{
// Setup