Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2.cs
===================================================================
diff -u -r877 -r955
--- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2.cs (.../SurfaceLine2.cs) (revision 877)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2.cs (.../SurfaceLine2.cs) (revision 955)
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using System.Linq;
using Deltares.DamEngine.Data.Geometry;
+using Deltares.DamEngine.Data.Standard;
using Deltares.DamEngine.Data.Standard.Language;
using Deltares.DamEngine.Data.Standard.Validation;
@@ -52,6 +53,17 @@
}
///
+ /// Deep clone the object.
+ ///
+ ///
+ public SurfaceLine2 FullDeepClone()
+ {
+ SurfaceLine2 surfaceLine2 = new SurfaceLine2();
+ surfaceLine2.SetValuesFromOtherSurfaceLine(this, true);
+ return surfaceLine2;
+ }
+
+ ///
/// The geometrical description of the surface line.
///
/// Aggregation relationship.
@@ -153,6 +165,59 @@
}
///
+ /// Gets the points orderd by x.
+ ///
+ ///
+ /// The points orderd by x.
+ ///
+ private IEnumerable PointsOrderdByX
+ {
+ get
+ {
+ return Geometry.Points.OrderBy(p => p.X);
+ }
+ }
+
+ ///
+ /// Tests if the given point is between the given start X and end X.
+ ///
+ /// The point.
+ /// 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)
+ {
+ if (point == null)
+ {
+ return false;
+ }
+
+ double x = point.X;
+ return (x >= startX || x.AlmostEquals(startX, GeometryPoint.Precision))
+ && (x < endX || x.AlmostEquals(endX, GeometryPoint.Precision));
+ }
+
+ ///
+ /// Gets the point segment including given start x and end x.
+ ///
+ /// The start x.
+ /// 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)
+ {
+ if (endX < startX)
+ {
+ throw new ArgumentException("End value is smaller then the start value");
+ }
+
+ return from point in PointsOrderdByX
+ where TestIncluding(point, startX, endX)
+ orderby point.X ascending
+ select point;
+ }
+
+ ///
/// Validates this surfaceline.
///
/// All validation messages.
@@ -318,5 +383,6 @@
}
return geometryAnnotations;
}
+
}
}
\ No newline at end of file