Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs =================================================================== diff -u -rbf818267e52cd63655978eb8b06d421f5abd5f0a -r67b2d336cbe41b18784008909c36a935ff3c04e4 --- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision bf818267e52cd63655978eb8b06d421f5abd5f0a) +++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 67b2d336cbe41b18784008909c36a935ff3c04e4) @@ -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 { @@ -115,7 +117,8 @@ { WaveHeightCalculationInput calculationInput = CreateInput(waveHeightCalculation, norm, hydraulicBoundaryDatabaseFilePath); - if (waveHeightCalculation.GetCalculateIllustrationPoints()) + bool calculateIllustrationPoints = waveHeightCalculation.GetCalculateIllustrationPoints(); + if (calculateIllustrationPoints) { calculator.CalculateWithIllustrationPoints(calculationInput); } @@ -124,12 +127,20 @@ calculator.Calculate(calculationInput); } - if (!canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent)) + if (canceled || !string.IsNullOrEmpty(calculator.LastErrorFileContent)) { - waveHeightCalculation.SetOutput( - CreateHydraulicBoundaryLocationOutput( - messageProvider, waveHeightCalculation.GetName(), calculationInput.Beta, norm, calculator.Converged)); + return; } + + HydraulicBoundaryLocationOutput hydraulicBoundaryLocationOutput = CreateHydraulicBoundaryLocationOutput( + messageProvider, waveHeightCalculation.GetName(), calculationInput.Beta, norm, calculator.Converged); + + if (calculateIllustrationPoints) + { + SetIllustrationPointsResult(hydraulicBoundaryLocationOutput, calculator.IllustrationPointsResult); + } + + waveHeightCalculation.SetOutput(hydraulicBoundaryLocationOutput); } catch (HydraRingCalculationException) { @@ -172,6 +183,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. ///