Index: Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Factories/AggregatedDuneLocationFactory.cs =================================================================== diff -u -rb1ac46d71a03753aaab278d2e129ba184b409e8e -rc99f0555da4a4e2be255330b87d2f6eac8ab0743 --- Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Factories/AggregatedDuneLocationFactory.cs (.../AggregatedDuneLocationFactory.cs) (revision b1ac46d71a03753aaab278d2e129ba184b409e8e) +++ Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Factories/AggregatedDuneLocationFactory.cs (.../AggregatedDuneLocationFactory.cs) (revision c99f0555da4a4e2be255330b87d2f6eac8ab0743) @@ -63,28 +63,24 @@ .ToArray(); return new AggregatedDuneLocation( location.Id, location.Name, location.Location, location.CoastalAreaId, location.Offset, - calculationsForLocation.Select(c => new Tuple( - c.Item1, GetWaterLevel(c.Item2))) - .ToArray(), - calculationsForLocation.Select(c => new Tuple( - c.Item1, GetWaveHeight(c.Item2))) - .ToArray(), - calculationsForLocation.Select(c => new Tuple( - c.Item1, GetWavePeriod(c.Item2))) - .ToArray(), - calculationsForLocation.Select(c => new Tuple( - c.Item1, GetMeanTidalAmplitude(c.Item2))) - .ToArray(), - calculationsForLocation.Select(c => new Tuple( - c.Item1, GetWaveDirectionalSpread(c.Item2))) - .ToArray(), - calculationsForLocation.Select(c => new Tuple( - c.Item1, GetTideSurgePhaseDifference(c.Item2))) - .ToArray()); + GetValues(calculationsForLocation, GetWaterLevel), + GetValues(calculationsForLocation, GetWaveHeight), + GetValues(calculationsForLocation, GetWavePeriod), + GetValues(calculationsForLocation, GetMeanTidalAmplitude), + GetValues(calculationsForLocation, GetWaveDirectionalSpread), + GetValues(calculationsForLocation, GetTideSurgePhaseDifference)); }) .ToArray(); } + private static IEnumerable> GetValues( + IEnumerable> calculationsForLocation, + Func getValueFunc) + { + return calculationsForLocation.Select(c => new Tuple(c.Item1, getValueFunc(c.Item2))) + .ToArray(); + } + private static RoundedDouble GetWaterLevel(DuneLocationCalculation calculation) { return calculation.Output?.WaterLevel ?? RoundedDouble.NaN; @@ -99,17 +95,17 @@ { return calculation.Output?.WavePeriod ?? RoundedDouble.NaN; } - + private static RoundedDouble GetMeanTidalAmplitude(DuneLocationCalculation calculation) { return calculation.Output?.MeanTidalAmplitude ?? RoundedDouble.NaN; } - + private static RoundedDouble GetWaveDirectionalSpread(DuneLocationCalculation calculation) { return calculation.Output?.WaveDirectionalSpread ?? RoundedDouble.NaN; } - + private static RoundedDouble GetTideSurgePhaseDifference(DuneLocationCalculation calculation) { return calculation.Output?.TideSurgePhaseDifference ?? RoundedDouble.NaN; Index: Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/AggregatedDuneLocation.cs =================================================================== diff -u -rcd3083fd075e017ee0ed87cbb22c463c087e965b -rc99f0555da4a4e2be255330b87d2f6eac8ab0743 --- Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/AggregatedDuneLocation.cs (.../AggregatedDuneLocation.cs) (revision cd3083fd075e017ee0ed87cbb22c463c087e965b) +++ Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/AggregatedDuneLocation.cs (.../AggregatedDuneLocation.cs) (revision c99f0555da4a4e2be255330b87d2f6eac8ab0743) @@ -40,24 +40,19 @@ /// The coastal area id of the dune location. /// The offset of the dune location. /// The results of the - /// water level calculations for different target probabilities. + /// water level calculations for different target probabilities. /// The results of the - /// wave height calculations for different target probabilities. + /// wave height calculations for different target probabilities. /// The results of the - /// wave period calculations for different target probabilities. + /// wave period calculations for different target probabilities. /// The results of the - /// mean tide calculations for different target probabilities. + /// mean tide calculations for different target probabilities. /// The results of the - /// wave directional spread calculations for different target probabilities. + /// wave directional spread calculations for different target probabilities. /// The results of the - /// tide surge phase difference calculations for different target probabilities. - /// Thrown when , - /// , , - /// , - /// , - /// , - /// or - /// is null. + /// tide surge phase difference calculations for different target probabilities. + /// Thrown when any parameter except , + /// or is null. public AggregatedDuneLocation(long id, string name, Point2D location, int coastalAreaId, RoundedDouble offset, IEnumerable> waterLevelCalculationsForTargetProbabilities, IEnumerable> waveHeightCalculationsForTargetProbabilities, Index: Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.TestUtil/DuneErosionMapFeaturesTestHelper.cs =================================================================== diff -u -r4c9832c954111e8a7d516bc275c96f168dfced1e -rc99f0555da4a4e2be255330b87d2f6eac8ab0743 --- Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.TestUtil/DuneErosionMapFeaturesTestHelper.cs (.../DuneErosionMapFeaturesTestHelper.cs) (revision 4c9832c954111e8a7d516bc275c96f168dfced1e) +++ Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.TestUtil/DuneErosionMapFeaturesTestHelper.cs (.../DuneErosionMapFeaturesTestHelper.cs) (revision c99f0555da4a4e2be255330b87d2f6eac8ab0743) @@ -120,7 +120,9 @@ Func getOutputPropertyFunc) { DuneLocationCalculation calculation = calculations.Single(calc => calc.DuneLocation.Equals(duneLocation)); - RoundedDouble result = calculation.Output == null ? RoundedDouble.NaN : getOutputPropertyFunc(calculation.Output); + RoundedDouble result = calculation.Output != null + ? getOutputPropertyFunc(calculation.Output) + : RoundedDouble.NaN; return result.ToString(); }