Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs =================================================================== diff -u -r78815b3a2e147742759aedddf28c0ada6fb76152 -r61659778ac6e2436b9112e9ff33ccdd2e0b90afe --- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 78815b3a2e147742759aedddf28c0ada6fb76152) +++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 61659778ac6e2436b9112e9ff33ccdd2e0b90afe) @@ -28,12 +28,14 @@ using log4net; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.IO.HydraRing; +using Ringtoets.Common.Service.IllustrationPoints; using Ringtoets.Common.Service.MessageProviders; using Ringtoets.Common.Service.Properties; using Ringtoets.HydraRing.Calculation.Calculator; using Ringtoets.HydraRing.Calculation.Calculator.Factory; using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics; using Ringtoets.HydraRing.Calculation.Exceptions; +using HydraGeneralResult = Ringtoets.HydraRing.Calculation.Parsers.IllustrationPoints.GeneralResult; namespace Ringtoets.Common.Service { @@ -114,7 +116,8 @@ { AssessmentLevelCalculationInput calculationInput = CreateInput(designWaterLevelCalculation, norm, hydraulicBoundaryDatabaseFilePath); - if (designWaterLevelCalculation.GetCalculateIllustrationPoints()) + bool calculateIllustrationPoints = designWaterLevelCalculation.GetCalculateIllustrationPoints(); + if (calculateIllustrationPoints) { calculator.CalculateWithIllustrationPoints(calculationInput); } @@ -123,12 +126,20 @@ calculator.Calculate(calculationInput); } - if (!canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent)) + if (canceled || !string.IsNullOrEmpty(calculator.LastErrorFileContent)) { - designWaterLevelCalculation.SetOutput( - CreateHydraulicBoundaryLocationOutput( - messageProvider, designWaterLevelCalculation.GetName(), calculationInput.Beta, norm, calculator.Converged)); + return; } + + HydraulicBoundaryLocationOutput hydraulicBoundaryLocationOutput = CreateHydraulicBoundaryLocationOutput( + messageProvider, designWaterLevelCalculation.GetName(), calculationInput.Beta, norm, calculator.Converged); + + if (calculateIllustrationPoints) + { + SetIllustrationPointsResult(hydraulicBoundaryLocationOutput, calculator.IllustrationPointsResult); + } + + designWaterLevelCalculation.SetOutput(hydraulicBoundaryLocationOutput); } catch (HydraRingCalculationException) { @@ -171,6 +182,15 @@ canceled = true; } + private static void SetIllustrationPointsResult(HydraulicBoundaryLocationOutput hydraulicBoundaryLocationOutput, + HydraGeneralResult generalResult) + { + if (generalResult != null) + { + hydraulicBoundaryLocationOutput.SetIllustrationPoints(GeneralResultConverter.CreateGeneralResult(generalResult)); + } + } + /// /// Creates the output of the calculation. ///