Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ListExtension.cs =================================================================== diff -u -r3522 -r3849 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ListExtension.cs (.../ListExtension.cs) (revision 3522) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ListExtension.cs (.../ListExtension.cs) (revision 3849) @@ -258,14 +258,11 @@ { return ((IFindList) findList).Find(match); } - else if (findList is List) + if (findList is List) { return ((List) findList).Find(match); } - else - { - throw new NotImplementedException("Find"); - } + throw new NotImplementedException("Find"); } public static List FindAll(this IList findList, Predicate match) @@ -274,14 +271,11 @@ { return ((IFindList) findList).FindAll(match); } - else if (findList is List) + if (findList is List) { return ((List) findList).FindAll(match); } - else - { - throw new NotImplementedException("FindAll"); - } + throw new NotImplementedException("FindAll"); } public static int FindIndex(this IList findList, Predicate match) @@ -306,14 +300,11 @@ { return ((IFindList) findList).FindLast(match); } - else if (findList is List) + if (findList is List) { return ((List) findList).FindLast(match); } - else - { - throw new NotImplementedException("Find"); - } + throw new NotImplementedException("Find"); } public static int FindLastIndex(this IList findList, Predicate match) @@ -326,10 +317,7 @@ { return ((List) findList).FindLastIndex(match); } - else - { - throw new NotImplementedException("Find"); - } + throw new NotImplementedException("Find"); } /// @@ -379,7 +367,7 @@ IEnumerable items, Func selector) { - if (items == null) + if (collection == null) { throw new ArgumentNullException("collection"); } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r3787 -r3849 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 3787) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 3849) @@ -22,7 +22,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Deltares.DamEngine.Calculators.General; using Deltares.DamEngine.Calculators.Uplift; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Gauges; @@ -898,378 +897,21 @@ } else { - plLines.Lines[plLineType] = CreatePlLineByExpertKnowledge(plLineType, location.SlopeDampingPiezometricHeightPolderSide); + if (location != null) + { + plLines.Lines[plLineType] = CreatePlLineByExpertKnowledge(plLineType, location.SlopeDampingPiezometricHeightPolderSide); + } } // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4 if (plLineType == PlLineType.Pl1) { - // var PlLine = PlLines.Lines[PlLineType]; - // AdaptPL1ForNonWaterRetainingObject(ref PlLine); - // PlLines.Lines[PlLineType] = PlLine; currentPl1Line = plLines.Lines[plLineType]; } } 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 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 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 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 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 PlLines CreateAllPlLinesWithGaugesWithFallbackToExpertKnowledgeRrd(Location location) { var plLines = new PlLines(); @@ -1282,8 +924,10 @@ Boolean isUseWaterLevel = ((plLineType == PlLineType.Pl1) || (plLineType == PlLineType.Pl2)); plLines.Lines[plLineType] = CreatePlLineFromGauges(gaugePlLine, this.Gauges, location, isUseWaterLevel); } - else + else if (location != null) + { plLines.Lines[plLineType] = CreatePlLineByExpertKnowledge(plLineType, location.SlopeDampingPiezometricHeightPolderSide); + } // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4 if (plLineType == PlLineType.Pl1) @@ -1715,7 +1359,7 @@ } else { - if (phreaticLine.Points.Last().X < dikeToeAtPolderPoint.X) + if (dikeToeAtPolderPoint != null && phreaticLine.Points.Last().X < dikeToeAtPolderPoint.X) { var newPoint = new PlLinePoint(dikeToeAtPolderPoint.X, waterLevelPolder); phreaticLine.Points.Add(newPoint); Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs =================================================================== diff -u -r3522 -r3849 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs (.../SoilSurfaceProfile.cs) (revision 3522) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs (.../SoilSurfaceProfile.cs) (revision 3849) @@ -37,8 +37,7 @@ public class SoilSurfaceProfile : SoilProfile2D { private Soil dikeEmbankmentMaterial; - private SoilProfile1D soilProfile; - private SoilProfile1D originalSoilProfile1D; + private SoilProfile1D soilProfile1D; private SurfaceLine2 surfaceLine2; /// @@ -76,11 +75,11 @@ { get { - return originalSoilProfile1D; + return soilProfile1D; } set { - originalSoilProfile1D = value; + soilProfile1D = value; } } @@ -114,9 +113,9 @@ { return Name; } - if (originalSoilProfile1D != null) + if (soilProfile1D != null) { - return originalSoilProfile1D.ToString(); + return soilProfile1D.ToString(); } return "Soil Surface Profile with null Soil Profile"; } @@ -147,13 +146,13 @@ /// private void Create2DGeometryBasedOn1DProfileAndSurfaceLine() { - var filteredSoilLayers = FilterSoilLayersToConvert(originalSoilProfile1D, surfaceLine2); + var filteredSoilLayers = FilterSoilLayersToConvert(soilProfile1D, surfaceLine2); var localSurfaceLinePoints = GetLocalSurfaceLinePoints(filteredSoilLayers, surfaceLine2); var layerData = CreateLayerData(filteredSoilLayers, localSurfaceLinePoints); var filteredLayerData = FilterLayerDataWithClosedLoops(layerData); - BuildGeometryModel(Geometry, filteredLayerData, originalSoilProfile1D, surfaceLine2, localSurfaceLinePoints); + BuildGeometryModel(Geometry, filteredLayerData, soilProfile1D, surfaceLine2, localSurfaceLinePoints); AssignSoilLayer2DProperties(Surfaces, filteredLayerData, Geometry); } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryLoop.cs =================================================================== diff -u -r3522 -r3849 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryLoop.cs (.../GeometryLoop.cs) (revision 3522) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryLoop.cs (.../GeometryLoop.cs) (revision 3849) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Linq; namespace Deltares.DamEngine.Data.Geometry { @@ -100,7 +99,7 @@ return false; } // Make sure points from curves are also exist as points - if (CalcPoints.Count >= 0) + if (CalcPoints.Count > 0) { SyncPoints(); } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/LayerDetector.cs =================================================================== diff -u -r3790 -r3849 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/LayerDetector.cs (.../LayerDetector.cs) (revision 3790) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/LayerDetector.cs (.../LayerDetector.cs) (revision 3849) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; using System.Linq; using Deltares.DamEngine.Data.Geometry;