Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r2601 -r2619 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 2601) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 2619) @@ -42,20 +42,20 @@ private const double cUpliftFactorEquilibrium = 1.0; private const double cOffsetPhreaticLineBelowSurface = 0.01; private ModelParametersForPlLines modelParametersForPlLines = new ModelParametersForPlLines(); - + public SoilProfileType SoilProfileType { get; set; } public SoilProfile1D SoilProfile { get; set; } public SoilProfile2D SoilProfile2D { get; set; } public string SoilGeometry2DName { get; set; } public Soil DikeEmbankmentMaterial { get; set; } - + public SoilList SoilList { get; set; } public double? HeadInPlLine2 { get; set; } private double? headInPlLine3 { get; set; } private double? headInPlLine4 { get; set; } - + private bool isAdjustPl3AndPl4SoNoUpliftWillOccurEnabled = true; private double waterLevelPolder; private double waterLevelRiverHigh; @@ -89,7 +89,7 @@ public double? PlLineOffsetFactorBelowShoulderCrest { get; set; } public bool? UsePlLineOffsetBelowDikeCrestMiddle { get; set; } public bool? UsePlLineOffsetFactorBelowShoulderCrest { get; set; } - + private double WaterLevelToUse() { if (isUseLowWaterLevel) @@ -102,30 +102,27 @@ return this.WaterLevelRiverHigh; } } - private double HeadPl3Taking + private double DetermineHeadPl3() { - get + double waterLevel = WaterLevelToUse(); + // If no value known for headPl3 then use waterlevel for headPL3 + if (HeadInPlLine3 == null) { - double waterLevel = WaterLevelToUse(); - // If no value known for headPl3 then use waterlevel for headPL3 - if (HeadInPlLine3 == null) - { - return waterLevel; - } - return HeadInPlLine3.Value; + return waterLevel; } + return HeadInPlLine3.Value; } - private double GetHeadPl4() + private double DetermineHeadPl4() { double waterLevel = WaterLevelToUse(); if (HeadInPlLine4 == null) { // If no value known for headPl4 then use water level (buitenwaterstand) for headPL4 - return waterLevel; + return waterLevel; } // If value is specified for headPl4 then use this value for headPL4 - return HeadInPlLine4.Value; + return HeadInPlLine4.Value; } private PlLine currentPl1Line = null; // is needed when calculating uplift reduction for PL3 and Pl4 @@ -179,7 +176,7 @@ case SoilProfileType.ProfileType2D: soilProfile = SoilProfile2D.GetSoilProfile1D(xCoordinate); cachedSoilProfiles1D[xCoordinate] = soilProfile; - return soilProfile; + return soilProfile; case SoilProfileType.ProfileTypeStiFile: var geometry2DTo1DConverter = new Geometry2DTo1DConverter(this.SoilGeometry2DName, this.SurfaceLine, this.DikeEmbankmentMaterial, this.SoilList, -this.XSoilGeometry2DOrigin); soilProfile = geometry2DTo1DConverter.Convert(xCoordinate); @@ -437,11 +434,11 @@ double headAtEnd = plLine.Points.Last().Z - slopeGradient * lengthFromLastPlPointToEnd; Line waterLevelPolderLine = - new Line(new Point2D(this.surfaceLine.Geometry.Points.First().X, this.WaterLevelPolder), + new Line(new Point2D(this.surfaceLine.Geometry.Points.First().X, this.WaterLevelPolder), new Point2D(this.surfaceLine.Geometry.Points.Last().X, WaterLevelPolder)); Line slopeLine = new Line( - new Point2D(this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, headAtLastPlPoint), + new Point2D(this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, headAtLastPlPoint), new Point2D(this.surfaceLine.Geometry.Points.Last().X, headAtEnd)); var intersectionPoint = new Point2D(); @@ -920,357 +917,357 @@ return plLines; } -// private IEnumerable FindAllPlLinePointsAtNWOLocation(PlLine pl1Line) -// { -// IEnumerable results = pl1Line.GetPointSegmentBetween(this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1).X - cOffsetPhreaticLineBelowSurface, -// this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4).X + cOffsetPhreaticLineBelowSurface); -// -// return results; -// } + // private IEnumerable FindAllPlLinePointsAtNWOLocation(PlLine pl1Line) + // { + // IEnumerable results = pl1Line.GetPointSegmentBetween(this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1).X - cOffsetPhreaticLineBelowSurface, + // this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4).X + cOffsetPhreaticLineBelowSurface); + // + // return results; + // } -// private void AdaptPL1ForNonWaterRetainingObject(ref PlLine pl1Line) -// { -// // check if nwo points are available as CharacteristicPoints -// var nwo1 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1); -// var nwo2 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint2); -// var nwo3 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint3); -// var nwo4 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4); -// if ((nwo1 != null) && (nwo2 != null) && (nwo3 != null) && (nwo4 != null)) -// { -// -// // Find all points in the Pl line that (might) coincide with the NWO -// IEnumerable plPointsToBeMoved = FindAllPlLinePointsAtNWOLocation(pl1Line); -// -// PlLinePoint nwo1Pl = null; -// PlLinePoint nwo2Pl = null; -// PlLinePoint nwo3Pl = null; -// PlLinePoint nwo4Pl = null; -// -// // For NWO point, determine whether a pl point has to be added -// if (pl1Line.PositionXzOfPointRelatedToPlLine(nwo1) != PlLinePointPositionXzType.AbovePlLine) -// { -// nwo1Pl = new PlLinePoint(nwo1.X, nwo1.Z - cOffsetPhreaticLineBelowSurface); -// } -// if (pl1Line.PositionXzOfPointRelatedToPlLine(nwo2) != PlLinePointPositionXzType.AbovePlLine) -// { -// nwo2Pl = new PlLinePoint(nwo2.X, nwo2.Z - cOffsetPhreaticLineBelowSurface); -// } -// if (pl1Line.PositionXzOfPointRelatedToPlLine(nwo3) != PlLinePointPositionXzType.AbovePlLine) -// { -// nwo3Pl = new PlLinePoint(nwo3.X, nwo3.Z - cOffsetPhreaticLineBelowSurface); -// } -// if (pl1Line.PositionXzOfPointRelatedToPlLine(nwo4) != PlLinePointPositionXzType.AbovePlLine) -// { -// nwo4Pl = new PlLinePoint(nwo4.X, nwo4.Z - cOffsetPhreaticLineBelowSurface); -// } -// -// // Find the intersections of pl line and NWO and handle these -// // Intersection between nwo point1 and nwo point2 only when nwo point1 is above pl line and nwo point2 is below PlLine -// PlLinePoint intersection1 = null; -// if ((nwo1Pl == null) && (nwo2Pl != null)) -// { -// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) }; -// var ips = pl1Line.IntersectionPointsXzWithLineXz(lineNWO); -// if (ips.Count > 0) -// { -// intersection1 = new PlLinePoint(ips.First().X, ips.First().Z); -// } -// } -// // Intersection between nwo point3 and nwo point4 only when nwo point3 is below pl line and nwo point4 is above PlLine -// PlLinePoint intersection2 = null; -// if ((nwo3Pl != null) && (nwo4Pl == null)) -// { -// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) }; -// var ips = pl1Line.IntersectionPointsXzWithLineXz(lineNWO); -// if (ips.Count > 0) -// { -// intersection2 = new PlLinePoint(ips.Last().X, ips.Last().Z); -// } -// } -// -// // Handle making the NWO empty -// if ((NWOPhreaticAdaption != null) && (NWOPhreaticAdaption == PhreaticAdaptionType.MakeEmpty)) -// { -// // for the polderside, the pl line is always allowed to be adapted. For the riverside, the pl line may only be adapted when the original waterlevel is runs through the nwo. -// RemoveAllWaterFromNonWaterRetainingObject(nwo1, pl1Line, nwo1Pl, nwo2Pl, nwo3Pl, nwo4Pl, intersection1, intersection2, plPointsToBeMoved); -// } -// // Handle making the waterlevel horizontal in the NWO at the Riverside when needed (Polderside is already done when needed, see CreatePhreaticLineSegmentsInShoulderAndPolder. -// if ((NWOPhreaticAdaption != null) && (NWOPhreaticAdaption == PhreaticAdaptionType.None)) -// { -// // For the riverside, the pl line may only be adapted when the original waterlevel is runs through the nwo and is not already level. -// if ((nwo1.X <= this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X) && ((intersection1 != null) || (intersection2 != null))) -// { -// double requiredWaterLevel; -// // Check whether adaption of intersection points is needed -// if (intersection2 == null) -// { -// // only intersection 1 avaialable so add intersection 2 -// // first see if nwo3/4 intersects, if not try nwo2/3. If still no intersection found valid level not possible, raise error -// MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1(nwo2, nwo3, nwo4, pl1Line, nwo3Pl, nwo4Pl, intersection1); -// requiredWaterLevel = intersection1.Z; -// } -// else -// { -// if (intersection1 == null) -// { -// // only intersection 2 avaialable so add intersection 1 -// // first see if nwo1/2 intersects, if not try nwo2/3. If still no intersection found valid level not possible, raise error -// MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2(nwo1, nwo2, nwo3, pl1Line, nwo1Pl, nwo2Pl, nwo3Pl, intersection2); -// requiredWaterLevel = intersection2.Z; -// } -// else -// { -// // intersection 1 and intersection 2 available. Only act when levels were different. -// requiredWaterLevel = Math.Min(intersection1.Z, intersection2.Z); -// if ((Math.Abs(intersection1.Z - intersection2.Z) > GeometryPoint.Precision)) -// { -// if (intersection1.Z < intersection2.Z) -// { -// // make level in NWO intersection1.Z -// MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1And2(nwo2, nwo3, nwo4, pl1Line, nwo3Pl, intersection1, intersection2); -// } -// else -// { -// // make level in NWO intersection2.Z -// MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2And1(nwo1, nwo2, nwo3, pl1Line, nwo2Pl, intersection1, intersection2); -// } -// -// } -// } -// } -// -// // Move all the points in the pl line itself that need to be moved to the horizontal proper level. -// foreach (var PlLinePoint in plPointsToBeMoved) -// { -// PlLinePoint.Z = requiredWaterLevel; -// } -// pl1Line.DeleteCoinsidingPoints(GeometryPoint.Precision); -// } -// } -// } -// } + // private void AdaptPL1ForNonWaterRetainingObject(ref PlLine pl1Line) + // { + // // check if nwo points are available as CharacteristicPoints + // var nwo1 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1); + // var nwo2 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint2); + // var nwo3 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint3); + // var nwo4 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4); + // if ((nwo1 != null) && (nwo2 != null) && (nwo3 != null) && (nwo4 != null)) + // { + // + // // Find all points in the Pl line that (might) coincide with the NWO + // IEnumerable plPointsToBeMoved = FindAllPlLinePointsAtNWOLocation(pl1Line); + // + // PlLinePoint nwo1Pl = null; + // PlLinePoint nwo2Pl = null; + // PlLinePoint nwo3Pl = null; + // PlLinePoint nwo4Pl = null; + // + // // For NWO point, determine whether a pl point has to be added + // if (pl1Line.PositionXzOfPointRelatedToPlLine(nwo1) != PlLinePointPositionXzType.AbovePlLine) + // { + // nwo1Pl = new PlLinePoint(nwo1.X, nwo1.Z - cOffsetPhreaticLineBelowSurface); + // } + // if (pl1Line.PositionXzOfPointRelatedToPlLine(nwo2) != PlLinePointPositionXzType.AbovePlLine) + // { + // nwo2Pl = new PlLinePoint(nwo2.X, nwo2.Z - cOffsetPhreaticLineBelowSurface); + // } + // if (pl1Line.PositionXzOfPointRelatedToPlLine(nwo3) != PlLinePointPositionXzType.AbovePlLine) + // { + // nwo3Pl = new PlLinePoint(nwo3.X, nwo3.Z - cOffsetPhreaticLineBelowSurface); + // } + // if (pl1Line.PositionXzOfPointRelatedToPlLine(nwo4) != PlLinePointPositionXzType.AbovePlLine) + // { + // nwo4Pl = new PlLinePoint(nwo4.X, nwo4.Z - cOffsetPhreaticLineBelowSurface); + // } + // + // // Find the intersections of pl line and NWO and handle these + // // Intersection between nwo point1 and nwo point2 only when nwo point1 is above pl line and nwo point2 is below PlLine + // PlLinePoint intersection1 = null; + // if ((nwo1Pl == null) && (nwo2Pl != null)) + // { + // var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) }; + // var ips = pl1Line.IntersectionPointsXzWithLineXz(lineNWO); + // if (ips.Count > 0) + // { + // intersection1 = new PlLinePoint(ips.First().X, ips.First().Z); + // } + // } + // // Intersection between nwo point3 and nwo point4 only when nwo point3 is below pl line and nwo point4 is above PlLine + // PlLinePoint intersection2 = null; + // if ((nwo3Pl != null) && (nwo4Pl == null)) + // { + // var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) }; + // var ips = pl1Line.IntersectionPointsXzWithLineXz(lineNWO); + // if (ips.Count > 0) + // { + // intersection2 = new PlLinePoint(ips.Last().X, ips.Last().Z); + // } + // } + // + // // Handle making the NWO empty + // if ((NWOPhreaticAdaption != null) && (NWOPhreaticAdaption == PhreaticAdaptionType.MakeEmpty)) + // { + // // for the polderside, the pl line is always allowed to be adapted. For the riverside, the pl line may only be adapted when the original waterlevel is runs through the nwo. + // RemoveAllWaterFromNonWaterRetainingObject(nwo1, pl1Line, nwo1Pl, nwo2Pl, nwo3Pl, nwo4Pl, intersection1, intersection2, plPointsToBeMoved); + // } + // // Handle making the waterlevel horizontal in the NWO at the Riverside when needed (Polderside is already done when needed, see CreatePhreaticLineSegmentsInShoulderAndPolder. + // if ((NWOPhreaticAdaption != null) && (NWOPhreaticAdaption == PhreaticAdaptionType.None)) + // { + // // For the riverside, the pl line may only be adapted when the original waterlevel is runs through the nwo and is not already level. + // if ((nwo1.X <= this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X) && ((intersection1 != null) || (intersection2 != null))) + // { + // double requiredWaterLevel; + // // Check whether adaption of intersection points is needed + // if (intersection2 == null) + // { + // // only intersection 1 avaialable so add intersection 2 + // // first see if nwo3/4 intersects, if not try nwo2/3. If still no intersection found valid level not possible, raise error + // MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1(nwo2, nwo3, nwo4, pl1Line, nwo3Pl, nwo4Pl, intersection1); + // requiredWaterLevel = intersection1.Z; + // } + // else + // { + // if (intersection1 == null) + // { + // // only intersection 2 avaialable so add intersection 1 + // // first see if nwo1/2 intersects, if not try nwo2/3. If still no intersection found valid level not possible, raise error + // MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2(nwo1, nwo2, nwo3, pl1Line, nwo1Pl, nwo2Pl, nwo3Pl, intersection2); + // requiredWaterLevel = intersection2.Z; + // } + // else + // { + // // intersection 1 and intersection 2 available. Only act when levels were different. + // requiredWaterLevel = Math.Min(intersection1.Z, intersection2.Z); + // if ((Math.Abs(intersection1.Z - intersection2.Z) > GeometryPoint.Precision)) + // { + // if (intersection1.Z < intersection2.Z) + // { + // // make level in NWO intersection1.Z + // MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1And2(nwo2, nwo3, nwo4, pl1Line, nwo3Pl, intersection1, intersection2); + // } + // else + // { + // // make level in NWO intersection2.Z + // MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2And1(nwo1, nwo2, nwo3, pl1Line, nwo2Pl, intersection1, intersection2); + // } + // + // } + // } + // } + // + // // Move all the points in the pl line itself that need to be moved to the horizontal proper level. + // foreach (var PlLinePoint in plPointsToBeMoved) + // { + // PlLinePoint.Z = requiredWaterLevel; + // } + // pl1Line.DeleteCoinsidingPoints(GeometryPoint.Precision); + // } + // } + // } + // } -// private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2And1(GeometryPoint nwo1, GeometryPoint nwo2, GeometryPoint nwo3, PlLine pl1Line, PlLinePoint nwo2Pl, PlLinePoint intersection1, PlLinePoint intersection2) -// { -// var lineNWO = new Line { BeginPoint = new Point2D(nwo1.X, nwo1.Z), EndPoint = new Point2D(nwo2.X, nwo2.Z) }; -// var linePL = new Line { BeginPoint = new Point2D(nwo1.X, intersection2.Z), EndPoint = new Point2D(intersection2.X, intersection2.Z) }; -// var isp = new GeometryPoint(); -// if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp)) -// { -// var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision); -// newP1.Z = intersection2.Z; -// var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP2.Z = intersection2.Z; -// var newP3 = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP3.Z = intersection1.Z; -// } -// else -// { -// var lineNWOb = new Line { BeginPoint = new Point2D(nwo2.X, nwo2.Z), EndPoint = new Point2D(nwo3.X, nwo3.Z) }; -// if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp)) -// { -// var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision); -// newP1.Z = intersection2.Z; -// var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP2.Z = intersection2.Z; -// var newP3 = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision); -// newP3.Z = nwo2Pl.Z; -// if (nwo2Pl.X > intersection1.X) -// { -// var newP4 = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP4.Z = intersection1.Z; -// } -// -// } -// else -// { -// throw new PlLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level."); -// } -// } -// } + // private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2And1(GeometryPoint nwo1, GeometryPoint nwo2, GeometryPoint nwo3, PlLine pl1Line, PlLinePoint nwo2Pl, PlLinePoint intersection1, PlLinePoint intersection2) + // { + // var lineNWO = new Line { BeginPoint = new Point2D(nwo1.X, nwo1.Z), EndPoint = new Point2D(nwo2.X, nwo2.Z) }; + // var linePL = new Line { BeginPoint = new Point2D(nwo1.X, intersection2.Z), EndPoint = new Point2D(intersection2.X, intersection2.Z) }; + // var isp = new GeometryPoint(); + // if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp)) + // { + // var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision); + // newP1.Z = intersection2.Z; + // var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP2.Z = intersection2.Z; + // var newP3 = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP3.Z = intersection1.Z; + // } + // else + // { + // var lineNWOb = new Line { BeginPoint = new Point2D(nwo2.X, nwo2.Z), EndPoint = new Point2D(nwo3.X, nwo3.Z) }; + // if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp)) + // { + // var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision); + // newP1.Z = intersection2.Z; + // var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP2.Z = intersection2.Z; + // var newP3 = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision); + // newP3.Z = nwo2Pl.Z; + // if (nwo2Pl.X > intersection1.X) + // { + // var newP4 = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP4.Z = intersection1.Z; + // } + // + // } + // else + // { + // throw new PlLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level."); + // } + // } + // } -// private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1And2(GeometryPoint nwo2, GeometryPoint nwo3, GeometryPoint nwo4, PlLine pl1Line, PlLinePoint nwo3Pl, PlLinePoint intersection1, PlLinePoint intersection2) -// { -// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) }; -// var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(intersection1.X, 0, intersection1.Z), EndPoint = new GeometryPoint(nwo4.X, 0, intersection1.Z) }; -// var isp = new GeometryPoint(); -// if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp)) -// { -// var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision); -// newP1.Z = intersection1.Z; -// var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP2.Z = intersection1.Z; -// var newP3 = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP3.Z = intersection2.Z; -// } -// else -// { -// var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) }; -// if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp)) -// { -// var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision); -// newP1.Z = intersection1.Z; -// var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP2.Z = intersection1.Z; -// var newP3 = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision); -// newP3.Z = nwo3Pl.Z; -// if (nwo3Pl.X < intersection2.X) -// { -// var newP4 = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP4.Z = intersection2.Z; -// } -// } -// else -// { -// throw new PlLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level."); -// } -// } -// } + // private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1And2(GeometryPoint nwo2, GeometryPoint nwo3, GeometryPoint nwo4, PlLine pl1Line, PlLinePoint nwo3Pl, PlLinePoint intersection1, PlLinePoint intersection2) + // { + // var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) }; + // var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(intersection1.X, 0, intersection1.Z), EndPoint = new GeometryPoint(nwo4.X, 0, intersection1.Z) }; + // var isp = new GeometryPoint(); + // if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp)) + // { + // var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision); + // newP1.Z = intersection1.Z; + // var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP2.Z = intersection1.Z; + // var newP3 = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP3.Z = intersection2.Z; + // } + // else + // { + // var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) }; + // if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp)) + // { + // var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision); + // newP1.Z = intersection1.Z; + // var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP2.Z = intersection1.Z; + // var newP3 = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision); + // newP3.Z = nwo3Pl.Z; + // if (nwo3Pl.X < intersection2.X) + // { + // var newP4 = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP4.Z = intersection2.Z; + // } + // } + // else + // { + // throw new PlLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level."); + // } + // } + // } -// private void RemoveAllWaterFromNonWaterRetainingObject(GeometryPoint nwo1, PlLine pl1Line, PlLinePoint nwo1Pl, PlLinePoint nwo2Pl, PlLinePoint nwo3Pl, PlLinePoint nwo4Pl, PlLinePoint intersection1, PlLinePoint intersection2, IEnumerable plPointsToBeMoved) -// { -// if ((nwo1.X >= this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X) || -// ((intersection1 != null) && (intersection2 != null))) -// { -// // Move all the points in the pl line itself that need to be moved to below the surfaceline. -// MoveSelectedPlLinePointsBelowSurfaceLine(plPointsToBeMoved); -// -// // now add all extra points to the pl line -// if (nwo1Pl != null) -// { -// var newP = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision); -// newP.Z = nwo1Pl.Z; -// } -// if (nwo2Pl != null) -// { -// var newP = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision); -// newP.Z = nwo2Pl.Z; -// } -// if (nwo3Pl != null) -// { -// var newP = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision); -// newP.Z = nwo3Pl.Z; -// } -// if (nwo4Pl != null) -// { -// var newP = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision); -// newP.Z = nwo4Pl.Z; -// } -// // Note: for intersection points, apply offset in X direction not in Z. -// if (intersection1 != null) -// { -// var newP = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP.Z = intersection1.Z; -// } -// if (intersection2 != null) -// { -// var newP = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP.Z = intersection2.Z; -// } -// pl1Line.DeleteCoinsidingPoints(GeometryPoint.Precision); -// } -// } + // private void RemoveAllWaterFromNonWaterRetainingObject(GeometryPoint nwo1, PlLine pl1Line, PlLinePoint nwo1Pl, PlLinePoint nwo2Pl, PlLinePoint nwo3Pl, PlLinePoint nwo4Pl, PlLinePoint intersection1, PlLinePoint intersection2, IEnumerable plPointsToBeMoved) + // { + // if ((nwo1.X >= this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X) || + // ((intersection1 != null) && (intersection2 != null))) + // { + // // Move all the points in the pl line itself that need to be moved to below the surfaceline. + // MoveSelectedPlLinePointsBelowSurfaceLine(plPointsToBeMoved); + // + // // now add all extra points to the pl line + // if (nwo1Pl != null) + // { + // var newP = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision); + // newP.Z = nwo1Pl.Z; + // } + // if (nwo2Pl != null) + // { + // var newP = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision); + // newP.Z = nwo2Pl.Z; + // } + // if (nwo3Pl != null) + // { + // var newP = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision); + // newP.Z = nwo3Pl.Z; + // } + // if (nwo4Pl != null) + // { + // var newP = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision); + // newP.Z = nwo4Pl.Z; + // } + // // Note: for intersection points, apply offset in X direction not in Z. + // if (intersection1 != null) + // { + // var newP = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP.Z = intersection1.Z; + // } + // if (intersection2 != null) + // { + // var newP = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP.Z = intersection2.Z; + // } + // pl1Line.DeleteCoinsidingPoints(GeometryPoint.Precision); + // } + // } -// private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2(GeometryPoint nwo1, GeometryPoint nwo2, GeometryPoint nwo3, PlLine pl1Line, PlLinePoint nwo1Pl, PlLinePoint nwo2Pl, PlLinePoint nwo3Pl, PlLinePoint intersection2) -// { -// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) }; -// var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, intersection2.Z), EndPoint = new GeometryPoint(intersection2.X, 0, intersection2.Z) }; -// var isp = new GeometryPoint(); -// if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp)) -// { -// var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision); -// newP1.Z = intersection2.Z; -// var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP2.Z = intersection2.Z; -// if (nwo1Pl != null) -// { -// var newP3 = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision); -// newP3.Z = nwo1Pl.Z; -// } -// } -// else -// { -// var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) }; -// if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp)) -// { -// var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision); -// newP1.Z = intersection2.Z; -// var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP2.Z = intersection2.Z; -// if (nwo2Pl != null) -// { -// var newP3 = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision); -// newP3.Z = nwo2Pl.Z; -// if ((nwo1Pl != null) && (nwo2Pl.X > nwo1Pl.X)) -// { -// var newP4 = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision); -// newP4.Z = nwo1Pl.Z; -// } -// } -// } -// else -// { -// throw new PlLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level."); -// } -// } -// } + // private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2(GeometryPoint nwo1, GeometryPoint nwo2, GeometryPoint nwo3, PlLine pl1Line, PlLinePoint nwo1Pl, PlLinePoint nwo2Pl, PlLinePoint nwo3Pl, PlLinePoint intersection2) + // { + // var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) }; + // var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, intersection2.Z), EndPoint = new GeometryPoint(intersection2.X, 0, intersection2.Z) }; + // var isp = new GeometryPoint(); + // if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp)) + // { + // var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision); + // newP1.Z = intersection2.Z; + // var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP2.Z = intersection2.Z; + // if (nwo1Pl != null) + // { + // var newP3 = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision); + // newP3.Z = nwo1Pl.Z; + // } + // } + // else + // { + // var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) }; + // if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp)) + // { + // var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision); + // newP1.Z = intersection2.Z; + // var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP2.Z = intersection2.Z; + // if (nwo2Pl != null) + // { + // var newP3 = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision); + // newP3.Z = nwo2Pl.Z; + // if ((nwo1Pl != null) && (nwo2Pl.X > nwo1Pl.X)) + // { + // var newP4 = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision); + // newP4.Z = nwo1Pl.Z; + // } + // } + // } + // else + // { + // throw new PlLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level."); + // } + // } + // } -// private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1(GeometryPoint nwo2, GeometryPoint nwo3, GeometryPoint nwo4, PlLine pl1Line, PlLinePoint nwo3Pl, PlLinePoint nwo4Pl, PlLinePoint intersection1) -// { -// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) }; -// var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(intersection1.X, 0, intersection1.Z), EndPoint = new GeometryPoint(nwo4.X, 0, intersection1.Z) }; -// var isp = new GeometryPoint(); -// if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp)) -// { -// var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision); -// newP1.Z = intersection1.Z; -// var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP2.Z = intersection1.Z; -// if (nwo4Pl != null) -// { -// var newP3 = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision); -// newP3.Z = nwo4Pl.Z; -// } -// } -// else -// { -// var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) }; -// if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp)) -// { -// var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision); -// newP1.Z = intersection1.Z; -// var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); -// newP2.Z = intersection1.Z; -// if (nwo3Pl != null) -// { -// var newP3 = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision); -// newP3.Z = nwo3Pl.Z; -// if ((nwo4Pl != null) && (nwo4Pl.X > nwo3Pl.X)) -// { -// var newP4 = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision); -// newP4.Z = nwo4Pl.Z; -// } -// } -// } -// else -// { -// throw new PlLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level."); -// } -// } -// } + // private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1(GeometryPoint nwo2, GeometryPoint nwo3, GeometryPoint nwo4, PlLine pl1Line, PlLinePoint nwo3Pl, PlLinePoint nwo4Pl, PlLinePoint intersection1) + // { + // var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) }; + // var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(intersection1.X, 0, intersection1.Z), EndPoint = new GeometryPoint(nwo4.X, 0, intersection1.Z) }; + // var isp = new GeometryPoint(); + // if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp)) + // { + // var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision); + // newP1.Z = intersection1.Z; + // var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP2.Z = intersection1.Z; + // if (nwo4Pl != null) + // { + // var newP3 = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision); + // newP3.Z = nwo4Pl.Z; + // } + // } + // else + // { + // var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) }; + // if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp)) + // { + // var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision); + // newP1.Z = intersection1.Z; + // var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision); + // newP2.Z = intersection1.Z; + // if (nwo3Pl != null) + // { + // var newP3 = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision); + // newP3.Z = nwo3Pl.Z; + // if ((nwo4Pl != null) && (nwo4Pl.X > nwo3Pl.X)) + // { + // var newP4 = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision); + // newP4.Z = nwo4Pl.Z; + // } + // } + // } + // else + // { + // throw new PlLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level."); + // } + // } + // } -// private void MoveSelectedPlLinePointsBelowSurfaceLine(IEnumerable plPointsToBeMoved) -// { -// foreach (var PlLinePoint in plPointsToBeMoved) -// { -// // Determine which of these points must be moved and move them -// if (this.surfaceLine.Geometry.PositionXzOfPointRelatedToExtrapolatedLine(PlLinePoint) != -// RelativeXzPosition.BelowGeometricLine) -// { -// PlLinePoint.Z = this.surfaceLine.Geometry.GetZatX(PlLinePoint.X) - cOffsetPhreaticLineBelowSurface; -// } -// } -// } + // private void MoveSelectedPlLinePointsBelowSurfaceLine(IEnumerable plPointsToBeMoved) + // { + // foreach (var PlLinePoint in plPointsToBeMoved) + // { + // // Determine which of these points must be moved and move them + // if (this.surfaceLine.Geometry.PositionXzOfPointRelatedToExtrapolatedLine(PlLinePoint) != + // RelativeXzPosition.BelowGeometricLine) + // { + // PlLinePoint.Z = this.surfaceLine.Geometry.GetZatX(PlLinePoint.X) - cOffsetPhreaticLineBelowSurface; + // } + // } + // } /// /// @@ -1312,9 +1309,11 @@ switch (modelParametersForPlLines.PlLineCreationMethod) { case PlLineCreationMethod.ExpertKnowledgeLinearInDike: - case PlLineCreationMethod.ExpertKnowledgeRRD: plLines = CreateAllPlLinesWithExpertKnowledge(location); + case PlLineCreationMethod.ExpertKnowledgeRRD: + plLines = CreateAllPlLinesWithExpertKnowledge(location); break; - case PlLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD: plLines = CreateAllPlLinesWithGaugesWithFallbackToExpertKnowledgeRrd(location); + case PlLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD: + plLines = CreateAllPlLinesWithGaugesWithFallbackToExpertKnowledgeRrd(location); break; } @@ -1352,10 +1351,10 @@ plLine = this.CreatePlLine2ByExpertKnowledge(this.ModelParametersForPlLines.PenetrationLength, this.HeadInPlLine2); break; case PlLineType.Pl3: - plLine = this.CreatePlLine3ByExpertKnowledge(HeadPl3Taking, this.ModelParametersForPlLines.DampingFactorPl3, slopeGradient); + plLine = this.CreatePlLine3ByExpertKnowledge(DetermineHeadPl3(), this.ModelParametersForPlLines.DampingFactorPl3, slopeGradient); break; case PlLineType.Pl4: - plLine = this.CreatePlLine4ByExpertKnowledge(GetHeadPl4(), this.ModelParametersForPlLines.DampingFactorPl4, slopeGradient); + plLine = this.CreatePlLine4ByExpertKnowledge(DetermineHeadPl4(), this.ModelParametersForPlLines.DampingFactorPl4, slopeGradient); break; } @@ -1539,7 +1538,7 @@ { //if (!surfaceLine.IsNonWaterRetainingObjectPoint(point)) //{ - phreaticLine.Points.Add(new PlLinePoint(point.X, point.Z - cPlLineOffsetBelowSurface)); + phreaticLine.Points.Add(new PlLinePoint(point.X, point.Z - cPlLineOffsetBelowSurface)); //} } @@ -1573,7 +1572,7 @@ { if (UsePlLineOffsetBelowDikeCrestMiddle.HasValue && UsePlLineOffsetBelowDikeCrestMiddle.Value && PlLineOffsetBelowDikeCrestMiddle != null) { - var middleDikeCrestX = (pointDikeTopAtRiver.X + pointDikeTopAtPolder.X)*0.5; + var middleDikeCrestX = (pointDikeTopAtRiver.X + pointDikeTopAtPolder.X) * 0.5; var middleDikeCrestZ = waterLevelRiverHigh - PlLineOffsetBelowDikeCrestMiddle.Value; // Check whether middleDikeCrestZ is above the surface line. If so, than use the value at the surfaceline instead. var allZ = surfaceLine.Geometry.GetAllZatXForLine(middleDikeCrestX); @@ -1692,7 +1691,7 @@ } var isDitchPresent = (ditchDikeSidePoint != null); - + // if there is a ditch, then adjust it. if (isDitchPresent) { @@ -1710,7 +1709,7 @@ if (phreaticLine.Points[phreaticLine.Points.Count - 1].Z > WaterLevelPolder) { AddPhreaticLineAlongSurfaceLevel(phreaticLine); - } + } } //Validate if endpoint surface has reached @@ -1759,7 +1758,7 @@ const double maxDouble = 99999.999; var phreaticPolderPartialLine = new Line(); //#bka: hier niet langer ook starten met waterlevel als waterlevel onder bottomditch zit! - phreaticPolderPartialLine.SetBeginAndEndPoints(new Point2D(phreaticLine.Points[0].X, waterLevelPolder), + phreaticPolderPartialLine.SetBeginAndEndPoints(new Point2D(phreaticLine.Points[0].X, waterLevelPolder), new Point2D(maxDouble, waterLevelPolder)); AddIntersectionDitchDikeSegmentPolderLevelToPhreatic(phreaticLine, surfacePointIndex, phreaticPolderPartialLine); AddIntersectionDitchPolderSegmentPolderLevelToPhreatic(phreaticLine, phreaticPolderPartialLine); @@ -1781,7 +1780,7 @@ var lineDitchPolderSide = new Line(); if (indexatDitchPolder > 1) { - lineDitchPolderSide.SetBeginAndEndPoints(new Point2D(surfaceLine.Geometry.Points[indexatDitchPolder - 1].X, surfaceLine.Geometry.Points[indexatDitchPolder - 1].Z), + lineDitchPolderSide.SetBeginAndEndPoints(new Point2D(surfaceLine.Geometry.Points[indexatDitchPolder - 1].X, surfaceLine.Geometry.Points[indexatDitchPolder - 1].Z), new Point2D(surfaceLine.Geometry.Points[indexatDitchPolder].X, surfaceLine.Geometry.Points[indexatDitchPolder].Z)); GeometryPoint intersectDitchPolderPhreatic = new GeometryPoint(); @@ -1813,7 +1812,7 @@ if (surfacePointIndex + 1 < surfaceLine.Geometry.Points.Count) { var lineDitchDikeSide = new Line(); - lineDitchDikeSide.SetBeginAndEndPoints(new Point2D(surfaceLine.Geometry.Points[surfacePointIndex].X, surfaceLine.Geometry.Points[surfacePointIndex].Z), + lineDitchDikeSide.SetBeginAndEndPoints(new Point2D(surfaceLine.Geometry.Points[surfacePointIndex].X, surfaceLine.Geometry.Points[surfacePointIndex].Z), new Point2D(surfaceLine.Geometry.Points[surfacePointIndex + 1].X, surfaceLine.Geometry.Points[surfacePointIndex + 1].Z)); GeometryPoint intersectDitchDikePhreatic = new GeometryPoint(); @@ -1857,7 +1856,7 @@ var polderlevelLine = new Line(); double startXCoordinate = this.surfaceLine.Geometry.Points.OrderBy(p => p.X).First().X; GeometryPoint pointEndOfprofile = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside); - polderlevelLine.SetBeginAndEndPoints(new Point2D(startXCoordinate, polderLevel), + polderlevelLine.SetBeginAndEndPoints(new Point2D(startXCoordinate, polderLevel), new Point2D(pointEndOfprofile.X, polderLevel)); ThrowWhenWaterLevelAboveDike(polderLevel, SurfaceLine); @@ -1869,7 +1868,7 @@ for (int surfacePointIndex = startPosition; surfacePointIndex < endPosition; surfacePointIndex++) { var surfaceLineSegment = new Line(); - surfaceLineSegment.SetBeginAndEndPoints(new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex].X, SurfaceLine.Geometry.Points[surfacePointIndex].Z), + surfaceLineSegment.SetBeginAndEndPoints(new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex].X, SurfaceLine.Geometry.Points[surfacePointIndex].Z), new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex + 1].X, SurfaceLine.Geometry.Points[surfacePointIndex + 1].Z)); GeometryPoint intersectPoint = new GeometryPoint(); if (LineHelper.GetStrictIntersectionPoint(surfaceLineSegment, polderlevelLine, ref intersectPoint)) @@ -2023,7 +2022,7 @@ { CreatePhreaticLineSegmentsInsideDikeForHighRiverLevel(phreaticLine); } - CreatePhreaticLineSegmentsInShoulderAndPolder(phreaticLine); + CreatePhreaticLineSegmentsInShoulderAndPolder(phreaticLine); //Check if phreatic line is above ValidatePhreaticAboveWaterLevelPolder(phreaticLine);