Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs =================================================================== diff -u -r0d12e759b6e46290d83d04a6a5760fe467b339ab -r7eea4fd806f40a4a4516c04d57ee9995cbbbadc8 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs (.../HeightStructuresCalculationService.cs) (revision 0d12e759b6e46290d83d04a6a5760fe467b339ab) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs (.../HeightStructuresCalculationService.cs) (revision 7eea4fd806f40a4a4516c04d57ee9995cbbbadc8) @@ -20,7 +20,7 @@ // All rights reserved. using System.Collections.Generic; -using Core.Common.Base.IO; +using System.Linq; using log4net; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; @@ -34,7 +34,6 @@ using Ringtoets.HydraRing.Calculation.Data.Input.Structures; using Ringtoets.HydraRing.Calculation.Data.Output; using Ringtoets.HydraRing.Calculation.Parsers; -using Ringtoets.HydraRing.Calculation.Services; using Ringtoets.HydraRing.IO; using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources; @@ -62,6 +61,15 @@ return CalculationServiceHelper.PerformValidation(calculation.Name, () => ValidateInput(calculation.InputParameters, assessmentSection)); } + public void Cancel() + { + if (calculator != null) + { + calculator.Cancel(); + } + canceled = true; + } + /// /// Performs a height structures calculation based on the supplied and sets /// if the calculation was successful. Error and status information is logged during the execution of the operation. @@ -74,11 +82,11 @@ /// The directory of the HLCD file that should be used for performing the calculation. /// A on a successful calculation, null otherwise. internal void Calculate(HeightStructuresCalculation calculation, - IAssessmentSection assessmentSection, - FailureMechanismSection failureMechanismSection, - GeneralHeightStructuresInput generalInput, - double failureMechanismContribution, - string hlcdDirectory) + IAssessmentSection assessmentSection, + FailureMechanismSection failureMechanismSection, + GeneralHeightStructuresInput generalInput, + double failureMechanismContribution, + string hlcdDirectory) { var calculationName = calculation.Name; @@ -115,22 +123,13 @@ } } - public void Cancel() - { - if (calculator != null) - { - calculator.Cancel(); - } - canceled = true; - } - private static StructuresOvertoppingCalculationInput CreateInput(HeightStructuresCalculation calculation, FailureMechanismSection failureMechanismSection, GeneralHeightStructuresInput generalInput) { return new StructuresOvertoppingCalculationInput( calculation.InputParameters.HydraulicBoundaryLocation.Id, new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.StructureNormalOrientation), - new HydraRingForelandPoint[0], - null, + ParseForeshore(calculation.InputParameters), + ParseBreakWater(calculation.InputParameters), generalInput.GravitationalAcceleration, generalInput.ModelFactorOvertoppingFlow.Mean, generalInput.ModelFactorOvertoppingFlow.StandardDeviation, calculation.InputParameters.LevelCrestStructure.Mean, calculation.InputParameters.LevelCrestStructure.StandardDeviation, @@ -148,6 +147,16 @@ calculation.InputParameters.StormDuration.Mean, calculation.InputParameters.StormDuration.GetVariationCoefficient()); } + private static IEnumerable ParseForeshore(HeightStructuresInput input) + { + return input.UseForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0]; + } + + private static HydraRingBreakWater ParseBreakWater(HeightStructuresInput input) + { + return input.UseBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null; + } + private static string[] ValidateInput(HeightStructuresInput inputParameters, IAssessmentSection assessmentSection) { List validationResult = new List(); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs =================================================================== diff -u -rb2306061789f5e34a6f0994552b4431d01d220f0 -r7eea4fd806f40a4a4516c04d57ee9995cbbbadc8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs (.../HeightStructuresCalculationServiceIntegrationTest.cs) (revision b2306061789f5e34a6f0994552b4431d01d220f0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs (.../HeightStructuresCalculationServiceIntegrationTest.cs) (revision 7eea4fd806f40a4a4516c04d57ee9995cbbbadc8) @@ -30,7 +30,6 @@ using Ringtoets.Common.IO.FileImporters; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Service; -using Ringtoets.HydraRing.Calculation.Data.Output; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Data;