using System; using System.ComponentModel; using System.Xml.Serialization; using Deltares.Geotechnics; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; using Deltares.Standard.Validation; namespace Deltares.DeltaModel { /// /// Revetment zones are visible in the map editor. /// [XmlOldName("Deltares.Geotechnics.RevetmentZone")] public class RoughnessZone : RevetmentZone { private RoughnessDescription roughnessDescription = new RoughnessDescription(); /// /// Initializes a new instance of the class. /// public RoughnessZone() { RoughnessDescription.UseStandardRoughness = true; RoughnessDescription.Name = string.Empty; DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange; } /// /// Initializes a new instance of the class. /// /// The name. /// Type of the revetment. /// The roughness. [Obsolete("Not used anymore", true)] public RoughnessZone(string name, RoughnessType roughnessType, double roughness) { RoughnessDescription.UseStandardRoughness = true; RoughnessDescription.Name = name; RoughnessDescription.RoughnessType = roughnessType; RoughnessDescription.Roughness = roughness; } [Browsable(false)] public RoughnessDescription RoughnessDescription { get { return roughnessDescription; } set { roughnessDescription = value; } } [Browsable(false)] [Data] public string RevetmentString { get { return RoughnessDescription.RevetmentString; } } /// /// Gets or sets the RoughnessType of the Revetment. /// /// /// The RoughnessType. /// [Data] [Label("Revetment type")] [Description("Revetment type")] [XmlIgnore] [PropertyOrder(1, 3)] public RoughnessType RoughnessType { get { return RoughnessDescription.RoughnessType; } set { RoughnessDescription.RoughnessType = value; } } /// /// Gets or sets the roughness of the Revetment. /// /// /// The roughness. /// [Format("F2")] [PropertyOrder(1, 2)] [Minimum(0.0)] [Maximum(1.0)] [XmlIgnore] public double Roughness { get { return RoughnessDescription.Roughness; } set { RoughnessDescription.Roughness = value; } } [Browsable(false)] public override ISegmentDescription Data { get { return RoughnessDescription; } } /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override string ToString() { return RoughnessDescription.ToString(); } # region ICloneable Members public override RevetmentZone Clone() { return new RoughnessZone { RoughnessDescription = RoughnessDescription.Clone() as RoughnessDescription }; } # endregion private void DataEventPublisher_OnAfterChange(object sender, PublishEventArgs e) { if (sender == RoughnessDescription) { DataEventPublisher.AfterChange(this); } } } }