Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WindDirectionClosingSituationIllustrationPointProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WindDirectionClosingSituationIllustrationPointProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WindDirectionClosingSituationIllustrationPointProperties.cs (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -0,0 +1,133 @@ +// 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 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.ComponentModel; +using System.Linq; +using Core.Common.Base.Data; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.Converters; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Forms.TypeConverters; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class WindDirectionClosingSituationIllustrationPointProperties : ObjectProperties + { + [PropertyOrder(1)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedProbability_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedProbability_Description))] + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CalculatedProbability + { + get + { + return StatisticsConverter.ReliabilityToProbability(data.IllustrationPoint.Beta); + + } + } + + [PropertyOrder(2)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedReliability_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedReliability_Description))] + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble CalculatedReliability + { + get + { + return data.IllustrationPoint.Beta; + } + } + + [PropertyOrder(3)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_WindDirection_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_WindDirection_Description))] + public string WindDirection + { + get + { + return data.WindDirection.Name; + } + } + + [PropertyOrder(4)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_ClosingSituation_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_ClosingSituation_Description))] + public string ClosingSituation + { + get + { + return data.ClosingSituation; + } + } + + [PropertyOrder(5)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_AlphaValues_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_AlphaValues_Description))] + [TypeConverter(typeof(KeyValueExpandableArrayConverter))] + [KeyValueElement(nameof(RealizedStochast.Name), nameof(RealizedStochast.Alpha))] + public RealizedStochast[] AlphaValues + { + get + { + return data.IllustrationPoint.Stochasts.ToArray(); + } + } + + [PropertyOrder(6)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Durations_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Durations_Description))] + [TypeConverter(typeof(KeyValueExpandableArrayConverter))] + [KeyValueElement(nameof(RealizedStochast.Name), nameof(RealizedStochast.Duration))] + public RealizedStochast[] Durations + { + get + { + return data.IllustrationPoint.Stochasts.ToArray(); + } + } + + [PropertyOrder(7)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_Values_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_Values_Description))] + [TypeConverter(typeof(KeyValueExpandableArrayConverter))] + [KeyValueElement(nameof(IllustrationPointResult.Description), nameof(IllustrationPointResult.Value))] + public IllustrationPointResult[] IllustrationPointResults + { + get + { + return data.IllustrationPoint.IllustrationPointResults.ToArray(); + } + } + + public override string ToString() + { + return $"{data.IllustrationPoint.Name}"; + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -ra2a3022ca8b69a87b4afde3727ebc035f132978f -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision a2a3022ca8b69a87b4afde3727ebc035f132978f) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -102,6 +102,7 @@ + UserControl Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WindDirectionClosingSituationIllustrationPointPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WindDirectionClosingSituationIllustrationPointPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WindDirectionClosingSituationIllustrationPointPropertiesTest.cs (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -0,0 +1,162 @@ +// 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 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 System.Linq; +using Core.Common.Gui.Converters; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class WindDirectionClosingSituationIllustrationPointPropertiesTest + { + + [Test] + public void Constructor_DefaultArgumentValues_DoesNotThrowException() + { + // Call + var properties = new WindDirectionClosingSituationIllustrationPointProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + } + + [Test] + [TestCase("north")] + [TestCase("some random name")] + public void ToString_WithName_ReturnsCombinationOfWindDirectionAndClosingSituation(string name) + { + // Setup + var illustrationPoint = new IllustrationPoint(name, Enumerable.Empty(), Enumerable.Empty(), 3); + var context = new WindDirectionClosingSituationIllustrationPoint(new TestWindDirection(), "direction", illustrationPoint); + + // Call + var hydraulicBoundaryLocationProperties = new WindDirectionClosingSituationIllustrationPointProperties + { + Data = context + }; + + // Assert + Assert.AreEqual(name, hydraulicBoundaryLocationProperties.ToString()); + } + + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + var random = new Random(21); + double beta = random.NextDouble(); + var stochasts = new[] + { + new RealizedStochast("some name", random.NextDouble(), random.NextDouble(), random.NextDouble()) + }; + var illustrationPointResults = new[] + { + new IllustrationPointResult("some description", random.NextDouble()) + }; + var illustrationPoint = new IllustrationPoint("name", stochasts, illustrationPointResults, beta); + + const string closingSituation = "closingSituation"; + const string windDirectionName = "windDirection"; + var windDirection = new WindDirection(windDirectionName, 123); + + var context = new WindDirectionClosingSituationIllustrationPoint(windDirection, closingSituation, illustrationPoint); + + // Call + var properties = new WindDirectionClosingSituationIllustrationPointProperties + { + Data = context + }; + + // Assert + Assert.AreEqual(windDirectionName, properties.WindDirection); + Assert.AreEqual(closingSituation, properties.ClosingSituation); + CollectionAssert.AreEqual(illustrationPoint.Stochasts, properties.AlphaValues); + CollectionAssert.AreEqual(illustrationPoint.Stochasts, properties.Durations); + CollectionAssert.AreEqual(illustrationPoint.IllustrationPointResults, properties.IllustrationPointResults); + + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(7, dynamicProperties.Count); + const string miscCategory = "Misc"; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[0], + miscCategory, + "Berekende kans [1/jaar]", + "De berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[1], + miscCategory, + "Betrouwbaarheidsindex berekende kans [-]", + "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[2], + miscCategory, + "Windrichting", + "De windrichting waarvoor dit illlustratiepunt is berekend.", + true); + + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[3], + miscCategory, + "Sluitscenario", + "Het sluitscenario waarvoor dit illustratiepunt is berekend.", + true); + + TestHelper.AssertTypeConverter(nameof(WindDirectionClosingSituationIllustrationPointProperties.AlphaValues)); + PropertyDescriptor alphaValuesProperty = dynamicProperties[4]; + Assert.NotNull(alphaValuesProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty, + miscCategory, + "Alfa's", + "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.", + true); + + TestHelper.AssertTypeConverter(nameof(WindDirectionClosingSituationIllustrationPointProperties.Durations)); + PropertyDescriptor durationsProperty = dynamicProperties[5]; + Assert.NotNull(durationsProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, + miscCategory, + "Tijdsduren", + "Tijdsduren waarop de stochasten betrekking hebben.", + true); + + TestHelper.AssertTypeConverter(nameof(WindDirectionClosingSituationIllustrationPointProperties.IllustrationPointResults)); + PropertyDescriptor illustrationPointResultsProperty = dynamicProperties[6]; + Assert.NotNull(illustrationPointResultsProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointResultsProperty, + miscCategory, + "Waarden in het illustratiepunt", + "Realisaties van de stochasten in het illustratiepunt.", + true); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -ra2a3022ca8b69a87b4afde3727ebc035f132978f -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision a2a3022ca8b69a87b4afde3727ebc035f132978f) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -101,6 +101,7 @@ + Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties.cs =================================================================== diff -u -r8bb6e849266ec28412ebfe23beccd7235c4db9bf -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties.cs) (revision 8bb6e849266ec28412ebfe23beccd7235c4db9bf) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -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.GrassCoverErosionOutwards.Data; using Ringtoets.GrassCoverErosionOutwards.Forms.Properties; @@ -39,33 +40,21 @@ /// public class GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties : GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties { - [PropertyOrder(1)] - public override long Id - { - get + /// + /// Creates a new instance of . + /// + public GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties() + : 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)] [TypeConverter(typeof(NoValueRoundedDoubleConverter))] [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] @@ -146,5 +135,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/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs =================================================================== diff -u -rfcd32c8e949b4581cc20adcaa7cf7639fcb69d20 -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs) (revision fcd32c8e949b4581cc20adcaa7cf7639fcb69d20) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -19,11 +19,17 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections.Generic; using System.ComponentModel; +using System.Linq; 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.Common.Forms.PropertyClasses; using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -36,6 +42,37 @@ public abstract class GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties : ObjectProperties { + private readonly Dictionary propertyIndexLookup; + + protected GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties(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 + } + }; + } + + [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))] @@ -47,6 +84,7 @@ } } + [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))] @@ -58,6 +96,7 @@ } } + [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))] @@ -69,9 +108,115 @@ } } + [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))] + [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Alpha))] + public Stochast[] AlphaValues + { + get + { + return GetGeneralIllustrationPointsResult().Stochasts.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))] + [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Duration))] + public Stochast[] Durations + { + get + { + return GetGeneralIllustrationPointsResult().Stochasts.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 + .Select(p => new WindDirectionClosingSituationIllustrationPointProperties + { + Data = p + }) + .ToArray(); + } + } + + [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; + } + public override string ToString() { - return string.Format("{0} {1}", Name, Location); + return $"{Name} {Location}"; } + + /// + /// 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 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; + } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationContextProperties.cs =================================================================== diff -u -r8bb6e849266ec28412ebfe23beccd7235c4db9bf -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationContextProperties.cs (.../GrassCoverErosionOutwardsWaveHeightLocationContextProperties.cs) (revision 8bb6e849266ec28412ebfe23beccd7235c4db9bf) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationContextProperties.cs (.../GrassCoverErosionOutwardsWaveHeightLocationContextProperties.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -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.GrassCoverErosionOutwards.Data; using Ringtoets.GrassCoverErosionOutwards.Forms.Properties; @@ -39,33 +40,21 @@ /// public class GrassCoverErosionOutwardsWaveHeightLocationContextProperties : GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties { - [PropertyOrder(1)] - public override long Id - { - get + /// + /// Creates a new instance of . + /// + public GrassCoverErosionOutwardsWaveHeightLocationContextProperties() + : 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)] [TypeConverter(typeof(NoValueRoundedDoubleConverter))] [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] @@ -146,5 +135,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/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextPropertiesTest.cs =================================================================== diff -u -rfcd32c8e949b4581cc20adcaa7cf7639fcb69d20 -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextPropertiesTest.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationContextPropertiesTest.cs) (revision fcd32c8e949b4581cc20adcaa7cf7639fcb69d20) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextPropertiesTest.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationContextPropertiesTest.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -23,8 +23,11 @@ using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Common.Gui.PropertyBag; +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.GrassCoverErosionOutwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses; @@ -54,7 +57,7 @@ hydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, hydraulicBoundaryLocation); + var context = new TestGrassCoverErosionOutwardsLocationContext(locations, hydraulicBoundaryLocation); // Call TestDelegate test = () => new TestGrassCoverErosionOutwardsLocationProperties @@ -79,7 +82,7 @@ { hydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, hydraulicBoundaryLocation); + var context = new TestGrassCoverErosionOutwardsLocationContext(locations, hydraulicBoundaryLocation); // Call var locationProperties = new TestGrassCoverErosionOutwardsLocationProperties @@ -107,7 +110,7 @@ { hydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, hydraulicBoundaryLocation); + var context = new TestGrassCoverErosionOutwardsLocationContext(locations, hydraulicBoundaryLocation); // Call var locationProperties = new TestGrassCoverErosionOutwardsLocationProperties @@ -133,7 +136,7 @@ { hydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, hydraulicBoundaryLocation); + var context = new TestGrassCoverErosionOutwardsLocationContext(locations, hydraulicBoundaryLocation); // Call var locationProperties = new TestGrassCoverErosionOutwardsLocationProperties @@ -182,6 +185,104 @@ Assert.AreEqual(expectedLocationDescription, locationProperty.Description); } - private class TestGrassCoverErosionOutwardsLocationProperties : GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties {} + [Test] + public void Constructor_WithGeneralIllustrationPointsResultAndDifferentPropertyOrder_PropertiesAreInExpectedOrder() + { + // Setup + const long id = 1; + const double x = 567.0; + const double y = 890.0; + const string name = "name"; + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + var locations = new ObservableList + { + hydraulicBoundaryLocation + }; + var context = new TestGrassCoverErosionOutwardsLocationContext(locations, hydraulicBoundaryLocation); + + // Call + var hydraulicBoundaryLocationProperties = new TestGrassCoverErosionOutwardsLocationProperties( + new GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.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(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.IllustrationPoints), dynamicProperties[0].Name); + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.Id), dynamicProperties[1].Name); + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.Name), dynamicProperties[2].Name); + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.Location), dynamicProperties[3].Name); + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.GoverningWindDirection), dynamicProperties[4].Name); + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.AlphaValues), dynamicProperties[5].Name); + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.Durations), dynamicProperties[6].Name); + } + + [Test] + public void Constructor_WithoutGeneralIllustrationPointsResult_PropertiesAreInExpectedOrder() + { + // Setup + const long id = 1; + const double x = 567.0; + const double y = 890.0; + const string name = "name"; + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + var locations = new ObservableList + { + hydraulicBoundaryLocation + }; + var context = new TestGrassCoverErosionOutwardsLocationContext(locations, hydraulicBoundaryLocation); + + // Call + var hydraulicBoundaryLocationProperties = new TestGrassCoverErosionOutwardsLocationProperties + { + WithGeneralResult = false, + Data = context + }; + + // Assert + + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(hydraulicBoundaryLocationProperties); + Assert.AreEqual(3, dynamicProperties.Count); + + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.Id), dynamicProperties[0].Name); + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.Name), dynamicProperties[1].Name); + Assert.AreEqual(nameof(GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.Location), dynamicProperties[2].Name); + } + + private class TestGrassCoverErosionOutwardsLocationProperties : GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties + { + public TestGrassCoverErosionOutwardsLocationProperties() : base(new ConstructionProperties()) {} + + public TestGrassCoverErosionOutwardsLocationProperties(ConstructionProperties propertyIndexes) : base(propertyIndexes) {} + + public bool WithGeneralResult; + + protected override GeneralResult GetGeneralIllustrationPointsResult() + { + return WithGeneralResult ? new TestGeneralResult() : null; + } + } + + private class TestGrassCoverErosionOutwardsLocationContext : GrassCoverErosionOutwardsHydraulicBoundaryLocationContext + { + public TestGrassCoverErosionOutwardsLocationContext( + ObservableList wrappedData, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + : base(wrappedData, hydraulicBoundaryLocation) {} + } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs =================================================================== diff -u -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2 -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (.../DesignWaterLevelLocationContextProperties.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (.../DesignWaterLevelLocationContextProperties.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -38,6 +38,9 @@ /// public class DesignWaterLevelLocationContextProperties : HydraulicBoundaryLocationProperties { + /// + /// Creates a new instance of . + /// public DesignWaterLevelLocationContextProperties() : base(new ConstructionProperties { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs =================================================================== diff -u -rc5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80 -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision c5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -29,6 +29,7 @@ using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Integration.Forms.PresentationObjects; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs =================================================================== diff -u -r2b62d771a30ac4a3a59b52efc9df88afbc6663b2 -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs (.../WaveHeightLocationContextProperties.cs) (revision 2b62d771a30ac4a3a59b52efc9df88afbc6663b2) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs (.../WaveHeightLocationContextProperties.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -38,6 +38,9 @@ /// public class WaveHeightLocationContextProperties : HydraulicBoundaryLocationProperties { + /// + /// Creates a new instance of . + /// public WaveHeightLocationContextProperties() : base(new ConstructionProperties { Fisheye: Tag 6cdf02ac497b3bab4f7f955efac588545f5b8986 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WindDirectionClosingSituationIllustrationPointProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -rc5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80 -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision c5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -79,7 +79,6 @@ - Form Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u -rc5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80 -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision c5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -210,13 +210,13 @@ 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)); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.IllustrationPoints), dynamicProperties[0].Name); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.Id), dynamicProperties[1].Name); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.Name), dynamicProperties[2].Name); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.Location), dynamicProperties[3].Name); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.GoverningWindDirection), dynamicProperties[4].Name); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.AlphaValues), dynamicProperties[5].Name); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.Durations), dynamicProperties[6].Name); } [Test] @@ -240,9 +240,9 @@ 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)); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.Id), dynamicProperties[0].Name); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.Name), dynamicProperties[1].Name); + Assert.AreEqual(nameof(HydraulicBoundaryLocationProperties.Location), dynamicProperties[2].Name); } private class TestHydraulicBoundaryLocationProperties : HydraulicBoundaryLocationProperties Fisheye: Tag 6cdf02ac497b3bab4f7f955efac588545f5b8986 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WindDirectionClosingSituationIllustrationPointPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -rc5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80 -r6cdf02ac497b3bab4f7f955efac588545f5b8986 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision c5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) @@ -87,7 +87,6 @@ -