Index: DamEngine/trunk/src/Deltares.DamEngine.Data/GeometryExport/GeometryExporter.cs =================================================================== diff -u -r5483 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/GeometryExport/GeometryExporter.cs (.../GeometryExporter.cs) (revision 5483) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/GeometryExport/GeometryExporter.cs (.../GeometryExporter.cs) (revision 6087) @@ -123,14 +123,6 @@ { using (var writer = new StreamWriter(fileName)) { - // Export points - writer.WriteLine("[BEGIN POINTS] " + surfaceLine.Points.Count); - foreach (GeometryPoint point in surfaceLine.Points) - { - writer.WriteLine($"{point.X}, {point.Z}"); - } - writer.WriteLine("[END POINTS]"); - // Export calc points writer.WriteLine("[BEGIN CALC POINTS] " + surfaceLine.CalcPoints.Count); foreach (Point2D calcPoint in surfaceLine.CalcPoints) Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/CharacteristicPointSet.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/CharacteristicPointSet.cs (.../CharacteristicPointSet.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/CharacteristicPointSet.cs (.../CharacteristicPointSet.cs) (revision 6087) @@ -34,7 +34,7 @@ public class CharacteristicPointSet : IList, IList { private readonly List annotations; - private readonly Dictionary typeCache; + private readonly Dictionary typeCache; private GeometryPointString geometry; private bool geometryMustContainPoint; @@ -44,7 +44,7 @@ /// public CharacteristicPointSet() { - typeCache = new Dictionary(); + typeCache = new Dictionary(); annotations = new List(); geometryMustContainPoint = false; } @@ -98,7 +98,7 @@ /// Null if no definition can be found. /// This method relies on this class observing changes to its /// to work correctly. - public GeometryPoint GetGeometryPoint(CharacteristicPointType characteristicPointType) + public Point2D GetPoint2D(CharacteristicPointType characteristicPointType) { return typeCache.ContainsKey(characteristicPointType) ? typeCache[characteristicPointType] @@ -127,7 +127,7 @@ /// The new type of the characteristic point. /// When is /// less then 0 or greater or equal to . - /// will be returning the correct points. + /// will be returning the correct points. public void Annotate(int index, CharacteristicPointType characteristicPointType) { annotations[index].CharacteristicPointType = characteristicPointType; @@ -144,19 +144,19 @@ { if (geometry == null) { - characteristicPoint.Z = double.NaN; + characteristicPoint.Point.Z = double.NaN; } - else if (!geometry.Points.Contains(characteristicPoint.GeometryPoint)) + else if (!geometry.CalcPoints.Contains(characteristicPoint.Point)) { - if (double.IsNaN(characteristicPoint.X)) + if (double.IsNaN(characteristicPoint.Point.X)) { - characteristicPoint.Z = double.NaN; + characteristicPoint.Point.Z = double.NaN; } else { // Note: Cannot use GeometryPointString.GetZAtX due to its requirement // that Geometry.Points is sorted on X. - characteristicPoint.Z = geometry.GetZAtUnsortedX(characteristicPoint.X); + characteristicPoint.Point.Z = geometry.GetZAtUnsortedX(characteristicPoint.Point.X); } } // Else: Keep Z the same as in Geometry @@ -174,11 +174,11 @@ return; } - foreach (GeometryPoint geometryPoint in geometry.Points) + foreach (Point2D point in geometry.CalcPoints) { Add(new CharacteristicPoint { - GeometryPoint = geometryPoint, + Point = point, CharacteristicPointType = CharacteristicPointType.None }); } @@ -190,7 +190,7 @@ // characteristic points should have their height updated: foreach (CharacteristicPoint characteristicPoint in annotations.ToArray()) { - if (geometry != null && geometry.Points.Contains(characteristicPoint.GeometryPoint)) + if (geometry != null && geometry.CalcPoints.Contains(characteristicPoint.Point)) { Remove(characteristicPoint); } @@ -219,14 +219,14 @@ { // Prevent duplication: CharacteristicPoint alreadyDefined = annotations.FirstOrDefault(cp => cp.CharacteristicPointType == item.CharacteristicPointType && - !ReferenceEquals(cp.GeometryPoint, item.GeometryPoint)); + !ReferenceEquals(cp.Point, item.Point)); if (alreadyDefined != null) { alreadyDefined.CharacteristicPointType = CharacteristicPointType.None; } // Set new annotation definition: - typeCache[item.CharacteristicPointType] = item.GeometryPoint; + typeCache[item.CharacteristicPointType] = item.Point; } } @@ -404,12 +404,12 @@ typeCache.Remove(item.CharacteristicPointType); bool removeGeometryPoint = GeometryMustContainPoint && Geometry != null && - Geometry.Points.Contains(item.GeometryPoint) && - !annotations.Any(cp => ReferenceEquals(cp.GeometryPoint, item.GeometryPoint)); + Geometry.CalcPoints.Contains(item.Point) && + !annotations.Any(cp => ReferenceEquals(cp.Point, item.Point)); if (removeGeometryPoint) { - PerformCollectionRemoveWithEvents(Geometry.Points, item.GeometryPoint); + PerformCollectionRemoveWithEvents(Geometry.CalcPoints, item.Point); } } @@ -434,7 +434,6 @@ if (GeometryMustContainPoint && Geometry != null) { - Geometry.Points.Clear(); Geometry.CalcPoints.Clear(); } } @@ -485,16 +484,16 @@ item.PointSet = this; } - GeometryPoint itemAtIndex = index < annotations.Count ? annotations[index].GeometryPoint : null; + Point2D itemAtIndex = index < annotations.Count ? annotations[index].Point : null; PerformListInsertWithEvents(annotations, item, index); - if (GeometryMustContainPoint && Geometry != null && !Geometry.Points.Contains(item.GeometryPoint)) + if (GeometryMustContainPoint && Geometry != null && !Geometry.CalcPoints.Contains(item.Point)) { - int geometryIndex = Geometry.Points.Count; + int geometryIndex = Geometry.CalcPoints.Count; if (null != itemAtIndex) { - for (var i = 0; i < Geometry.Points.Count; i++) + for (var i = 0; i < Geometry.CalcPoints.Count; i++) { - if (ReferenceEquals(Geometry.Points[i], itemAtIndex)) + if (ReferenceEquals(Geometry.CalcPoints[i], itemAtIndex)) { geometryIndex = i; break; @@ -505,11 +504,11 @@ // Check if point at same position already exists and set that point to the existing point // Do this to avoid points in Surfaceline.Geometry with the same location var IsPointExist = false; - for (var i = 0; i < Geometry.Points.Count; i++) + for (var i = 0; i < Geometry.CalcPoints.Count; i++) { - if (Geometry.Points[i].LocationEquals(item.GeometryPoint)) + if (Geometry.CalcPoints[i].LocationEquals(item.Point)) { - item.GeometryPoint = Geometry.Points[i]; + item.Point = Geometry.CalcPoints[i]; IsPointExist = true; break; } @@ -518,7 +517,7 @@ if (!IsPointExist) { // Only add new point if no point on same location was found - PerformListInsertWithEvents(Geometry.Points, item.GeometryPoint, geometryIndex); + PerformListInsertWithEvents(Geometry.CalcPoints, item.Point, geometryIndex); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineSlopeAdapter.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineSlopeAdapter.cs (.../SurfaceLineSlopeAdapter.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineSlopeAdapter.cs (.../SurfaceLineSlopeAdapter.cs) (revision 6087) @@ -54,9 +54,9 @@ public SurfaceLine2 ConstructNewSurfaceLine(double deltaXAtToeOfSlope) { ThrowHelper.ThrowWhenConditionIsTrue("deltaXAtToeOfSlope should be >= 0.0", () => deltaXAtToeOfSlope < 0.0); - GeometryPoint dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - GeometryPoint dikeBaseInside = surfaceLine.HasShoulderInside() ? surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder; + Point2D dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); + Point2D dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeBaseInside = surfaceLine.HasShoulderInside() ? surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder; double slopeTangent = (dikeTopAtPolder.Z - dikeBaseInside.Z) / (dikeBaseInside.X + deltaXAtToeOfSlope - dikeTopAtPolder.X); @@ -88,9 +88,9 @@ orgMaxX = double.MaxValue; } - GeometryPoint dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - GeometryPoint dikeBaseInside = surfaceLine.HasShoulderInside() ? surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder; + Point2D dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); + Point2D dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeBaseInside = surfaceLine.HasShoulderInside() ? surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder; // Remove points on inside slope surfaceLine.RemoveSegmentBetween(dikeTopAtPolder.X, dikeBaseInside.X); // Store the ditch (if any) Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs =================================================================== diff -u -r5741 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs (.../Point2D.cs) (revision 5741) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs (.../Point2D.cs) (revision 6087) @@ -171,4 +171,13 @@ return String.Compare(ToString(), obj.ToString(), StringComparison.Ordinal); } + + /// + /// Gets the geometry bounds. + /// + /// + public GeometryBounds GetGeometryBounds() + { + return new GeometryBounds(X, X, Z, Z); + } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2.cs (.../SurfaceLine2.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2.cs (.../SurfaceLine2.cs) (revision 6087) @@ -107,15 +107,15 @@ /// Define a new characteristic point on the surface line with the given characteristic /// point annotation. /// - /// The point to be added. Cannot be null. - /// The annotations for . - public void AddCharacteristicPoint(GeometryPoint geometryPoint, params CharacteristicPointType[] annotations) + /// The point to be added. Cannot be null. + /// The annotations for . + public void AddCharacteristicPoint(Point2D point, params CharacteristicPointType[] annotations) { if (annotations == null || annotations.Length == 0) { CharacteristicPoints.Add(new CharacteristicPoint { - GeometryPoint = geometryPoint, + Point = point, CharacteristicPointType = CharacteristicPointType.None }); } @@ -125,7 +125,7 @@ { CharacteristicPoints.Add(new CharacteristicPoint { - GeometryPoint = geometryPoint, + Point = point, CharacteristicPointType = type }); } @@ -141,7 +141,7 @@ /// The annotations for geometryPoint with x, z/>. public void AddCharacteristicPoint(double x, double z, params CharacteristicPointType[] annotations) { - var geometryPoint = new GeometryPoint(x, z); + var geometryPoint = new Point2D(x, z); AddCharacteristicPoint(geometryPoint, annotations); } @@ -150,9 +150,9 @@ /// /// /// - public IEnumerable GetCharacteristicPoints(GeometryPoint geometryPoint) + public IEnumerable GetCharacteristicPoints(Point2D geometryPoint) { - return CharacteristicPoints.Where(cp => ReferenceEquals(cp.GeometryPoint, geometryPoint)) + return CharacteristicPoints.Where(cp => ReferenceEquals(cp.Point, geometryPoint)) .Select(cp => cp.CharacteristicPointType); } @@ -171,7 +171,7 @@ /// The end x. /// collection of points between start X and end X (inlcuding those) /// End value is smaller then the start value - public virtual IEnumerable GetPointSegmentIncluding(double startX, double endX) + public virtual IEnumerable GetPointSegmentIncluding(double startX, double endX) { if (endX < startX) { @@ -234,11 +234,11 @@ /// /// The points orderd by x. /// - private IEnumerable PointsOrderedByX + private IEnumerable PointsOrderedByX { get { - return Geometry.Points.OrderBy(p => p.X); + return Geometry.CalcPoints.OrderBy(p => p.X); } } @@ -249,16 +249,16 @@ /// The start x. /// The end x. /// true if the given point is between the given start X and end X, otherwise false - private bool TestIncluding(GeometryPoint point, double startX, double endX) + private bool TestIncluding(Point2D point, double startX, double endX) { if (point == null) { return false; } double x = point.X; - return (x >= startX || x.AlmostEquals(startX, GeometryPoint.Precision)) - && (x <= endX || x.AlmostEquals(endX, GeometryPoint.Precision)); + return (x >= startX || x.AlmostEquals(startX, GeometryConstants.Accuracy)) + && (x <= endX || x.AlmostEquals(endX, GeometryConstants.Accuracy)); } /// @@ -278,19 +278,19 @@ CharacteristicPoints.GeometryMustContainPoint = source.CharacteristicPoints.GeometryMustContainPoint; Geometry = cloneGeometry ? source.Geometry.Clone() : source.Geometry; - Dictionary geometryAnnotations = GetCharacteristicAnnotationsInSource(source, cloneGeometry); + Dictionary geometryAnnotations = GetCharacteristicAnnotationsInSource(source, cloneGeometry); // Reconstruct annotation state from dictionary: if (CharacteristicPoints.GeometryMustContainPoint) { - foreach (KeyValuePair annotation in geometryAnnotations) + foreach (KeyValuePair annotation in geometryAnnotations) { for (var i = 0; i < annotation.Value.Length; i++) { int index = -1; for (var j = 0; j < CharacteristicPoints.Count; j++) { - if (ReferenceEquals(CharacteristicPoints[j].GeometryPoint, annotation.Key)) + if (ReferenceEquals(CharacteristicPoints[j].Point, annotation.Key)) { index = j; break; @@ -315,9 +315,9 @@ } else { - foreach (KeyValuePair annotation in geometryAnnotations) + foreach (KeyValuePair annotation in geometryAnnotations) { - AddCharacteristicPoint((GeometryPoint) annotation.Key.Clone(), annotation.Value); + AddCharacteristicPoint((Point2D) annotation.Key.Clone(), annotation.Value); } } } @@ -333,7 +333,7 @@ /// take the same instance instead. /// Dictionary keyed on instances in the surfaceline /// that have annotations. - private Dictionary GetCharacteristicAnnotationsInSource(SurfaceLine2 source, bool cloneGeometry) + private Dictionary GetCharacteristicAnnotationsInSource(SurfaceLine2 source, bool cloneGeometry) { return CharacteristicPoints.GeometryMustContainPoint ? GetCharacteristicAnnotationsInSource_GeometryMustContainPoints(source, cloneGeometry) @@ -350,15 +350,15 @@ /// take the same instance instead. /// Dictionary keyed on instances in the surfaceline /// that have annotations. - private Dictionary GetCharacteristicAnnotationsInSource_GeometryMustContainPoints(SurfaceLine2 source, bool cloneGeometry) + private Dictionary GetCharacteristicAnnotationsInSource_GeometryMustContainPoints(SurfaceLine2 source, bool cloneGeometry) { - var geometryAnnotations = new Dictionary(); + var geometryAnnotations = new Dictionary(); for (var i = 0; i < source.Geometry.Count; i++) { - CharacteristicPointType[] annotationsForPoint = source.GetCharacteristicPoints(source.Geometry.Points[i]).Where(cpt => cpt != CharacteristicPointType.None).ToArray(); + CharacteristicPointType[] annotationsForPoint = source.GetCharacteristicPoints(source.Geometry.CalcPoints[i]).Where(cpt => cpt != CharacteristicPointType.None).ToArray(); if (annotationsForPoint.Length > 0) { - geometryAnnotations[Geometry.Points[i]] = annotationsForPoint; + geometryAnnotations[Geometry.CalcPoints[i]] = annotationsForPoint; } } @@ -372,15 +372,15 @@ /// The referenced surfaceline. /// Dictionary keyed on instances in the surfaceline /// that have annotations. - private static Dictionary GetCharacteristicAnnotationsInSource_GeometryMustNotContainPoints(SurfaceLine2 source) + private static Dictionary GetCharacteristicAnnotationsInSource_GeometryMustNotContainPoints(SurfaceLine2 source) { - var geometryAnnotations = new Dictionary(); + var geometryAnnotations = new Dictionary(); foreach (CharacteristicPoint characteristicPoint in source.CharacteristicPoints) { - if (!geometryAnnotations.ContainsKey(characteristicPoint.GeometryPoint)) + if (!geometryAnnotations.ContainsKey(characteristicPoint.Point)) { - geometryAnnotations[characteristicPoint.GeometryPoint] = - source.GetCharacteristicPoints(characteristicPoint.GeometryPoint).ToArray(); + geometryAnnotations[characteristicPoint.Point] = + source.GetCharacteristicPoints(characteristicPoint.Point).ToArray(); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPointString.cs =================================================================== diff -u -r5992 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPointString.cs (.../GeometryPointString.cs) (revision 5992) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPointString.cs (.../GeometryPointString.cs) (revision 6087) @@ -83,15 +83,13 @@ /// /// The calculate points as protected field (to be able to prevent recursive calls to CalcPoints) /// - protected readonly List calcPoints = new List(); + protected List calcPoints = new List(); - private readonly List points = new List(); - /// - /// Gets the at the specified index. + /// Gets the at the specified index. /// /// - /// The . + /// The . /// /// The index. /// When less @@ -105,7 +103,7 @@ } /// - /// The calculate points (to be used in calcualtion instead of Points for better performance) + /// The calculate points (to be used in calculation instead of Points for better performance) /// public virtual List CalcPoints { @@ -116,20 +114,6 @@ } /// - /// List of points that describe the physical surface line or surface. - /// - /// - /// The points. - /// - public virtual IList Points - { - get - { - return points; - } - } - - /// /// Gets the count of the points. /// /// @@ -151,13 +135,11 @@ { var clone = new GeometryPointString(); this.CloneProperties(clone); // excludes the points ! - clone.Points.Clear(); - foreach (GeometryPoint point in Points) + clone.CalcPoints.Clear(); + foreach (Point2D point in CalcPoints) { - clone.Points.Add(new GeometryPoint(point)); + clone.CalcPoints.Add(new Point2D(point.X, point.Z)); } - - clone.SyncCalcPoints(); return clone; } @@ -166,7 +148,7 @@ /// public void RoundPointsCoordinates(double accuracy) { - foreach (GeometryPoint point in Points) + foreach (Point2D point in CalcPoints) { point.X = RoundValue(point.X, accuracy); point.Z = RoundValue(point.Z, accuracy); @@ -405,19 +387,6 @@ } /// - /// Gets the GeometryPoint at the specified coordinates. - /// - /// The x. - /// The z. - /// - public GeometryPoint DetermineGeometryPointAt(double x, double z) - { - return Points.FirstOrDefault( - point => point.X.AlmostEquals(x, GeometryPoint.Precision) && - point.Z.AlmostEquals(z, GeometryPoint.Precision)); - } - - /// /// Returns ALL intersection points that are found for a line costructed at level z, /// including the double ones as the number of points can be relevant! /// @@ -474,13 +443,12 @@ public virtual void SortPointsByXAscending() { calcPoints.Sort(); - points.Sort(); } /// /// Removes all double points at a location, if consecutive /// - public void CondensePoints() + private void CondensePoints() { for (int i = calcPoints.Count - 1; i > 0; i--) { @@ -514,46 +482,12 @@ } /// - /// Synchronizes the calculation points based on the Points. - /// - public void SyncCalcPoints() - { - calcPoints.Clear(); - foreach (GeometryPoint geometryPoint in Points) - { - var p2D = new Point2D - { - X = geometryPoint.X, - Z = geometryPoint.Z - }; - calcPoints.Add(p2D); - } - } - - /// - /// Synchronizes the points based on the CalcPoints. - /// - public void SyncPoints() - { - points.Clear(); - foreach (Point2D p2D in calcPoints) - { - var geometryPoint = new GeometryPoint - { - X = p2D.X, - Z = p2D.Z - }; - points.Add(geometryPoint); - } - } - - /// /// Finds all intersections in the XZ-plane the given list. /// /// The list. /// /// - public List IntersectionXzPointsWithGeometryPointList(IList list) + private List IntersectionXzPointsWithGeometryPointList(IList list) { return IntersectWithPointsListCore(list, false); } @@ -566,7 +500,7 @@ /// public RelativeXzPosition GetPosition(GeometryLoop geometryLoop, ExtraPolationMode extraPolationMode = ExtraPolationMode.Beyond) { - foreach (GeometryPoint point in geometryLoop.Points.Concat(DetermineLoopSegmentMiddlePoints(geometryLoop))) + foreach (Point2D point in geometryLoop.CalcPoints.Concat(DetermineLoopSegmentMiddlePoints(geometryLoop))) { RelativeXzPosition position = PositionXzOfPointRelatedToExtrapolatedLine(point, extraPolationMode); if (position == RelativeXzPosition.BeyondGeometricLine) @@ -589,22 +523,11 @@ /// public override GeometryBounds GetGeometryBounds() { - if (!Points.Any()) + GeometryBounds bounds = CalcPoints[0].GetGeometryBounds(); + for (var i = 1; i < CalcPoints.Count; i++) { - // Sync with calcPoints - SyncPoints(); - // if still no points, then return null - if (!Points.Any()) - { - return null; - } - } + Point2D point = CalcPoints[i]; - GeometryBounds bounds = Points[0].GetGeometryBounds(); - for (var i = 1; i < Points.Count; i++) - { - GeometryPoint point = Points[i]; - bounds.Left = Math.Min(bounds.Left, point.X); bounds.Right = Math.Max(bounds.Right, point.X); bounds.Top = Math.Max(bounds.Top, point.Z); @@ -628,28 +551,28 @@ return intersectionPointsWithLine; } - private RelativeXzPosition PositionXzOfPointRelatedToExtrapolatedLine(GeometryPoint point, + private RelativeXzPosition PositionXzOfPointRelatedToExtrapolatedLine(Point2D point, ExtraPolationMode extraPolationMode = ExtraPolationMode.Beyond) { return IsPointConsideredBeyondLine(point, extraPolationMode) ? RelativeXzPosition.BeyondGeometricLine : DeterminePositionWithRespectToExtrapolatedLine(point, extraPolationMode); } - private bool IsPointConsideredBeyondLine(GeometryPoint point, ExtraPolationMode extraPolationMode) + private bool IsPointConsideredBeyondLine(Point2D point, ExtraPolationMode extraPolationMode) { - if (Points.Count == 0) + if (CalcPoints.Count == 0) { return true; } return IsPointOutsideRangeX(point) && extraPolationMode == ExtraPolationMode.Beyond; } - private bool IsPointOutsideRangeX(GeometryPoint point) + private bool IsPointOutsideRangeX(Point2D point) { - return point.X < Points[0].X || point.X > Points[checked(Points.Count - 1)].X; + return point.X < CalcPoints[0].X || point.X > CalcPoints[checked(CalcPoints.Count - 1)].X; } - private RelativeXzPosition DeterminePositionWithRespectToExtrapolatedLine(GeometryPoint point, + private RelativeXzPosition DeterminePositionWithRespectToExtrapolatedLine(Point2D point, ExtraPolationMode extraPolationMode) { double xToEvaluate = DetermineXToEvaluate(point, extraPolationMode); @@ -662,55 +585,55 @@ return point.Z <= zAtX ? RelativeXzPosition.BelowGeometricLine : RelativeXzPosition.AboveGeometricLine; } - private double DetermineXToEvaluate(GeometryPoint point, ExtraPolationMode extraPolationMode) + private double DetermineXToEvaluate(Point2D point, ExtraPolationMode extraPolationMode) { double x = point.X; if (extraPolationMode == ExtraPolationMode.Horizontal) { - if (x < Points[0].X) + if (x < CalcPoints[0].X) { - x = Points[0].X; + x = CalcPoints[0].X; } - else if (x > Points[checked(Points.Count - 1)].X) + else if (x > CalcPoints[checked(CalcPoints.Count - 1)].X) { - x = Points[checked(Points.Count - 1)].X; + x = CalcPoints[checked(CalcPoints.Count - 1)].X; } } return x; } - private static IEnumerable DetermineLoopSegmentMiddlePoints(GeometryPointString geometryLoop) + private static IEnumerable DetermineLoopSegmentMiddlePoints(GeometryPointString geometryLoop) { - var loopSegmentMiddlePoints = new List(); + var loopSegmentMiddlePoints = new List(); var index = 0; - while (index < checked(geometryLoop.Points.Count - 1)) + while (index < checked(geometryLoop.CalcPoints.Count - 1)) { - AddLoopSegmentMiddlePoint(geometryLoop.Points[index], geometryLoop.Points[checked(index + 1)], loopSegmentMiddlePoints); + AddLoopSegmentMiddlePoint(geometryLoop.CalcPoints[index], geometryLoop.CalcPoints[checked(index + 1)], loopSegmentMiddlePoints); checked { ++index; } } - if (geometryLoop.Points.Count > 2) + if (geometryLoop.CalcPoints.Count > 2) { - int last = geometryLoop.Points.Count - 1; - AddLoopSegmentMiddlePoint(geometryLoop.Points[0], geometryLoop.Points[last], loopSegmentMiddlePoints); + int last = geometryLoop.CalcPoints.Count - 1; + AddLoopSegmentMiddlePoint(geometryLoop.CalcPoints[0], geometryLoop.CalcPoints[last], loopSegmentMiddlePoints); } return loopSegmentMiddlePoints; } - private static void AddLoopSegmentMiddlePoint(GeometryPoint point1, GeometryPoint point2, IList loopSegmentMiddlePoints) + private static void AddLoopSegmentMiddlePoint(Point2D point1, Point2D point2, IList loopSegmentMiddlePoints) { if (Math.Abs(point1.Z - point2.Z) < 0.001) { - loopSegmentMiddlePoints.Insert(0, new GeometryPoint((point1.X + point2.X) / 2.0, point1.Z)); + loopSegmentMiddlePoints.Insert(0, new Point2D((point1.X + point2.X) / 2.0, point1.Z)); } else { - loopSegmentMiddlePoints.Add(new GeometryPoint((point1.X + point2.X) / 2.0, (point1.Z + point2.Z) / 2.0)); + loopSegmentMiddlePoints.Add(new Point2D((point1.X + point2.X) / 2.0, (point1.Z + point2.Z) / 2.0)); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs =================================================================== diff -u -r5404 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs (.../DamPipingHelper.cs) (revision 5404) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs (.../DamPipingHelper.cs) (revision 6087) @@ -59,15 +59,15 @@ /// The point. /// The pl lines. /// The uplift location and result. - public static void DeterminePlLinesAndUpliftLocation(DamKernelInput damKernelInput, GeometryPoint point, out PlLines plLines, out UpliftLocationAndResult upliftLocationAndResult) + public static void DeterminePlLinesAndUpliftLocation(DamKernelInput damKernelInput, Point2D point, out PlLines plLines, out UpliftLocationAndResult upliftLocationAndResult) { Location location = damKernelInput.Location; SoilProfile1D soilProfile = damKernelInput.SubSoilScenario.SoilProfile1D; SurfaceLine2 surfaceLine = damKernelInput.Location.SurfaceLine; // The validation of the soilProfile will be performed in CreatePlLinesForPiping by calling the SoilProfileValidator. // Here only the presence of point DikeToeAtRiver is checked because it is not done in SoilProfileValidator. - GeometryPoint entryPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); + Point2D entryPoint = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver); ThrowHelper.ThrowIfArgumentNull(entryPoint, string.Format(Resources.NoDikeToeDefinedForLocation, location.Name)); plLines = PlLinesHelper.CreatePlLinesForPiping(damKernelInput.TimeStepDateTime, damKernelInput.Location, damKernelInput.SubSoilScenario.SoilProfile1D, Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs =================================================================== diff -u -r5886 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 5886) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 6087) @@ -114,7 +114,7 @@ iterationIndex++; DesignCalculatorUtils.ThrowWhenMaxIterationsExceeded(iterationIndex, maxRedesignIterations); - GeometryPoint limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); + Point2D limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); if (designAdvise == DesignAdvise.ShoulderInwards) { // If exit point of circle is after the limitPointForShoulderDesign then enlarge the shoulder Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs (.../DesignCalculatorShoulderPerPoint.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs (.../DesignCalculatorShoulderPerPoint.cs) (revision 6087) @@ -80,9 +80,9 @@ double orgShoulderLength = surfaceLine.DetermineShoulderLength(); double orgShoulderHeight = surfaceLine.DetermineShoulderHeight(); - GeometryPoint startSurfacePoint = surfaceLine.GetDikeToeInward(); + Point2D startSurfacePoint = surfaceLine.GetDikeToeInward(); - IEnumerable relevantSurfacePointsList = from GeometryPoint point in surfaceLine.Geometry.Points + IEnumerable relevantSurfacePointsList = from Point2D point in surfaceLine.Geometry.CalcPoints where point.X >= startSurfacePoint.X orderby point.X select point; @@ -91,7 +91,7 @@ double oldDesiredShoulderLength = orgShoulderLength; double desiredShoulderHeight = orgShoulderHeight; double oldDesiredShoulderHeight = orgShoulderHeight; - foreach (GeometryPoint point in relevantSurfacePointsList) + foreach (Point2D point in relevantSurfacePointsList) { // Calculate the piping design at the given point. This returns the required adaption (berm length and height) if any. ShoulderDesign shoulderDesign = kernelWrapper.CalculateDesignAtPoint(damKernelInput, kernelDataInput, kernelDataOutput, point, out locationCalculationMessages); @@ -197,8 +197,8 @@ /// private static double CalculateMaximumShoulderLevel(SurfaceLine2 surfaceLine, double maxFractionOfDikeHeightForShoulderHeight) { - double top = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; - double bottom = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + double top = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).Z; + double bottom = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).Z; if (top - bottom <= 0) { throw new DesignCalculatorException(Resources.SurfaceLineShoulderAdapterMaxShoulderHeightError); @@ -213,16 +213,16 @@ /// /// /// - private static IEnumerable GetDiscretizedSurfaceLine(IEnumerable originalLine) + private static IEnumerable GetDiscretizedSurfaceLine(IEnumerable originalLine) { const double cDiff = 0.5; - var newLine = new List(); + var newLine = new List(); double currentX = originalLine.First().X; - foreach (GeometryPoint point in originalLine) + foreach (Point2D point in originalLine) { while (point.X > currentX + cDiff) { - var newPoint = new GeometryPoint(point) + var newPoint = new Point2D (point.X, point.Z) { X = currentX + cDiff }; Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryData.cs =================================================================== diff -u -r5786 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryData.cs (.../GeometryData.cs) (revision 5786) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryData.cs (.../GeometryData.cs) (revision 6087) @@ -228,7 +228,6 @@ CreateSurfaceLinePointString(curves); updatingSurfaceLine = false; - surfaceLine.SyncPoints(); } /// @@ -338,9 +337,16 @@ foreach (GeometrySurface surface in Surfaces) { GeometryLoop clonedLoop = surface.OuterLoop.Clone(); + ReplacePointsForLoop(clonedGeometryData, clonedLoop); + ReplaceCurvesForLoop(clonedGeometryData, clonedLoop); clonedGeometryData.Loops.Add(clonedLoop); var innerLoops = new List(); innerLoops.AddRange(surface.InnerLoops.Select(loop => loop.Clone()).ToList()); + foreach (GeometryLoop innerLoop in innerLoops) + { + ReplacePointsForLoop(clonedGeometryData, innerLoop); + ReplaceCurvesForLoop(clonedGeometryData, innerLoop); + } clonedGeometryData.Loops.AddRange(innerLoops); GeometrySurface clonedSurface = surface.Clone(); clonedSurface.OuterLoop = clonedLoop; @@ -349,6 +355,23 @@ } } + private void ReplacePointsForLoop(GeometryData clonedGeometryData, GeometryLoop clonedLoop) + { + for (int i = 0; i < clonedLoop.CalcPoints.Count; i++) + { + clonedLoop.CalcPoints[i] = clonedGeometryData.GetPointAtLocation(clonedLoop.CalcPoints[i]); + } + } + + private void ReplaceCurvesForLoop(GeometryData clonedGeometryData, GeometryLoop clonedLoop) + { + for (int i = 0; i < clonedLoop.CurveList.Count; i++) + { + clonedLoop.CurveList[i].HeadPoint = clonedGeometryData.GetPointAtLocation(clonedLoop.CurveList[i].HeadPoint); + clonedLoop.CurveList[i].EndPoint = clonedGeometryData.GetPointAtLocation(clonedLoop.CurveList[i].EndPoint); + } + } + private void CloneNewlyEffectedCurves(GeometryData clonedGeometryData) { foreach (GeometryCurve curve in NewlyEffectedCurves) @@ -1167,7 +1190,51 @@ return false; } + + /// + /// Finds a Surface based on its outerloop + /// + /// + /// the surface or when not found null + public GeometrySurface FindSurfaceByItsOuterLoop(GeometryLoop outerLoop) + { + foreach (GeometrySurface geometrySurface in Surfaces) + { + if (geometrySurface.OuterLoop.HasSameCurves(outerLoop)) + { + return geometrySurface; + } + } + return null; + } + + /// + /// + /// + /// + /// + public GeometryLoop FindLoopThatHasSameLoopCurves(GeometryLoop outerLoop) + { + foreach (GeometrySurface geometrySurface in Surfaces) + { + if (geometrySurface.OuterLoop.HasSameCurves(outerLoop)) + { + return geometrySurface.OuterLoop; + } + + foreach (GeometryLoop innerLoop in geometrySurface.InnerLoops) + { + if (innerLoop.HasSameCurves(outerLoop)) + { + return innerLoop; + } + } + } + + return null; + } + #region calculation function private int GetDependentCurveCount(Point2D point) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 6087) @@ -177,7 +177,7 @@ /// The point. /// The messages. /// - public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, Point2D point, out List messages) { messages = new List(); var damPipingBlighInput = kernelDataInput as DamPipingBlighInput; @@ -197,7 +197,7 @@ // if there is no uplift, then there is no piping so return null if (upliftLocationAndResult != null) { - double xEntry = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + double xEntry = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).X; double xExit = upliftLocationAndResult.X; damPipingBlighInput.SeepageLength = xExit - xEntry; double topLevelAquifer = soilProfile.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId).TopLevel; @@ -216,7 +216,7 @@ { // Finally, determine the required shoulderheight double currentShoulderHeight = upliftLocationAndResult.Z - - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).Z; var shoulderDesign = new ShoulderDesign( upliftLocationAndResult.X - surfaceLine.GetDikeToeInward().X, currentShoulderHeight + ShoulderDesignHelper.CalculateExtraShoulderHeight(soilProfile, plLines, upliftLocationAndResult, upliftCriterion)); @@ -291,7 +291,7 @@ double upliftCriterion = location.UpliftCriterionPiping - upliftCriterionTolerance; UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(upliftCriterion); upliftSituation.IsUplift = (upliftLocationAndResult != null); - double xEntry = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + double xEntry = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).X; if (upliftLocationAndResult != null) { double xExit = upliftLocationAndResult.X; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationAndResult.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationAndResult.cs (.../UpliftLocationAndResult.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationAndResult.cs (.../UpliftLocationAndResult.cs) (revision 6087) @@ -26,7 +26,7 @@ /// /// Data class containing information about uplift location and uplift factor /// -public class UpliftLocationAndResult : GeometryPoint +public class UpliftLocationAndResult : Point2D { public UpliftLocationAndResult() { @@ -40,10 +40,9 @@ LayerWhereUpliftOccuresId = layerWhereUpliftOccuresId; } - public UpliftLocationAndResult(GeometryPoint point, double upliftFactor, string layerWhereUpliftOccuresId) + public UpliftLocationAndResult(Point2D point, double upliftFactor, string layerWhereUpliftOccuresId) { X = point.X; - Y = point.Y; Z = point.Z; UpliftFactor = upliftFactor; LayerWhereUpliftOccuresId = layerWhereUpliftOccuresId; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs =================================================================== diff -u -r5960 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs (.../UpliftLocationDeterminator.cs) (revision 5960) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs (.../UpliftLocationDeterminator.cs) (revision 6087) @@ -77,16 +77,16 @@ ThrowIfNoSurfaceLinDefined(); ThrowIfNoSoilProfileDefined(); - GeometryPoint startSurfacePoint = SurfaceLine.GetDikeToeInward(); + Point2D startSurfacePoint = SurfaceLine.GetDikeToeInward(); - IEnumerable relevantSurfacePointsList = from GeometryPoint point in SurfaceLine.Geometry.Points + IEnumerable relevantSurfacePointsList = from Point2D point in SurfaceLine.Geometry.CalcPoints where point.X >= startSurfacePoint.X orderby point.X select point; var foundUpliftFactor = false; UpliftLocationAndResult upliftLocationAndResult = null; - foreach (GeometryPoint surfacePoint in relevantSurfacePointsList) + foreach (Point2D surfacePoint in relevantSurfacePointsList) { upliftLocationAndResult = GetUpliftFactorAtPoint(surfacePoint); if ((upliftLocationAndResult != null) && (upliftLocationAndResult.UpliftFactor < upliftCriterion)) @@ -106,7 +106,7 @@ /// /// /// location and upliftfactor - public UpliftLocationAndResult GetUpliftFactorAtPoint(GeometryPoint point) + public UpliftLocationAndResult GetUpliftFactorAtPoint(Point2D point) { const double toleranceAlmostEqual = 1e-09; SoilProfile1D soilProfileInCurrentPoint = GetSoilProfileBelowPoint(point.X); @@ -191,13 +191,13 @@ ThrowIfNoSurfaceLinDefined(); ThrowIfNoSoilProfileDefined(); - GeometryPoint startSurfacePoint = SurfaceLine.GetDikeToeInward(); - IEnumerable relevantSurfacePointsList = from GeometryPoint point in SurfaceLine.Geometry.Points + Point2D startSurfacePoint = SurfaceLine.GetDikeToeInward(); + IEnumerable relevantSurfacePointsList = from Point2D point in SurfaceLine.Geometry.CalcPoints where point.X >= startSurfacePoint.X orderby point.X select point; UpliftLocationAndResult lowestUpliftLocationAndResult = null; - foreach (GeometryPoint surfacePoint in relevantSurfacePointsList) + foreach (Point2D surfacePoint in relevantSurfacePointsList) { UpliftLocationAndResult upliftLocationAndResult = GetUpliftFactorAtPoint(surfacePoint); if (upliftLocationAndResult != null) @@ -216,10 +216,10 @@ /// /// Create upliftcalculator at given point /// - /// GeometryPoint for which to calculate upliftfactor + /// Point2D for which to calculate upliftfactor /// Top of layer where uplift occurs /// location and upliftfactor - private UpliftCalculator CreateUpliftCalculator(GeometryPoint point, double topOfLayer, SoilProfile1D soilProfile) + private UpliftCalculator CreateUpliftCalculator(Point2D point, double topOfLayer, SoilProfile1D soilProfile) { PlLine phreaticLine = PlLines.Lines[PlLineType.Pl1]; return new UpliftCalculator Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs =================================================================== diff -u -r5886 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision 5886) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision 6087) @@ -126,7 +126,7 @@ clonedSoilProfile2D.Geometry = Geometry.Clone(); foreach (SoilLayer2D surface in Surfaces) { - SoilLayer2D clonedSurface = surface.Clone(); + SoilLayer2D clonedSurface = surface.Clone(clonedSoilProfile2D.Geometry); clonedSoilProfile2D.Surfaces.Add(clonedSurface); } foreach (PreConsolidationStress preconsolidationStress in PreconsolidationStresses) @@ -146,6 +146,23 @@ { return Name; } + + /// + /// Finds a SoilLayer2D based on its outer loop + /// + /// + /// the layer or when not found null + public SoilLayer2D FindSoilLayer2DByItsOuterLoop(GeometryLoop outerLoop) + { + foreach (SoilLayer2D soilLayer2D in Surfaces) + { + if (soilLayer2D.GeometrySurface.OuterLoop.HasSameCurves(outerLoop)) + { + return soilLayer2D; + } + } + return null; + } /// /// Get the soil layer from the old surfaces Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs =================================================================== diff -u -r5982 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 5982) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 6087) @@ -44,7 +44,7 @@ public static IEnumerable GetCharacteristicPointsRequiringAscendingX(this SurfaceLine2 line) { return line.CharacteristicPoints.Where(p => - !double.IsNaN(p.X) && // Note: This probably shall no longer apply to SurfaceLine2 + !double.IsNaN(p.Point.X) && // Note: This probably shall no longer apply to SurfaceLine2 p.CharacteristicPointType != CharacteristicPointType.None && p.CharacteristicPointType != CharacteristicPointType.TrafficLoadInside && p.CharacteristicPointType != CharacteristicPointType.TrafficLoadOutside).OrderBy(p => p.CharacteristicPointType); @@ -59,7 +59,7 @@ /// public static bool HasAnnotation(this SurfaceLine2 line, CharacteristicPointType type) { - return line.CharacteristicPoints.GetGeometryPoint(type) != null; + return line.CharacteristicPoints.GetPoint2D(type) != null; } /// @@ -74,7 +74,7 @@ { // TODO: GRASP: Information Expert -> CharacteristicPoint class should be responsible for this logic. return line.HasAnnotation(characteristicPointType) && - !Double.IsNaN(line.CharacteristicPoints.GetGeometryPoint(characteristicPointType).X); + !Double.IsNaN(line.CharacteristicPoints.GetPoint2D(characteristicPointType).X); } /// @@ -84,7 +84,7 @@ /// is not defined for the surface line. public static double? GetDikeHeight(this SurfaceLine2 line) { - GeometryPoint dikeTopAtRiver = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Point2D dikeTopAtRiver = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); if (dikeTopAtRiver != null) { return dikeTopAtRiver.Z; @@ -100,10 +100,10 @@ /// /// Toe of the dike, or null if none of the required characteristic /// annotations can be found. - public static GeometryPoint GetDikeToeInward(this SurfaceLine2 line) + public static Point2D GetDikeToeInward(this SurfaceLine2 line) { - return line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) ?? - line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + return line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside) ?? + line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); } /// @@ -112,8 +112,8 @@ /// dike length or null in case toe points are null public static double? GetDikeLength(this SurfaceLine2 line) { - GeometryPoint dikeToeAtRiver = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); - GeometryPoint dikeToeAtPolder = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeToeAtRiver = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver); + Point2D dikeToeAtPolder = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); if (dikeToeAtRiver != null && dikeToeAtPolder != null) { @@ -165,16 +165,16 @@ var movedPointToMatch = false; var addPoint = false; - GeometryPoint point = null; - var newPoint = new GeometryPoint + Point2D point = null; + var newPoint = new Point2D() { X = x, Z = z }; if (type.HasValue) { // Get point of this type.. - point = line.CharacteristicPoints.GetGeometryPoint(type.Value); + point = line.CharacteristicPoints.GetPoint2D(type.Value); if (point != null) { // Characteristic point annotation set, check location... @@ -189,7 +189,7 @@ if (isAssignedToOtherCharacteristicPoints) { // Other characteristic points exist with the same coordinates so add as new point - point = line.Geometry.DetermineGeometryPointAt(newPoint.X, newPoint.Z); // Get point at specified coords + point = line.Geometry.DeterminePointAt(newPoint.X, newPoint.Z); // Get point at specified coords if (point == null) { point = newPoint; @@ -208,12 +208,12 @@ if (point == null) { - point = line.Geometry.DetermineGeometryPointAt(x, z); // Get point at specified coords + point = line.Geometry.DeterminePointAt(x, z); // Get point at specified coords } if (point == null) { - point = new GeometryPoint + point = new Point2D() { X = x, Z = z @@ -223,12 +223,12 @@ if (addPoint) { - line.Geometry.Points.Add(point); + line.Geometry.CalcPoints.Add(point); line.AddCharacteristicPoint(point, type ?? CharacteristicPointType.None); } else if (type.HasValue && !movedPointToMatch) { - if (line.CharacteristicPoints.Any(cp => ReferenceEquals(cp.GeometryPoint, point) && + if (line.CharacteristicPoints.Any(cp => ReferenceEquals(cp.Point, point) && cp.CharacteristicPointType != CharacteristicPointType.None)) { line.AddCharacteristicPoint(point, type.Value); @@ -238,7 +238,7 @@ int index = -1; for (var i = 0; i < line.CharacteristicPoints.Count; i++) { - if (ReferenceEquals(line.CharacteristicPoints[i].GeometryPoint, point)) + if (ReferenceEquals(line.CharacteristicPoints[i].Point, point)) { index = i; break; @@ -248,8 +248,6 @@ line.CharacteristicPoints.Annotate(index, type.Value); } } - - line.Geometry.SyncCalcPoints(); } /// @@ -323,16 +321,16 @@ if (!res) { // check the unchecked points - GeometryPoint bottomDitchDikeSide = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchDikeSide); - GeometryPoint bottomDitchPolderSide = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchPolderSide); + Point2D bottomDitchDikeSide = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchDikeSide); + Point2D bottomDitchPolderSide = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchPolderSide); res = (bottomDitchDikeSide != null && bottomDitchPolderSide != null); // check the ditch points describe following shape: // 0 0 // \ / // 0---0 - GeometryPoint ditchPolderSide = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide); - GeometryPoint ditchDikeSide = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide); + Point2D ditchPolderSide = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide); + Point2D ditchDikeSide = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide); if (res) { res = ditchPolderSide.X >= bottomDitchPolderSide.X && @@ -359,11 +357,11 @@ /// /// /// - public static GeometryPoint GetStartingPoint(this SurfaceLine2 line) + public static Point2D GetStartingPoint(this SurfaceLine2 line) { - return line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseOutside) ?? - line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopOutside) ?? - line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); + return line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseOutside) ?? + line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopOutside) ?? + line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver); } /// @@ -373,7 +371,7 @@ public static double? GetDefaultDikeTableHeight(this SurfaceLine2 line) { // Consulted Erik Vastenburg about this: Use buitenkruinlijn as default DTH - GeometryPoint point = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Point2D point = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); return point == null ? null : point.Z; } @@ -392,7 +390,7 @@ // Waterlevel MUST be above level of dike toe at river side if (riverLevel.HasValue) { - double z = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Z; + double z = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).Z; if (riverLevel < z) { ThrowWhenLevelBelowDikeToeDike(z, riverLevel.Value); @@ -421,7 +419,7 @@ /// When greater than /// the height of the characteristic point . /// - public static GeometryPoint DetermineIntersectionWithLevel(this SurfaceLine2 line, double level) + public static Point2D DetermineIntersectionWithLevel(this SurfaceLine2 line, double level) { double startXCoordinate = line.Geometry.GetMinX(); Line waterlevelLine = GetWaterlevelLineStartingFrom(line, level, startXCoordinate); @@ -450,9 +448,9 @@ /// When greater than /// the height of the characteristic point . /// - public static GeometryPoint DetermineIntersectionBetweenTaludRiverSideAndWaterLevel(this SurfaceLine2 line, double level) + public static Point2D DetermineIntersectionBetweenTaludRiverSideAndWaterLevel(this SurfaceLine2 line, double level) { - double startXCoordinate = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X; + double startXCoordinate = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside).X; Line waterlevelLine = GetWaterlevelLineStartingFrom(line, level, startXCoordinate); return DetermineIntersectionWithHorizontalLevel(line, waterlevelLine); @@ -464,13 +462,13 @@ /// The line. /// The shoulder top inside. /// - public static double DetermineShoulderLengthForGivenShoulderTopInside(this SurfaceLine2 line, GeometryPoint shoulderTopInside) + public static double DetermineShoulderLengthForGivenShoulderTopInside(this SurfaceLine2 line, Point2D shoulderTopInside) { - GeometryPoint geometryPoint1 = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - 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.DetermineIntersectionPointWithExtrapolation(geometryPoint1, p2, shoulderTopInside, new GeometryPoint(geometryPoint3.X, shoulderTopInside.Z)); + Point2D geometryPoint1 = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); + Point2D geometryPoint2 = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); + Point2D p2 = line.HasShoulderInside() ? line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside) : geometryPoint2; + Point2D geometryPoint3 = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside); + Point2D withExtrapolation = LineHelper.DetermineIntersectionPointWithExtrapolation(geometryPoint1, p2, shoulderTopInside, new Point2D(geometryPoint3.X, shoulderTopInside.Z)); return shoulderTopInside.X - withExtrapolation.X; } @@ -481,11 +479,11 @@ /// public static double DetermineShoulderHeight(this SurfaceLine2 line) { - GeometryPoint geometryPoint1 = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); - GeometryPoint geometryPoint2 = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + Point2D geometryPoint1 = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopInside); + Point2D geometryPoint2 = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside); if (geometryPoint1 != null && geometryPoint2 != null) { - return geometryPoint1.Z - line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + return geometryPoint1.Z - line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).Z; } return 0.0; @@ -506,7 +504,7 @@ /// public static double DetermineShoulderLength(this SurfaceLine2 line) { - GeometryPoint shoulderTopInside = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + Point2D shoulderTopInside = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopInside); if (shoulderTopInside != null && HasAnnotation(line, CharacteristicPointType.ShoulderBaseInside)) { return line.DetermineShoulderLengthForGivenShoulderTopInside(shoulderTopInside); @@ -527,13 +525,13 @@ /// public static double GetCotangentOfInnerSlope(this SurfaceLine2 line) { - GeometryPoint geometryPoint = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D geometryPoint = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); if (geometryPoint == null) { throw new InvalidOperationException(Resources.GetCotangentOfInnerSlopeDikeTopAtPolderRequired); } - GeometryPoint dikeToeInward = line.GetDikeToeInward(); + Point2D dikeToeInward = line.GetDikeToeInward(); if (dikeToeInward == null) { throw new InvalidOperationException(Resources.GetCotangentOfInnerSlopeDikeToeAtPolderRequired); @@ -547,9 +545,9 @@ /// /// The line. /// - public static GeometryPoint GetLimitPointForShoulderDesign(this SurfaceLine2 line) + public static Point2D GetLimitPointForShoulderDesign(this SurfaceLine2 line) { - return line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside) ?? line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + return line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopInside) ?? line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); } /// @@ -562,9 +560,9 @@ /// are inclusive bounds or not. private static void RemoveGeometryPointsInRange(SurfaceLine2 line, double startX, double endX, bool isInclusiveRange) { - foreach (GeometryPoint geometryPoint in GetGeometryPointsWithinRange(line, startX, endX, isInclusiveRange).ToArray()) + foreach (Point2D geometryPoint in GetGeometryPointsWithinRange(line, startX, endX, isInclusiveRange).ToArray()) { - CharacteristicPoint[] characteristicPoints = line.CharacteristicPoints.Where(cp => ReferenceEquals(cp.GeometryPoint, geometryPoint)).ToArray(); + CharacteristicPoint[] characteristicPoints = line.CharacteristicPoints.Where(cp => ReferenceEquals(cp.Point, geometryPoint)).ToArray(); if (characteristicPoints.Length > 0) { // CharacteristicPointSet will manage both collections of CharacteristicPoint instances and Geometry @@ -577,11 +575,9 @@ { // Notify change such that CharacteristicPointSet instances observing this // geometry can update if required. - line.Geometry.Points.Remove(geometryPoint); + line.Geometry.CalcPoints.Remove(geometryPoint); } } - - line.Geometry.SyncCalcPoints(); } /// @@ -594,16 +590,16 @@ /// Indicates if and /// are inclusive bounds or not. /// Collection of characteristic points within the given range. - private static IEnumerable GetGeometryPointsWithinRange(SurfaceLine2 line, + private static IEnumerable GetGeometryPointsWithinRange(SurfaceLine2 line, double startX, double endX, bool isInclusiveRange) { if (isInclusiveRange) { - return line.Geometry.Points.Where(cp => (cp.X >= startX || cp.X.AlmostEquals(startX, GeometryPoint.Precision)) && - (cp.X <= endX || cp.X.AlmostEquals(endX, GeometryPoint.Precision))); + return line.Geometry.CalcPoints.Where(cp => (cp.X >= startX || cp.X.AlmostEquals(startX, GeometryPoint.Precision)) && + (cp.X <= endX || cp.X.AlmostEquals(endX, GeometryPoint.Precision))); } - return line.Geometry.Points.Where(cp => cp.X > startX && cp.X < endX); + return line.Geometry.CalcPoints.Where(cp => cp.X > startX && cp.X < endX); } #region Private methods @@ -619,7 +615,7 @@ /// The line segment. private static Line GetWaterlevelLineStartingFrom(SurfaceLine2 line, double level, double startXCoordinate) { - GeometryPoint pointEndOfprofile = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside); + Point2D pointEndOfprofile = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside); var waterlevelLine = new Line(); waterlevelLine.CreateHorizontalZLine(startXCoordinate, pointEndOfprofile.X, level); @@ -634,13 +630,13 @@ /// The intersection point, or null in case no intersection was found. /// When height of the horizontal line is /// greater than the height of the characteristic point . - private static GeometryPoint DetermineIntersectionWithHorizontalLevel(SurfaceLine2 line, Line waterlevelLine) + private static Point2D DetermineIntersectionWithHorizontalLevel(SurfaceLine2 line, Line waterlevelLine) { ThrowWhenLevelAboveDike(line, waterlevelLine.BeginPoint.Z); - List list = line.Geometry.Points.Where(point => - point.X >= line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X && - point.X <= line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X).ToList(); + List list = line.Geometry.CalcPoints.Where(point => + point.X >= line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside).X && + point.X <= line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver).X).ToList(); for (var i = 1; i < list.Count; i++) { @@ -652,7 +648,7 @@ Point2D intersectPoint = surfaceLineSegment.GetIntersectPointXz(waterlevelLine); if (intersectPoint != null) { - return new GeometryPoint(intersectPoint.X, intersectPoint.Z); + return new Point2D(intersectPoint.X, intersectPoint.Z); } } @@ -665,7 +661,7 @@ /// private static void ThrowWhenLevelAboveDike(SurfaceLine2 line, double level) { - GeometryPoint dikeTopAtRiver = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Point2D dikeTopAtRiver = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); if (level > dikeTopAtRiver.Z) { throw new SurfaceLineException($"Level ({level:F2} m) should NOT be higher than dike top at river side ({dikeTopAtRiver.Z:F2}))"); Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Gauges/GaugePLLine.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Gauges/GaugePLLine.cs (.../GaugePLLine.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Gauges/GaugePLLine.cs (.../GaugePLLine.cs) (revision 6087) @@ -24,7 +24,7 @@ namespace Deltares.DamEngine.Data.General.Gauges; -public class GaugePlLinePoint : GeometryPoint +public class GaugePlLinePoint : Point2D { public GaugePlLinePoint() : this(null, null, null, null) {} Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/PlLines/PlLine.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/PlLines/PlLine.cs (.../PlLine.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/PlLines/PlLine.cs (.../PlLine.cs) (revision 6087) @@ -24,7 +24,7 @@ namespace Deltares.DamEngine.Data.General.PlLines; -public class PlLinePoint : GeometryPoint +public class PlLinePoint : Point2D { public PlLinePoint() : this(0, 0) {} @@ -66,7 +66,6 @@ var newPoint = new PlLinePoint { X = point.X, - Y = point.Y, Z = point.Z }; plLine.Points.Add(newPoint); Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Location.cs =================================================================== diff -u -r5767 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Location.cs (.../Location.cs) (revision 5767) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Location.cs (.../Location.cs) (revision 6087) @@ -526,13 +526,13 @@ /// The adapted surface line. public void AlignBoundaryPointsOfPl1LineWithAdaptedSurfaceLine(SurfaceLine2 adaptedSurfaceLine) { - if ((LocalXzpl1Line != null) && (LocalXzpl1Line.Points.Count > 1)) + if ((LocalXzpl1Line != null) && (LocalXzpl1Line.CalcPoints.Count > 1)) { - GeometryPoint lastPointPl1Line = LocalXzpl1Line.Points.Last(); - GeometryPoint lastPointSurfaceLine = adaptedSurfaceLine.Geometry.Points.Last(); + Point2D lastPointPl1Line = LocalXzpl1Line.CalcPoints.Last(); + Point2D lastPointSurfaceLine = adaptedSurfaceLine.Geometry.CalcPoints.Last(); lastPointPl1Line.X = lastPointSurfaceLine.X; - GeometryPoint firstPointPl1Line = LocalXzpl1Line.Points.First(); - GeometryPoint firstPointSurfaceLine = adaptedSurfaceLine.Geometry.Points.First(); + Point2D firstPointPl1Line = LocalXzpl1Line.CalcPoints.First(); + Point2D firstPointSurfaceLine = adaptedSurfaceLine.Geometry.CalcPoints.First(); firstPointPl1Line.X = firstPointSurfaceLine.X; } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/SoilProfile2DHelper.cs =================================================================== diff -u -r6077 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/SoilProfile2DHelper.cs (.../SoilProfile2DHelper.cs) (revision 6077) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/SoilProfile2DHelper.cs (.../SoilProfile2DHelper.cs) (revision 6087) @@ -63,8 +63,9 @@ /// The X coordinate of the starting point for the search. /// The intersection point of the surface line (often the ditch) with the aquifer. /// true if the aquifer intersects the surface line; otherwise, false. - public static bool IsSurfaceLineIntersectedByAquifer(LayerType aquiferType, SoilProfile2D soilProfile, double xStart, out GeometryPoint intersectionPoint) + public static bool IsSurfaceLineIntersectedByAquifer(LayerType aquiferType, SoilProfile2D soilProfile, double xStart, out Point2D intersectionPoint) { + intersectionPoint = new Point2D(); double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile); foreach (double xCoordinate in xCoordinates.Where(xCoordinate => xCoordinate.IsGreaterThanOrEqualTo(xStart))) { @@ -73,11 +74,8 @@ { case LayerType.BottomAquiferCluster when crossSection.Layers.All(layer => layer.IsAquifer): case LayerType.InBetweenAquiferCluster when crossSection.Layers[0].IsAquifer && crossSection.Layers.Any(layer => !layer.IsAquifer): - intersectionPoint = new GeometryPoint - { - X = xCoordinate, - Z = crossSection.TopLevel - }; + intersectionPoint.X = xCoordinate; + intersectionPoint.Z = crossSection.TopLevel; return true; } } @@ -125,16 +123,39 @@ { SoilProfile2D soilProfileWithoutInnerLoops = soilProfile.Clone(); + var innerSurfaces = new List(); foreach (GeometrySurface geometrySurface in soilProfileWithoutInnerLoops.Geometry.Surfaces.Where(surface => surface.InnerLoops.Count > 0)) { + foreach (GeometryLoop innerLoop in geometrySurface.InnerLoops) + { + GeometrySurface innerSurface = soilProfileWithoutInnerLoops.Geometry.FindSurfaceByItsOuterLoop(innerLoop); + innerSurfaces.Add(innerSurface); + } geometrySurface.InnerLoops.Clear(); } + foreach (GeometrySurface innerSurface in innerSurfaces) + { + soilProfileWithoutInnerLoops.Geometry.Surfaces.Remove(innerSurface); + } + innerSurfaces.Clear(); + + var innerSoiLayers2D = new List(); foreach (SoilLayer2D surface in soilProfileWithoutInnerLoops.Surfaces.Where(surface => surface.GeometrySurface.InnerLoops.Count > 0)) { + foreach (GeometryLoop innerLoop in surface.GeometrySurface.InnerLoops) + { + SoilLayer2D innerSoilLayer = soilProfileWithoutInnerLoops.FindSoilLayer2DByItsOuterLoop(innerLoop); + innerSoiLayers2D.Add(innerSoilLayer); + } surface.GeometrySurface.InnerLoops.Clear(); } + foreach (SoilLayer2D innerSoilLayer in innerSoiLayers2D) + { + soilProfileWithoutInnerLoops.Surfaces.Remove(innerSoilLayer); + } + return soilProfileWithoutInnerLoops; } @@ -318,7 +339,10 @@ } else { - xCoordinatesAll.Add(xCoordinate); + if (xCoordinatesAll.IndexOf(xCoordinate) < 0) + { + xCoordinatesAll.Add(xCoordinate); + } } } } @@ -373,7 +397,6 @@ isConnectionFound = IsConnectionFound(connectionType, polyLines, usedPolyLines, currentPolyLine); } while (isConnectionFound); - currentPolyLine.SyncPoints(); connectedPolyLines.Add(currentPolyLine); } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs =================================================================== diff -u -r6043 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs (.../SoilProfile2DSurfaceLineHelper.cs) (revision 6043) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs (.../SoilProfile2DSurfaceLineHelper.cs) (revision 6087) @@ -47,13 +47,13 @@ return false; } - if (Math.Round(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X, precisionDecimals) < + if (Math.Round(surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside).X, precisionDecimals) < Math.Round(soilProfile2D.Geometry.GetGeometryBounds().Left, precisionDecimals)) { return false; } - if (Math.Round(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X, precisionDecimals) > + if (Math.Round(surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside).X, precisionDecimals) > Math.Round(soilProfile2D.Geometry.GetGeometryBounds().Right, precisionDecimals)) { return false; @@ -74,7 +74,7 @@ { if (soilProfile2D == null || soilProfile2D.Surfaces.Count == 0) return null; - if (surfaceLine == null || surfaceLine.Points.Count == 0) + if (surfaceLine == null || surfaceLine.CalcPoints.Count == 0) return null; SoilProfile2D clonedProfile = soilProfile2D.Clone(); @@ -111,7 +111,7 @@ public static bool IsSurfaceLineAboveBottomSoilProfile2D(SurfaceLine2 surfaceLine, SoilProfile2D soilProfile2D) { double bottom = soilProfile2D.Geometry.Bottom; - foreach (GeometryPoint point in surfaceLine.Geometry.Points) + foreach (Point2D point in surfaceLine.Geometry.CalcPoints) { if (point.Z < bottom) { @@ -155,7 +155,7 @@ } resultGeometry.Rebox(); - if (surfaceLine == null || surfaceLine.Points.Count <= 2) + if (surfaceLine == null || surfaceLine.CalcPoints.Count <= 2) { return null; } @@ -201,7 +201,6 @@ { geometryData.NewlyEffectedCurves.Clear(); geometryData.NewlyEffectedPoints.Clear(); - surfaceLine.SyncCalcPoints(); IList points = surfaceLine.CalcPoints; GeometryData geometry = geometryData; Point2D currentPoint1 = points[0].Clone(); @@ -270,7 +269,7 @@ private static void RemoveGeometryDataAboveSurfaceLine(GeometryPointString surfaceLine, ref GeometryData result) { - if (surfaceLine == null || surfaceLine.Points.Count <= 1) + if (surfaceLine == null || surfaceLine.CalcPoints.Count <= 1) return; foreach (GeometrySurface geometrySurface in result.Surfaces.ToArray()) { @@ -354,7 +353,7 @@ return false; } - return layer.GeometrySurface.OuterLoop.Points.All(point => !point.Z.IsLessThan(surfaceLine.GetZatX(point.X))); + return layer.GeometrySurface.OuterLoop.CalcPoints.All(point => !point.Z.IsLessThan(surfaceLine.GetZatX(point.X))); } private static void ReconstructPreConsolidations(ref SoilProfile2D result, SoilProfile2D clonedProfile) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs =================================================================== diff -u -r5960 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs (.../SoilProfileValidator.cs) (revision 5960) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs (.../SoilProfileValidator.cs) (revision 6087) @@ -171,7 +171,7 @@ + Resources.SoilProfileValidator_NoSurfaceLineDefined); } - if (SurfaceLine.Geometry.Points.Count < 2) + if (SurfaceLine.Geometry.CalcPoints.Count < 2) { throw new PlLinesCreatorException(Resources.SoilProfileValidator_General + Resources.SoilProfileValidator_AtLeastTwoSurfaceLinePoints); @@ -196,7 +196,7 @@ private SoilProfile1D DetermineSoilProfileAtDikeTopAtPolder() { - GeometryPoint relevantPoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D relevantPoint = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); return DetermineSoilProfileBelowPoint(relevantPoint.X); } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs =================================================================== diff -u -r5994 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 5994) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 6087) @@ -67,8 +67,8 @@ // Here we only have to check that the PL-lines were indeed created. ThrowWhenPlLinesIsNull(plLines); - double xLeft = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X; - double xRight = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X; + double xLeft = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside).X; + double xRight = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside).X; var waternet = new Waternet(); @@ -80,11 +80,10 @@ WaternetLine waternetLine = CreateWaternetLineForPhreaticLine(soilProfile1D, surfaceLine, plLine, xLeft, xRight, pressureType); waternetLine.Name = waternetLine1Name; waternetLine.HeadLine = headLine; - waternetLine.HeadLine.SyncCalcPoints(); waternet.WaternetLineList.Add(waternetLine); } - double x = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; + double x = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).X; var dummySoil = new Soil("dummy", 0.0, 0.0); SoilProfile1D soilProfile1DDikeToeAtPolder = SoilProfileHelper.DetermineForSurfaceLineCorrected1DProfileAtX(soilProfile1D, surfaceLine, x, dummySoil); @@ -185,9 +184,8 @@ internal static WaternetLine CreateWaternetLine(double level, double xLeft, double xRight) { var waternetLine = new WaternetLine(); - waternetLine.Points.Add(new GeometryPoint(xLeft, level)); - waternetLine.Points.Add(new GeometryPoint(xRight, level)); - waternetLine.SyncCalcPoints(); + waternetLine.CalcPoints.Add(new Point2D(xLeft, level)); + waternetLine.CalcPoints.Add(new Point2D(xRight, level)); return waternetLine; } @@ -267,8 +265,7 @@ } var line = new TLineType(); - line.Points.AddRange(plLine.Points); - line.SyncCalcPoints(); + line.CalcPoints.AddRange(plLine.Points); line.Name = name; return line; } @@ -278,16 +275,14 @@ var line = new WaternetLine(); foreach (Point2D coordinate in coordinates) { - var point = new GeometryPoint(coordinate.X, coordinate.Z + zOffSet); - line.Points.Add(point); + var point = new Point2D(coordinate.X, coordinate.Z + zOffSet); + line.CalcPoints.Add(point); } - line.SyncCalcPoints(); LineHelper.RemoveDuplicatedPoints(line.CalcPoints, toleranceAlmostEqual); line.RemoveUnnecessaryPoints(); AvoidUpwardsVerticalLine(line.CalcPoints); - line.SyncPoints(); - + return line; } @@ -314,7 +309,7 @@ { case IntrusionVerticalWaterPressureType.Linear: { - List coordinates = surfaceLine.Geometry.Points.Select(point => new Point2D(point.X, point.Z)).ToList(); + List coordinates = surfaceLine.Geometry.CalcPoints.Select(point => new Point2D(point.X, point.Z)).ToList(); return CreateWaternetLine(coordinates); } case IntrusionVerticalWaterPressureType.HydroStatic: @@ -378,7 +373,7 @@ } case IntrusionVerticalWaterPressureType.Linear: { - List xCoordinates = soilProfile2D.Geometry.SurfaceLine.Points.Select(point => new Point2D(point.X, point.Z)).ToList(); + List xCoordinates = soilProfile2D.Geometry.SurfaceLine.CalcPoints.Select(point => new Point2D(point.X, point.Z)).ToList(); return CreateWaternetLine(xCoordinates); } case IntrusionVerticalWaterPressureType.FullHydroStatic: @@ -414,20 +409,18 @@ // Add the first point to get a closed GeometryPointString outerLoop.CalcPoints.Add(new Point2D(outerLoop.CalcPoints[0].X, outerLoop.CalcPoints[0].Z)); - var plLineInGeometryPoint = new GeometryPointString(); + var plLineInPoint2D = new GeometryPointString(); foreach (PlLinePoint point in plLine.Points) { - plLineInGeometryPoint.Points.Add(new GeometryPoint(point.X, point.Z)); - plLineInGeometryPoint.SyncCalcPoints(); + plLineInPoint2D.CalcPoints.Add(new Point2D(point.X, point.Z)); } - List intersectionPoints = outerLoop.IntersectionXzPointsWithGeometryString(plLineInGeometryPoint); + List intersectionPoints = outerLoop.IntersectionXzPointsWithGeometryString(plLineInPoint2D); // Only the layers that intersect the phreatic line are kept. if (intersectionPoints.Count > 0) { var geometrySurface = new GeometrySurface(outerLoop); GeometryPointString bottom = geometrySurface.DetermineBottomGeometrySurface(); - bottom.SyncPoints(); bottom.SortPointsByXAscending(); curves.Add(bottom); } @@ -452,23 +445,21 @@ List relevantLinesAtXWithZBeginMax = relevantLinesAtX.FindAll(line => Math.Abs(line.BeginPoint.Z - minZBegin) < toleranceAlmostEqual); double minZEnd = relevantLinesAtXWithZBeginMax.Select(line => line.EndPoint.Z).Min(); Line relevantLine = relevantLinesAtXWithZBeginMax.Find(line => Math.Abs(line.EndPoint.Z - minZEnd) < toleranceAlmostEqual); - waternetLine.Points.Add(new GeometryPoint(relevantLine.BeginPoint.X, relevantLine.BeginPoint.Z)); - waternetLine.Points.Add(new GeometryPoint(relevantLine.EndPoint.X, relevantLine.EndPoint.Z)); + waternetLine.CalcPoints.Add(new Point2D(relevantLine.BeginPoint.X, relevantLine.BeginPoint.Z)); + waternetLine.CalcPoints.Add(new Point2D(relevantLine.EndPoint.X, relevantLine.EndPoint.Z)); } // Make sure the waternet line for PL 1 is not in the bottom aquifer. - foreach (GeometryPoint waternetLinePoint in waternetLine.Points) + foreach (Point2D waternetLinePoint in waternetLine.CalcPoints) { double bottomAquiferLevel = soilProfile2D.GetSoilProfile1D(waternetLinePoint.X).BottomAquiferLayer.TopLevel; waternetLinePoint.Z = Math.Max(waternetLinePoint.Z, bottomAquiferLevel); } - waternetLine.SyncCalcPoints(); LineHelper.RemoveDuplicatedPoints(waternetLine.CalcPoints, toleranceAlmostEqual); waternetLine.RemoveUnnecessaryPoints(); AvoidUpwardsVerticalLine(waternetLine.CalcPoints); - waternetLine.SyncPoints(); - + return waternetLine; } @@ -497,15 +488,14 @@ WaternetLine waternetLine1 = waternet.WaternetLineList.Find(w => w.Name == waternetLine1Name); if (waternetLine1 != null) { - foreach (GeometryPoint waternetLine1Point + foreach (Point2D waternetLine1Point in from waternetLineOther in waternet.WaternetLineList.FindAll(w => w.Name != waternetLine1Name) - from waternetLine1Point in waternetLine1.Points - where waternetLineOther.Points.Any(point => Math.Abs(point.Z - waternetLine1Point.Z) < toleranceAlmostEqual) + from waternetLine1Point in waternetLine1.CalcPoints + where waternetLineOther.CalcPoints.Any(point => Math.Abs(point.Z - waternetLine1Point.Z) < toleranceAlmostEqual) select waternetLine1Point) { waternetLine1Point.Z += minimumDistance; } - waternetLine1.SyncCalcPoints(); } } @@ -551,7 +541,7 @@ private static List DivideCurvesIntoLines(List curves) { var lines = new List(); - foreach (IList points in curves.Select(curve => curve.Points)) + foreach (IList points in curves.Select(curve => curve.CalcPoints)) { for (var i = 0; i < points.Count - 1; i++) { @@ -593,7 +583,7 @@ private static bool IsLineEndingInPolderSide(GeometryPointString line, SurfaceLine2 surfaceLine) { - GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); return dikeToeAtPolder.X.IsLessThan(line.CalcPoints.Last().X, toleranceAlmostEqual); } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Interface/FillXmlOutputFromDam.cs =================================================================== diff -u -r5354 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Interface/FillXmlOutputFromDam.cs (.../FillXmlOutputFromDam.cs) (revision 5354) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface/FillXmlOutputFromDam.cs (.../FillXmlOutputFromDam.cs) (revision 6087) @@ -142,8 +142,8 @@ var inputPoint = new SurfaceLinePoint { PointType = ConversionHelper.ConvertToInputPointType(characteristicPoint.CharacteristicPointType), - X = characteristicPoint.X, - Z = characteristicPoint.Z + X = characteristicPoint.Point.X, + Z = characteristicPoint.Point.Z }; desResult.PipingDesignResults.RedesignedSurfaceLine.Points[j] = inputPoint; } @@ -314,8 +314,8 @@ var inputPoint = new SurfaceLinePoint { PointType = ConversionHelper.ConvertToInputPointType(characteristicPoint.CharacteristicPointType), - X = characteristicPoint.X, - Z = characteristicPoint.Z + X = characteristicPoint.Point.X, + Z = characteristicPoint.Point.Z }; desResult.StabilityDesignResults.RedesignedSurfaceLine.Points[j] = inputPoint; } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Waternet.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Waternet.cs (.../Waternet.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Waternet.cs (.../Waternet.cs) (revision 6087) @@ -52,14 +52,7 @@ } set { - phreaticLine = value; - if (phreaticLine != null) - { - if (phreaticLine.Points.Count == 0 && phreaticLine.CalcPoints.Count > 0) - { - phreaticLine.SyncPoints(); - } - } + phreaticLine = value; } } @@ -103,7 +96,6 @@ { if (!WaternetLineList.Contains(aWaternetLine)) { - aWaternetLine.SyncPoints(); WaternetLineList.Add(aWaternetLine); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/PolyLine.cs =================================================================== diff -u -r5936 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/PolyLine.cs (.../PolyLine.cs) (revision 5936) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/PolyLine.cs (.../PolyLine.cs) (revision 6087) @@ -27,7 +27,7 @@ namespace Deltares.DamEngine.Data.General; -public class PolyLine where T : GeometryPoint, new() +public class PolyLine where T : Point2D, new() { protected IList points; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WtiPipingSellmeijerRevised/WtiPipingSellmeijerRevisedKernelWrapper.cs =================================================================== diff -u -r4733 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WtiPipingSellmeijerRevised/WtiPipingSellmeijerRevisedKernelWrapper.cs (.../WtiPipingSellmeijerRevisedKernelWrapper.cs) (revision 4733) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WtiPipingSellmeijerRevised/WtiPipingSellmeijerRevisedKernelWrapper.cs (.../WtiPipingSellmeijerRevisedKernelWrapper.cs) (revision 6087) @@ -296,7 +296,7 @@ /// The point. /// The messages. /// - public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, Point2D point, out List messages) { messages = new List(); var damPipingInput = kernelDataInput as WtiPipingSellmeijerRevisedInput; @@ -316,7 +316,7 @@ // if there is no uplift, then there is no piping so return null if (upliftLocationAndResult != null) { - double xEntry = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + double xEntry = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).X; double xExit = upliftLocationAndResult.X; damPipingInput.SeepageLength = (xExit - xEntry) + damKernelInput.Location.DistanceToEntryPoint; damPipingOutput.SeepageLength = damPipingInput.SeepageLength; @@ -348,7 +348,7 @@ { // Finally, determine the required shoulderheight double currentShoulderHeight = upliftLocationAndResult.Z - - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).Z; var shoulderDesign = new ShoulderDesign(upliftLocationAndResult.X - surfaceLine.GetDikeToeInward().X, currentShoulderHeight + ShoulderDesignHelper.CalculateExtraShoulderHeight(soilProfile, plLines, upliftLocationAndResult, upliftCriterion)); @@ -439,8 +439,8 @@ { var pipingPoint = new PipingPoint { - X = surfaceLineCharacteristicPoint.X, - Z = surfaceLineCharacteristicPoint.Z, + X = surfaceLineCharacteristicPoint.Point.X, + Z = surfaceLineCharacteristicPoint.Point.Z, Type = ConvertToPipingPointType(surfaceLineCharacteristicPoint.CharacteristicPointType) }; pipingSurfaceLine.Points.Add(pipingPoint); @@ -525,7 +525,7 @@ double upliftCriterion = location.UpliftCriterionPiping - upliftCriterionTolerance; UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(upliftCriterion); upliftSituation.IsUplift = (upliftLocationAndResult != null); - double xEntry = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + double xEntry = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).X; if (upliftLocationAndResult != null) { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs =================================================================== diff -u -r5720 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs (.../UpliftVanGridCreator.cs) (revision 5720) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs (.../UpliftVanGridCreator.cs) (revision 6087) @@ -67,8 +67,8 @@ if (surfaceLine != null) { // Use middle of the dike for X-coordinate - GeometryPoint dikeTopAtRiverPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - GeometryPoint dikeTopAtPolderPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D dikeTopAtRiverPoint = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); + Point2D dikeTopAtPolderPoint = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); double gridXCoordinate = (dikeTopAtRiverPoint.X + dikeTopAtPolderPoint.X) * 0.5; double gridYCoordinate = surfaceLine.Geometry.GetZatX(gridXCoordinate); double gridWidth = slipCircleDefinition.UpliftVanLeftGridHorizontalPointDistance * @@ -87,7 +87,7 @@ if (surfaceLine != null) { const double gridOffset = 0.2; - GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); // X-coordinates settings of the grid double gridWidth = slipCircleDefinition.UpliftVanRightGridHorizontalPointDistance * Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineHeightAdapter.cs =================================================================== diff -u -r5982 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineHeightAdapter.cs (.../SurfaceLineHeightAdapter.cs) (revision 5982) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineHeightAdapter.cs (.../SurfaceLineHeightAdapter.cs) (revision 6087) @@ -54,25 +54,25 @@ public SurfaceLine2 ConstructNewSurfaceLine(double newDikeHeight) { //Input data - GeometryPoint pointAtTopRiver = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - GeometryPoint pointAtTopPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - GeometryPoint pointDikeToeInward = surfaceLine.GetDikeToeInward(); - GeometryPoint startingPoint = surfaceLine.GetStartingPoint(); + Point2D pointAtTopRiver = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); + Point2D pointAtTopPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); + Point2D pointDikeToeInward = surfaceLine.GetDikeToeInward(); + Point2D startingPoint = surfaceLine.GetStartingPoint(); surfaceLine.RemoveSegmentBetween(startingPoint.X, pointAtTopRiver.X); - GeometryPoint newPointAtTopRiver; - GeometryPoint oldPointAtTopRiver = null; + Point2D newPointAtTopRiver; + Point2D oldPointAtTopRiver = null; if (Location.UseNewDikeSlopeOutside) { - var newOutsideSlopePoint = new GeometryPoint + var newOutsideSlopePoint = new Point2D { X = pointAtTopRiver.X + 100, Z = pointAtTopRiver.Z + 100 * Location.NewDikeSlopeOutside }; newPointAtTopRiver = LineHelper.DetermineIntersectionPointWithExtrapolation(pointAtTopRiver, newOutsideSlopePoint, - new GeometryPoint(pointAtTopRiver.X, newDikeHeight), - new GeometryPoint(pointAtTopPolder.X, newDikeHeight)); - oldPointAtTopRiver = new GeometryPoint + new Point2D(pointAtTopRiver.X, newDikeHeight), + new Point2D(pointAtTopPolder.X, newDikeHeight)); + oldPointAtTopRiver = new Point2D { X = pointAtTopRiver.X, Z = pointAtTopRiver.Z @@ -81,8 +81,8 @@ else { newPointAtTopRiver = LineHelper.DetermineIntersectionPointWithExtrapolation(startingPoint, pointAtTopRiver, - new GeometryPoint(pointAtTopRiver.X, newDikeHeight), - new GeometryPoint(pointAtTopPolder.X, newDikeHeight)); + new Point2D(pointAtTopRiver.X, newDikeHeight), + new Point2D(pointAtTopPolder.X, newDikeHeight)); } // Determine the new point at DIKE TOP RIVER @@ -93,7 +93,7 @@ } // Determine the new point at DIKE TOP POLDER - var newPointAtTopPolder = new GeometryPoint(newPointAtTopRiver.X + dikeTopWidth, newDikeHeight); + var newPointAtTopPolder = new Point2D(newPointAtTopRiver.X + dikeTopWidth, newDikeHeight); double slopeTangentInside = (pointAtTopPolder.Z - pointDikeToeInward.Z) / (pointDikeToeInward.X - pointAtTopPolder.X); if (Location.UseNewDikeSlopeInside) @@ -102,7 +102,7 @@ } // check case where the new top falls completely above the old top - GeometryPoint intersectionPointDikeTop = IntersectionpointWithOldDikeTop(newPointAtTopPolder, slopeTangentInside); + Point2D intersectionPointDikeTop = IntersectionpointWithOldDikeTop(newPointAtTopPolder, slopeTangentInside); if (intersectionPointDikeTop != null) { // Remove all points between old dike top river and old dike top polder @@ -127,7 +127,7 @@ // Delete the ditch from the surfaceline (if any) RemoveExistingDitch(ditchDefinition); // Adjust for the new slope - GeometryPoint slopePoint = ReplaceBaseInsideForNewSlope(newPointAtTopPolder, slopeTangentInside); + Point2D slopePoint = ReplaceBaseInsideForNewSlope(newPointAtTopPolder, slopeTangentInside); // Reset pointDikeToeInward for new position pointDikeToeInward = surfaceLine.GetDikeToeInward(); // Remove all points between "old" dike top river side and new toe inward @@ -165,17 +165,17 @@ /// /// /// The intersection point when found else null - private GeometryPoint IntersectionpointWithOldDikeTop(GeometryPoint newPointAtTopPolder, double slopeTangent) + private Point2D IntersectionpointWithOldDikeTop(Point2D newPointAtTopPolder, double slopeTangent) { - GeometryPoint res = null; - var newPoint = new GeometryPoint + Point2D res = null; + var newPoint = new Point2D { X = newPointAtTopPolder.X + 100, Z = newPointAtTopPolder.Z - 100 * slopeTangent }; - GeometryPoint dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - GeometryPoint ip = LineHelper.DetermineIntersectionPointWithExtrapolation(newPointAtTopPolder, newPoint, - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver), + Point2D dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); + Point2D ip = LineHelper.DetermineIntersectionPointWithExtrapolation(newPointAtTopPolder, newPoint, + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver), dikeTopAtPolder); if (ip != null && ip.X <= dikeTopAtPolder.X) { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLineCreatorBase.cs =================================================================== diff -u -r5658 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLineCreatorBase.cs (.../SensorPlLineCreatorBase.cs) (revision 5658) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLineCreatorBase.cs (.../SensorPlLineCreatorBase.cs) (revision 6087) @@ -129,7 +129,7 @@ { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside).X; } } @@ -140,7 +140,7 @@ { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside).X; } } @@ -160,22 +160,11 @@ } } - /// - /// Gets the Y value at the end boundary. - /// - protected double YEndBoundary - { - get - { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).Y; - } - } - protected double XDikeToeAtRiver { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).X; } } @@ -203,7 +192,7 @@ /// protected double? IntersectionXAtRiverWaterLevel(double waterLevel) { - GeometryPoint point = SensorLocation.SurfaceLine.DetermineIntersectionBetweenTaludRiverSideAndWaterLevel(waterLevel); + Point2D point = SensorLocation.SurfaceLine.DetermineIntersectionBetweenTaludRiverSideAndWaterLevel(waterLevel); return point?.X; } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilLayer2D.cs =================================================================== diff -u -r5294 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilLayer2D.cs (.../SoilLayer2D.cs) (revision 5294) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilLayer2D.cs (.../SoilLayer2D.cs) (revision 6087) @@ -57,7 +57,7 @@ /// Creates a clone of the SoilLayer2D /// /// The cloned SoilLayer2D - public SoilLayer2D Clone() + public SoilLayer2D Clone(GeometryData geometryData) { var clonedSoilLayer2D = new SoilLayer2D { @@ -67,10 +67,14 @@ WaterpressureInterpolationModel = WaterpressureInterpolationModel, GeometrySurface = GeometrySurface.Clone() }; - var clonedLoop = GeometrySurface.OuterLoop.Clone(); + GeometryLoop clonedLoop = geometryData.FindLoopThatHasSameLoopCurves(GeometrySurface.OuterLoop); clonedSoilLayer2D.GeometrySurface.OuterLoop = clonedLoop; List innerLoops = new List(); - innerLoops.AddRange(GeometrySurface.InnerLoops.Select(loop => loop.Clone()).ToList()); + foreach (GeometryLoop innerLoop in GeometrySurface.InnerLoops) + { + innerLoops.Add(geometryData.FindLoopThatHasSameLoopCurves(innerLoop)); + } + clonedSoilLayer2D.GeometrySurface.InnerLoops.AddRange(innerLoops); return clonedSoilLayer2D; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r5980 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs (.../MacroStabilityInwardsKernelWrapper.cs) (revision 5980) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs (.../MacroStabilityInwardsKernelWrapper.cs) (revision 6087) @@ -40,6 +40,7 @@ using Deltares.DamEngine.Data.Standard.Logging; using Deltares.MacroStability.CSharpWrapper; using Deltares.MacroStability.CSharpWrapper.Output; +using Point2D = Deltares.DamEngine.Data.Geometry.Point2D; using UpliftVanCalculationGrid = Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon.UpliftVanCalculationGrid; namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityInwards; @@ -341,7 +342,7 @@ /// /// public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, - IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + IKernelDataOutput kernelDataOutput, Point2D point, out List messages) { // ToDo: Not clear yet if this must be done or how throw new NotImplementedException(); @@ -383,7 +384,7 @@ // Check if the factor of safety is achieved double fosAchieved = leadingStabilityOutputItem.SafetyFactor; double exitPointXCoordinate = leadingStabilityOutputItem.CircleSurfacePointRightXCoordinate; - GeometryPoint limitPointForShoulderDesign = damKernelInput.Location.SurfaceLine.GetLimitPointForShoulderDesign(); + Point2D limitPointForShoulderDesign = damKernelInput.Location.SurfaceLine.GetLimitPointForShoulderDesign(); evaluationMessage = string.Format(Resources.FactorAchievedVsFactorRequired, fosAchieved, fosRequired); if (exitPointXCoordinate > limitPointForShoulderDesign.X) { Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs =================================================================== diff -u -r5483 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs (.../GeometryCurve.cs) (revision 5483) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs (.../GeometryCurve.cs) (revision 6087) @@ -201,16 +201,7 @@ { Name = Name }; - if (SurfaceAtLeft != null) - { - curve.SurfaceAtLeft = SurfaceAtLeft; - } - if (SurfaceAtRight != null) - { - curve.SurfaceAtRight = SurfaceAtRight; - } - return curve; } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/PlLines/Pl1Line.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/PlLines/Pl1Line.cs (.../Pl1Line.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/PlLines/Pl1Line.cs (.../Pl1Line.cs) (revision 6087) @@ -25,14 +25,14 @@ public class Pl1Line : GeometryPointString { - public void Assign(Pl1Line pl1Line) + private void Assign(Pl1Line pl1Line) { - Points.Clear(); + CalcPoints.Clear(); - foreach (GeometryPoint point in pl1Line.Points) + foreach (Point2D point in pl1Line.CalcPoints) { - var newPoint = (GeometryPoint) point.Clone(); - Points.Add(newPoint); + var newPoint = (Point2D) point.Clone(); + CalcPoints.Add(newPoint); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityOutwards/MacroStabilityOutwardsKernelWrapper.cs =================================================================== diff -u -r5886 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityOutwards/MacroStabilityOutwardsKernelWrapper.cs (.../MacroStabilityOutwardsKernelWrapper.cs) (revision 5886) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityOutwards/MacroStabilityOutwardsKernelWrapper.cs (.../MacroStabilityOutwardsKernelWrapper.cs) (revision 6087) @@ -39,6 +39,7 @@ using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; using Deltares.MacroStability.CSharpWrapper; +using Point2D = Deltares.DamEngine.Data.Geometry.Point2D; namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityOutwards; @@ -221,7 +222,7 @@ /// The messages. /// /// - public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, Point2D point, out List messages) { throw new NotImplementedException(); } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Sensors/SensorLocation.cs =================================================================== diff -u -r5979 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Sensors/SensorLocation.cs (.../SensorLocation.cs) (revision 5979) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Sensors/SensorLocation.cs (.../SensorLocation.cs) (revision 6087) @@ -499,7 +499,7 @@ /// internal IDictionary BuildRelativeLocationTable() { - GeometryPoint surfaceLevelOutside = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside); + Point2D surfaceLevelOutside = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside); if (surfaceLevelOutside == null) { throw new InvalidOperationException("No SurfaceLevelOutside point on surface line defined"); Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Validator.cs =================================================================== diff -u -r5615 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Validator.cs (.../SurfaceLine2Validator.cs) (revision 5615) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Validator.cs (.../SurfaceLine2Validator.cs) (revision 6087) @@ -94,26 +94,9 @@ /// public static bool AreAllPointsXCoordinatesAscending(SurfaceLine2 line) { - if ((line.Geometry.Points.Count == line.Geometry.CalcPoints.Count) && ArePointsAndCalcPointsEqual(line)) - { - return AreGeometryPointsXCoordinatesAscending(line.Geometry.Points); - } - return false; + return AreGeometryPointsXCoordinatesAscending(line.Geometry.CalcPoints); } - private static bool ArePointsAndCalcPointsEqual(SurfaceLine2 line) - { - for (int i = 0; i < line.Geometry.Points.Count; i++) - { - var geometryPoint = new GeometryPoint(line.Geometry.CalcPoints[i].X, line.Geometry.CalcPoints[i].Z); - if (!line.Geometry.Points[i].LocationEquals(geometryPoint)) - { - return false; - } - } - return true; - } - /// /// Determines whether all characteristic points are in correct shape. /// @@ -125,12 +108,12 @@ if (line.IsDefined(CharacteristicPointType.DikeToeAtRiver) && line.IsDefined(CharacteristicPointType.DikeTopAtRiver)) { - result = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Z < line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z; + result = line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).Z < line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver).Z; } if (line.IsDefined(CharacteristicPointType.DikeToeAtPolder) && line.IsDefined(CharacteristicPointType.DikeTopAtPolder)) { - result = result && line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z < line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; + result = result && line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).Z < line.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).Z; } return result; @@ -152,11 +135,21 @@ private bool ArePointsAscending(SurfaceLine2 line) { - return AreGeometryPointsXCoordinatesAscending(line.Geometry.Points); + return AreGeometryPointsXCoordinatesAscending(line.Geometry.CalcPoints); } - private static bool AreGeometryPointsXCoordinatesAscending(IList points) + private static bool AreGeometryPointsXCoordinatesAscending(IList characteristicPoints) { + List points = new List(); + foreach (CharacteristicPoint characteristicPoint in characteristicPoints) + { + points.Add(characteristicPoint.Point); + } + return AreGeometryPointsXCoordinatesAscending(points); + } + + private static bool AreGeometryPointsXCoordinatesAscending(IList points) + { for (var i = 1; i < points.Count; i++) { if (points[i].X < points[i - 1].X + GeometryConstants.Accuracy) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLine1Creator.cs =================================================================== diff -u -r6063 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLine1Creator.cs (.../SensorPlLine1Creator.cs) (revision 6063) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLine1Creator.cs (.../SensorPlLine1Creator.cs) (revision 6087) @@ -68,7 +68,7 @@ { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver).X; } } @@ -79,7 +79,7 @@ { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).X; } } @@ -90,7 +90,7 @@ { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).X; } } @@ -101,7 +101,7 @@ { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside).X; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside).X; } } @@ -112,7 +112,7 @@ { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside).Z; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside).Z; } } @@ -123,7 +123,7 @@ { get { - return SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + return SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).Z; } } @@ -134,28 +134,28 @@ /// public double? GetDitchWaterLevelIntersectionAtXDikeSide(double level) { - GeometryPoint ditchDikeSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide); + Point2D ditchDikeSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide); if (ditchDikeSide == null) { throw new PlLinesCreatorException("Ditch at dike side is not defined in surface line, but was expected"); } - GeometryPoint ditchPolderSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide); + Point2D ditchPolderSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide); if (ditchPolderSide == null) { throw new PlLinesCreatorException("Ditch at polder side is not defined in surface line, but was expected"); } - GeometryPoint ditchBottomDikeSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchDikeSide); + Point2D ditchBottomDikeSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchDikeSide); if (ditchBottomDikeSide == null) { throw new PlLinesCreatorException("Ditch at bottom polder side is not defined in surface line, but was expected"); } var waterlevelLine = new Line(); - double startX = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X; - double endX = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X; + double startX = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside).X; + double endX = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside).X; var waterLevelBeginPoint = new Point2D(startX, level); var waterLevelEndPoint = new Point2D(endX, level); waterlevelLine.SetBeginAndEndPoints(waterLevelBeginPoint, waterLevelEndPoint); @@ -176,28 +176,28 @@ public double? GetDitchWaterLevelIntersectionAtXPolderSide(double level) { - GeometryPoint ditchDikeSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide); + Point2D ditchDikeSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide); if (ditchDikeSide == null) { throw new PlLinesCreatorException("Ditch at dike side is not defined in surface line, but was expected"); } - GeometryPoint ditchPolderSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide); + Point2D ditchPolderSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide); if (ditchPolderSide == null) { throw new PlLinesCreatorException("Ditch at polder side is not defined in surface line, but was expected"); } - GeometryPoint ditchBottomPolderSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchPolderSide); + Point2D ditchBottomPolderSide = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchPolderSide); if (ditchBottomPolderSide == null) { throw new PlLinesCreatorException("Ditch at bottom polder side is not defined in surface line, but was expected"); } var waterlevelLine = new Line(); - double startX = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X; - double endX = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X; + double startX = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelOutside).X; + double endX = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside).X; var waterLevelBeginPoint = new Point2D(startX, level); var waterLevelEndPoint = new Point2D(endX, level); waterlevelLine.SetBeginAndEndPoints(waterLevelBeginPoint, waterLevelEndPoint); @@ -264,7 +264,7 @@ } else { - GeometryPoint dikeToeAtRiver = SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); + Point2D dikeToeAtRiver = SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver); var point = new PlLinePoint(dikeToeAtRiver.X, dikeToeAtRiver.Z); lineConstructor.Insert(point); } @@ -308,7 +308,7 @@ if (DikeHasDitch) { Sensor ditchWaterLevelSensor = SensorLocation.Sensors - .GetBySpecification(new DitchWaterLevelSensorSpecification(SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide).X, SensorLocation.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide).X)) + .GetBySpecification(new DitchWaterLevelSensorSpecification(SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide).X, SensorLocation.SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide).X)) .FirstOrDefault(); double polderLevel = ditchWaterLevelSensor != null ? SensorValues[ditchWaterLevelSensor] : PolderLevel; @@ -359,9 +359,9 @@ { // add tail of surface line - foreach (GeometryPoint geometryPoint in SensorLocation.SurfaceLine.GetSurfaceLineTailExcluding(lastX)) + foreach (Point2D Point2D in SensorLocation.SurfaceLine.GetSurfaceLineTailExcluding(lastX)) { - lineConstructor.Insert(new PlLinePoint(geometryPoint.X, geometryPoint.Z) { Name = geometryPoint.Name }); + lineConstructor.Insert(new PlLinePoint(Point2D.X, Point2D.Z) { Name = Point2D.Name }); } } */ Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs =================================================================== diff -u -r5811 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 5811) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 6087) @@ -160,7 +160,7 @@ // Determine new width and height for shoulder double shoulderHeight; double shoulderLength; - GeometryPoint limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); + Point2D limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); DesignCalculatorUtils.DetermineNewShoulderLengthAndHeight(location.StabilityShoulderGrowDeltaX, location.StabilityShoulderGrowSlope, surfaceLine, limitPointForShoulderDesign, out shoulderHeight, out shoulderLength); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorUtils.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorUtils.cs (.../DesignCalculatorUtils.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorUtils.cs (.../DesignCalculatorUtils.cs) (revision 6087) @@ -42,18 +42,18 @@ /// New height of the shoulder. /// New length of the shoulder. public static void DetermineNewShoulderLengthAndHeight(double shoulderGrowDeltaX, double shoulderGrowSlope, - SurfaceLine2 surfaceLine, GeometryPoint limitPointForShoulderDesign, out double shoulderHeight, out double shoulderLength) + SurfaceLine2 surfaceLine, Point2D limitPointForShoulderDesign, out double shoulderHeight, out double shoulderLength) { // Determine new shoulderpoint - var newShoulderPoint = new GeometryPoint + var newShoulderPoint = new Point2D() { X = limitPointForShoulderDesign.X + shoulderGrowDeltaX, Z = limitPointForShoulderDesign.Z + shoulderGrowDeltaX * shoulderGrowSlope }; // Determine new shoulder length and height shoulderLength = surfaceLine.DetermineShoulderLengthForGivenShoulderTopInside(newShoulderPoint); - shoulderHeight = newShoulderPoint.Z - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + shoulderHeight = newShoulderPoint.Z - surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).Z; } /// @@ -79,8 +79,8 @@ /// public static double CalculateMaximumShoulderLevel(SurfaceLine2 surfaceLine, double maxFractionOfDikeHeightForShoulderHeight) { - double top = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; - double bottom = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + double top = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).Z; + double bottom = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).Z; if (top - bottom <= 0) { throw new SurfaceLineAdapterException(Resources.SurfaceLineShoulderAdapterMaxShoulderHeightError); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r6077 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 6077) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 6087) @@ -47,7 +47,7 @@ private double? waterLevelRiverLow; internal PlLine CurrentPl1Line; // is needed when calculating uplift reduction for PL3 and Pl4 - + /// /// Constructor /// @@ -208,7 +208,7 @@ /// private PlLinePoint DetermineIntersectionBetweenWaterLevelAndDike(double waterLevelRiver) { - GeometryPoint pointAtLevel = SurfaceLine.DetermineIntersectionWithLevel(waterLevelRiver); + Point2D pointAtLevel = SurfaceLine.DetermineIntersectionWithLevel(waterLevelRiver); if (pointAtLevel != null) { return new PlLinePoint(pointAtLevel.X, pointAtLevel.Z); @@ -331,8 +331,8 @@ } var plLine = new PlLine(); - plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.First().X, headInPlLine2.Value)); - plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.Last().X, headInPlLine2.Value)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints.First().X, headInPlLine2.Value)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints.Last().X, headInPlLine2.Value)); return plLine; } @@ -372,8 +372,8 @@ if (separationLevel <= infiltrationLayers.First().TopLevel) { - plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.First().X, headInPlLine2.Value)); - plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.Last().X, headInPlLine2.Value)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints.First().X, headInPlLine2.Value)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints.Last().X, headInPlLine2.Value)); } } } @@ -416,16 +416,16 @@ { 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.Geometry.CalcPoints.First().X, headValue)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).X, headValue)); - if (IsSurfaceLineIntersectedByAquiferAtPolder(plLineType, out GeometryPoint intersectionAquifer)) + if (IsSurfaceLineIntersectedByAquiferAtPolder(plLineType, out Point2D intersectionAquifer)) { ReducePlLineToPl1(intersectionAquifer, plLine); } else { - plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, headAtPolderDikeToe)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).X, headAtPolderDikeToe)); // Now continue PlLine to the end with a slope of SlopeGradient AddTailOfPl3OrPl4WithSlopeGradient(slopeGradient, plLine); @@ -450,18 +450,18 @@ /// /// The intersection point of the surface line (often ditch) with the aquifer. /// The PL-line. - internal void ReducePlLineToPl1(GeometryPoint intersectionAquifer, PlLine plLine) + internal void ReducePlLineToPl1(Point2D intersectionAquifer, PlLine plLine) { - if (IsDitchIntersectedByPl1(intersectionAquifer, out GeometryPoint intersectDitchPl1)) + if (IsDitchIntersectedByPl1(intersectionAquifer, out Point2D intersectDitchPl1)) { plLine.Points.Add(new PlLinePoint(intersectDitchPl1.X, intersectDitchPl1.Z)); - plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X, intersectDitchPl1.Z)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside).X, intersectDitchPl1.Z)); } else { double pl1Level = CurrentPl1Line.ZFromX(intersectionAquifer.X); plLine.Points.Add(new PlLinePoint(intersectionAquifer.X, pl1Level)); - plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X, pl1Level)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside).X, pl1Level)); } } @@ -476,30 +476,30 @@ if (plLine.Points.Last().Z <= WaterLevelPolder) { // the PL line is already at WaterLevelPolder, so countinue it horizontally - plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.Last().X, WaterLevelPolder)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints.Last().X, WaterLevelPolder)); } else { - double lengthFromLastPlPointToEnd = Math.Abs(SurfaceLine.Geometry.Points.Last().X - plLine.Points.Last().X); + double lengthFromLastPlPointToEnd = Math.Abs(SurfaceLine.Geometry.CalcPoints.Last().X - plLine.Points.Last().X); double headAtLastPlPoint = plLine.Points.Last().Z; double headAtEnd = plLine.Points.Last().Z - slopeGradient * lengthFromLastPlPointToEnd; var waterLevelPolderLine = - new Line(new Point2D(SurfaceLine.Geometry.Points.First().X, WaterLevelPolder), - new Point2D(SurfaceLine.Geometry.Points.Last().X, WaterLevelPolder)); + new Line(new Point2D(SurfaceLine.Geometry.CalcPoints.First().X, WaterLevelPolder), + new Point2D(SurfaceLine.Geometry.CalcPoints.Last().X, WaterLevelPolder)); var slopeLine = new Line( - new Point2D(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, headAtLastPlPoint), - new Point2D(SurfaceLine.Geometry.Points.Last().X, headAtEnd)); + new Point2D(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).X, headAtLastPlPoint), + new Point2D(SurfaceLine.Geometry.CalcPoints.Last().X, headAtEnd)); if (waterLevelPolderLine.IntersectsZ(slopeLine, out Point2D intersectionPoint)) { plLine.Points.Add(new PlLinePoint(intersectionPoint.X, WaterLevelPolder)); - plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.Last().X, WaterLevelPolder)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints.Last().X, WaterLevelPolder)); } else { - plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.Last().X, headAtEnd)); + plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints.Last().X, headAtEnd)); } } } @@ -623,7 +623,7 @@ for (int pointIndex = plLine.Points.Count - 1; pointIndex > 0; pointIndex--) { PlLinePoint plPoint = plLine.Points[pointIndex]; - if (plPoint.X.AlmostEquals(x, GeometryPoint.Precision)) + if (plPoint.X.AlmostEquals(x, GeometryConstants.Accuracy)) { return pointIndex; } @@ -654,8 +654,8 @@ { if (SurfaceLine.HasDitch()) { - return (xCoordinate > SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide).X && - xCoordinate < SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide).X); + return (xCoordinate > SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide).X && + xCoordinate < SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide).X); } // if ditch does not exist the x coordinate is clearly not in the ditch @@ -675,10 +675,10 @@ return null; } - GeometryPoint characteristicGeometryPoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(characteristicPointType); - SoilProfile1D actualSoilProfile = GetSoilProfileBelowPoint(characteristicGeometryPoint.X); + Point2D characteristicPoint2D = SurfaceLine.CharacteristicPoints.GetPoint2D(characteristicPointType); + SoilProfile1D actualSoilProfile = GetSoilProfileBelowPoint(characteristicPoint2D.X); double bottomLevel = actualSoilProfile.GetHighestAquifer().TopLevel; - double topLevel = characteristicGeometryPoint.Z; + double topLevel = characteristicPoint2D.Z; return topLevel - bottomLevel; } @@ -715,19 +715,19 @@ IsUseOvenDryUnitWeight = false, UnitWeightSoilEmbankment = (DikeEmbankmentMaterial == null) ? null : DikeEmbankmentMaterial.AbovePhreaticLevel }; - GeometryPoint startSurfacePoint = SurfaceLine.GetDikeToeInward(); + Point2D startSurfacePoint = SurfaceLine.GetDikeToeInward(); - int indexOfFixedPlPoint = FindIndexOfPointInPlLineWithXCoordinate(plLine, SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X); + int indexOfFixedPlPoint = FindIndexOfPointInPlLineWithXCoordinate(plLine, SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver).X); if (indexOfFixedPlPoint < 0) { throw new PlLinesCreatorException("Could not find fixed point for PlLine"); } // Adjust PL3/4 for all surface points from toe of dike to end of profile to, so no uplift will occur in that surface point - IEnumerable relevantSurfacePointsList = from GeometryPoint point in SurfaceLine.Geometry.Points - where point.X >= startSurfacePoint.X - orderby point.X - select point; + IEnumerable relevantSurfacePointsList = from Point2D point in SurfaceLine.Geometry.CalcPoints + where point.X >= startSurfacePoint.X + orderby point.X + select point; // Adjustment will only be applied if the value to adjust to is smaller than the previous adjusted value // (to avoid that the PL3/PL4 will be adjusted to the polder side of the ditch i.s.o. the dike side of the ditch). // So we remember which was the last adjusted value in lastAdjustedHeadOfPlLine. @@ -737,7 +737,7 @@ bool isSkipAdjustmentInDitch; DetermineHowToActDueToDitch(out isSkipAdjustmentInDitch, out isRemoveAllPlPointsBackToDikeToeAtRiver); - foreach (GeometryPoint surfacePoint in relevantSurfacePointsList) + foreach (Point2D surfacePoint in relevantSurfacePointsList) { if (IsXCoordinateInDitch(surfacePoint.X) && isSkipAdjustmentInDitch) { @@ -791,14 +791,14 @@ // Recheck on Uplift in case points are removed if (isRemoveAllPlPointsBackToDikeToeAtRiver && SurfaceLine.HasDitch()) { - GeometryPoint startPoint = SurfaceLine.GetDikeToeInward(); - GeometryPoint endPoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide); - IEnumerable recheckSurfacePointsList = from GeometryPoint point in SurfaceLine.Geometry.Points - where point.X >= startPoint.X && point.X <= endPoint.X - orderby point.X - select point; + Point2D startPoint = SurfaceLine.GetDikeToeInward(); + Point2D endPoint = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide); + IEnumerable recheckSurfacePointsList = from Point2D point in SurfaceLine.Geometry.CalcPoints + where point.X >= startPoint.X && point.X <= endPoint.X + orderby point.X + select point; - foreach (GeometryPoint surfacePoint in recheckSurfacePointsList) + foreach (Point2D surfacePoint in recheckSurfacePointsList) { ConfigureUpliftCalculator(upliftCalculator, surfacePoint); SoilLayer1D relevantSandLayer = GetRelevantAquiferLayer(plLineType, upliftCalculator.SoilProfile); @@ -832,7 +832,7 @@ /// /// The uplift calculator. /// The surface point. - private void ConfigureUpliftCalculator(UpliftCalculator upliftCalculator, GeometryPoint surfacePoint) + private void ConfigureUpliftCalculator(UpliftCalculator upliftCalculator, Point2D surfacePoint) { upliftCalculator.SurfaceLevel = surfacePoint.Z; if (CurrentPl1Line != null) @@ -864,11 +864,11 @@ DetermineThicknessAquitardAtCharacteristicPoint(CharacteristicPointType.DitchPolderSide).Value; double thicknessAquitardAtBottomDitch = DetermineThicknessAquitardAtCharacteristicPoint(CharacteristicPointType.BottomDitchPolderSide).Value; - double widthDitchAtTop = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide).X - - SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide).X; + double widthDitchAtTop = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide).X - + SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide).X; double widthDitchAtTBottom = - SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchPolderSide).X - - SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchDikeSide).X; + SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchPolderSide).X - + SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchDikeSide).X; if ((thicknessAquitardAtTopDitch > widthDitchAtTop) && (thicknessAquitardAtBottomDitch > widthDitchAtTBottom)) { @@ -910,7 +910,7 @@ void CopyPointsInPlLine(ref PlLine plLine, GeometryPointString genericLine) { plLine.Points.Clear(); - foreach (GeometryPoint point in genericLine.Points) + foreach (Point2D point in genericLine.CalcPoints) { plLine.Points.Add(new PlLinePoint(point.X, point.Z)); } @@ -931,7 +931,7 @@ if (location != null) { bool isPl1LineDefinedForLocation = location.LocalXzpl1Line != null && - location.LocalXzpl1Line.Points.Count > 1; + location.LocalXzpl1Line.CalcPoints.Count > 1; if ((plLineType == PlLineType.Pl1) && isPl1LineDefinedForLocation) { PlLine plLine = plLines.Lines[plLineType]; @@ -1069,15 +1069,15 @@ else { // No intersection with dike; polder is flooded - leftMostXAtRiverLevel = SurfaceLine.Geometry.Points.Last().X; - plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points.Last().X, gaugeWaterLevelRiver.Value)); + leftMostXAtRiverLevel = SurfaceLine.Geometry.CalcPoints.Last().X; + plLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints.Last().X, gaugeWaterLevelRiver.Value)); } } } else { // In this case no intersection for this PlLine with the dike will be considered - leftMostXAtRiverLevel = SurfaceLine.Geometry.Points.First().X; + leftMostXAtRiverLevel = SurfaceLine.Geometry.CalcPoints.First().X; } } @@ -1086,8 +1086,8 @@ if (plLine.Points.Any()) { - plLine.Points.First().X = SurfaceLine.Geometry.Points.First().X; - plLine.Points.Last().X = SurfaceLine.Geometry.Points.Last().X; + plLine.Points.First().X = SurfaceLine.Geometry.CalcPoints.First().X; + plLine.Points.Last().X = SurfaceLine.Geometry.CalcPoints.Last().X; } return plLine; @@ -1102,7 +1102,7 @@ private void CreatePhreaticLineSegmentsInsideDikeForLowRiverLevel(PlLine phreaticLine, double lowWaterLevel, double highWaterLevel) { PlLinePoint intersectionLowWaterLevelWithDike = DetermineIntersectionBetweenWaterLevelAndDike(lowWaterLevel); - GeometryPoint pointDikeToeAtRiver = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); + Point2D pointDikeToeAtRiver = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtRiver); switch (ModelParametersForPlLines.PlLineCreationMethod) { case PlLineCreationMethod.ExpertKnowledgeLinearInDike: @@ -1120,7 +1120,7 @@ intersectionHighWaterLevelWithDike.Z - cPlLineOffsetBelowSurface); //Add points below surface of dike talud riverside - foreach (GeometryPoint point in SurfaceLine.Geometry.Points.Where( + foreach (Point2D point in SurfaceLine.Geometry.CalcPoints.Where( point => point.X > intersectionLowWaterLevelWithDike.X && point.X < intersectionHighWaterLevelWithDike.X)) { @@ -1133,7 +1133,7 @@ break; case PlLineCreationMethod.ExpertKnowledgeRRD: //Add points below surface of dike talud riverside until toe of dike riverside - foreach (GeometryPoint point in SurfaceLine.Geometry.Points.Where( + foreach (Point2D point in SurfaceLine.Geometry.CalcPoints.Where( point => point.X > intersectionLowWaterLevelWithDike.X && point.X <= pointDikeToeAtRiver.X)) { @@ -1146,8 +1146,8 @@ // Add points below crest of dike double offsetDikeTopAtRiver = WaterLevelRiverHigh - PlLineOffsetBelowDikeTopAtRiver; double offsetDikeTopAtPolder = WaterLevelRiverHigh - PlLineOffsetBelowDikeTopAtPolder; - GeometryPoint pointDikeTopAtRiver = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - GeometryPoint pointDikeTopAtPolder = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D pointDikeTopAtRiver = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); + Point2D pointDikeTopAtPolder = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); if (pointDikeTopAtRiver != null) { phreaticLine.Points.Add(new PlLinePoint(pointDikeTopAtRiver.X, offsetDikeTopAtRiver)); @@ -1173,8 +1173,8 @@ /// The phreatic line. /// The point dike top at river. /// The point dike top at polder. - private void CreateOptionalPointAtDikeCrestMiddle(PlLine phreaticLine, GeometryPoint pointDikeTopAtRiver, - GeometryPoint pointDikeTopAtPolder) + private void CreateOptionalPointAtDikeCrestMiddle(PlLine phreaticLine, Point2D pointDikeTopAtRiver, + Point2D pointDikeTopAtPolder) { if (UsePlLineOffsetBelowDikeCrestMiddle.HasValue && UsePlLineOffsetBelowDikeCrestMiddle.Value && PlLineOffsetBelowDikeCrestMiddle != null) { @@ -1211,13 +1211,13 @@ // No extra points below top of dike at river and top of dike at polder break; case PlLineCreationMethod.ExpertKnowledgeRRD: - GeometryPoint pointDikeTopAtRiver = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Point2D pointDikeTopAtRiver = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); if (pointDikeTopAtRiver != null) { phreaticLine.Points.Add(new PlLinePoint(pointDikeTopAtRiver.X, offsetDikeTopAtRiver)); } - GeometryPoint pointDikeTopAtPolder = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D pointDikeTopAtPolder = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); if (pointDikeTopAtRiver != null && pointDikeTopAtPolder != null) { CreateOptionalPointAtDikeCrestMiddle(phreaticLine, pointDikeTopAtRiver, pointDikeTopAtPolder); @@ -1241,13 +1241,13 @@ // intersectionPolderLevelWithDike is always determined between dike toe polder side and dike top riverside. Any intersection(s) at polder side // beyond dike toe are ignored. PlLinePoint intersectionPolderLevelWithDike = DetermineIntersectionBetweenPolderLevelAndDike(WaterLevelPolder); - GeometryPoint dikeToeAtPolderPoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeToeAtPolderPoint = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); - double maxXCoordinateSurface = SurfaceLine.Geometry.Points.Max(x => x.X); + double maxXCoordinateSurface = SurfaceLine.Geometry.CalcPoints.Max(x => x.X); if (ModelParametersForPlLines.PlLineCreationMethod != PlLineCreationMethod.ExpertKnowledgeLinearInDike) { // Points created below are points starting at shoulder point to the right - GeometryPoint shoulderBaseInsidePoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + Point2D shoulderBaseInsidePoint = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside); if (shoulderBaseInsidePoint != null) { double zLevel = Math.Min(phreaticLine.Points.Last().Z, @@ -1264,8 +1264,8 @@ if (UsePlLineOffsetFactorBelowShoulderCrest.HasValue && UsePlLineOffsetFactorBelowShoulderCrest.Value && PlLineOffsetFactorBelowShoulderCrest != null && dikeToeAtPolderPoint != null) { - GeometryPoint shoulderTopInsidePoint = - SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + Point2D shoulderTopInsidePoint = + SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopInside); if (shoulderTopInsidePoint != null) { zLevel = dikeToeAtPolderPoint.Z + (PlLineOffsetFactorBelowShoulderCrest.Value * @@ -1279,7 +1279,7 @@ } } - GeometryPoint ditchDikeSidePoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide); + Point2D ditchDikeSidePoint = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide); if (dikeToeAtPolderPoint != null) { double zLevel = Math.Min(phreaticLine.Points.Last().Z, dikeToeAtPolderPoint.Z - Math.Max(cOffsetPhreaticLineBelowSurface, PlLineOffsetBelowDikeToeAtPolder)); @@ -1312,7 +1312,7 @@ // if there is a ditch, then adjust it. if (isDitchPresent) { - int surfacePointIndex = SurfaceLine.Geometry.Points.IndexOf(ditchDikeSidePoint); + int surfacePointIndex = SurfaceLine.Geometry.CalcPoints.IndexOf(ditchDikeSidePoint); AdjustForDitchAtPolderSide(phreaticLine, surfacePointIndex); } else @@ -1356,19 +1356,19 @@ { // Add phreatic point at offset below every surface line point as long as depth > polder level. Else determine the // proper position of the point at polder level (intersection) and stop. - int surfacePointIndex = SurfaceLine.Geometry.Points.IndexOf(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder)) + 1; + int surfacePointIndex = SurfaceLine.Geometry.CalcPoints.IndexOf(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder)) + 1; var intersected = false; - for (int i = surfacePointIndex; i < SurfaceLine.Geometry.Points.Count; i++) + for (int i = surfacePointIndex; i < SurfaceLine.Geometry.CalcPoints.Count; i++) { - double z = Math.Max(WaterLevelPolder, SurfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder); - double x = SurfaceLine.Geometry.Points[i].X; - if (WaterLevelPolder > SurfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder) + double z = Math.Max(WaterLevelPolder, SurfaceLine.Geometry.CalcPoints[i].Z - PlLineOffsetBelowDikeToeAtPolder); + double x = SurfaceLine.Geometry.CalcPoints[i].X; + if (WaterLevelPolder > SurfaceLine.Geometry.CalcPoints[i].Z - PlLineOffsetBelowDikeToeAtPolder) { // Determine intersection between would be phreatic segment and polderlevel. Add that as next point. - var waterLevelPolderLine = new Line(new Point2D(SurfaceLine.Geometry.Points.First().X, WaterLevelPolder), - new Point2D(SurfaceLine.Geometry.Points.Last().X, WaterLevelPolder)); + var waterLevelPolderLine = new Line(new Point2D(SurfaceLine.Geometry.CalcPoints.First().X, WaterLevelPolder), + new Point2D(SurfaceLine.Geometry.CalcPoints.Last().X, WaterLevelPolder)); var slopeLine = new Line(new Point2D(phreaticLine.Points[phreaticLine.Points.Count - 1].X, phreaticLine.Points[phreaticLine.Points.Count - 1].Z), - new Point2D(SurfaceLine.Geometry.Points[i].X, SurfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder)); + new Point2D(SurfaceLine.Geometry.CalcPoints[i].X, SurfaceLine.Geometry.CalcPoints[i].Z - PlLineOffsetBelowDikeToeAtPolder)); Point2D intersectionPoint; if (waterLevelPolderLine.IntersectsZ(slopeLine, out intersectionPoint)) { @@ -1407,17 +1407,17 @@ /// private void AddIntersectionDitchPolderSegmentPolderLevelToPhreatic(PlLine phreaticLine, Line phreaticPolderPartialLine) { - GeometryPoint pointDitchPolder = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide); + Point2D pointDitchPolder = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide); if (pointDitchPolder != null) { - int indexatDitchPolder = SurfaceLine.Geometry.Points.IndexOf(pointDitchPolder); + int indexatDitchPolder = SurfaceLine.Geometry.CalcPoints.IndexOf(pointDitchPolder); var lineDitchPolderSide = new Line(); if (indexatDitchPolder > 1) { - 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)); + lineDitchPolderSide.SetBeginAndEndPoints(new Point2D(SurfaceLine.Geometry.CalcPoints[indexatDitchPolder - 1].X, SurfaceLine.Geometry.CalcPoints[indexatDitchPolder - 1].Z), + new Point2D(SurfaceLine.Geometry.CalcPoints[indexatDitchPolder].X, SurfaceLine.Geometry.CalcPoints[indexatDitchPolder].Z)); - var intersectDitchPolderPhreatic = new GeometryPoint(); + var intersectDitchPolderPhreatic = new Point2D(); if (LineHelper.DetermineStrictIntersectionPoint(lineDitchPolderSide, phreaticPolderPartialLine, ref intersectDitchPolderPhreatic)) { phreaticLine.Points.Add(new PlLinePoint(intersectDitchPolderPhreatic.X, intersectDitchPolderPhreatic.Z)); @@ -1444,20 +1444,20 @@ /// private void AddIntersectionDitchDikeSegmentPolderLevelToPhreatic(PlLine phreaticLine, int surfacePointIndex, Line phreaticPolderPartialLine) { - if (surfacePointIndex + 1 < SurfaceLine.Geometry.Points.Count) + if (surfacePointIndex + 1 < SurfaceLine.Geometry.CalcPoints.Count) { var lineDitchDikeSide = new Line(); - 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)); + lineDitchDikeSide.SetBeginAndEndPoints(new Point2D(SurfaceLine.Geometry.CalcPoints[surfacePointIndex].X, SurfaceLine.Geometry.CalcPoints[surfacePointIndex].Z), + new Point2D(SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].X, SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].Z)); - var intersectDitchDikePhreatic = new GeometryPoint(); + var intersectDitchDikePhreatic = new Point2D(); if (LineHelper.DetermineStrictIntersectionPoint(lineDitchDikeSide, phreaticPolderPartialLine, ref intersectDitchDikePhreatic)) { phreaticLine.Points.Add(new PlLinePoint(intersectDitchDikePhreatic.X, intersectDitchDikePhreatic.Z)); } else { - phreaticLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.Points[surfacePointIndex].X, phreaticPolderPartialLine.EndPoint.Z)); + phreaticLine.Points.Add(new PlLinePoint(SurfaceLine.Geometry.CalcPoints[surfacePointIndex].X, phreaticPolderPartialLine.EndPoint.Z)); } } else @@ -1469,23 +1469,23 @@ private PlLinePoint DetermineIntersectionBetweenPolderLevelAndDike(double polderLevel) { var polderlevelLine = new Line(); - double startXCoordinate = SurfaceLine.Geometry.Points.OrderBy(p => p.X).First().X; - GeometryPoint pointEndOfprofile = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside); + double startXCoordinate = SurfaceLine.Geometry.CalcPoints.OrderBy(p => p.X).First().X; + Point2D pointEndOfprofile = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside); polderlevelLine.SetBeginAndEndPoints(new Point2D(startXCoordinate, polderLevel), new Point2D(pointEndOfprofile.X, polderLevel)); ThrowWhenWaterLevelAboveDike(polderLevel, SurfaceLine); // Find intersection between dike top (riverside because that is taken as default DTH) and dike toe (polder side) with polder level. // Start at dike toe and work your way back to dike top. - int startPosition = SurfaceLine.Geometry.Points.IndexOf(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder)); - int endPosition = SurfaceLine.Geometry.Points.IndexOf(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver)); + int startPosition = SurfaceLine.Geometry.CalcPoints.IndexOf(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder)); + int endPosition = SurfaceLine.Geometry.CalcPoints.IndexOf(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver)); for (int surfacePointIndex = startPosition; surfacePointIndex > endPosition; surfacePointIndex--) { var surfaceLineSegment = new Line(); - surfaceLineSegment.SetBeginAndEndPoints(new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex - 1].X, - SurfaceLine.Geometry.Points[surfacePointIndex - 1].Z), new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex].X, - SurfaceLine.Geometry.Points[surfacePointIndex].Z)); - var intersectPoint = new GeometryPoint(); + surfaceLineSegment.SetBeginAndEndPoints(new Point2D(SurfaceLine.Geometry.CalcPoints[surfacePointIndex - 1].X, + SurfaceLine.Geometry.CalcPoints[surfacePointIndex - 1].Z), new Point2D(SurfaceLine.Geometry.CalcPoints[surfacePointIndex].X, + SurfaceLine.Geometry.CalcPoints[surfacePointIndex].Z)); + var intersectPoint = new Point2D(); if (LineHelper.DetermineStrictIntersectionPoint(surfaceLineSegment, polderlevelLine, ref intersectPoint)) { return new PlLinePoint(intersectPoint.X, intersectPoint.Z); @@ -1504,12 +1504,12 @@ /// private void ValidatePhreaticBelowDike(PlLine phreaticLine) { - int startIndex = SurfaceLine.Geometry.Points.IndexOf(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver)); - int stopIndex = SurfaceLine.Geometry.Points.IndexOf(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder)); + int startIndex = SurfaceLine.Geometry.CalcPoints.IndexOf(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver)); + int stopIndex = SurfaceLine.Geometry.CalcPoints.IndexOf(SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder)); var stopIteration = false; // This code can go into an endless loop // Enter failsave to raise exception when this occurs - int cMaxIterations = Math.Max(100, phreaticLine.Points.Count * SurfaceLine.Geometry.Points.Count); + int cMaxIterations = Math.Max(100, phreaticLine.Points.Count * SurfaceLine.Geometry.CalcPoints.Count); var iterationCount = 0; while (!stopIteration) { @@ -1525,9 +1525,9 @@ { var surfaceLineSegment = new Line(); 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)); - var intersectGeoPoint = new GeometryPoint(); + new Point2D(SurfaceLine.Geometry.CalcPoints[surfacePointIndex].X, SurfaceLine.Geometry.CalcPoints[surfacePointIndex].Z), + new Point2D(SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].X, SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].Z)); + var intersectGeoPoint = new Point2D(); var intersectPoint = new Point2D(); if (LineHelper.DetermineStrictIntersectionPoint(phreaticLineSegment, surfaceLineSegment, ref intersectGeoPoint)) { @@ -1547,19 +1547,19 @@ if (newPlLinePoint.X > phreaticLineSegment.BeginPoint.X) { phreaticLine.Points.Insert(phreaticPointIndex + 1, newPlLinePoint); - if (SurfaceLine.Geometry.Points[surfacePointIndex + 1].X.IsNearEqual(intersectPoint.X)) + if (SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].X.IsNearEqual(intersectPoint.X)) { // phreatic point and surfaceline point are postioned above each other, so replace the phreatic point with the intersect point phreaticLine.Points[phreaticPointIndex + 2] = - new PlLinePoint(SurfaceLine.Geometry.Points[surfacePointIndex + 1].X, - SurfaceLine.Geometry.Points[surfacePointIndex + 1].Z - + new PlLinePoint(SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].X, + SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].Z - cOffsetPhreaticLineBelowSurface); } else { var newNextPlLinePoint = - new PlLinePoint(SurfaceLine.Geometry.Points[surfacePointIndex + 1].X, - SurfaceLine.Geometry.Points[surfacePointIndex + 1].Z - + new PlLinePoint(SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].X, + SurfaceLine.Geometry.CalcPoints[surfacePointIndex + 1].Z - cOffsetPhreaticLineBelowSurface); if (newNextPlLinePoint.X <= phreaticLine.Points[phreaticPointIndex + 2].X) { @@ -1608,7 +1608,7 @@ ThrowWhenWaterLevelPolderAboveDikeTopAtPolder(); //Create Phreatic line and add polderwater level - double startXCoordinate = SurfaceLine.Geometry.Points.OrderBy(p => p.X).First().X; + double startXCoordinate = SurfaceLine.Geometry.CalcPoints.OrderBy(p => p.X).First().X; var phreaticLine = new PlLine(); phreaticLine.IsPhreatic = true; @@ -1672,7 +1672,7 @@ private SoilProfile1D GetRelevantSoilProfileForAquiferLayersSearch() { - GeometryPoint relevantPoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D relevantPoint = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); if (relevantPoint == null) { throw new PlLinesCreatorException("Characteristic point \"dike toe at polder\" is not defined."); @@ -1689,7 +1689,7 @@ /// private void ThrowWhenWaterLevelAboveDike(double waterLevelRiver, SurfaceLine2 surfaceLine2) { - double dikeTopAtRiverHeight = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z; + double dikeTopAtRiverHeight = surfaceLine2.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver).Z; if (waterLevelRiver > dikeTopAtRiverHeight) { throw new PlLinesCreatorException($"Phreatic water level should have an intersection with the dike at least once (phreatic line higher ({waterLevelRiver:F2} m) than surface line ({dikeTopAtRiverHeight:F2}))"); @@ -1701,7 +1701,7 @@ /// private void ThrowWhenWaterLevelPolderAboveDikeTopAtPolder() { - double dikeTopPolder = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; + double dikeTopPolder = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).Z; if (WaterLevelPolder > dikeTopPolder) { throw new PlLinesCreatorException($"Waterlevel ({WaterLevelPolder:0.00}) in polder higher than dike top at polder ({dikeTopPolder:0.00}) in surfaceline {SurfaceLine.Name}"); @@ -1722,7 +1722,7 @@ validator.ValidateSoilProfileForPlLinesCreator(); } - internal bool IsSurfaceLineIntersectedByAquiferAtPolder(PlLineType plLineType, out GeometryPoint intersectionPoint) + internal bool IsSurfaceLineIntersectedByAquiferAtPolder(PlLineType plLineType, out Point2D intersectionPoint) { // If all the layers below the dike toe at polder are aquifer, no intersection point can be found SoilProfile1D relevantSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); @@ -1731,24 +1731,24 @@ intersectionPoint = null; return false; } - + // Soil profile 2D - double xStartSearch = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; + double xStartSearch = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).X; if (SoilProfileType == SoilProfileType.ProfileType2D) { SoilProfile2DHelper.LayerType aquiferType = plLineType == PlLineType.Pl3 ? SoilProfile2DHelper.LayerType.BottomAquiferCluster : SoilProfile2DHelper.LayerType.InBetweenAquiferCluster; return SoilProfile2DHelper.IsSurfaceLineIntersectedByAquifer(aquiferType, SoilProfile2D, xStartSearch, out intersectionPoint); } - + // Soil profile 1D SoilLayer1D aquifer = GetRelevantAquiferLayer(plLineType, relevantSoilProfile); if (aquifer != null) { - int indexStartSearch = SurfaceLine.Geometry.Points.FindIndex(p => p.X.IsNearEqual(xStartSearch, toleranceAlmostEquals)); + int indexStartSearch = SurfaceLine.Geometry.CalcPoints.FindIndex(p => p.X.IsNearEqual(xStartSearch, toleranceAlmostEquals)); double xIntersection = SurfaceLine.Geometry.GetXatZStartingAt(indexStartSearch, aquifer.TopLevel); if (!double.IsNaN(xIntersection)) { - intersectionPoint = new GeometryPoint + intersectionPoint = new Point2D { X = xIntersection, Z = aquifer.TopLevel @@ -1772,26 +1772,26 @@ /// Returns the intersection point of the ditch with PL 1. If no intersection point is /// found, returns null. /// true if the ditch intersects the polder level; otherwise, false. - internal bool IsDitchIntersectedByPl1(GeometryPoint intersectionDitchAquifer, out GeometryPoint intersectionDitchPl1) + internal bool IsDitchIntersectedByPl1(Point2D intersectionDitchAquifer, out Point2D intersectionDitchPl1) { - intersectionDitchPl1 = new GeometryPoint(); + intersectionDitchPl1 = new Point2D(); bool isPl1AboveAquifer = CurrentPl1Line.Points.Last().Z.IsGreaterThanOrEqualTo(intersectionDitchAquifer.Z, toleranceAlmostEquals); - GeometryPoint dikeToeAtPolder = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - double xStart = SurfaceLine.Geometry.Points.First(p => p.X.IsGreaterThanOrEqualTo(intersectionDitchAquifer.X, toleranceAlmostEquals)).X; - int indexStart = SurfaceLine.Geometry.Points.FindIndex(p => p.X.AlmostEquals(xStart, toleranceAlmostEquals)) - 1; - int indexDikeToeAtPolder = SurfaceLine.Geometry.Points.FindIndex(p => p.X.AlmostEquals(dikeToeAtPolder.X, toleranceAlmostEquals)); - int indexEnd = isPl1AboveAquifer ? indexDikeToeAtPolder : SurfaceLine.Geometry.Points.Count - 1; + Point2D dikeToeAtPolder = SurfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); + double xStart = SurfaceLine.Geometry.CalcPoints.First(p => p.X.IsGreaterThanOrEqualTo(intersectionDitchAquifer.X, toleranceAlmostEquals)).X; + int indexStart = SurfaceLine.Geometry.CalcPoints.FindIndex(p => p.X.AlmostEquals(xStart, toleranceAlmostEquals)) - 1; + int indexDikeToeAtPolder = SurfaceLine.Geometry.CalcPoints.FindIndex(p => p.X.AlmostEquals(dikeToeAtPolder.X, toleranceAlmostEquals)); + int indexEnd = isPl1AboveAquifer ? indexDikeToeAtPolder : SurfaceLine.Geometry.CalcPoints.Count - 1; if ((isPl1AboveAquifer && indexStart < indexEnd) || (!isPl1AboveAquifer && indexStart > indexEnd)) { throw new PlLinesCreatorException(Resources.PlLinesCreator_ErrorDuringIsDitchIntersectedByPl1); } - + int index = indexStart; while (index != indexEnd) { - GeometryPoint currentPoint = SurfaceLine.Geometry.Points[index]; - GeometryPoint nextPoint = SurfaceLine.Geometry.Points[index + 1]; + Point2D currentPoint = SurfaceLine.Geometry.CalcPoints[index]; + Point2D nextPoint = SurfaceLine.Geometry.CalcPoints[index + 1]; var surfaceLineSegment = new Line(); surfaceLineSegment.SetBeginAndEndPoints(new Point2D(currentPoint.X, currentPoint.Z), new Point2D(nextPoint.X, nextPoint.Z)); var phreaticPolderPartialLine = new Line(); @@ -1802,6 +1802,7 @@ { return true; } + index = isPl1AboveAquifer ? index - 1 : index + 1; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs =================================================================== diff -u -r5770 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs (.../BishopGridCreator.cs) (revision 5770) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs (.../BishopGridCreator.cs) (revision 6087) @@ -61,8 +61,8 @@ if (surfaceLine != null) { // Use middle of the dike for X-coordinate - GeometryPoint dikeTopAtRiverPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - GeometryPoint dikeTopAtPolderPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D dikeTopAtRiverPoint = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); + Point2D dikeTopAtPolderPoint = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); double gridXCoordinate = (dikeTopAtRiverPoint.X + dikeTopAtPolderPoint.X) * 0.5; double gridYCoordinate = surfaceLine.Geometry.GetZatX(gridXCoordinate); double gridWidth = slipCircleDefinition.BishopGridHorizontalPointDistance * Index: DamEngine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlOutput.cs =================================================================== diff -u -r5354 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlOutput.cs (.../FillDamFromXmlOutput.cs) (revision 5354) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlOutput.cs (.../FillDamFromXmlOutput.cs) (revision 6087) @@ -305,10 +305,9 @@ for (var j = 0; j < inputSurfaceLine.Points.Length; j++) { SurfaceLinePoint inputPoint = inputSurfaceLine.Points[j]; - var geometryPoint = new GeometryPoint + var geometryPoint = new Point2D() { X = inputPoint.X, - Y = 0.0, Z = inputPoint.Z }; surfaceLine.AddCharacteristicPoint(geometryPoint, ConversionHelper.ConvertToDamPointType(inputPoint.PointType)); Index: DamEngine/trunk/src/Deltares.DamEngine.Interface/FillXmlInputFromDam.cs =================================================================== diff -u -r6005 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Interface/FillXmlInputFromDam.cs (.../FillXmlInputFromDam.cs) (revision 6005) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface/FillXmlInputFromDam.cs (.../FillXmlInputFromDam.cs) (revision 6087) @@ -576,8 +576,8 @@ var inputPoint = new SurfaceLinePoint { PointType = ConversionHelper.ConvertToInputPointType(characteristicPoint.CharacteristicPointType), - X = characteristicPoint.X, - Z = characteristicPoint.Z + X = characteristicPoint.Point.X, + Z = characteristicPoint.Point.Z }; inputSurfaceLine.Points[j] = inputPoint; } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs =================================================================== diff -u -r5399 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs (.../SoilSurfaceProfile.cs) (revision 5399) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs (.../SoilSurfaceProfile.cs) (revision 6087) @@ -133,7 +133,7 @@ || profile == null || profile.Layers.Count == 0 || surfaceLine.Geometry.GetMaxZ() < profile.BottomLevel - || surfaceLine.Geometry.Points.Count < 2) + || surfaceLine.Geometry.CalcPoints.Count < 2) { return; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs =================================================================== diff -u -r5784 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs (.../SurfaceLineAdapter.cs) (revision 5784) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs (.../SurfaceLineAdapter.cs) (revision 6087) @@ -85,8 +85,8 @@ { if (hasTrafficLoad) { - GeometryPoint pointDikeTopAtRiver = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - GeometryPoint pointDikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D pointDikeTopAtRiver = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); + Point2D pointDikeTopAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); if (isTrafficLoadOnCrest) { // The traffic load will be restored relative to the binnenkruinlijn. If the leftside of the traffic load passes the buitenkruinlijn, @@ -129,9 +129,9 @@ /// /// /// point equal to the ShoulderTopInside when the new slope ends on that point else null - protected GeometryPoint ReplaceBaseInsideForNewSlope(GeometryPoint startPoint, double slopeTangent) + protected Point2D ReplaceBaseInsideForNewSlope(Point2D startPoint, double slopeTangent) { - GeometryPoint result = null; + Point2D result = null; var line = new Line { BeginPoint = new Point2D(startPoint.X, startPoint.Z), @@ -146,8 +146,8 @@ { newSlopeEndPoint = intersectionpoints.First(); // One of the intersection points can be the dike top which should not be replaced - if (newSlopeEndPoint.X.IsNearEqual(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X, GeometryConstants.Tolerance) && - newSlopeEndPoint.Z.IsNearEqual(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, GeometryConstants.Tolerance)) + if (newSlopeEndPoint.X.IsNearEqual(surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).X, GeometryConstants.Tolerance) && + newSlopeEndPoint.Z.IsNearEqual(surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).Z, GeometryConstants.Tolerance)) { newSlopeEndPoint = null; if (intersectionpoints.Count > 1) @@ -162,20 +162,20 @@ throw new SurfaceLineAdapterException(Resources.SlopeErrorNoIntersection); } - GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); if (newSlopeEndPoint.X > dikeToeAtPolder.X) { // The new point is beyond the old dike toe so adapt that point. surfaceLine.EnsurePointOfType(newSlopeEndPoint.X, newSlopeEndPoint.Z, CharacteristicPointType.DikeToeAtPolder); // Remove all points between top and dike toe, surfaceLine.RemoveSegmentBetween( - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X, + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).X, newSlopeEndPoint.X); } else { - GeometryPoint shoulderTopInside = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); - GeometryPoint shoulderBaseInside = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + Point2D shoulderTopInside = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopInside); + Point2D shoulderBaseInside = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside); if (shoulderBaseInside != null && shoulderTopInside != null) { if (newSlopeEndPoint.X > shoulderTopInside.X) @@ -185,7 +185,7 @@ //surfaceLine.RemovePoint(CharacteristicPointType.); surfaceLine.EnsurePoint(newSlopeEndPoint.X, newSlopeEndPoint.Z); surfaceLine.RemoveSegmentBetween( - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X, + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).X, newSlopeEndPoint.X); } else @@ -211,9 +211,9 @@ surfaceLine.EnsurePoint(newSlopeEndPoint.X, newSlopeEndPoint.Z); surfaceLine.RemoveSegmentBetween( - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X, + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).X, newSlopeEndPoint.X); - result = new GeometryPoint(newSlopeEndPoint.X, newSlopeEndPoint.Z); + result = new Point2D(newSlopeEndPoint.X, newSlopeEndPoint.Z); } } } @@ -242,25 +242,25 @@ var ditchDefinition = new DitchDefinition(); if (surfaceLine.HasDitch() && surfaceLine.IsDitchCorrect()) { - GeometryPoint ditchDikeSide = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide); + Point2D ditchDikeSide = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide); ditchDefinition.DistanceFromToe = ditchDikeSide.X - - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).X; if (ditchDefinition.DistanceFromToe >= 0) { ditchDefinition.OriginalX = ditchDikeSide.X; ditchDefinition.DistanceToBottomDikeSide = - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchDikeSide).X - + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchDikeSide).X - ditchDikeSide.X; ditchDefinition.DistanceToBottomPolderSide = - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchPolderSide).X - + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchPolderSide).X - ditchDikeSide.X; ditchDefinition.DistanceToEndDitch = - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide).X - + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide).X - ditchDikeSide.X; ditchDefinition.DepthBottomDikeSide = ditchDikeSide.Z - - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchDikeSide).Z; + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchDikeSide).Z; ditchDefinition.DepthBottomPolderSide = ditchDikeSide.Z - - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchPolderSide).Z; + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.BottomDitchPolderSide).Z; return ditchDefinition; } } @@ -287,15 +287,15 @@ // It is possible that DikeToeAtPolder coinsides with DitchDikeSide or SurfaceLevelInside with DitchPolderSide // If that is the case, those characteristic points should be restored // So first save those characteristic points - GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - GeometryPoint surfaceLevelInside = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside); + Point2D dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); + Point2D surfaceLevelInside = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside); // The characteristic points DitchDikeSide and DitchPolderSide should be removed, but the points itself should be restored, // else the surfaceline will get a new form. So save those points - GeometryPoint ditchDikeSide = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide); - GeometryPoint ditchPolderSide = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide); + Point2D ditchDikeSide = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide); + Point2D ditchPolderSide = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide); surfaceLine.RemoveSegmentIncluding( - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide).X, - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide).X); + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchDikeSide).X, + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DitchPolderSide).X); // Now restore characteristic points DikeToeAtPolder and SurfaceLevelInside if necessary surfaceLine.EnsurePointOfType(dikeToeAtPolder.X, dikeToeAtPolder.Z, CharacteristicPointType.DikeToeAtPolder); surfaceLine.EnsurePointOfType(surfaceLevelInside.X, surfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); @@ -318,7 +318,7 @@ return; } - GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); double distanceToNewToe = ditchDefinition.Value.OriginalX - dikeToeAtPolder.X; double xDitchDikeSide; DitchCoordinates coors; @@ -357,7 +357,7 @@ return; } - double surfaceLevelInsideX = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X; + double surfaceLevelInsideX = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside).X; if (coors.XAtPolder > surfaceLevelInsideX) { throw new SurfaceLineAdapterException(Resources.SurfaceLineHeightAdapterDitchOutsideSurfaceLine); @@ -385,10 +385,10 @@ /// private void RetainTrafficLoad() { - GeometryPoint pointTrafficLoadInside = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside); - GeometryPoint pointTrafficLoadOutside = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside); - GeometryPoint pointDikeTopAtRiver = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - GeometryPoint pointDikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D pointTrafficLoadInside = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.TrafficLoadInside); + Point2D pointTrafficLoadOutside = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.TrafficLoadOutside); + Point2D pointDikeTopAtRiver = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); + Point2D pointDikeTopAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); hasTrafficLoad = ((pointTrafficLoadInside != null) && (pointTrafficLoadOutside != null)); if (hasTrafficLoad) @@ -413,15 +413,15 @@ /// The candidate to test private static void ThrowWhenSurfaceLineDoesNotSatisfyToSpecification(SurfaceLine2 surfaceLine) { - ThrowWhenSurfaceLineHasNoOrLessThenFourPoints(surfaceLine.Geometry.Points); + ThrowWhenSurfaceLineHasNoOrLessThenFourPoints(surfaceLine.Geometry.CalcPoints); ThrowWhenSurfaceHasNoDike(surfaceLine); ThrowWhenSurfaceLineHasAShoulderInsideAndNoSurfaceLevel(surfaceLine, - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside)); + surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.SurfaceLevelInside)); - GeometryPoint p1 = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - GeometryPoint p2 = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Point2D p1 = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver); + Point2D p2 = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); - var zeroPoint = new GeometryPoint(); + var zeroPoint = new Point2D(); if (zeroPoint.LocationEquals(p1) || zeroPoint.LocationEquals(p2)) { @@ -430,16 +430,16 @@ if (surfaceLine.HasShoulderInside()) { - p1 = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); - p2 = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + p1 = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopInside); + p2 = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside); if (zeroPoint.LocationEquals(p1) || zeroPoint.LocationEquals(p2)) { throw new SurfaceLineAdapterException(Resources.SurfaceLineAdapterShoulderHeightError); } } } - private static void ThrowWhenSurfaceLineHasAShoulderInsideAndNoSurfaceLevel(SurfaceLine2 surfaceLine, GeometryPoint surfaceLevelPoint) + private static void ThrowWhenSurfaceLineHasAShoulderInsideAndNoSurfaceLevel(SurfaceLine2 surfaceLine, Point2D surfaceLevelPoint) { if (surfaceLine.HasShoulderInside() && surfaceLevelPoint == null) { @@ -463,7 +463,7 @@ } } - private static void ThrowWhenSurfaceLineHasNoOrLessThenFourPoints(ICollection points) + private static void ThrowWhenSurfaceLineHasNoOrLessThenFourPoints(ICollection points) { if (points == null || points.Count < 4) { Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs =================================================================== diff -u -r6030 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs (.../GeometryGenerator.cs) (revision 6030) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs (.../GeometryGenerator.cs) (revision 6087) @@ -158,7 +158,7 @@ /// private GeometrySurface CreateSurface(GeometryLoop loop) { - if (loop.IsLoop() && loop.HasArea()) + if (loop.IsContinuous() && loop.HasArea()) { var newSurface = new GeometrySurface(); newSurface.SetOuterLoop(loop); @@ -263,12 +263,28 @@ { if (!geometryData.Points.Contains(curve.HeadPoint)) { - geometryData.Points.Add(curve.HeadPoint); + var point = geometryData.GetPointAtLocation(curve.HeadPoint); + if (point != null) + { + curve.HeadPoint = point; + } + else + { + geometryData.Points.Add(curve.HeadPoint); + } } if (!geometryData.Points.Contains(curve.EndPoint)) { - geometryData.Points.Add(curve.EndPoint); + var point = geometryData.GetPointAtLocation(curve.EndPoint); + if (point != null) + { + curve.EndPoint = point; + } + else + { + geometryData.Points.Add(curve.EndPoint); + } } } @@ -553,7 +569,7 @@ } } - if (!loop.IsLoop() || !loop.HasArea()) + if (!loop.IsContinuous() || !loop.HasArea()) { continue; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs =================================================================== diff -u -r5720 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs (.../FillEngineFromMacroStabilityWrapperInput.cs) (revision 5720) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs (.../FillEngineFromMacroStabilityWrapperInput.cs) (revision 6087) @@ -241,7 +241,7 @@ var damCharPoint = new CharacteristicPoint { CharacteristicPointType = ConversionHelper.ConvertToDamCharacteristicPointType(kernelCharPoint.CharacteristicPointType), - GeometryPoint = new GeometryPoint + Point = new Point2D { X = kernelCharPoint.GeometryPoint.X, Z = kernelCharPoint.GeometryPoint.Z Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs =================================================================== diff -u -r5770 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 5770) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 6087) @@ -152,9 +152,9 @@ location.StabilityOptions.ForbiddenZoneFactor.HasValue) { CharacteristicPointSet characteristicPoints = location.SurfaceLine.CharacteristicPoints; - slipPlaneConstraints.XEntryMin = characteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; - double xDikeTopAtPolder = characteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; - double xDikeToeAtPolder = characteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; + slipPlaneConstraints.XEntryMin = characteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtRiver).X; + double xDikeTopAtPolder = characteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).X; + double xDikeToeAtPolder = characteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).X; double factor = location.StabilityOptions.ForbiddenZoneFactor.Value; slipPlaneConstraints.XEntryMax = (xDikeToeAtPolder * factor) + ((1 - factor) * xDikeTopAtPolder); } @@ -316,7 +316,7 @@ var kernelCharPoint = new SurfaceLineCharacteristicPoint(); kernelCharPoint.CharacteristicPointType = ConversionHelper.ConvertToMacroStabilityCharacteristicPointType(damCharPoint.CharacteristicPointType); - kernelCharPoint.GeometryPoint = new KernelPoint2D(damCharPoint.X, damCharPoint.Z); + kernelCharPoint.GeometryPoint = new KernelPoint2D(damCharPoint.Point.X, damCharPoint.Point.Z); kernelSurfaceLine.CharacteristicPoints.Add(kernelCharPoint); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryLoop.cs =================================================================== diff -u -r5634 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryLoop.cs (.../GeometryLoop.cs) (revision 5634) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryLoop.cs (.../GeometryLoop.cs) (revision 6087) @@ -40,11 +40,10 @@ { get { - // explicit use of protected field to prevent stack overflow due to recursive call + //explicit use of protected field to prevent stack overflow due to recursive call if (calcPoints.Count == 0) { - PopulateLoopPointList(); - SyncPoints(); + calcPoints = PopulateLoopPointList(calcPoints); } return calcPoints; @@ -92,14 +91,8 @@ return false; } - // Make sure points from curves are also exist as points - if (CalcPoints.Count > 0) - { - SyncPoints(); - } - - var points = new List(); - points.AddRange(Points); + var points = new List(); + points = PopulateLoopPointList(points); points.Add(points[0]); // Calculate area of polygon using Shoelace algorithm: @@ -108,7 +101,7 @@ { sum += points[i - 1].X * points[i].Z - points[i - 1].Z * points[i].X; } - + return Math.Abs(sum) > 1e-6; } @@ -120,8 +113,7 @@ /// Cannot determine if loop is clockwise if checked location forms a straight line with its neighboring vectors. public bool IsClockWise() { - List polyGon = GetLocalPoint2DList(); - Clockwise isClockWise = Routines2D.IsClockWise(polyGon); + Clockwise isClockWise = Routines2D.IsClockWise(CalcPoints); if (isClockWise == Clockwise.NotEnoughUniquePoints) { throw new NotEnoughUniquePointsException(); @@ -173,15 +165,9 @@ { // Note: explicit use of CalcPoints to ensure calcPoints are populated List p = CalcPoints; - if (p.Count > 0) - { - SyncPoints(); - } - GeometryPointString clonedGeometryPointString = base.Clone(); var clonedGeometryLoop = new GeometryLoop(); - clonedGeometryLoop.Points.AddRange(clonedGeometryPointString.Points); - clonedGeometryLoop.SyncCalcPoints(); + clonedGeometryLoop.CalcPoints.AddRange(clonedGeometryPointString.CalcPoints); foreach (GeometryCurve curve in CurveList) { clonedGeometryLoop.CurveList.Add(curve.Clone(clonedGeometryLoop.CalcPoints)); @@ -191,64 +177,55 @@ } /// - /// Gets the local 2D Points List. - /// - /// - private List GetLocalPoint2DList() - { - return CalcPoints; - } - - /// /// Populates the loop's GeometryPoint list. /// - private void PopulateLoopPointList() + private List PopulateLoopPointList(List points) { // explicit use of protected field to prevent stack overflow due to recursive call - if (calcPoints.Count > 0) + if (points.Count > 0) { - return; + return points; } for (var index = 0; index < CurveList.Count; index++) { if (index == 0) { - calcPoints.Add(CurveList[index].HeadPoint); - calcPoints.Add(CurveList[index].EndPoint); + points.Add(CurveList[index].HeadPoint); + points.Add(CurveList[index].EndPoint); } else { - if (!AddEitherHeadOrEndPointOfCurveToCalcPoints(index)) + if (!AddEitherHeadOrEndPointOfCurveToCalcPoints(index, points)) { - if (calcPoints.Count == 2) + if (points.Count == 2) { - calcPoints.Reverse(); + points.Reverse(); } - AddEitherHeadOrEndPointOfCurveToCalcPoints(index); + AddEitherHeadOrEndPointOfCurveToCalcPoints(index, points); } } } RemoveDoubleClosingPointWhenNeeded(); + return points; } - private bool AddEitherHeadOrEndPointOfCurveToCalcPoints(int index) + private bool AddEitherHeadOrEndPointOfCurveToCalcPoints(int index, List points) { - // Compare by reference (is faster than by value) - if (CurveList[index].HeadPoint == calcPoints[calcPoints.Count - 1]) + if (CurveList[index].HeadPoint.LocationEquals(points[points.Count - 1])) { - calcPoints.Add(CurveList[index].EndPoint); + points.Add(CurveList[index].EndPoint); return true; } - if (CurveList[index].EndPoint != calcPoints[calcPoints.Count - 1]) + if (!CurveList[index].EndPoint.LocationEquals(points[points.Count - 1])) { return false; } - calcPoints.Add(CurveList[index].HeadPoint); + points.Add(CurveList[index].HeadPoint); return true; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs =================================================================== diff -u -r5823 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs (.../IKernelWrapper.cs) (revision 5823) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs (.../IKernelWrapper.cs) (revision 6087) @@ -138,7 +138,7 @@ /// The point. /// The messages. /// - ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages); + ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, Point2D point, out List messages); /// /// Evaluates the design (current factor greater than desired factor) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs =================================================================== diff -u -r5960 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 5960) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 6087) @@ -93,9 +93,9 @@ { Pressure = damKernelInput.Location.StabilityOptions.TrafficLoad.Value, XEnd = damKernelInput.Location.SurfaceLine - .CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside).X, + .CharacteristicPoints.GetPoint2D(CharacteristicPointType.TrafficLoadInside).X, XStart = damKernelInput.Location.SurfaceLine - .CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside).X + .CharacteristicPoints.GetPoint2D(CharacteristicPointType.TrafficLoadOutside).X }; } @@ -121,12 +121,12 @@ if (damKernelInput.DamFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside) { - centerOfLeftGridXCoordinate = damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint( + centerOfLeftGridXCoordinate = damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetPoint2D( CharacteristicPointType.DikeToeAtPolder).X; } else { - centerOfLeftGridXCoordinate = damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint( + centerOfLeftGridXCoordinate = damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetPoint2D( CharacteristicPointType.DikeToeAtRiver).X; } } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometrySurface.cs =================================================================== diff -u -r5923 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometrySurface.cs (.../GeometrySurface.cs) (revision 5923) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometrySurface.cs (.../GeometrySurface.cs) (revision 6087) @@ -183,7 +183,6 @@ int currentIndex = OuterLoop.CalcPoints.IndexOf(startTopPoint); FillTopOrBottomPoints(topPoints, endTopPoint, currentIndex); - topPoints.SyncPoints(); return topPoints; } @@ -213,7 +212,6 @@ // As the curves are sorted clockwise, the bottom curves are always orientated from right to left // while this result of this method must be from left to right so reverse the curves bottomPoints.CalcPoints.Reverse(); - bottomPoints.SyncPoints(); return bottomPoints; } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/CharacteristicPoint.cs =================================================================== diff -u -r4540 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/CharacteristicPoint.cs (.../CharacteristicPoint.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/CharacteristicPoint.cs (.../CharacteristicPoint.cs) (revision 6087) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Standard.Language; @@ -28,7 +29,7 @@ /// Represents a point on a surface line of a particular . /// /// -public class CharacteristicPoint : GeometryPoint +public class CharacteristicPoint: IComparable { // Aggregation relationship @@ -46,51 +47,14 @@ /// /// The containing characteristic point set. /// The geometry point. - public CharacteristicPoint(CharacteristicPointSet set, GeometryPoint point) + public CharacteristicPoint(CharacteristicPointSet set, Point2D point) : this() { PointSet = set; - GeometryPoint = point; + Point = point; } /// - /// Gets or sets the X coordinate of GeometryPoint - /// - [Translation("L")] - public override double X - { - get - { - return GeometryPoint.X; - } - set - { - if (GeometryPoint != null) - { - GeometryPoint.X = value; - } - } - } - - /// - /// Gets or sets the Z coordinate of GeometryPoint - /// - public override double Z - { - get - { - return GeometryPoint.Z; - } - set - { - if (GeometryPoint != null) - { - GeometryPoint.Z = value; - } - } - } - - /// /// Gets or sets the characteristic type 'marker' of a geometry point on a surfaceline.. /// public CharacteristicPointType CharacteristicPointType { get; set; } = CharacteristicPointType.None; @@ -101,7 +65,7 @@ /// /// The geometry point. /// - public GeometryPoint GeometryPoint { get; set; } + public Point2D Point { get; set; } /// /// Gets or sets the characteristic point set associated containing this point. @@ -118,4 +82,25 @@ { return LocalizationManager.GetTranslatedText(GetType(), CharacteristicPointType.ToString()); } + + /// + /// Compares the Point of the object. + /// + /// + /// + public int CompareTo(object obj) + { + var characteristicPoint = obj as CharacteristicPoint; + if (characteristicPoint != null) + { + var comparePoint = characteristicPoint.Point; + + if (comparePoint != null) + { + return Point.X.CompareTo(comparePoint.X); + } + } + + return String.Compare(ToString(), obj.ToString(), StringComparison.Ordinal); + } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs =================================================================== diff -u -r5982 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs (.../LineHelper.cs) (revision 5982) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs (.../LineHelper.cs) (revision 6087) @@ -35,7 +35,7 @@ /// /// /// - public static bool DetermineStrictIntersectionPoint(Line line1, Line line2, ref GeometryPoint intersectPoint) + public static bool DetermineStrictIntersectionPoint(Line line1, Line line2, ref Point2D intersectPoint) { var point1 = new Point2D(line1.BeginPoint.X, line1.BeginPoint.Z); var point2 = new Point2D(line1.EndPoint.X, line1.EndPoint.Z); @@ -54,38 +54,14 @@ return res == LineIntersection.Intersects; } - public static GeometryPoint DetermineIntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4) + public static Point2D DetermineIntersectionPointWithExtrapolation(Point2D p1, Point2D p2, Point2D p3, Point2D p4) { - return IntersectionPointWithExtrapolation(p1, p2, p3, p4); + Point2D intersectPoint = null; + Routines2D.DetermineIf2DLinesIntersectWithExtrapolation(p1, p2, p3, p4, out intersectPoint); + return intersectPoint; } /// - /// Determines the intersection point of two lines, allowing the intersection point being extrapolated. - /// - /// - /// - /// - /// - /// Intersection point or null (parallel lines) - private static GeometryPoint IntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4) - { - GeometryPoint intersectPoint = null; - - var point1 = new Point2D(p1.X, p1.Z); - var point2 = new Point2D(p2.X, p2.Z); - var point3 = new Point2D(p3.X, p3.Z); - var point4 = new Point2D(p4.X, p4.Z); - - Routines2D.DetermineIf2DLinesIntersectWithExtrapolation(point1, point2, point3, point4, out Point2D ip); - if (ip != null) - { - intersectPoint = new GeometryPoint(ip.X, ip.Z); - } - - return intersectPoint; - } - - /// /// Deletes the duplicated points. /// /// List of points Index: DamEngine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs =================================================================== diff -u -r6005 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs (.../FillDamFromXmlInput.cs) (revision 6005) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs (.../FillDamFromXmlInput.cs) (revision 6087) @@ -576,16 +576,13 @@ for (var j = 0; j < inputSurfaceLine.Points.Length; j++) { SurfaceLinePoint inputPoint = inputSurfaceLine.Points[j]; - var geometryPoint = new GeometryPoint + var geometryPoint = new Point2D() { X = inputPoint.X, - Y = 0.0, Z = inputPoint.Z }; surfaceLine.AddCharacteristicPoint(geometryPoint, ConversionHelper.ConvertToDamPointType(inputPoint.PointType)); } - - surfaceLine.Geometry.SyncCalcPoints(); } private static void TransferLocations(string projectPath, Io.XmlInput.Location[] inputLocations, @@ -941,7 +938,6 @@ isStartPoint = false; } - outputInnerLoop.SyncPoints(); geometry.Loops.Add(outputInnerLoop); } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineShoulderAdapter.cs =================================================================== diff -u -r5982 -r6087 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineShoulderAdapter.cs (.../SurfaceLineShoulderAdapter.cs) (revision 5982) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineShoulderAdapter.cs (.../SurfaceLineShoulderAdapter.cs) (revision 6087) @@ -56,7 +56,7 @@ SlopeOfNewShoulder = 1 / Location.NewShoulderBaseSlope; } - MaxShoulderLevel = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; + MaxShoulderLevel = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).Z; } /// @@ -100,8 +100,8 @@ // Then delete it from the surfaceline RemoveExistingDitch(ditchDefinition); ValidateNewShoulderSize(shoulderLength, shoulderHeight); - GeometryPoint dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - GeometryPoint dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); + Point2D dikeToeAtPolder = surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); if (designFromDikeToe) { @@ -120,19 +120,19 @@ // Find the intersection point at new shoulder height with the dike, this is where the new shoulder starts bool hasShoulderInside = surfaceLine.HasShoulderInside(); double dikeToeZ = dikeToeAtPolder.Z; - GeometryPoint dikeBaseInside = hasShoulderInside ? surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder; + Point2D dikeBaseInside = hasShoulderInside ? surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside) : dikeToeAtPolder; // Determine intersectionpoint with slope for a horizontal shoulder - GeometryPoint intersectionPointAtDike; + Point2D intersectionPointAtDike; intersectionPointAtDike = LineHelper.DetermineIntersectionPointWithExtrapolation(dikeTopAtPolder, dikeBaseInside, - new GeometryPoint(dikeToeAtPolder.X, shoulderHeight + dikeToeZ), - new GeometryPoint(dikeToeAtPolder.X + 1, shoulderHeight + dikeToeZ)); - var newTopShoulder = new GeometryPoint(intersectionPointAtDike.X + shoulderLength, shoulderHeight + dikeToeZ); + new Point2D(dikeToeAtPolder.X, shoulderHeight + dikeToeZ), + new Point2D(dikeToeAtPolder.X + 1, shoulderHeight + dikeToeZ)); + var newTopShoulder = new Point2D(intersectionPointAtDike.X + shoulderLength, shoulderHeight + dikeToeZ); if (Location.UseNewShoulderTopSlope) { // if top slope is not to be horizontal then recalculate the intersection from a point at required slope width // 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)); + var pb = new Point2D(newTopShoulder.X - 100, newTopShoulder.Z + (100 * Location.NewShoulderTopSlope)); intersectionPointAtDike = LineHelper.DetermineIntersectionPointWithExtrapolation(dikeTopAtPolder, dikeBaseInside, pb, newTopShoulder); if (intersectionPointAtDike.Z > MaxShoulderLevel) { @@ -156,11 +156,11 @@ EndPoint = new Point2D(newTopShoulder.X + offset, newTopShoulder.Z - offset / SlopeOfNewShoulder) }; IList intersectionpoints = surfaceLine.Geometry.IntersectionPointsXzWithLineXz(line); - GeometryPoint newToeAtPolder = null; + Point2D newToeAtPolder = null; if (intersectionpoints.Count > 0) { Point2D firstIntersectionPoint = intersectionpoints.First(); - newToeAtPolder = new GeometryPoint(firstIntersectionPoint.X, firstIntersectionPoint.Z); + newToeAtPolder = new Point2D(firstIntersectionPoint.X, firstIntersectionPoint.Z); } if (newToeAtPolder == null) @@ -179,7 +179,7 @@ if (intersectionpoints2.Count > 0) { Point2D firstIntersectionPoint = intersectionpoints2.First(); - newToeAtPolder = new GeometryPoint(firstIntersectionPoint.X, firstIntersectionPoint.Z); + newToeAtPolder = new Point2D(firstIntersectionPoint.X, firstIntersectionPoint.Z); } if (newToeAtPolder == null) @@ -230,7 +230,7 @@ { if (surfaceLine.HasShoulderInside()) { - double currentShoulderLength = surfaceLine.DetermineShoulderLengthForGivenShoulderTopInside(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside)); + double currentShoulderLength = surfaceLine.DetermineShoulderLengthForGivenShoulderTopInside(surfaceLine.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopInside)); if (currentShoulderLength > shoulderLength) { throw new SurfaceLineAdapterException(Resources.SurfaceLineShoulderAdapterNewShoulderLengthError); @@ -261,12 +261,12 @@ private void RemovePointsBetweenCharacteristicPointsDikeTopAtPolderDikeToeAtPolder(SurfaceLine2 surfaceLine2) { bool hasShoulderInside = surfaceLine2.HasShoulderInside(); - GeometryPoint dikeTopAtPolder = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - GeometryPoint dikeToeAtPolder = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Point2D dikeTopAtPolder = surfaceLine2.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder); + Point2D dikeToeAtPolder = surfaceLine2.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder); if (hasShoulderInside) { - GeometryPoint shoulderBaseInside = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); - GeometryPoint shoulderTopInside = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + Point2D shoulderBaseInside = surfaceLine2.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderBaseInside); + Point2D shoulderTopInside = surfaceLine2.CharacteristicPoints.GetPoint2D(CharacteristicPointType.ShoulderTopInside); surfaceLine2.RemoveSegmentBetween(dikeTopAtPolder.X, shoulderBaseInside.X); surfaceLine2.RemoveSegmentBetween(shoulderBaseInside.X, shoulderTopInside.X); surfaceLine2.RemoveSegmentBetween(shoulderTopInside.X, dikeToeAtPolder.X);