Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties.cs =================================================================== diff -u -r9b83f33bbdd0e5bcd78e60342e5c780599c12c93 -r6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties.cs) (revision 9b83f33bbdd0e5bcd78e60342e5c780599c12c93) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties.cs) (revision 6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4) @@ -37,14 +37,27 @@ /// public class GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties : HydraulicBoundaryLocationsProperties { + private readonly Func getCalculationFunc; + /// /// Creates a new instance of . /// /// The locations to show the properties for. - /// Thrown when is null. - public GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties(ObservableList locations) - : base(locations) {} + /// for obtaining a + /// based on . + /// Thrown when any input parameter is null. + public GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties(ObservableList locations, + Func getCalculationFunc) + : base(locations) + { + if (getCalculationFunc == null) + { + throw new ArgumentNullException(nameof(getCalculationFunc)); + } + this.getCalculationFunc = getCalculationFunc; + } + [TypeConverter(typeof(ExpandableArrayConverter))] [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Locations_DisplayName))] @@ -53,7 +66,7 @@ { get { - return data.Select(loc => new GrassCoverErosionOutwardsDesignWaterLevelLocationProperties(loc, loc.DesignWaterLevelCalculation)).ToArray(); + return data.Select(loc => new GrassCoverErosionOutwardsDesignWaterLevelLocationProperties(loc, getCalculationFunc(loc))).ToArray(); } } } Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationsProperties.cs =================================================================== diff -u -r9b83f33bbdd0e5bcd78e60342e5c780599c12c93 -r6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationsProperties.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsProperties.cs) (revision 9b83f33bbdd0e5bcd78e60342e5c780599c12c93) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationsProperties.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsProperties.cs) (revision 6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4) @@ -37,14 +37,27 @@ /// public class GrassCoverErosionOutwardsWaveHeightLocationsProperties : HydraulicBoundaryLocationsProperties { + private readonly Func getCalculationFunc; + /// /// Creates a new instance of . /// /// The locations to show the properties for. - /// Thrown when is null. - public GrassCoverErosionOutwardsWaveHeightLocationsProperties(ObservableList locations) - : base(locations) {} + /// for obtaining a + /// based on . + /// Thrown when any input parameter is null. + public GrassCoverErosionOutwardsWaveHeightLocationsProperties(ObservableList locations, + Func getCalculationFunc) + : base(locations) + { + if (getCalculationFunc == null) + { + throw new ArgumentNullException(nameof(getCalculationFunc)); + } + this.getCalculationFunc = getCalculationFunc; + } + [TypeConverter(typeof(ExpandableArrayConverter))] [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Locations_DisplayName))] @@ -53,7 +66,7 @@ { get { - return data.Select(loc => new GrassCoverErosionOutwardsWaveHeightLocationProperties(loc, loc.WaveHeightCalculation)).ToArray(); + return data.Select(loc => new GrassCoverErosionOutwardsWaveHeightLocationProperties(loc, getCalculationFunc(loc))).ToArray(); } } } Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -r9b83f33bbdd0e5bcd78e60342e5c780599c12c93 -r6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 9b83f33bbdd0e5bcd78e60342e5c780599c12c93) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4) @@ -79,11 +79,13 @@ }; yield return new PropertyInfo { - CreateInstance = context => new GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties(context.WrappedData) + CreateInstance = context => new GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties(context.WrappedData, + hbl => hbl.DesignWaterLevelCalculation) }; yield return new PropertyInfo { - CreateInstance = context => new GrassCoverErosionOutwardsWaveHeightLocationsProperties(context.WrappedData) + CreateInstance = context => new GrassCoverErosionOutwardsWaveHeightLocationsProperties(context.WrappedData, + hbl => hbl.WaveHeightCalculation) }; yield return new PropertyInfo(); @@ -97,12 +99,14 @@ yield return new PropertyInfo { - CreateInstance = context => new GrassCoverErosionOutwardsDesignWaterLevelLocationProperties(context.WrappedData, context.WrappedData.DesignWaterLevelCalculation) + CreateInstance = context => new GrassCoverErosionOutwardsDesignWaterLevelLocationProperties(context.WrappedData, + context.WrappedData.DesignWaterLevelCalculation) }; yield return new PropertyInfo { - CreateInstance = context => new GrassCoverErosionOutwardsWaveHeightLocationProperties(context.WrappedData, context.WrappedData.WaveHeightCalculation) + CreateInstance = context => new GrassCoverErosionOutwardsWaveHeightLocationProperties(context.WrappedData, + context.WrappedData.WaveHeightCalculation) }; } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsPropertiesTest.cs =================================================================== diff -u -rcedf973769c057c935ffce89259027f2ea13c4df -r6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsPropertiesTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsPropertiesTest.cs) (revision cedf973769c057c935ffce89259027f2ea13c4df) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsPropertiesTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsPropertiesTest.cs) (revision 6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4) @@ -42,8 +42,8 @@ var hydraulicBoundaryLocations = new ObservableList(); // Call - var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties( - hydraulicBoundaryLocations); + var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties(hydraulicBoundaryLocations, + hbl => hbl.DesignWaterLevelCalculation); // Assert Assert.IsInstanceOf(properties); @@ -73,13 +73,14 @@ { // Setup HydraulicBoundaryLocation location = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(1.2); + var hydraulicBoundaryLocations = new ObservableList + { + location + }; // Call - var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties( - new ObservableList - { - location - }); + var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties(hydraulicBoundaryLocations, + hbl => hbl.DesignWaterLevelCalculation); // Assert Assert.AreEqual(1, properties.Locations.Length); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationsPropertiesTest.cs =================================================================== diff -u -rcedf973769c057c935ffce89259027f2ea13c4df -r6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationsPropertiesTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsPropertiesTest.cs) (revision cedf973769c057c935ffce89259027f2ea13c4df) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationsPropertiesTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsPropertiesTest.cs) (revision 6b0cf3b2a278cb86ec4fc5af26f792afcf0cf3a4) @@ -43,8 +43,8 @@ var hydraulicBoundaryLocations = new ObservableList(); // Call - var properties = new GrassCoverErosionOutwardsWaveHeightLocationsProperties( - hydraulicBoundaryLocations); + var properties = new GrassCoverErosionOutwardsWaveHeightLocationsProperties(hydraulicBoundaryLocations, + hbl => hbl.DesignWaterLevelCalculation); // Assert Assert.IsInstanceOf(properties); @@ -73,13 +73,14 @@ { // Setup HydraulicBoundaryLocation location = TestHydraulicBoundaryLocation.CreateWaveHeightCalculated(1.2); + var hydraulicBoundaryLocations = new ObservableList + { + location + }; // Call - var properties = new GrassCoverErosionOutwardsWaveHeightLocationsProperties( - new ObservableList - { - location - }); + var properties = new GrassCoverErosionOutwardsWaveHeightLocationsProperties(hydraulicBoundaryLocations, + hbl => hbl.WaveHeightCalculation); // Assert Assert.AreEqual(1, properties.Locations.Length);