Index: Core/Common/src/Core.Common.Gui/Converters/ExpandableArrayConverter.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Core/Common/src/Core.Common.Gui/Converters/ExpandableArrayConverter.cs (.../ExpandableArrayConverter.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Common/src/Core.Common.Gui/Converters/ExpandableArrayConverter.cs (.../ExpandableArrayConverter.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -23,6 +23,7 @@
using System.ComponentModel;
using System.Globalization;
using Core.Common.Gui.Properties;
+using Core.Common.Gui.PropertyBag;
namespace Core.Common.Gui.Converters
{
@@ -102,7 +103,7 @@
public override object GetValue(object component)
{
var array = (Array) component;
- return array.GetValue(index);
+ return new DynamicPropertyBag(array.GetValue(index));
}
public override void SetValue(object component, object value)
Index: Core/Common/src/Core.Common.Gui/Converters/KeyValueExpandableArrayConverter.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.Gui/Converters/KeyValueExpandableArrayConverter.cs (revision 0)
+++ Core/Common/src/Core.Common.Gui/Converters/KeyValueExpandableArrayConverter.cs (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -0,0 +1,122 @@
+// Copyright (C) Stichting Deltares 2017. 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 Lesser 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser 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 System.Globalization;
+using Core.Common.Gui.Properties;
+
+namespace Core.Common.Gui.Converters
+{
+ public class KeyValueExpandableArrayConverter : ExpandableArrayConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ var array = value as Array;
+ if (destinationType == typeof(string) && array != null)
+ {
+ return string.Format(CultureInfo.CurrentCulture,
+ Resources.ExpandableArrayConverter_ConvertTo_Count_0_,
+ array.GetLength(0));
+ }
+
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
+ {
+ PropertyDescriptor[] properties = null;
+ var array = value as Array;
+ if (array != null)
+ {
+ Type type = array.GetType();
+ Type elementType = type.GetElementType();
+
+ if (!typeof(KeyValueExpandableArrayElement).IsAssignableFrom(elementType))
+ {
+ throw new ArgumentException($"Require elements in the array of type {typeof(KeyValueExpandableArrayElement).Name}.");
+ }
+
+ int length = array.GetLength(0);
+ properties = new PropertyDescriptor[length];
+
+ for (var index = 0; index < length; ++index)
+ {
+ var keyValueExpandableArrayElement = array.GetValue(index) as KeyValueExpandableArrayElement;
+
+ if (keyValueExpandableArrayElement == null)
+ {
+ throw new ArgumentException($"Require elements in the array to be not null.");
+ }
+ properties[index] = new ArrayPropertyDescriptor(keyValueExpandableArrayElement, type, elementType);
+ }
+ }
+ return new PropertyDescriptorCollection(properties);
+ }
+
+ ///
+ /// Array element property descriptor used by .
+ /// Properties are named based the first item in the provided tuple and the value is
+ /// based on the second item.
+ ///
+ protected class ArrayPropertyDescriptor : SimplePropertyDescriptor
+ {
+ private readonly object value;
+
+ public ArrayPropertyDescriptor(KeyValueExpandableArrayElement element, Type componentType, Type propertyType)
+ : base(componentType, Convert.ToString(element.Name), propertyType)
+ {
+ value = element.Value;
+ }
+
+ public override bool IsReadOnly
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public override object GetValue(object component)
+ {
+ return value;
+ }
+
+ public override void SetValue(object component, object value)
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ public class KeyValueExpandableArrayElement
+ {
+ public KeyValueExpandableArrayElement(string name, object value)
+ {
+ Name = name;
+ Value = value;
+ }
+
+ public string Name { get; }
+
+ public object Value { get;}
+ }
+}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj
===================================================================
diff -u -r9a63232347559e0dceb413fd38d7b87258807910 -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 9a63232347559e0dceb413fd38d7b87258807910)
+++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -121,6 +121,7 @@
+
Index: Core/Common/test/Core.Common.Gui.Test/Converters/ExpandableArrayConverterTest.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Core/Common/test/Core.Common.Gui.Test/Converters/ExpandableArrayConverterTest.cs (.../ExpandableArrayConverterTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Common/test/Core.Common.Gui.Test/Converters/ExpandableArrayConverterTest.cs (.../ExpandableArrayConverterTest.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -23,6 +23,7 @@
using System.ComponentModel;
using System.Linq;
using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
using NUnit.Framework;
namespace Core.Common.Gui.Test.Converters
@@ -117,12 +118,14 @@
for (var i = 0; i < elementCount; i++)
{
Assert.AreEqual(array.GetType(), propertyDescriptors[i].ComponentType);
- Assert.AreEqual(string.Format("[{0}]", i + 1), propertyDescriptors[i].Name);
- Assert.AreEqual(string.Format("[{0}]", i + 1), propertyDescriptors[i].DisplayName);
+ Assert.AreEqual($"[{i + 1}]", propertyDescriptors[i].Name);
+ Assert.AreEqual($"[{i + 1}]", propertyDescriptors[i].DisplayName);
Assert.AreEqual(typeof(int), propertyDescriptors[i].PropertyType);
CollectionAssert.IsEmpty(propertyDescriptors[i].Attributes);
- Assert.AreEqual(array[i], propertyDescriptors[i].GetValue(array));
+ var value = propertyDescriptors[i].GetValue(array) as DynamicPropertyBag;
+ Assert.NotNull(value);
+ Assert.AreEqual(array[i], value.WrappedObject);
}
}
Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs
===================================================================
diff -u -ra979e6ebe32c21456dd9139b3fb07f4a499351c1 -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision a979e6ebe32c21456dd9139b3fb07f4a499351c1)
+++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -674,7 +674,7 @@
}
[Test]
- public void HasTypeConverter_PropertyWithoutTypeConverterAttribute_ThrowsAssertionException()
+ public void AssertTypeConverter_PropertyWithoutTypeConverterAttribute_ThrowsAssertionException()
{
// Call
TestDelegate test = () => TestHelper.AssertTypeConverter(nameof(TestClass.PropertyWithoutTypeConverter));
@@ -684,7 +684,7 @@
}
[Test]
- public void HasTypeConverter_PropertyWithDifferentTypeConverterAttribute_ThrowsAssertionException()
+ public void AssertTypeConverter_PropertyWithDifferentTypeConverterAttribute_ThrowsAssertionException()
{
// Call
TestDelegate test = () => TestHelper.AssertTypeConverter(nameof(TestClass.PropertyWithTypeConverter));
@@ -694,7 +694,7 @@
}
[Test]
- public void HasTypeConverter_PropertyWithMatchingTypeConverterAttribute_DoesNotThrowException()
+ public void AssertTypeConverter_PropertyWithMatchingTypeConverterAttribute_DoesNotThrowException()
{
// Call
TestDelegate test = () => TestHelper.AssertTypeConverter(nameof(TestClass.PropertyWithTypeConverter));
@@ -704,7 +704,7 @@
}
[Test]
- public void HasTypeConverter_TypeConverterAttributeInherited_ReturnTrue()
+ public void AssertTypeConverter_TypeConverterAttributeInherited_ReturnTrue()
{
// Call
TestDelegate test = () => TestHelper.AssertTypeConverter(nameof(DerivedTestClass.PropertyWithTypeConverter));
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -rbe071aa3c09c7847b51d73e6877a6409366bc78f -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision be071aa3c09c7847b51d73e6877a6409366bc78f)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -599,6 +599,15 @@
}
///
+ /// Looks up a localized string similar to Illustratiepunten.
+ ///
+ public static string Categories_IllustrationPoints {
+ get {
+ return ResourceManager.GetString("Categories_IllustrationPoints", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Lengte-effect parameters.
///
public static string Categories_LengthEffect {
@@ -1422,6 +1431,78 @@
}
///
+ /// Looks up a localized string similar to Berekende invloedscoëfficiënten voor alle beschouwde stochasten..
+ ///
+ public static string HydraulicBoundaryDatabase_AlphaValues_Description {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_AlphaValues_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Alfa's.
+ ///
+ public static string HydraulicBoundaryDatabase_AlphaValues_DisplayName {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_AlphaValues_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Tijdsduren waarop de stochasten betrekking hebben..
+ ///
+ public static string HydraulicBoundaryDatabase_Durations_Description {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_Durations_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Tijdsduren.
+ ///
+ public static string HydraulicBoundaryDatabase_Durations_DisplayName {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_Durations_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is..
+ ///
+ public static string HydraulicBoundaryDatabase_GoverningWindDirection_Description {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_GoverningWindDirection_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Maatgevende windrichting.
+ ///
+ public static string HydraulicBoundaryDatabase_GoverningWindDirection_DisplayName {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_GoverningWindDirection_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to De lijst van illustratiepunten voor de berekening..
+ ///
+ public static string HydraulicBoundaryDatabase_IllustrationPoints_Description {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_IllustrationPoints_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Illustratiepunten.
+ ///
+ public static string HydraulicBoundaryDatabase_IllustrationPoints_DisplayName {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_IllustrationPoints_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Coördinaten van de hydraulische randvoorwaardenlocatie..
///
public static string HydraulicBoundaryDatabase_Location_Coordinates_Description {
@@ -1557,6 +1638,132 @@
}
///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_ClosingSituation_Description {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_ClosingSituation_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_ClosingSituation_DisplayName {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_ClosingSituation_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Durations_Description {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Durations_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Durations_DisplayName {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Durations_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Probability_Description {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Probability_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Probability_DisplayName {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Probability_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Reliability_index_Description {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Reliability_index_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Reliability_index_DisplayName {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Reliability_index_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Stochasts_Description {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Stochasts_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Stochasts_DisplayName {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Stochasts_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Values_Description {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Values_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_Values_DisplayName {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_Values_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_WindDirection_Description {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_WindDirection_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ public static string IllustrationPoint_WindDirection_DisplayName {
+ get {
+ return ResourceManager.GetString("IllustrationPoint_WindDirection_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
public static System.Drawing.Bitmap InputFolderIcon {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -rbe071aa3c09c7847b51d73e6877a6409366bc78f -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision be071aa3c09c7847b51d73e6877a6409366bc78f)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -996,4 +996,73 @@
Illustratiepunten inlezen
+
+ Illustratiepunten
+
+
+ Tijdsduren waarop de stochasten betrekking hebben.
+
+
+ Tijdsduren
+
+
+ De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is.
+
+
+ Maatgevende windrichting
+
+
+ De lijst van illustratiepunten voor de berekening.
+
+
+ Illustratiepunten
+
+
+ Berekende invloedscoëfficiënten voor alle beschouwde stochasten.
+
+
+ Alfa's
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs
===================================================================
diff -u -r8bb6e849266ec28412ebfe23beccd7235c4db9bf -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (.../DesignWaterLevelLocationContextProperties.cs) (revision 8bb6e849266ec28412ebfe23beccd7235c4db9bf)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (.../DesignWaterLevelLocationContextProperties.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -26,6 +26,7 @@
using Core.Common.Utils;
using Core.Common.Utils.Attributes;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.Hydraulics.IllustrationPoints;
using Ringtoets.Common.Forms.TypeConverters;
using Ringtoets.Integration.Forms.Properties;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
@@ -37,33 +38,18 @@
///
public class DesignWaterLevelLocationContextProperties : HydraulicBoundaryLocationProperties
{
- [PropertyOrder(1)]
- public override long Id
- {
- get
+ public DesignWaterLevelLocationContextProperties()
+ : base(new ConstructionProperties
{
- return base.Id;
- }
- }
+ IdIndex = 1,
+ NameIndex = 2,
+ LocationIndex = 3,
+ GoverningWindDirectionIndex = 10,
+ StochastsIndex = 11,
+ DurationsIndex = 12,
+ IllustrationPointsIndex = 13
+ }) {}
- [PropertyOrder(2)]
- public override string Name
- {
- get
- {
- return base.Name;
- }
- }
-
- [PropertyOrder(3)]
- public override Point2D Location
- {
- get
- {
- return base.Location;
- }
- }
-
[PropertyOrder(4)]
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
[ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_DesignWaterLevel_DisplayName))]
@@ -144,5 +130,15 @@
return new EnumDisplayWrapper(data.HydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence).DisplayName;
}
}
+
+ protected override GeneralResult GetGeneralIllustrationPointsResult()
+ {
+ if (data.HydraulicBoundaryLocation.DesignWaterLevelCalculation.HasOutput
+ && data.HydraulicBoundaryLocation.DesignWaterLevelCalculation.Output.HasIllustrationPoints)
+ {
+ return data.HydraulicBoundaryLocation.DesignWaterLevelCalculation.Output.GeneralResult;
+ }
+ return null;
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs
===================================================================
diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -19,11 +19,18 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
+using System.Collections.Generic;
using System.ComponentModel;
+using System.Linq;
+using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.Converters;
using Core.Common.Gui.PropertyBag;
using Core.Common.Utils.Attributes;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.Hydraulics.IllustrationPoints;
using Ringtoets.Integration.Forms.PresentationObjects;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
@@ -35,42 +42,173 @@
[TypeConverter(typeof(ExpandableObjectConverter))]
public abstract class HydraulicBoundaryLocationProperties : ObjectProperties
{
+ private readonly Dictionary propertyIndexLookup;
+
+ protected HydraulicBoundaryLocationProperties(ConstructionProperties propertyIndexes)
+ {
+ propertyIndexLookup = new Dictionary
+ {
+ {
+ nameof(Id), propertyIndexes.IdIndex
+ },
+ {
+ nameof(Name), propertyIndexes.NameIndex
+ },
+ {
+ nameof(Location), propertyIndexes.LocationIndex
+ },
+ {
+ nameof(GoverningWindDirection), propertyIndexes.GoverningWindDirectionIndex
+ },
+ {
+ nameof(AlphaValues), propertyIndexes.StochastsIndex
+ },
+ {
+ nameof(Durations), propertyIndexes.DurationsIndex
+ },
+ {
+ nameof(IllustrationPoints), propertyIndexes.IllustrationPointsIndex
+ }
+ };
+ }
+
+ public class ConstructionProperties
+ {
+ public int IdIndex { get; set; } = 1;
+ public int NameIndex { get; set; } = 2;
+ public int LocationIndex { get; set; } = 3;
+ public int GoverningWindDirectionIndex { get; set; } = 4;
+ public int StochastsIndex { get; set; } = 5;
+ public int DurationsIndex { get; set; } = 6;
+ public int IllustrationPointsIndex { get; set; } = 7;
+ }
+
+ [DynamicPropertyOrderEvaluationMethod]
+ public int DynamicPropertyOrderEvaluationMethod(string propertyName)
+ {
+ int propertyIndex;
+
+ propertyIndexLookup.TryGetValue(propertyName, out propertyIndex);
+
+ return propertyIndex;
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool DynamicVisibleValidationMethod(string propertyName)
+ {
+ bool hasGeneralIllustrationPointsResult = GetGeneralIllustrationPointsResult() != null;
+ if (propertyName == nameof(GoverningWindDirection)
+ || propertyName == nameof(AlphaValues)
+ || propertyName == nameof(Durations)
+ || propertyName == nameof(IllustrationPoints))
+ {
+ return hasGeneralIllustrationPointsResult;
+ }
+
+ return true;
+ }
+
+ [DynamicPropertyOrder]
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_DisplayName))]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_Description))]
- public virtual long Id
+ public long Id
{
get
{
return data.HydraulicBoundaryLocation.Id;
}
}
+ [DynamicPropertyOrder]
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_DisplayName))]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_Description))]
- public virtual string Name
+ public string Name
{
get
{
return data.HydraulicBoundaryLocation.Name;
}
}
+ [DynamicPropertyOrder]
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_DisplayName))]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_Description))]
- public virtual Point2D Location
+ public Point2D Location
{
get
{
return data.HydraulicBoundaryLocation.Location;
}
}
+ [DynamicPropertyOrder]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_GoverningWindDirection_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_GoverningWindDirection_Description))]
+ public string GoverningWindDirection
+ {
+ get
+ {
+ return GetGeneralIllustrationPointsResult().GoverningWindDirection.Name;
+ }
+ }
+
+ [DynamicPropertyOrder]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_AlphaValues_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_AlphaValues_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ public KeyValueExpandableArrayElement[] AlphaValues
+ {
+ get
+ {
+ return GetGeneralIllustrationPointsResult().Stochasts.Select(s => new KeyValueExpandableArrayElement(s.Name, s.Alpha)).ToArray();
+ }
+ }
+
+ [DynamicPropertyOrder]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Durations_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Durations_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ public KeyValueExpandableArrayElement[] Durations
+ {
+ get
+ {
+ return GetGeneralIllustrationPointsResult().Stochasts.Select(s => new KeyValueExpandableArrayElement(s.Name, s.Duration)).ToArray();
+ }
+ }
+
+ [DynamicPropertyOrder]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_IllustrationPoints_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_IllustrationPoints_Description))]
+ [TypeConverter(typeof(ExpandableArrayConverter))]
+ public IEnumerable IllustrationPoints
+ {
+ get
+ {
+ return GetGeneralIllustrationPointsResult().WindDirectionClosingSituationIllustrationPoints;
+ }
+ }
+
+ ///
+ /// Gets the general illustration points result.
+ ///
+ /// The general illustration points if it has obtained as part of the calculation, null
+ /// otherwise.
+ protected abstract GeneralResult GetGeneralIllustrationPointsResult();
+
public override string ToString()
{
- return string.Format("{0} {1}", Name, Location);
+ return $"{Name} {Location}";
}
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs
===================================================================
diff -u -r8bb6e849266ec28412ebfe23beccd7235c4db9bf -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs (.../WaveHeightLocationContextProperties.cs) (revision 8bb6e849266ec28412ebfe23beccd7235c4db9bf)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs (.../WaveHeightLocationContextProperties.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -26,6 +26,7 @@
using Core.Common.Utils;
using Core.Common.Utils.Attributes;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.Hydraulics.IllustrationPoints;
using Ringtoets.Common.Forms.TypeConverters;
using Ringtoets.Integration.Forms.Properties;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
@@ -37,33 +38,18 @@
///
public class WaveHeightLocationContextProperties : HydraulicBoundaryLocationProperties
{
- [PropertyOrder(1)]
- public override long Id
- {
- get
+ public WaveHeightLocationContextProperties()
+ : base(new ConstructionProperties
{
- return base.Id;
- }
- }
+ IdIndex = 1,
+ NameIndex = 2,
+ LocationIndex = 3,
+ GoverningWindDirectionIndex = 10,
+ StochastsIndex = 11,
+ DurationsIndex = 12,
+ IllustrationPointsIndex = 13
+ }) { }
- [PropertyOrder(2)]
- public override string Name
- {
- get
- {
- return base.Name;
- }
- }
-
- [PropertyOrder(3)]
- public override Point2D Location
- {
- get
- {
- return base.Location;
- }
- }
-
[PropertyOrder(4)]
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
[ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_WaveHeight_DisplayName))]
@@ -144,5 +130,15 @@
return new EnumDisplayWrapper(data.HydraulicBoundaryLocation.WaveHeightCalculationConvergence).DisplayName;
}
}
+
+ protected override GeneralResult GetGeneralIllustrationPointsResult()
+ {
+ if (data.HydraulicBoundaryLocation.WaveHeightCalculation.HasOutput
+ && data.HydraulicBoundaryLocation.WaveHeightCalculation.Output.HasIllustrationPoints)
+ {
+ return data.HydraulicBoundaryLocation.WaveHeightCalculation.Output.GeneralResult;
+ }
+ return null;
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs
===================================================================
diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2)
@@ -21,9 +21,12 @@
using System.ComponentModel;
using Core.Common.Base.Geometry;
-using Core.Common.Gui.PropertyBag;
+using Core.Common.Gui.Converters;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.Hydraulics.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.PropertyClasses;
@@ -99,12 +102,12 @@
};
// Assert
- string expectedString = string.Format("{0} {1}", name, new Point2D(x, y));
+ string expectedString = $"{name} {new Point2D(x, y)}";
Assert.AreEqual(expectedString, hydraulicBoundaryLocationProperties.ToString());
}
[Test]
- public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
+ public void Constructor_WithGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues()
{
// Setup
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0);
@@ -115,50 +118,143 @@
// Call
var hydraulicBoundaryLocationProperties = new TestHydraulicBoundaryLocationProperties
{
+ WithGeneralResult = true,
Data = context
};
// Assert
- var dynamicPropertyBag = new DynamicPropertyBag(hydraulicBoundaryLocationProperties);
- const string expectedCategory = "Algemeen";
- const string expectedIdDisplayName = "ID";
- const string expectedNameDisplayName = "Naam";
- const string expectedLocationDisplayName = "Coördinaten [m]";
- const string expectedIdDescription = "ID van de hydraulische randvoorwaardenlocatie in de database.";
- const string expectedNameDescription = "Naam van de hydraulische randvoorwaardenlocatie.";
- const string expectedLocationDescription = "Coördinaten van de hydraulische randvoorwaardenlocatie.";
TypeConverter classTypeConverter = TypeDescriptor.GetConverter(hydraulicBoundaryLocationProperties, true);
- PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties();
- PropertyDescriptor idProperty = dynamicProperties.Find("Id", false);
- PropertyDescriptor nameProperty = dynamicProperties.Find("Name", false);
- PropertyDescriptor locationProperty = dynamicProperties.Find("Location", false);
-
Assert.IsInstanceOf(classTypeConverter);
- Assert.IsNotNull(idProperty);
- Assert.IsTrue(idProperty.IsReadOnly);
- Assert.IsTrue(idProperty.IsBrowsable);
- Assert.AreEqual(expectedCategory, idProperty.Category);
- Assert.AreEqual(expectedIdDisplayName, idProperty.DisplayName);
- Assert.AreEqual(expectedIdDescription, idProperty.Description);
+ const string generalCategory = "Algemeen";
+ const string illustrationPointsCategory = "Illustratiepunten";
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(hydraulicBoundaryLocationProperties);
+ Assert.AreEqual(7, dynamicProperties.Count);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[0],
+ generalCategory,
+ "ID",
+ "ID van de hydraulische randvoorwaardenlocatie in de database.",
+ true);
- Assert.IsNotNull(nameProperty);
- Assert.IsTrue(nameProperty.IsReadOnly);
- Assert.IsTrue(nameProperty.IsBrowsable);
- Assert.AreEqual(expectedCategory, nameProperty.Category);
- Assert.AreEqual(expectedNameDisplayName, nameProperty.DisplayName);
- Assert.AreEqual(expectedNameDescription, nameProperty.Description);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[1],
+ generalCategory,
+ "Naam",
+ "Naam van de hydraulische randvoorwaardenlocatie.",
+ true);
- Assert.IsNotNull(locationProperty);
- Assert.IsTrue(locationProperty.IsReadOnly);
- Assert.IsTrue(locationProperty.IsBrowsable);
- Assert.AreEqual(expectedCategory, locationProperty.Category);
- Assert.AreEqual(expectedLocationDisplayName, locationProperty.DisplayName);
- Assert.AreEqual(expectedLocationDescription, locationProperty.Description);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[2],
+ generalCategory,
+ "Coördinaten [m]",
+ "Coördinaten van de hydraulische randvoorwaardenlocatie.",
+ true);
+
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[3],
+ illustrationPointsCategory,
+ "Maatgevende windrichting",
+ "De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is.",
+ true);
+
+ TestHelper.AssertTypeConverter(nameof(HydraulicBoundaryLocationProperties.AlphaValues));
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[4],
+ illustrationPointsCategory,
+ "Alfa's",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ TestHelper.AssertTypeConverter(nameof(HydraulicBoundaryLocationProperties.Durations));
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[5],
+ illustrationPointsCategory,
+ "Tijdsduren",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+
+ TestHelper.AssertTypeConverter(nameof(HydraulicBoundaryLocationProperties.IllustrationPoints));
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[6],
+ illustrationPointsCategory,
+ "Illustratiepunten",
+ "De lijst van illustratiepunten voor de berekening.",
+ true);
}
- private class TestHydraulicBoundaryLocationProperties : HydraulicBoundaryLocationProperties {}
+ [Test]
+ public void Constructor_WithGeneralIllustrationPointsResultAndDifferentPropertyOrder_PropertiesAreInExpectedOrder()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0);
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
+ var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation);
+ // Call
+ var hydraulicBoundaryLocationProperties = new TestHydraulicBoundaryLocationProperties(new HydraulicBoundaryLocationProperties.ConstructionProperties
+ {
+ IllustrationPointsIndex = 1,
+ IdIndex = 2,
+ NameIndex = 3,
+ LocationIndex = 4,
+ GoverningWindDirectionIndex = 5,
+ StochastsIndex = 6,
+ DurationsIndex = 7
+ })
+ {
+ WithGeneralResult = true,
+ Data = context
+ };
+
+ // Assert
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(hydraulicBoundaryLocationProperties);
+ Assert.AreEqual(7, dynamicProperties.Count);
+
+ Assert.AreEqual(dynamicProperties[0].Name, nameof(HydraulicBoundaryLocationProperties.IllustrationPoints));
+ Assert.AreEqual(dynamicProperties[1].Name, nameof(HydraulicBoundaryLocationProperties.Id));
+ Assert.AreEqual(dynamicProperties[2].Name, nameof(HydraulicBoundaryLocationProperties.Name));
+ Assert.AreEqual(dynamicProperties[3].Name, nameof(HydraulicBoundaryLocationProperties.Location));
+ Assert.AreEqual(dynamicProperties[4].Name, nameof(HydraulicBoundaryLocationProperties.GoverningWindDirection));
+ Assert.AreEqual(dynamicProperties[5].Name, nameof(HydraulicBoundaryLocationProperties.AlphaValues));
+ Assert.AreEqual(dynamicProperties[6].Name, nameof(HydraulicBoundaryLocationProperties.Durations));
+ }
+
+ [Test]
+ public void Constructor_WithoutGeneralIllustrationPointsResult_PropertiesAreInExpectedOrder()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0);
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
+ var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation);
+
+ // Call
+ var hydraulicBoundaryLocationProperties = new TestHydraulicBoundaryLocationProperties
+ {
+ WithGeneralResult = false,
+ Data = context
+ };
+
+ // Assert
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(hydraulicBoundaryLocationProperties);
+ Assert.AreEqual(3, dynamicProperties.Count);
+
+ Assert.AreEqual(dynamicProperties[0].Name, nameof(HydraulicBoundaryLocationProperties.Id));
+ Assert.AreEqual(dynamicProperties[1].Name, nameof(HydraulicBoundaryLocationProperties.Name));
+ Assert.AreEqual(dynamicProperties[2].Name, nameof(HydraulicBoundaryLocationProperties.Location));
+ }
+
+ private class TestHydraulicBoundaryLocationProperties : HydraulicBoundaryLocationProperties
+ {
+ public TestHydraulicBoundaryLocationProperties() : base(new ConstructionProperties()) {}
+
+ public TestHydraulicBoundaryLocationProperties(ConstructionProperties propertyIndexes) : base(propertyIndexes) {}
+
+ public bool WithGeneralResult;
+
+ protected override GeneralResult GetGeneralIllustrationPointsResult()
+ {
+ return WithGeneralResult ? new TestGeneralResult() : null;
+ }
+ }
+
private class TestHydraulicBoundaryLocationContext : HydraulicBoundaryLocationContext
{
public TestHydraulicBoundaryLocationContext(HydraulicBoundaryDatabase wrappedData, HydraulicBoundaryLocation hydraulicBoundaryLocation)