Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs (.../RingtoetsMacroStabilityInwardsSurfaceLine.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs (.../RingtoetsMacroStabilityInwardsSurfaceLine.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9) @@ -31,6 +31,8 @@ using Ringtoets.MacroStabilityInwards.Primitives.Exceptions; using Ringtoets.MacroStabilityInwards.Primitives.Properties; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; + namespace Ringtoets.MacroStabilityInwards.Primitives { /// @@ -62,16 +64,95 @@ public Point3D[] Points { get; private set; } /// - /// Gets or sets the first 3D geometry point defining the surfaceline in world coordinates. + /// Gets the first 3D geometry point defining the surfaceline in world coordinates. /// public Point3D StartingWorldPoint { get; private set; } /// - /// Gets or sets the last 3D geometry point defining the surfaceline in world coordinates. + /// Gets the last 3D geometry point defining the surfaceline in world coordinates. /// public Point3D EndingWorldPoint { get; private set; } /// + /// Gets the location which generalizes the height of the surface + /// on the oustide of the polder. + /// + public Point3D SurfaceLevelOutside { get; private set; } + + /// + /// Gets the location of dike toe when approaching from outside + /// the polder. + /// + public Point3D DikeToeAtRiver { get; private set; } + + /// + /// Gets the location of the start of traffic load when approaching + /// from outside the polder. + /// + public Point3D TrafficLoadOutside { get; private set; } + + /// + /// Gets the location of the start of traffic load when approaching + /// from inside the polder. + /// + public Point3D TrafficLoadInside { get; private set; } + + /// + /// Gets the location of the top of the dike when approaching from + /// inside the polder. + /// + public Point3D DikeTopAtPolder { get; private set; } + + /// + /// Gets the location where the shoulder on the side of the polder + /// connects with the dike. + /// + public Point3D ShoulderBaseInside { get; private set; } + + /// + /// Gets the location where the shoulder on the side of the polder + /// declines towards the location of the dike toe when approaching from inside + /// the polder. + /// + public Point3D ShoulderTopInside { get; private set; } + + /// + /// Gets the location of dike toe when approaching from inside + /// the polder. + /// + public Point3D DikeToeAtPolder { get; private set; } + + /// + /// Gets the location of the start of the ditch when approaching + /// from the dike. + /// + public Point3D DitchDikeSide { get; private set; } + + /// + /// Gets the location of the bottom of the ditch when approaching + /// from the dike. + /// + public Point3D BottomDitchDikeSide { get; private set; } + + /// + /// Gets the location of the bottom of the ditch when approaching + /// from inside the polder. + /// + public Point3D BottomDitchPolderSide { get; private set; } + + /// + /// Gets the location of the start of the ditch when approaching from + /// inside the polder. + /// + public Point3D DitchPolderSide { get; private set; } + + /// + /// Gets the location which generalizes the surface level on the + /// inside of the polder + /// + public Point3D SurfaceLevelInside { get; private set; } + + /// /// Gets or sets the reference line intersection point in world coordinates. /// public Point2D ReferenceLineIntersectionWorldPoint { get; set; } @@ -115,6 +196,227 @@ } /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetDitchPolderSideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DitchPolderSide); + } + DitchPolderSide = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetBottomDitchPolderSideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_BottomDitchPolderSide); + } + BottomDitchPolderSide = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetBottomDitchDikeSideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_BottomDitchDikeSide); + } + BottomDitchDikeSide = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetDitchDikeSideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DitchDikeSide); + } + DitchDikeSide = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetDikeTopAtPolderAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder); + } + DikeTopAtPolder = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetShoulderBaseInsideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_ShoulderBaseInside); + } + ShoulderBaseInside = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetShoulderTopInsideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_ShoulderTopInside); + } + ShoulderTopInside = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetTrafficLoadInsideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_TrafficLoadInside); + } + TrafficLoadInside = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetTrafficLoadOutsideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_TrafficLoadOutside); + } + TrafficLoadOutside = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetDikeToeAtRiverAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver); + } + DikeToeAtRiver = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetDikeToeAtPolderAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder); + } + DikeToeAtPolder = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetSurfaceLevelInsideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelInside); + } + SurfaceLevelInside = geometryPoint; + } + + /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// is null. + public void SetSurfaceLevelOutsideAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelOutside); + } + SurfaceLevelOutside = geometryPoint; + } + + /// /// Gets the height of the projected at a L=. /// /// The L coordinate from where to take the height of the . @@ -279,6 +581,29 @@ return Name; } + /// + /// Finds a point from which is at the same position as . + /// + /// The location of a point from . + /// The from at the same location as . + /// is null. + private Point3D GetPointFromGeometry(Point3D point) + { + if (point == null) + { + throw new ArgumentNullException(nameof(point), @"Cannot find a point in geometry using a null point."); + } + return Points.FirstOrDefault(p => p.Equals(point)); + } + + private static ArgumentException CreatePointNotInGeometryException(Point3D point, string characteristicPointDescription) + { + string message = string.Format(Resources.MacroStabilityInwardsSurfaceLine_SetCharacteristicPointAt_Geometry_does_not_contain_point_at_0_to_assign_as_characteristic_point_1_, + point, + characteristicPointDescription); + return new ArgumentException(message); + } + private bool Equals(RingtoetsMacroStabilityInwardsSurfaceLine other) { return string.Equals(Name, other.Name)