// Copyright (C) Stichting Deltares 2016. All rights reserved. // // This file is part of Ringtoets. // // Ringtoets is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System; using System.Collections.Generic; using System.Linq; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Ringtoets.Common.Data.Properties; namespace Ringtoets.Common.Data.DikeProfiles { /// /// Definition for a dike profile for a failure mechanism. /// public class DikeProfile { /// /// Creates a new instance of the class. /// /// The value for . /// The geometry of the dike. /// The geometry of the dike foreshore. /// The break water definition (can be null). /// The property values required to create an instance of . /// Thrown when either , /// , or /// is null. /// Thrown when any element of /// or is null. public DikeProfile(Point2D worldCoordinate, IEnumerable dikeGeometry, IEnumerable foreshoreGeometry, BreakWater breakWater, ConstructionProperties properties) { if (properties == null) { throw new ArgumentNullException("properties"); } ForeshoreProfile = new ForeshoreProfile(worldCoordinate, foreshoreGeometry, breakWater, new ForeshoreProfile.ConstructionProperties { Name = properties.Name, Orientation = properties.Orientation, X0 = properties.X0 }); SetGeometry(dikeGeometry); DikeHeight = new RoundedDouble(2, properties.DikeHeight); } /// /// Gets the foreshore profile. /// public ForeshoreProfile ForeshoreProfile { get; private set; } /// /// Gets the name of the dike profile. /// public string Name { get { return ForeshoreProfile.Name; } } /// /// Gets the reference point in world coordinates corresponding to the local coordinate . /// public Point2D WorldReferencePoint { get { return ForeshoreProfile.WorldReferencePoint; } } /// /// Gets the local x-coordinate corresponding to the world reference point . /// public double X0 { get { return ForeshoreProfile.X0; } } /// /// Gets or the orientation of the dike profile geometry with respect to North /// in degrees. A positive value equals a clockwise rotation. /// public RoundedDouble Orientation { get { return ForeshoreProfile.Orientation; } } /// /// Indicates if there is a break water object available for this instance or not. /// public bool HasBreakWater { get { return BreakWater != null; } } /// /// Gets the break water object of the dike profile, if any. /// public BreakWater BreakWater { get { return ForeshoreProfile.BreakWater; } } /// /// Gets the geometry of the foreshore. /// public RoundedPoint2DCollection ForeshoreGeometry { get { return ForeshoreProfile.Geometry; } } /// /// Gets the geometry of the dike with roughness data. /// /// /// The roughness of a in the list represents /// the roughness of the section between this /// and the succeeding . The roughness of the last /// point is irrelevant. /// public RoughnessPoint[] DikeGeometry { get; private set; } /// /// Gets or sets the height of the dike [m+NAP]. /// public RoundedDouble DikeHeight { get; private set; } public override string ToString() { return Name; } private void SetGeometry(IEnumerable points) { if (points == null) { throw new ArgumentNullException("points", Resources.DikeProfile_SetGeometry_Collection_of_points_for_geometry_is_null); } var roughnessPoints = points.ToArray(); if (roughnessPoints.Any(p => p == null)) { throw new ArgumentException(Resources.DikeProfile_SetGeometry_A_point_in_the_collection_is_null); } DikeGeometry = roughnessPoints; } /// /// Class holding the various construction parameters for . /// public class ConstructionProperties { /// /// Gets or sets the value for . /// public string Name { get; set; } /// /// Gets or sets the value for . /// public double X0 { get; set; } /// /// Gets or sets the value for . /// public double Orientation { get; set; } /// /// Gets or sets the value for . /// /// will be rounded to the /// of . public double DikeHeight { get; set; } } } }