Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs
===================================================================
diff -u -r5847 -r5863
--- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision 5847)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision 5863)
@@ -152,22 +152,23 @@
///
///
///
+ ///
/// The 2D soil layer
- public static SoilLayer2D DetermineOriginalLayerFromOldSurfaces(GeometrySurface geometrySurface,
- IEnumerable oldSurfaces)
+ public static SoilLayer2D DetermineOriginalLayerFromOldSurfaces(GeometrySurface geometrySurface, IEnumerable oldSurfaces,
+ double shift)
{
Point2D point = new Point2D(0.0, 0.0);
bool isPointInOuterLoopAndOldSurface = false;
- point = IsPointInOuterLoopAndOldSurface(geometrySurface, oldSurfaces, point, ref isPointInOuterLoopAndOldSurface);
+ point = IsPointInOuterLoopAndOldSurface(geometrySurface, oldSurfaces, shift, point, ref isPointInOuterLoopAndOldSurface);
if (!isPointInOuterLoopAndOldSurface)
{
isPointInOuterLoopAndOldSurface = IsPointInOldSurfaceJustBelowTopOfNewGeometryWithinItsLimits(geometrySurface,
- oldSurfaces, point,
- isPointInOuterLoopAndOldSurface);
+ oldSurfaces, shift, point, isPointInOuterLoopAndOldSurface);
}
if (isPointInOuterLoopAndOldSurface)
{
+ point.X -= shift;
if (IsPointInPreviousOuterLoopOfOldSurface(oldSurfaces, point, out SoilLayer2D soilLayer2D))
{
return soilLayer2D;
@@ -236,7 +237,7 @@
}
private static bool IsPointInOldSurfaceJustBelowTopOfNewGeometryWithinItsLimits(GeometrySurface geometrySurface,
- IEnumerable oldSurfaces, Point2D point, bool isPointInOuterLoopAndOldSurface)
+ IEnumerable oldSurfaces, double shift, Point2D point, bool isPointInOuterLoopAndOldSurface)
{
GeometryPointString topGeometrySurface = geometrySurface.DetermineTopGeometrySurface();
topGeometrySurface.SortPointsByXAscending();
@@ -246,8 +247,8 @@
Point2D geometryPoint2 = topGeometrySurface[checked (topGeometrySurface.Count - 1)];
geometryPoint2.X += deviation;
geometryPoint2.Z -= deviation;
- bool isPoint1WithinOldSurfaces = IsPointWithinOldSurfaces(geometryPoint1, oldSurfaces, -deviation);
- bool isPoint2WithinOldSurfaces = IsPointWithinOldSurfaces(geometryPoint2, oldSurfaces, -deviation);
+ bool isPoint1WithinOldSurfaces = IsPointWithinOldSurfaces(geometryPoint1, oldSurfaces, shift, -deviation);
+ bool isPoint2WithinOldSurfaces = IsPointWithinOldSurfaces(geometryPoint2, oldSurfaces, shift, -deviation);
double d = double.NaN;
if (isPoint1WithinOldSurfaces && !isPoint2WithinOldSurfaces)
{
@@ -274,13 +275,13 @@
return isPointInOuterLoopAndOldSurface;
}
- private static Point2D IsPointInOuterLoopAndOldSurface(GeometrySurface geometrySurface, IEnumerable oldSurfaces, Point2D point, ref bool isPointInOuterLoopAndOldSurface)
+ private static Point2D IsPointInOuterLoopAndOldSurface(GeometrySurface geometrySurface, IEnumerable oldSurfaces, double shift, Point2D point, ref bool isPointInOuterLoopAndOldSurface)
{
foreach (GeometryCurve curve in geometrySurface.OuterLoop.CurveList)
{
point = new Point2D((curve.HeadPoint.X + curve.EndPoint.X) / 2.0, (curve.HeadPoint.Z + curve.EndPoint.Z) / 2.0);
- if (IsPointWithinOldSurfaces(point, oldSurfaces, deviation) || IsPointWithinOldSurfaces(point, oldSurfaces,
- -deviation))
+ if (IsPointWithinOldSurfaces(point, oldSurfaces, shift, deviation) || IsPointWithinOldSurfaces(point, oldSurfaces,
+ shift, -deviation))
{
point.Z += deviation;
if (Routines2D.CheckIfPointIsInPolygon(geometrySurface.OuterLoop, point.X, point.Z) ==
@@ -318,10 +319,11 @@
return xmaxFromSurfaces;
}
- private static bool IsPointWithinOldSurfaces(Point2D point, IEnumerable oldSurfaces, double verticalShift)
+ private static bool IsPointWithinOldSurfaces(Point2D point, IEnumerable oldSurfaces, double shift,
+ double verticalShift)
{
point.Z += verticalShift;
- var shiftedPoint = new Point2D(point.X, point.Z);
+ var shiftedPoint = new Point2D(point.X - shift, point.Z);
foreach (SoilLayer2D oldSurface in oldSurfaces)
{
GeometryLoop outerLoop = oldSurface.GeometrySurface.OuterLoop;