Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs =================================================================== diff -u -r4000 -r4052 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision 4000) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision 4052) @@ -25,181 +25,180 @@ using Deltares.DamEngine.Data.Standard.Language; using Deltares.DamEngine.Data.Standard.Validation; -namespace Deltares.DamEngine.Data.Geotechnics +namespace Deltares.DamEngine.Data.Geotechnics; + +/// +/// 2D Soil Profile Object +/// +public class SoilProfile2D : SoilProfile { + protected readonly List surfaces = new List(); + protected GeometryData geometry = new GeometryData(); + /// - /// 2D Soil Profile Object - /// - public class SoilProfile2D : SoilProfile + /// Initializes a new instance of the class. + /// + public SoilProfile2D() { - protected readonly List surfaces = new List(); - protected GeometryData geometry = new GeometryData(); + Name = LocalizationManager.GetTranslatedText(this, "DefaultNameSoilProfile2D"); + } - /// - /// Initializes a new instance of the class. - /// - public SoilProfile2D() + /// + /// Gets the surfaces. + /// + /// + /// The surfaces. + /// + [Validate] + public virtual IList Surfaces + { + get { - Name = LocalizationManager.GetTranslatedText(this, "DefaultNameSoilProfile2D"); + return surfaces; } + } - /// - /// Gets the surfaces. - /// - /// - /// The surfaces. - /// - [Validate] - public virtual IList Surfaces + /// + /// Gets or sets the geometry. + /// + /// + /// The geometry. + /// + public GeometryData Geometry + { + get { - get - { - return surfaces; - } + return geometry; } - - /// - /// Gets or sets the geometry. - /// - /// - /// The geometry. - /// - public GeometryData Geometry + set { - get - { - return geometry; - } - set - { - geometry = value; - } + geometry = value; } + } - /// - /// Gets the soil profile 1D at the given X. - /// - /// The x. - /// Soil Profile 1D - public virtual SoilProfile1D GetSoilProfile1D(double x) + /// + /// Gets the soil profile 1D at the given X. + /// + /// The x. + /// Soil Profile 1D + public virtual SoilProfile1D GetSoilProfile1D(double x) + { + const double diff = 0.001; + if (Geometry.Surfaces.Count == 0) { - const double diff = 0.001; - if (Geometry.Surfaces.Count == 0) + foreach (SoilLayer2D soilLayer2D in Surfaces) { - foreach (SoilLayer2D soilLayer2D in Surfaces) + var loop = new GeometryLoop(); + var isStartPoint = true; + var curve = new GeometryCurve(); + foreach (Point2D outerLoopCalcPoint in soilLayer2D.GeometrySurface.OuterLoop.CalcPoints) { - var loop = new GeometryLoop(); - var isStartPoint = true; - var curve = new GeometryCurve(); - foreach (Point2D outerLoopCalcPoint in soilLayer2D.GeometrySurface.OuterLoop.CalcPoints) + Geometry.Points.Add(outerLoopCalcPoint); + loop.CalcPoints.Add(outerLoopCalcPoint); + Geometry.Surfaces.Add(soilLayer2D.GeometrySurface); + if (isStartPoint) { - Geometry.Points.Add(outerLoopCalcPoint); - loop.CalcPoints.Add(outerLoopCalcPoint); - Geometry.Surfaces.Add(soilLayer2D.GeometrySurface); - if (isStartPoint) - { - curve.HeadPoint = outerLoopCalcPoint; - } - else - { - curve.EndPoint = outerLoopCalcPoint; - loop.CurveList.Add(curve); - curve = new GeometryCurve(); - curve.HeadPoint = outerLoopCalcPoint; - } - - isStartPoint = false; + curve.HeadPoint = outerLoopCalcPoint; } + else + { + curve.EndPoint = outerLoopCalcPoint; + loop.CurveList.Add(curve); + curve = new GeometryCurve(); + curve.HeadPoint = outerLoopCalcPoint; + } - curve.EndPoint = loop.CurveList.First().HeadPoint; - Geometry.Curves.Add(curve); - loop.CurveList.Add(curve); - Geometry.Loops.Add(loop); - var surface = new GeometrySurface(); - surface.OuterLoop = loop; - Geometry.Surfaces.Add(surface); + isStartPoint = false; } - Geometry.Right = Geometry.MaxGeometryPointsX; - Geometry.Left = Geometry.MinGeometryPointsX; + curve.EndPoint = loop.CurveList.First().HeadPoint; + Geometry.Curves.Add(curve); + loop.CurveList.Add(curve); + Geometry.Loops.Add(loop); + var surface = new GeometrySurface(); + surface.OuterLoop = loop; + Geometry.Surfaces.Add(surface); } - var soilProfile = new SoilProfile1D - { - Name = "Generated at x = " + x + " from " + Name - }; - var detector = new LayerDetector(Surfaces); - if (x > Geometry.Right) - { - x = Geometry.Right - diff; - } + Geometry.Right = Geometry.MaxGeometryPointsX; + Geometry.Left = Geometry.MinGeometryPointsX; + } - if (x < Geometry.Left) - { - x = Geometry.Left + diff; - } + var soilProfile = new SoilProfile1D + { + Name = "Generated at x = " + x + " from " + Name + }; + var detector = new LayerDetector(Surfaces); + if (x > Geometry.Right) + { + x = Geometry.Right - diff; + } - detector.DetermineMaterials(x); + if (x < Geometry.Left) + { + x = Geometry.Left + diff; + } - if (detector.LayerList.Count > 0) + detector.DetermineMaterials(x); + + if (detector.LayerList.Count > 0) + { + soilProfile.BottomLevel = detector.LayerList[detector.LayerList.Count - 1].EndPoint.Z; + for (var i = 0; i < detector.LayerList.Count; i++) { - soilProfile.BottomLevel = detector.LayerList[detector.LayerList.Count - 1].EndPoint.Z; - for (var i = 0; i < detector.LayerList.Count; i++) + var layer = new SoilLayer1D(detector.LayerList[i].Soil, detector.LayerList[i].StartPoint.Z) { - var layer = new SoilLayer1D(detector.LayerList[i].Soil, detector.LayerList[i].StartPoint.Z) - { - IsAquifer = detector.LayerList[i].IsAquifer - }; - soilProfile.Layers.Add(layer); - } + IsAquifer = detector.LayerList[i].IsAquifer + }; + soilProfile.Layers.Add(layer); } - - return soilProfile; } - /// - /// Get the surface from the point - /// - /// The point which is supposed to be within the soil layer - /// Surface - public SoilLayer2D GetSoilLayer(Point2D point) + return soilProfile; + } + + /// + /// Get the surface from the point + /// + /// The point which is supposed to be within the soil layer + /// Surface + public SoilLayer2D GetSoilLayer(Point2D point) + { + for (var i = 0; i < Surfaces.Count; i++) { - for (var i = 0; i < Surfaces.Count; i++) + SoilLayer2D surface = Surfaces[i]; + GeometryLoop surfaceLine = surface.GeometrySurface.OuterLoop; + if (surfaceLine.IsPointInLoopArea(point)) { - SoilLayer2D surface = Surfaces[i]; - GeometryLoop surfaceLine = surface.GeometrySurface.OuterLoop; - if (surfaceLine.IsPointInLoopArea(point)) - { - var found = true; + var found = true; - // if point lies in an innerloop it belongs to another area - foreach (GeometryLoop innerloop in surface.GeometrySurface.InnerLoops) + // if point lies in an innerloop it belongs to another area + foreach (GeometryLoop innerloop in surface.GeometrySurface.InnerLoops) + { + if (innerloop.IsPointInLoopArea(point)) { - if (innerloop.IsPointInLoopArea(point)) - { - found = false; - } + found = false; } + } - if (found) - { - return surface; - } + if (found) + { + return surface; } } - - return null; } - /// - /// Returns a that represents this instance. - /// - /// - /// A that represents this instance. - /// - public override string ToString() - { - return Name; - } + return null; } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return Name; + } } \ No newline at end of file