Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresInput.cs =================================================================== diff -u -rc3294111adba59fbf4a19757d1b945ec7045a19f -r547267b70fbf09e80c59b252b4660300cc370c74 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresInput.cs (.../ClosingStructuresInput.cs) (revision c3294111adba59fbf4a19757d1b945ec7045a19f) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresInput.cs (.../ClosingStructuresInput.cs) (revision 547267b70fbf09e80c59b252b4660300cc370c74) @@ -159,33 +159,62 @@ #region Deterministic inputs + #region Structure Normal orientation + /// - /// Gets or sets the storm duration for an open structure. + /// Gets or sets the orientation of the normal of the structure. /// - public RoundedDouble FactorStormDurationOpenStructure + /// + /// When the value is smaller than 0, it will be set to 0. + /// When the value is larger than 360, it will be set to 360. + /// + public RoundedDouble StructureNormalOrientation { get { - return factorStormDurationOpenStructure; + return structureNormalOrientation; } set { - factorStormDurationOpenStructure = value.ToPrecision(factorStormDurationOpenStructure.NumberOfDecimalPlaces); + + RoundedDouble newOrientationValue = value.ToPrecision(structureNormalOrientation.NumberOfDecimalPlaces); + newOrientationValue = ValidateStructureNormalOrientationInRange(newOrientationValue); + + structureNormalOrientation = newOrientationValue; } } + private RoundedDouble ValidateStructureNormalOrientationInRange(RoundedDouble newOrientationValue) + { + const double upperBoundaryRange = 360; + const double lowerBoundaryRange = 0.0; + + if (newOrientationValue > upperBoundaryRange) + { + newOrientationValue = new RoundedDouble(2, upperBoundaryRange); + } + else if (newOrientationValue < lowerBoundaryRange) + { + newOrientationValue = new RoundedDouble(2, lowerBoundaryRange); + } + + return newOrientationValue; + } + + #endregion + /// - /// Gets or sets the orientation of the normal of the structure. + /// Gets or sets the storm duration for an open structure. /// - public RoundedDouble StructureNormalOrientation + public RoundedDouble FactorStormDurationOpenStructure { get { - return structureNormalOrientation; + return factorStormDurationOpenStructure; } set { - structureNormalOrientation = value.ToPrecision(structureNormalOrientation.NumberOfDecimalPlaces); + factorStormDurationOpenStructure = value.ToPrecision(factorStormDurationOpenStructure.NumberOfDecimalPlaces); } }