Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs =================================================================== diff -u -r4905 -r5936 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs (.../LineHelper.cs) (revision 4905) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs (.../LineHelper.cs) (revision 5936) @@ -28,7 +28,7 @@ /// /// Helper class for Line objects /// -public class LineHelper +public static class LineHelper { /// /// Calculate intersection between two lines (strict interpolation) @@ -37,7 +37,7 @@ /// /// /// - public bool GetStrictIntersectionPoint(Line line1, Line line2, ref GeometryPoint intersectPoint) + public static bool GetStrictIntersectionPoint(Line line1, Line line2, ref GeometryPoint intersectPoint) { var point1 = new Point2D(line1.BeginPoint.X, line1.BeginPoint.Z); var point2 = new Point2D(line1.EndPoint.X, line1.EndPoint.Z); @@ -55,109 +55,21 @@ return res == LineIntersection.Intersects; } - - /// - /// This method uses constant extrapolation from the start point to the negative X direction and - /// from the end point to the positive X direction. Then the method tries to find intersection - /// points with the circle on that line. - /// - /// Circle's middle point X value - /// Circle's middle point Z value - /// Circle's radius - /// Point collection which defines a line. Extrapolation is performed at the start and end points. - /// Intersections of this line extrapolated to the negative and positive X with the circle. - public List ExtendedSurfaceIntersectionPointsWithCircle(double xMid, double zMid, double radius, IList pointss) + + public static GeometryPoint GetIntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4) { - List points = pointss.Where(p => !double.IsNaN(p.X)).ToList(); - if (points.Count >= 2) - { - double requiredMinSurfacePointX = xMid - radius; - double requiredMaxSurfacePointX = xMid + radius; - if (requiredMinSurfacePointX < points[0].X) - { - points.Insert(0, new Point2D - { - X = requiredMinSurfacePointX, - Z = points[0].Z - }); - } - - if (requiredMaxSurfacePointX > points[points.Count - 1].X) - { - points.Insert(points.Count, new Point2D - { - X = requiredMaxSurfacePointX, - Z = points[points.Count - 1].Z - }); - } - } - - return IntersectionPointsWithCircle(xMid, zMid, radius, points); - } - - /// - /// Intersections the points with circle. - /// - /// The x mid. - /// The z mid. - /// The radius. - /// The points. - /// - public List IntersectionPointsWithCircle(double xMid, double zMid, double radius, IList points) - { - var result = new List(); - if (points.Count >= 2) - { - for (var pointIndex = 0; pointIndex < points.Count - 1; pointIndex++) - { - Point2D start = points[pointIndex]; - Point2D end = points[pointIndex + 1]; - bool outOfReach = ((Math.Max(start.X, end.X) < xMid - radius) || - (Math.Min(start.X, end.X) > xMid + radius) || - (Math.Max(start.Z, end.Z) < zMid - radius) || - (Math.Min(start.Z, end.Z) > zMid + radius)); - if (!outOfReach) - { - var line = new Line - { - BeginPoint = start, - EndPoint = end - }; - result.AddRange(Intersect_Circle_line(xMid, zMid, radius, line)); - } - } - } - - return result; - } - - public GeometryPoint GetIntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4) - { return IntersectionPointWithExtrapolation(p1, p2, p3, p4); } /// - /// Intersects the circle line. - /// - /// The xm. - /// The ym. - /// The r. - /// The line. - /// - private List Intersect_Circle_line(double xm, double ym, double r, Line line) - { - return Routines2D.IntersectCircleline(xm, ym, r, line.BeginPoint.X, line.EndPoint.X, line.BeginPoint.Z, line.EndPoint.Z); - } - - /// /// Determines the intersection point of two lines, allowing the intersection point being extrapolated. /// /// /// /// /// /// Intersection point or null (parallel lines) - private GeometryPoint IntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4) + private static GeometryPoint IntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4) { GeometryPoint intersectPoint = null; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineHeightAdapter.cs =================================================================== diff -u -r4540 -r5936 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineHeightAdapter.cs (.../SurfaceLineHeightAdapter.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineHeightAdapter.cs (.../SurfaceLineHeightAdapter.cs) (revision 5936) @@ -30,8 +30,6 @@ /// public class SurfaceLineHeightAdapter : SurfaceLineAdapter { - private readonly LineHelper lineHelper = new LineHelper(); - /// /// Initializes a new instance of the class. /// @@ -71,7 +69,7 @@ X = pointAtTopRiver.X + 100, Z = pointAtTopRiver.Z + 100 * Location.NewDikeSlopeOutside }; - newPointAtTopRiver = lineHelper.GetIntersectionPointWithExtrapolation(pointAtTopRiver, newOutsideSlopePoint, + newPointAtTopRiver = LineHelper.GetIntersectionPointWithExtrapolation(pointAtTopRiver, newOutsideSlopePoint, new GeometryPoint(pointAtTopRiver.X, newDikeHeight), new GeometryPoint(pointAtTopPolder.X, newDikeHeight)); oldPointAtTopRiver = new GeometryPoint @@ -82,7 +80,7 @@ } else { - newPointAtTopRiver = lineHelper.GetIntersectionPointWithExtrapolation(startingPoint, pointAtTopRiver, + newPointAtTopRiver = LineHelper.GetIntersectionPointWithExtrapolation(startingPoint, pointAtTopRiver, new GeometryPoint(pointAtTopRiver.X, newDikeHeight), new GeometryPoint(pointAtTopPolder.X, newDikeHeight)); } @@ -176,7 +174,7 @@ Z = newPointAtTopPolder.Z - 100 * slopeTangent }; GeometryPoint dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - GeometryPoint ip = lineHelper.GetIntersectionPointWithExtrapolation(newPointAtTopPolder, newPoint, + GeometryPoint ip = LineHelper.GetIntersectionPointWithExtrapolation(newPointAtTopPolder, newPoint, surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver), dikeTopAtPolder); if (ip != null && ip.X <= dikeTopAtPolder.X) Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/PolyLine.cs =================================================================== diff -u -r4540 -r5936 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/PolyLine.cs (.../PolyLine.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/PolyLine.cs (.../PolyLine.cs) (revision 5936) @@ -190,10 +190,10 @@ } /// - /// Deletes the coinsiding points. + /// Deletes the coinciding points. /// /// The tolerance. - public virtual void DeleteCoinsidingPoints(double tolerance) + public virtual void DeleteCoincidingPoints(double tolerance) { // First build a list of indices of points that have to be removed (from end of list to start) var indicesToDelete = new List(); @@ -215,10 +215,10 @@ } } - public virtual void DeleteCoinsidingPoints() + public virtual void DeleteCoincidingPoints() { const double defaultTolerance = 0.001; - DeleteCoinsidingPoints(defaultTolerance); + DeleteCoincidingPoints(defaultTolerance); } public virtual double MinZ() Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs =================================================================== diff -u -r5745 -r5936 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 5745) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 5936) @@ -33,8 +33,6 @@ /// public static class SurfaceLine2Extensions { - private static readonly LineHelper lineHelper = new LineHelper(); - /// /// Returns all that require to be sorted on X /// ascending. @@ -472,7 +470,7 @@ GeometryPoint geometryPoint2 = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); GeometryPoint p2 = line.HasShoulderInside() ? line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : geometryPoint2; GeometryPoint geometryPoint3 = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside); - GeometryPoint withExtrapolation = lineHelper.GetIntersectionPointWithExtrapolation(geometryPoint1, p2, shoulderTopInside, new GeometryPoint(geometryPoint3.X, shoulderTopInside.Z)); + GeometryPoint withExtrapolation = LineHelper.GetIntersectionPointWithExtrapolation(geometryPoint1, p2, shoulderTopInside, new GeometryPoint(geometryPoint3.X, shoulderTopInside.Z)); return shoulderTopInside.X - withExtrapolation.X; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/PlLinesCreatorTest.cs =================================================================== diff -u -r5416 -r5936 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/PlLinesCreatorTest.cs (.../PlLinesCreatorTest.cs) (revision 5416) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/PlLinesCreatorTest.cs (.../PlLinesCreatorTest.cs) (revision 5936) @@ -968,78 +968,26 @@ } /// - /// Test if exception is thrown when creating PL2 with no soilprofile + /// Test if exception is thrown when creating Pl-lines with no soil profile /// [Test] - public void CreatePL2WithExpertKnowledgeRRDThrowsExceptionIfNoSoilProfile() + [SetUICulture("nl-NL")] + public void GivenSoilProfile1DIsNull_WhenCreatingPlLines_ThenThrowsException() { - var surfaceLine = new SurfaceLine2 - { - Geometry = new GeometryPointString(), - CharacteristicPoints = - { - GeometryMustContainPoint = true - } - }; var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator { - SurfaceLine = surfaceLine, - ModelParametersForPlLines = - { - PenetrationLength = 6.0 - }, - HeadInPlLine2 = 4.0 + SurfaceLine = FactoryForSurfaceLines.CreateSurfacelineSimpleDike(), + SoilProfileType = SoilProfileType.ProfileType1D, + SoilProfile = null }; - Assert.That(() => plLineCreator.CreatePlLineByExpertKnowledge(PlLineType.Pl2, 0.02), Throws.InstanceOf()); + Assert.That(() => plLineCreator.CreateAllPlLines(new Location()), + Throws.InstanceOf().With.Message.EqualTo + ("Voor dit scenario wordt geen berekening uitgevoerd omdat het ondergrondprofiel niet voldoet aan " + + "de eisen die aan de aanleg van het waternet worden gesteld: Er is niet voldoende informatie over het " + + "ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar om de PL-lijnen te maken.")); } /// - /// Test if exception is thrown when creating PL2 with no surface line - /// - [Test] - public void CreatePL2WithExpertKnowledgeRRDThrowsExceptionIfNoSurfaceLine() - { - var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator - { - SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile(), - SurfaceLine = null, - ModelParametersForPlLines = - { - PenetrationLength = 6.0 - }, - HeadInPlLine2 = 4.0 - }; - Assert.That(() => plLineCreator.CreatePlLineByExpertKnowledge(PlLineType.Pl2, 0.02), Throws.InstanceOf()); - } - - /// - /// Test if exception is thrown when creating PL2 if no aquifer present - /// - [Test] - public void CreatePL2For1DGeometryWithExpertKnowledgeRRDThrowsExceptionIfNoAquiferLayerAtAll() - { - var surfaceLine = new SurfaceLine2 - { - Geometry = new GeometryPointString(), - CharacteristicPoints = - { - GeometryMustContainPoint = true - } - }; - var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator - { - SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile(), - SurfaceLine = surfaceLine, - ModelParametersForPlLines = - { - PenetrationLength = 6.0 - }, - HeadInPlLine2 = 4.0 - }; - Assert.That(() => plLineCreator.CreatePlLineByExpertKnowledge(PlLineType.Pl2, 0.02), Throws.InstanceOf()); - } - - /// /// Test if PL2 is created correctly if no inbetween aquifer present /// [Test] @@ -1421,28 +1369,8 @@ Assert.That(plLineCreator.SoilProfile.InBetweenAquiferLayer.TopLevel, Is.EqualTo(1.0)); }); } - + [Test] - public void CreatePl3For1DGeometryWithExpertKnowledgeRrdThrowsExceptionIfNoAquiferLayers() - { - const double cDampingFactor = 0.3; - SurfaceLine2 surfaceLineTutorial1 = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(); - var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator - { - SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile(), - SurfaceLine = surfaceLineTutorial1, - WaterLevelRiverHigh = 4.0, - WaterLevelPolder = -0.5, - ModelParametersForPlLines = - { - DampingFactorPl3 = cDampingFactor - } - }; - - Assert.That(() => plLineCreator.CreatePlLineByExpertKnowledge(PlLineType.Pl3, 0.02), Throws.InstanceOf()); - } - - [Test] public void CreatePl4For1DGeometryWithExpertKnowledgeRrdIfNoInBetweenAquiferLayer() { const double cDampingFactor = 0.3; @@ -1728,26 +1656,6 @@ } [Test] - public void CreatePl4For1DGeometryWithExpertKnowledgeRrdThrowsExceptionIfNoAquifers() - { - const double cDampingFactor = 0.4; - SurfaceLine2 surfaceLineTutorial1 = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(); - var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator - { - SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile(), - SurfaceLine = surfaceLineTutorial1, - WaterLevelRiverHigh = 4.0, - WaterLevelPolder = -0.5, - ModelParametersForPlLines = - { - DampingFactorPl4 = cDampingFactor - } - }; - - Assert.That(() => plLineCreator.CreatePlLineByExpertKnowledge(PlLineType.Pl4, 0.02), Throws.InstanceOf()); - } - - [Test] public void CreatePlLinesFromGaugesWithNonExistentGauge() { SurfaceLine2 surfaceLineTutorial1 = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r5784 -r5936 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 5784) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 5936) @@ -40,8 +40,7 @@ private const double cUpliftFactorEquilibrium = 1.0; private const double cOffsetPhreaticLineBelowSurface = 0.01; protected readonly Dictionary cachedSoilProfiles1D = new Dictionary(); - private readonly LineHelper lineHelper = new LineHelper(); - + private double? waterLevelRiverLow; private PlLine currentPl1Line; // is needed when calculating uplift reduction for PL3 and Pl4 @@ -193,15 +192,15 @@ if (plLine != null) { - plLine.DeleteCoinsidingPoints(); + plLine.DeleteCoincidingPoints(); } return plLine; } /// /// Intersection between two line segments: - /// - Horizontal waterlevel + /// - Horizontal water level /// - Surface line (until DikeTopAtRiver) /// /// @@ -234,7 +233,7 @@ private double DetermineHeadPl3() { double waterLevel = WaterLevelToUse(); - // If no value known for headPl3 then use waterlevel for headPL3 + // If no value known for headPl3 then use water level for headPL3 if (HeadInPlLine3 == null) { return waterLevel; @@ -288,20 +287,6 @@ } /// - /// Check if enough soil geometry data available - /// - private void ThrowIfInsufficientSoilGeometryData() - { - bool hasNoGeometry1DData = (SoilProfileType == SoilProfileType.ProfileType1D) && SoilProfile == null; - bool hasNoGeometry2DData = ((SoilProfileType == SoilProfileType.ProfileTypeStiFile) && (SoilGeometry2DName == null || DikeEmbankmentMaterial == null)) || - ((SoilProfileType == SoilProfileType.ProfileType2D) && (SoilProfile2D == null || DikeEmbankmentMaterial == null)); - if (hasNoGeometry1DData && hasNoGeometry2DData) - { - throw new PlLinesCreatorException("PlLinesCreator contains not enough soil geometry information (SoilProfile1D, FullStiFileName, dikeEmbankmentMaterial or soilBase)"); - } - } - - /// /// Create PL2 (is pl line for penetration) /// /// @@ -314,17 +299,13 @@ throw new PlLinesCreatorException("Negative penetration length."); } - if ((penetrationLength.AlmostEquals(0.0)) || (headInPlLine2 == null)) + if (penetrationLength.AlmostEquals(0.0) || (headInPlLine2 == null)) { // No penetration, or no Head Pl2 defined, so empty pl-line will be returned plLine = new PlLine(); } else { - ThrowIfInsufficientSoilGeometryData(); - ThrowIfNoSurfaceLine(); - ThrowIfSurfaceLineContainsNoPoints(); - switch (SoilProfileType) { case SoilProfileType.ProfileType1D: @@ -404,40 +385,18 @@ return plLine; } - + /// - /// Check if surfaceline contains points + /// Create PL3 /// - private void ThrowIfSurfaceLineContainsNoPoints() - { - if (SurfaceLine.Geometry.Count < 1) - { - throw new PlLinesCreatorException("Surface line contains no points."); - } - } - - /// - /// Check if surfaceline assigned - /// - private void ThrowIfNoSurfaceLine() - { - if (SurfaceLine == null) - { - throw new PlLinesCreatorException("PlLinesCreator contains no surface line."); - } - } - - /// - /// Create PL3 (is phreatic level) - /// /// private PlLine CreatePlLine3ByExpertKnowledge(double headValue, double dampingFactor, double slopeGradient) { return CreatePlLine3Or4ByExpertKnowledge(headValue, dampingFactor, PlLineType.Pl3, slopeGradient); } /// - /// Create PL4 (is phreatic level) + /// Create PL4 /// /// private PlLine CreatePlLine4ByExpertKnowledge(double headValue, double dampingFactor, double slopeGradient) @@ -448,31 +407,24 @@ private PlLine CreatePlLine3Or4ByExpertKnowledge(double headValue, double dampingFactor, PlLineType plLineType, double slopeGradient) { var plLine = new PlLine(); - - ThrowIfInsufficientSoilGeometryData(); - ThrowIfNoSurfaceLine(); - ThrowIfSurfaceLineContainsNoPoints(); - // Soil profile is used to check if there is really an aquifer below toe of dike at river. - // The assumption is made that if there is an aquifer at the riverside and at the polderside, - // that there is a connection between these aquifers. - // In the uplift calculation there will also be a check on the existence of an aquifer. - SoilProfile1D actualSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); if (dampingFactor < 0.0) { throw new PlLinesCreatorException("Damping factor < 0.0"); } - + + // Soil profile 1D below toe of dike at polder is used to check if there is really a relevant aquifer. + SoilProfile1D actualSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); SoilLayer1D relevantAquiferLayer = GetRelevantAquiferLayer(plLineType, actualSoilProfile); if (relevantAquiferLayer != null) { - double referenceLevel = (HeadInPlLine2 != null) ? HeadInPlLine2.Value : WaterLevelPolder; + double referenceLevel = HeadInPlLine2 ?? WaterLevelPolder; double headAtPolderDikeToe = headValue - Math.Max(0, dampingFactor * (headValue - referenceLevel)); plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.First().X, headValue)); plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X, headValue)); plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, headAtPolderDikeToe)); - // Now continue PlLine to the end with a slope of slope gradient + // Now continue PlLine to the end with a slope of SlopeGradient AddTailOfPl3OrPl4WithSlopeGradient(slopeGradient, plLine); if (IsAdjustPL3AndPL4SoNoUpliftWillOccurEnabled) @@ -529,14 +481,6 @@ private SoilLayer1D GetRelevantAquiferLayer(PlLineType type, SoilProfile1D actualSoilProfile) { - IList aquiferLayers = actualSoilProfile.GetAquiferLayers(); - // Note : if no aquifers at all, always throw a message - if (aquiferLayers.Count == 0) - { - string message = "Soil profile (" + actualSoilProfile.Name + ") contains no aquifer layers at all."; - throw new PlLinesCreatorException(message); - } - SoilLayer1D relevantAquiferLayer; switch (type) { @@ -550,13 +494,6 @@ throw new PlLinesCreatorException($"Invalid PL line type:{type} for creation of PL Line 3 or 4"); } - // Note : DAM already handles a missing (null) InBetweenAquiferLayer itself so do not throw for that. - if (relevantAquiferLayer == null && type == PlLineType.Pl3) - { - string message = "Soil profile (" + actualSoilProfile.Name + ") contains no relevant aquifer layer."; - throw new PlLinesCreatorException(message); - } - return relevantAquiferLayer; } @@ -702,7 +639,7 @@ /// /// Determines the thickness of aquitard at characteristic point. - /// This is the distance betweeen the surfacelevel and the top of the first aquifer + /// This is the distance between the surface level and the top of the first aquifer /// /// Type of the characteristic point. /// @@ -725,7 +662,7 @@ /// Check every point from DikeToeAtPolder to SurfaceLevelInside (from left to right) for uplift. /// If uplift occurs, then correct PL3/PL4 value, so uplift does not occur. /// All points in PL3 from this point to DikeToeAtRiver should be removed. - /// The PL3 continues from this point on with the specified slopegradient until polderlevel. + /// The PL3 continues from this point on with the specified slope gradient until polder level. /// Make sure PL3 is always descending from left to right. /// /// A better implementation (not implemented yet) would be: @@ -734,7 +671,7 @@ /// - Adjust PL3/4 for all surface points from end of profile to toe of dike, so no uplift will occur in that surface point /// - From the point, closest to the dike, (firstAdjustedPLPoint) where this correction has been made the following has to be done /// * PL3/4 will continue horizontally from firstAdjustedPLPoint over a distance L = 2* d (d is height all layers above the aquifer) - /// * The the PL3/4 will go down in a slope of 1:50 to the PolderLevel + /// * The PL3/4 will go down in a slope of 1:50 to the PolderLevel /// PL3/4----- /// \___________ L = 2 * d /// \ @@ -1351,7 +1288,7 @@ if (isDitchPresent) { int surfacePointIndex = SurfaceLine.Geometry.Points.IndexOf(ditchDikeSidePoint); - AdjustForDitchatPolderSide(phreaticLine, surfacePointIndex); + AdjustForDitchAtPolderSide(phreaticLine, surfacePointIndex); } else { @@ -1425,7 +1362,7 @@ } } - private void AdjustForDitchatPolderSide(PlLine phreaticLine, int surfacePointIndex) + private void AdjustForDitchAtPolderSide(PlLine phreaticLine, int surfacePointIndex) { const double maxDouble = 99999.999; var phreaticPolderPartialLine = new Line(); @@ -1456,7 +1393,7 @@ new Point2D(SurfaceLine.Geometry.Points[indexatDitchPolder].X, SurfaceLine.Geometry.Points[indexatDitchPolder].Z)); var intersectDitchPolderPhreatic = new GeometryPoint(); - if (lineHelper.GetStrictIntersectionPoint(lineDitchPolderSide, phreaticPolderPartialLine, ref intersectDitchPolderPhreatic)) + if (LineHelper.GetStrictIntersectionPoint(lineDitchPolderSide, phreaticPolderPartialLine, ref intersectDitchPolderPhreatic)) { phreaticLine.Points.Add(new PlLinePoint(intersectDitchPolderPhreatic.X, intersectDitchPolderPhreatic.Z)); } @@ -1489,7 +1426,7 @@ new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex + 1].X, SurfaceLine.Geometry.Points[surfacePointIndex + 1].Z)); var intersectDitchDikePhreatic = new GeometryPoint(); - if (lineHelper.GetStrictIntersectionPoint(lineDitchDikeSide, phreaticPolderPartialLine, ref intersectDitchDikePhreatic)) + if (LineHelper.GetStrictIntersectionPoint(lineDitchDikeSide, phreaticPolderPartialLine, ref intersectDitchDikePhreatic)) { phreaticLine.Points.Add(new PlLinePoint(intersectDitchDikePhreatic.X, intersectDitchDikePhreatic.Z)); } @@ -1524,7 +1461,7 @@ SurfaceLine.Geometry.Points[surfacePointIndex - 1].Z), new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex].X, SurfaceLine.Geometry.Points[surfacePointIndex].Z)); var intersectPoint = new GeometryPoint(); - if (lineHelper.GetStrictIntersectionPoint(surfaceLineSegment, polderlevelLine, ref intersectPoint)) + if (LineHelper.GetStrictIntersectionPoint(surfaceLineSegment, polderlevelLine, ref intersectPoint)) { return new PlLinePoint(intersectPoint.X, intersectPoint.Z); } @@ -1567,7 +1504,7 @@ new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex + 1].X, SurfaceLine.Geometry.Points[surfacePointIndex + 1].Z)); var intersectGeoPoint = new GeometryPoint(); var intersectPoint = new Point2D(); - if (lineHelper.GetStrictIntersectionPoint(phreaticLineSegment, surfaceLineSegment, ref intersectGeoPoint)) + if (LineHelper.GetStrictIntersectionPoint(phreaticLineSegment, surfaceLineSegment, ref intersectGeoPoint)) { intersectPoint.X = intersectGeoPoint.X; intersectPoint.Z = intersectGeoPoint.Z; @@ -1759,7 +1696,5 @@ }; validator.ValidateSoilProfileForPlLinesCreator(); - - } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineShoulderAdapter.cs =================================================================== diff -u -r4540 -r5936 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineShoulderAdapter.cs (.../SurfaceLineShoulderAdapter.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineShoulderAdapter.cs (.../SurfaceLineShoulderAdapter.cs) (revision 5936) @@ -34,8 +34,6 @@ /// public class SurfaceLineShoulderAdapter : SurfaceLineAdapter { - private readonly LineHelper lineHelper = new LineHelper(); - /// /// Initializes a new instance of the class. /// @@ -125,7 +123,7 @@ GeometryPoint dikeBaseInside = hasShoulderInside ? surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder; // Determine intersectionpoint with slope for a horizontal shoulder GeometryPoint intersectionPointAtDike; - intersectionPointAtDike = lineHelper.GetIntersectionPointWithExtrapolation(dikeTopAtPolder, dikeBaseInside, + intersectionPointAtDike = LineHelper.GetIntersectionPointWithExtrapolation(dikeTopAtPolder, dikeBaseInside, new GeometryPoint(dikeToeAtPolder.X, shoulderHeight + dikeToeZ), new GeometryPoint(dikeToeAtPolder.X + 1, shoulderHeight + dikeToeZ)); var newTopShoulder = new GeometryPoint(intersectionPointAtDike.X + shoulderLength, shoulderHeight + dikeToeZ); @@ -135,7 +133,7 @@ // from the horizontal intersection point. This will result in the actual width of the shoulder being a bit // larger than the requested size but that can not be helped (classic chicken-egg problem) var pb = new GeometryPoint(newTopShoulder.X - 100, newTopShoulder.Z + (100 * Location.NewShoulderTopSlope)); - intersectionPointAtDike = lineHelper.GetIntersectionPointWithExtrapolation(dikeTopAtPolder, dikeBaseInside, pb, newTopShoulder); + intersectionPointAtDike = LineHelper.GetIntersectionPointWithExtrapolation(dikeTopAtPolder, dikeBaseInside, pb, newTopShoulder); if (intersectionPointAtDike.Z > MaxShoulderLevel) { throw new SurfaceLineAdapterException(Resources.SurfaceLineShoulderAdapterNewShoulderHeightTooLargeTopSlopeError);