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(); } }