Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs
===================================================================
diff -u -r5867 -r5886
--- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs (.../SoilProfile2DSurfaceLineHelper.cs) (revision 5867)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs (.../SoilProfile2DSurfaceLineHelper.cs) (revision 5886)
@@ -68,10 +68,9 @@
/// The surface line.
/// The SoilProfile2D.
/// The dike embankment soil.
- /// The required shift of the geometry so it will fit the surface line.
///
public static SoilProfile2D CombineSurfaceLineWithSoilProfile2D(GeometryPointString surfaceLine, SoilProfile2D soilProfile2D,
- Soil defaultSoil, double shift)
+ Soil defaultSoil)
{
if (soilProfile2D == null || soilProfile2D.Surfaces.Count == 0)
return null;
@@ -80,37 +79,23 @@
SoilProfile2D clonedProfile = soilProfile2D.Clone();
GeometryPointString clonedSurfaceLine = surfaceLine.Clone();
- GeometryPointString originalSurfaceLine = soilProfile2D.Geometry.SurfaceLine;
- shift = GeometryObject.RoundValue(shift);
- if (Math.Abs(shift) >= GeometryConstants.Accuracy)
- {
- foreach (Point2D point in clonedProfile.Geometry.Points)
- point.X += shift;
- clonedProfile.Geometry.Rebox();
-
- foreach (GeometryPoint point in originalSurfaceLine.Points)
- point.X += shift;
- originalSurfaceLine.SyncCalcPoints();
- }
-
+
+ RoundCoordinates(clonedProfile.Geometry);
if (clonedProfile.Geometry.Right < surfaceLine.GetMinX() || clonedProfile.Geometry.Left > surfaceLine.GetMaxX())
{
throw new ArgumentException("Surface line is beyond the profile.");
}
- // As the original profile may have been moved as cloned profile, a new clone is needed to perform all reset actions with.
- // The cloned profile is used to determine the original surfaces and preconsolidations.
- SoilProfile2D soilProfile2D2 = clonedProfile.Clone();
var oldSurfaces = new List();
- oldSurfaces.AddRange((IEnumerable) soilProfile2D2.Surfaces);
+ oldSurfaces.AddRange((IEnumerable) soilProfile2D.Surfaces);
var result = new SoilProfile2D();
result.Name = soilProfile2D.Name;
result.Geometry = CreateNewGeometryForSoilProfile2DByCombiningItsGeometryWithSurfaceLine(clonedSurfaceLine, clonedProfile.Geometry);
RemoveGeometryDataOfSoilProfileAboveSurfaceLine(clonedSurfaceLine, ref result);
- ReconstructSurfaces(ref result, originalSurfaceLine, oldSurfaces, defaultSoil, shift);
- ReconstructPreConsolidations(ref result, clonedProfile, shift);
+ ReconstructSurfaces(ref result, clonedSurfaceLine, oldSurfaces, defaultSoil);
+ ReconstructPreConsolidations(ref result, clonedProfile);
result.Geometry.Rebox();
result.Geometry.UpdateSurfaceLine();
RoundCoordinates(result.Geometry);
@@ -315,8 +300,8 @@
result.DeleteLoosePoints();
}
- private static void ReconstructSurfaces(ref SoilProfile2D result, GeometryPointString surfaceLine, List oldSurfaces,
- Soil defaultSoil, double shift)
+ private static void ReconstructSurfaces(ref SoilProfile2D result, GeometryPointString surfaceLine,
+ List oldSurfaces, Soil defaultSoil)
{
result.Surfaces.Clear();
foreach (GeometrySurface surface in result.Geometry.Surfaces)
@@ -327,7 +312,7 @@
Soil = defaultSoil
};
SoilLayer2D soilLayer2D2 = soilLayer2D1;
- SoilLayer2D layerFromOldSurfaces = SoilProfile2D.DetermineOriginalLayerFromOldSurfaces(surface, (IEnumerable) oldSurfaces, shift);
+ SoilLayer2D layerFromOldSurfaces = SoilProfile2D.DetermineOriginalLayerFromOldSurfaces(surface, oldSurfaces);
if (layerFromOldSurfaces != null && layerFromOldSurfaces.Soil != null)
{
soilLayer2D2.Soil = layerFromOldSurfaces.Soil;
@@ -341,7 +326,7 @@
bool isDefaultLayer = IsLayerAboveOriginalSurfaceLine(soilLayer2D2, surfaceLine);
if (!isDefaultLayer)
{
- oldLayer = DetermineLayerIfSurfaceIsLeftOrRightOfOldSurfaces(surface, oldSurfaces, shift);
+ oldLayer = DetermineLayerIfSurfaceIsLeftOrRightOfOldSurfaces(surface, oldSurfaces);
isDefaultLayer = oldLayer == null;
}
if (!isDefaultLayer)
@@ -373,22 +358,21 @@
return layer.GeometrySurface.OuterLoop.Points.All(point => !point.Z.IsLessThan(surfaceLine.GetZatX(point.X)));
}
- private static void ReconstructPreConsolidations(ref SoilProfile2D result, SoilProfile2D clonedProfile, double shift)
+ private static void ReconstructPreConsolidations(ref SoilProfile2D result, SoilProfile2D clonedProfile)
{
foreach (PreConsolidationStress preconsolidationStress in clonedProfile.PreconsolidationStresses)
{
- preconsolidationStress.X += shift;
result.PreconsolidationStresses.Add(preconsolidationStress);
}
}
- private static SoilLayer2D DetermineLayerIfSurfaceIsLeftOrRightOfOldSurfaces(GeometrySurface surface, List oldSurfaces, double shift)
+ private static SoilLayer2D DetermineLayerIfSurfaceIsLeftOrRightOfOldSurfaces(GeometrySurface surface, List oldSurfaces)
{
double[] xMin = surface.OuterLoop.CalcPoints.Select(p => p.X).OrderBy(x => x).Distinct().ToArray();
double[] zMin = surface.OuterLoop.CalcPoints.Select(p => p.Z).OrderBy(z => z).Distinct().ToArray();
var leftPoint = new Point2D
{
- X = xMin[0] - shift - 0.1,
+ X = xMin[0] - 0.1,
Z = zMin[0] + 0.1
};
@@ -400,7 +384,7 @@
var rightPoint = new Point2D
{
- X = xMin[^1] - shift + 0.1,
+ X = xMin[^1] + 0.1,
Z = zMin[0] + 0.1
};