// Copyright (C) Stichting Deltares 2017. 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.Xml.Serialization; using Core.Common.Base.Geometry; using Ringtoets.AssemblyTool.IO.Model.DataTypes; using Ringtoets.AssemblyTool.IO.Properties; namespace Ringtoets.AssemblyTool.IO.Model { /// /// Class describing a serializable assessment section. /// [XmlType(AssemblyXmlIdentifiers.AssessmentSection)] public class SerializableAssessmentSection : SerializableFeatureMember { /// /// Creates a new instance of . /// public SerializableAssessmentSection() { AssessmentSectionType = Resources.AssessmentSectionType; } /// /// Creates a new instance of . /// /// The unique ID of the assessment section. /// The name of the assessment section. /// The geometry of the surface line. /// Thrown when any parameter is null. /// Thrown when contains no elements. public SerializableAssessmentSection(string id, string name, IEnumerable geometry) : this() { if (id == null) { throw new ArgumentNullException(nameof(id)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } if (geometry == null) { throw new ArgumentNullException(nameof(geometry)); } Id = id; Name = name; SurfaceLineLength = new SerializableMeasure(Math2D.Length(geometry)); SurfaceLineGeometry = new SerializableLine(geometry); } /// /// Gets or sets the ID. /// [XmlAttribute(AssemblyXmlIdentifiers.Id, Namespace = AssemblyXmlIdentifiers.GmlNamespace)] public string Id { get; set; } /// /// Gets or sets the name of the assessment section. /// [XmlElement(AssemblyXmlIdentifiers.Name)] public string Name { get; set; } /// /// Gets or sets the geometry of the surface line. /// [XmlElement(AssemblyXmlIdentifiers.Geometry2D)] public SerializableLine SurfaceLineGeometry { get; set; } /// /// Gets or sets the length of the surface line. /// [m] /// [XmlElement(AssemblyXmlIdentifiers.Length)] public SerializableMeasure SurfaceLineLength { get; set; } /// /// Gets or sets the type of the assessment section. /// [XmlElement(AssemblyXmlIdentifiers.AssessmentSectionType)] public string AssessmentSectionType { get; set; } } }