Index: Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/GeneralResultConverter.cs =================================================================== diff -u -rf1e6b4ad5dddc6e771288f17a0b619d6dd23ec07 -r853509ec4de49576e9627ec0bf148aa32e04e461 --- Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/GeneralResultConverter.cs (.../GeneralResultConverter.cs) (revision f1e6b4ad5dddc6e771288f17a0b619d6dd23ec07) +++ Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/GeneralResultConverter.cs (.../GeneralResultConverter.cs) (revision 853509ec4de49576e9627ec0bf148aa32e04e461) @@ -23,21 +23,26 @@ using System.Collections.Generic; using System.Linq; using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.HydraRing.Calculation.Parsers.IllustrationPoints; +using GeneralResult = Ringtoets.Common.Data.Hydraulics.IllustrationPoints.GeneralResult; using HydraGeneralResult = Ringtoets.HydraRing.Calculation.Parsers.IllustrationPoints.GeneralResult; +using IHydraRingIllustrationPoint = Ringtoets.HydraRing.Calculation.Parsers.IllustrationPoints.IIllustrationPoint; +using Stochast = Ringtoets.Common.Data.Hydraulics.IllustrationPoints.Stochast; +using WindDirection = Ringtoets.Common.Data.Hydraulics.IllustrationPoints.WindDirection; namespace Ringtoets.Common.Service.IllustrationPoints { /// - /// Converter for related to creating a . + /// Converter for related to creating a . /// public static class GeneralResultConverter { /// - /// Creates a new instance of based on the information of . + /// Creates a new instance of based on the information of . /// /// The to base the - /// to create on. - /// The newly created . + /// to create on. + /// The newly created . /// Thrown when is null. public static GeneralResult CreateGeneralResult(HydraGeneralResult hydraGeneralResult) { @@ -48,17 +53,35 @@ WindDirection windDirection = WindDirectionConverter.CreateWindDirection(hydraGeneralResult.GoverningWind); IEnumerable stochasts = GetStochasts(hydraGeneralResult); + IEnumerable windDirectionClosingScenarioIllustrationPoints = + GetWindDirectionClosingSituationIllustrationPoint(hydraGeneralResult); - // TODO WTI-1303: Write converter - IEnumerable windDirectionClosingScenarioIllustrationPoints = - Enumerable.Empty(); - return new GeneralResult(hydraGeneralResult.Beta, windDirection, stochasts, windDirectionClosingScenarioIllustrationPoints); } private static IEnumerable GetStochasts(HydraGeneralResult hydraGeneralResult) { return hydraGeneralResult.Stochasts.Select(StochastConverter.CreateStochast); } + + private static IEnumerable GetWindDirectionClosingSituationIllustrationPoint( + HydraGeneralResult hydraGeneralResult) + { + var combinations = new List(); + foreach (KeyValuePair illustrationPointTreeNode in hydraGeneralResult.IllustrationPoints) + { + IHydraRingIllustrationPoint hydraIllustrationPoint = illustrationPointTreeNode.Value.Data; + WindDirectionClosingSituation hydraWindDirectionClosingSituation = illustrationPointTreeNode.Key; + + var subMechanismIllustrationPoint = hydraIllustrationPoint as SubMechanismIllustrationPoint; + if (subMechanismIllustrationPoint != null) + { + combinations.Add(WindDirectionClosingSituationIllustrationPointConverter.CreateWindDirectionClosingScenarioIllustrationPoint( + hydraWindDirectionClosingSituation, subMechanismIllustrationPoint)); + } + } + + return combinations; + } } } \ No newline at end of file