using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; using Deltares.Standard.Units; using Deltares.Standard.Validation; namespace Deltares.Stability { public class SlipplaneConstraints : IVisibleEnabled { private bool createZones; private double xEntryMax = double.NaN; private double xEntryMin = double.NaN; private double slipPlaneMinDepth = 0; private double slipPlaneMinLength = 0; [Unit(UnitType.Length)] [Label("Minimal slip plane depth")] [Minimum(0)] [Maximum(100)] [PropertyOrder(1)] [Format("F3")] public double SlipPlaneMinDepth { get { return slipPlaneMinDepth; } set { DataEventPublisher.BeforeChange(this, "SlipPlaneMinDepth"); slipPlaneMinDepth = value; DataEventPublisher.AfterChange(this, "SlipPlaneMinDepth"); } } [Label("Minimal slip plane length")] [Minimum(0)] [Maximum(1000)] [PropertyOrder(1)] [Format("F3")] [Unit(UnitType.Length)] public double SlipPlaneMinLength { get { return slipPlaneMinLength; } set { DataEventPublisher.BeforeChange(this, "SlipPlaneMinLength"); slipPlaneMinLength = value; DataEventPublisher.AfterChange(this, "SlipPlaneMinLength"); } } public bool CreateZones { get { return createZones; } set { DataEventPublisher.BeforeChange(this, "CreateZones"); createZones = value; DataEventPublisher.AfterChange(this, "CreateZones"); } } [Label("X min entry")] [Unit(UnitType.Length)] [Format("F3")] [Clearable] public double XEntryMin { get { return xEntryMin; } set { DataEventPublisher.BeforeChange(this, "XEntryMin"); xEntryMin = value; DataEventPublisher.AfterChange(this, "XEntryMin"); } } [Label("X max entry")] [Unit(UnitType.Length)] [Format("F3")] [Clearable] public double XEntryMax { get { return xEntryMax; } set { DataEventPublisher.BeforeChange(this, "XEntryMax"); xEntryMax = value; DataEventPublisher.AfterChange(this, "XEntryMax"); } } public bool IsEnabled(string property) { switch (property) { case "XEntryMin": case "XEntryMax": return !CreateZones; default: return true; } } public bool IsVisible(string property) { return true; } } }