Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs =================================================================== diff -u -r411b50528bbd83c02ffdcae699895529b2b34bf7 -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs (.../DikeProfile.cs) (revision 411b50528bbd83c02ffdcae699895529b2b34bf7) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs (.../DikeProfile.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) @@ -33,29 +33,34 @@ /// public class DikeProfile { - private readonly List foreshoreGeometry; - private RoughnessPoint[] dikeGeometry; private RoundedDouble orientation; private RoundedDouble dikeHeight; /// /// Creates a new instance of the class. /// - /// The value for . - public DikeProfile(Point2D worldCoordinate) + /// worldCoordinate">The value for + /// The geometry of the dike. + /// The geometry of the dike foreshore. + /// Thrown when + /// or is null. + /// Thrown when any element of + /// or is null. + public DikeProfile(Point2D worldCoordinate, RoughnessPoint[] dikeGeometry, Point2D[] foreshoreGeometry) { if (worldCoordinate == null) { throw new ArgumentNullException("worldCoordinate"); } + SetGeometry(dikeGeometry); + SetForshoreGeometry(foreshoreGeometry); + orientation = new RoundedDouble(2); dikeHeight = new RoundedDouble(2); Name = Resources.DikeProfile_DefaultName; Memo = ""; - dikeGeometry = new RoughnessPoint[0]; - foreshoreGeometry = new List(); WorldReferencePoint = worldCoordinate; } @@ -114,13 +119,7 @@ /// /// Gets the geometry of the foreshore. /// - public List ForeshoreGeometry - { - get - { - return foreshoreGeometry; - } - } + public Point2D[] ForeshoreGeometry { get; private set; } /// /// Gets the geometry of the dike with roughness data. @@ -131,13 +130,7 @@ /// and the succeeding . The roughness of the last /// point is irrelevant. /// - public RoughnessPoint[] DikeGeometry - { - get - { - return dikeGeometry; - } - } + public RoughnessPoint[] DikeGeometry { get; private set; } /// /// Gets or sets the height of the dike [m+NAP]. @@ -159,13 +152,7 @@ return Name; } - /// - /// Sets the geometry of the dike profile. - /// - /// The collection of defining the dike profile geometry. - /// Thrown when is null. - /// Thrown when any element of is null. - public void SetGeometry(IEnumerable points) + private void SetGeometry(IEnumerable points) { if (points == null) { @@ -174,10 +161,25 @@ if (points.Any(p => p == null)) { - throw new ArgumentException(Resources.DikeProfile_SetGeometry_A_point_in_the_collection_was_null); + throw new ArgumentException(Resources.DikeProfile_SetGeometry_A_point_in_the_collection_is_null); } - dikeGeometry = points.ToArray(); + DikeGeometry = points.ToArray(); } + + private void SetForshoreGeometry(IEnumerable points) + { + if (points == null) + { + throw new ArgumentNullException("points", Resources.DikeProfile_SetForshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null); + } + + if (points.Any(p => p == null)) + { + throw new ArgumentException(Resources.DikeProfile_SetForshoreGeometry_A_point_in_the_collection_is_null); + } + + ForeshoreGeometry = points.ToArray(); + } } } \ No newline at end of file