Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineSlopeAdapter.cs
===================================================================
diff -u -r3893 -r4000
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineSlopeAdapter.cs (.../SurfaceLineSlopeAdapter.cs) (revision 3893)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineSlopeAdapter.cs (.../SurfaceLineSlopeAdapter.cs) (revision 4000)
@@ -22,6 +22,7 @@
using System.Linq;
using Deltares.DamEngine.Calculators.Properties;
using Deltares.DamEngine.Data.General;
+using Deltares.DamEngine.Data.Geometry;
using Deltares.DamEngine.Data.Geotechnics;
using Deltares.DamEngine.Data.Standard;
using Deltares.DamEngine.Data.Standard.Validation;
@@ -40,9 +41,7 @@
///
///
public SurfaceLineSlopeAdapter(SurfaceLine2 surfaceLine, Location location, double scenarioPolderLevel)
- : base(surfaceLine, location, scenarioPolderLevel)
- {
- }
+ : base(surfaceLine, location, scenarioPolderLevel) {}
///
/// Constructs a new surface line with an adjusted slope
@@ -55,11 +54,11 @@
public SurfaceLine2 ConstructNewSurfaceLine(double deltaXAtToeOfSlope)
{
ThrowHelper.ThrowWhenConditionIsTrue("deltaXAtToeOfSlope should be >= 0.0", () => deltaXAtToeOfSlope < 0.0);
- var dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder);
- var dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder);
- var dikeBaseInside = surfaceLine.HasShoulderInside() ? surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder;
- var slopeTangent = (dikeTopAtPolder.Z - dikeBaseInside.Z) /
- (dikeBaseInside.X + deltaXAtToeOfSlope - dikeTopAtPolder.X);
+ GeometryPoint dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder);
+ GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder);
+ GeometryPoint dikeBaseInside = surfaceLine.HasShoulderInside() ? surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder;
+ double slopeTangent = (dikeTopAtPolder.Z - dikeBaseInside.Z) /
+ (dikeBaseInside.X + deltaXAtToeOfSlope - dikeTopAtPolder.X);
ConstructNewSurfaceLineBySlope(slopeTangent);
@@ -77,23 +76,25 @@
{
ThrowHelper.ThrowWhenConditionIsTrue("Slopetangent should be >= 0.0", () => slopeTangent < 0.0);
// the given surface line must be valid to begin with.
- var validationError = surfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error);
+ ValidationResult validationError = surfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error);
if (validationError != null)
{
throw new SurfaceLineException(validationError.Text);
}
- var orgMaxX = surfaceLine.Geometry.GetMaxX();
+
+ double orgMaxX = surfaceLine.Geometry.GetMaxX();
if (double.IsNaN(orgMaxX))
{
orgMaxX = double.MaxValue;
}
- var dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder);
- var dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder);
- var dikeBaseInside = surfaceLine.HasShoulderInside() ? surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder;
+
+ GeometryPoint dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder);
+ GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder);
+ GeometryPoint dikeBaseInside = surfaceLine.HasShoulderInside() ? surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder;
// Remove points on inside slope
surfaceLine.RemoveSegmentBetween(dikeTopAtPolder.X, dikeBaseInside.X);
// Store the ditch (if any)
- var ditchDefinition = GetDitchDefinition();
+ DitchDefinition? ditchDefinition = GetDitchDefinition();
// Delete the ditch from the surfaceline (if any)
RemoveExistingDitch(ditchDefinition);
// Adjust for the new slope
@@ -105,6 +106,7 @@
{
throw new SurfaceLineAdapterException(Resources.SurfaceLineShoulderAdapterNewShoulderHeightTooLargeError);
}
+
// Restore traffic load
RestoreTrafficLoad();
surfaceLine.SortPoints();