using System; using System.ComponentModel; using System.Xml.Serialization; using Deltares.Geometry; using Deltares.Geotechnics; using Deltares.Geotechnics.Soils; using Deltares.Mathematics; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; using Deltares.Standard.Units; using Deltares.Standard.Validation; namespace Deltares.Stability { [Serializable] public class Nail : GeometryObject, IVisibleEnabled, IName { private readonly GeometryPoint nailHeadPoint; private double bendingStiffness; private double diameterGrout; private double diameterNail; private double direction; private double horizontalSpacing; private ShearStressCurve lateralStressCurve; private double length; private double maxMom; private double maxPullForce; private double plasticMoment; private ShearStressCurve shearStressCurve; private bool useDefault = false; private bool useFacing; private bool useLateralStress; private bool useShearStress; private IVisibleEnabledProvider visibleEnabledProvider = null; private double yieldForce; public Nail() { nailHeadPoint = new GeometryPoint(); direction = 0.0; horizontalSpacing = 0.0; length = 3.0; diameterNail = 0.5; diameterGrout = 0.0; yieldForce = 0.0; plasticMoment = 0.0; bendingStiffness = 0.0F; useFacing = false; shearStressCurve = new ShearStressCurve(); lateralStressCurve = new ShearStressCurve(); maxPullForce = 0; maxMom = 0; useShearStress = false; useLateralStress = false; } [Browsable(false)] public GeometryPoint NailHeadPoint { get { return nailHeadPoint; } } [Unit(UnitType.Length)] [Minimum(-1.000e+06)] [Maximum(1.000e+06)] [PropertyOrder(1)] [Format("F3")] public double X { get { return nailHeadPoint.X; } set { if (value != nailHeadPoint.X) { nailHeadPoint.X = value; DataEventPublisher.Changed(this); } } } [Browsable(false)] public double Y { get { return nailHeadPoint.Y; } set { if (value != nailHeadPoint.Y) { nailHeadPoint.Y = value; DataEventPublisher.Changed(this, "Y"); } } } [Unit(UnitType.Length)] [Minimum(-1.000e+06)] [Maximum(1.000e+06)] [PropertyOrder(2)] [Format("F3")] public double Z { get { return nailHeadPoint.Z; } set { if (value != nailHeadPoint.Z) { nailHeadPoint.Z = value; DataEventPublisher.Changed(this); } } } [Unit(UnitType.Angle)] [Minimum(-90)] [Maximum(90)] [DefaultValue(0)] [PropertyOrder(3)] [Format("F3")] public double Direction { get { return direction; } set { if (value != direction) { DataEventPublisher.BeforeChange(this, "Direction"); direction = value; DataEventPublisher.AfterChange(this, "Direction"); } } } [Unit(UnitType.Length)] [Minimum(-1.000e+06)] [Maximum(1.000e+06)] [PropertyOrder(4)] [Format("F3")] public double HorizontalSpacing { get { return horizontalSpacing; } set { if (value != horizontalSpacing) { DataEventPublisher.BeforeChange(this, "HorizontalSpacing"); horizontalSpacing = value; DataEventPublisher.AfterChange(this, "HorizontalSpacing"); } } } [Unit(UnitType.Length)] [Minimum(0)] [Maximum(100)] [PropertyOrder(5)] [Format("F3")] public double Length { get { return length; } set { if (value != length) { DataEventPublisher.BeforeChange(this, "Length"); length = value; DataEventPublisher.AfterChange(this, "Length"); } } } [Unit(UnitType.Length)] [Minimum(0)] [Maximum(10)] [PropertyOrder(6)] [Format("F3")] public double DiameterNail { get { return diameterNail; } set { if (value != diameterNail) { DataEventPublisher.BeforeChange(this, "DiameterNail"); diameterNail = value; DataEventPublisher.AfterChange(this, "DiameterNail"); } } } [Unit(UnitType.Length)] [Minimum(0)] [Maximum(10)] [PropertyOrder(7)] [Format("F3")] public double DiameterGrout { get { return diameterGrout; } set { if (value != diameterGrout) { DataEventPublisher.BeforeChange(this, "DiameterGrout"); diameterGrout = value; DataEventPublisher.AfterChange(this, "DiameterGrout"); } } } [Unit(UnitType.Force)] [Minimum(-100000)] [Maximum(100000)] [PropertyOrder(8)] [Format("F3")] public double YieldForce { get { return yieldForce; } set { if (value != yieldForce) { DataEventPublisher.BeforeChange(this, "YieldForce"); yieldForce = value; DataEventPublisher.AfterChange(this, "YieldForce"); } } } [Unit(UnitType.PressurePerLength)] [Minimum(0)] [Maximum(1000000)] [PropertyOrder(9)] [Format("F3")] public double PlasticMoment { get { return plasticMoment; } set { if (value != plasticMoment) { DataEventPublisher.BeforeChange(this, "PlasticMoment"); plasticMoment = value; DataEventPublisher.AfterChange(this, "PlasticMoment"); } } } [Unit(UnitType.Pressure)] [Minimum(0)] [Maximum(1000000)] [PropertyOrder(10)] [Format("F3")] public double BendingStiffness { get { return bendingStiffness; } set { if (value != bendingStiffness) { DataEventPublisher.BeforeChange(this, "BendingStiffness"); bendingStiffness = value; DataEventPublisher.AfterChange(this, "BendingStiffness"); } } } [Unit(UnitType.None)] [PropertyOrder(11)] [Format("F3")] public bool UseFacing { get { return useFacing; } set { if (value != useFacing) { DataEventPublisher.BeforeChange(this, "UseFacing"); useFacing = value; DataEventPublisher.AfterChange(this, "UseFacing"); } } } [Unit(UnitType.None)] [PropertyOrder(12)] [Format("F3")] public bool UseShearStress { get { return useShearStress; } set { if (value != useShearStress) { DataEventPublisher.BeforeChange(this, "UseShearStress"); useShearStress = value; DataEventPublisher.AfterChange(this, "UseShearStress"); } } } [Unit(UnitType.None)] [PropertyOrder(13)] [Format("F3")] public bool UseLateralStress { get { return useLateralStress; } set { if (value != useLateralStress) { DataEventPublisher.BeforeChange(this, "UseLateralStress"); useLateralStress = value; DataEventPublisher.AfterChange(this, "UseLateralStress"); } } } [Unit(UnitType.PressurePerLength)] [Browsable(false)] [Format("F3")] public double MaxPullForce { get { return maxPullForce; } set { if (value != maxPullForce) { DataEventPublisher.BeforeChange(this, "MaxPullForce"); maxPullForce = value; DataEventPublisher.AfterChange(this, "MaxPullForce"); } } } [Unit(UnitType.PressurePerLength)] [Browsable(false)] [Format("F3")] public double MaxMom { get { return maxMom; } set { if (value != maxMom) { DataEventPublisher.BeforeChange(this, "MaxMom"); maxMom = value; DataEventPublisher.AfterChange(this, "MaxMom"); } } } [Label("Shear Stress values")] [Description("ShearStressCaption")] [Category("StressCategory")] [Browsable(false)] public ShearStressCurve ShearStressCurve { get { return shearStressCurve; } set { shearStressCurve = value; } } [Label("Lateral Stress values")] [Description("LateralStressCaption")] [Category("StressCategory")] [Browsable(false)] public ShearStressCurve LateralStressCurve { get { return lateralStressCurve; } set { lateralStressCurve = value; } } [XmlIgnore] [Browsable(false)] public IVisibleEnabledProvider VisibleEnabledProvider { get { return visibleEnabledProvider; } set { visibleEnabledProvider = value; } } public bool UseDefault { get { return useDefault; } set { useDefault = value; } } public double CriticalAngle { get; set; } public double EI { get; set; } //public TTauMAxCalcTypeSet TaumaxType { get; set; } public override GeometryBounds GetGeometryBounds() { return nailHeadPoint.GetGeometryBounds(); } public override bool ContainsPoint(Point3D point, double tolerance) { return Routines2D.DetermineIfPointsCoincide(point.GetPointXZ(), nailHeadPoint.GetPointXz(), tolerance); } public bool IsVisible(string property) { if (visibleEnabledProvider != null) { switch (property) { case "ShearStressCurve": return visibleEnabledProvider.IsVisible(this, "ShearStressCurve"); case "LateralStressCurve": return true; // visibleEnabledProvider.IsVisible(this, "LateralStressCurve"); default: return true; } } return false; } public bool IsEnabled(string property) { return true; } } }