// Copyright (C) Stichting Deltares 2024. All rights reserved. // // This file is part of the application DAM - UI. // // DAM - UI 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; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Linq; using System.Xml.Serialization; using Deltares.Dam.Data.Sensors; using Deltares.DamEngine.Data.Standard; using Deltares.Geographic; using Deltares.Geometry; using Deltares.Geotechnics.Converter; using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; using Deltares.Geotechnics.Validation; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; using Deltares.Standard.Language; using Deltares.Standard.Units; using Deltares.Standard.Validation; namespace Deltares.Dam.Data; internal static class LocationParameterNames { public const string DikeRingId = "DikeRingId"; public const string Description = "Description"; public const string XRd = "XRd"; public const string YRd = "YRd"; public const string SegmentId = "SegmentId"; public const string SurfaceLineId = "SurfaceLineId"; public const string PL1LineId = "PL1LineId"; public const string XSoilGeometry2DOrigin = "XSoilGeometry2DOrigin"; public const string DikeEmbankmentMaterial = "DikeEmbankmentMaterial"; public const string ShoulderEmbankmentMaterial = "ShoulderEmbankmentMaterial"; public const string DampingFactorPL3 = "DampingFactorPL3"; public const string DampingFactorPL4 = "DampingFactorPL4"; public const string PenetrationLength = "PenetrationLength"; public const string TrafficLoad = "TrafficLoad"; public const string TL_DegreeOfConsolidation = "TL_DegreeOfConsolidation"; public const string PLLineCreationMethod = "PLLineCreationMethod"; public const string StabilityShoulderGrowSlope = "StabilityShoulderGrowSlope"; public const string StabilityShoulderGrowDeltaX = "StabilityShoulderGrowDeltaX"; public const string StabilitySlopeAdaptionDeltaX = "StabilitySlopeAdaptionDeltaX"; public const string MinimalCircleDepth = "MinimalCircleDepth"; public const string DistanceToEntryPoint = "DistanceToEntryPoint"; public const string StabilityZoneType = "StabilityZoneType"; public const string ForbiddenZoneFactor = "ForbiddenZoneFactor"; public const string StabilityDesignMethod = "StabilityDesignMethod"; public const string SlopeAdaptionStartCotangent = "SlopeAdaptionStartCotangent"; public const string SlopeAdaptionEndCotangent = "SlopeAdaptionEndCotangent"; public const string SlopeAdaptionStepCotangent = "SlopeAdaptionStepCotangent"; public const string SlopeDampingPiezometricHeightPolderSide = "SlopeDampingPiezometricHeightPolderSide"; public const string NewDepthDitch = "NewDepthDitch"; public const string NewDikeSlopeInside = "NewDikeSlopeInside"; public const string NewDikeSlopeOutside = "NewDikeSlopeOutside"; public const string NewDikeTopWidth = "NewDikeTopWidth"; public const string NewMaxHeightShoulderAsFraction = "NewMaxHeightShoulderAsFraction"; public const string NewMinDistanceDikeToeStartDitch = "NewMinDistanceDikeToeStartDitch"; public const string NewShoulderBaseSlope = "NewShoulderBaseSlope"; public const string NewShoulderTopSlope = "NewShoulderTopSlope"; public const string NewSlopeAngleDitch = "NewSlopeAngleDitch"; public const string NewWidthDitchBottom = "NewWidthDitchBottom"; public const string UseNewDikeSlopeInside = "UseNewDikeSlopeInside"; public const string UseNewDikeSlopeOutside = "UseNewDikeSlopeOutside"; public const string UseNewDikeTopWidth = "UseNewDikeTopWidth"; public const string UseNewDitchDefinition = "UseNewDitchDefinition"; public const string UseNewMaxHeightShoulderAsFraction = "UseNewMaxHeightShoulderAsFraction"; public const string UseNewMinDistanceDikeToeStartDitch = "UseNewMinDistanceDikeToeStartDitch"; public const string UseNewShoulderBaseSlope = "UseNewShoulderBaseSlope"; public const string UseNewShoulderTopSlope = "UseNewShoulderTopSlope"; public const string IntrusionVerticalWaterPressure = "IntrusionVerticalWaterPressure"; } [TrackChanges] public class Location : IVisibleEnabled, IGeographicPoint, IRepairer, IDomain, IDisposable { // Added initial value as these properties must be tested for real values on import public const string AllCategory = "MainItems"; public const string DikeCategory = "Dike"; public const string WaterCategory = "Water levels"; public const string DesignCategory = "Design"; private const double newDikeTopWidthMinValue = 0.1; private const double newDikeSlopeInsideMinValue = 0.01; private const double newDikeSlopeOutsideMinValue = 0.01; private const double penetrationLenghtMinValue = 0.00; private bool areLocalXZObjectsCreated; // ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // // When adding properties below do not forget to add these properties to SetParameterFromNameValuePair and GetParametersAsNameValuePairs // // ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! private double dampingFactorPL3; private double dampingFactorPL4; private string description = ""; private string dikeEmbankmentMaterial = ""; private double distanceToEntryPoint; private double forbiddenZoneFactor = 1.0; // Start of parameters that are also defined in modelparameters private PL1Line localXZPL1Line; private SurfaceLine2 localXzSurfaceLine; private double minimalCircleDepth; private string name = ""; private double newDepthDitch = 1.0; private double newDikeSlopeInside = 1.0 / 3.0; // as tangent private double newDikeSlopeOutside = 1.0 / 3.0; // as tangent private double newDikeTopWidth = 5.0; private double newMaxHeightShoulderAsFraction = 2.0 / 3.0; // as tangent private double newMinDistanceDikeToeStartDitch = 5.0; private double newShoulderBaseSlope = 1.0 / 3.0; // as tangent private double newShoulderTopSlope = 1.0 / 20.0; // as tangent private double newSlopeAngleDitch = 1.0 / 0.5; // as tangent private double newWidthDitchBottom = 1.0; private PL1Line pL1Line; private PLLineCreationMethod pLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD; private double penetrationLength; private bool redesignDikeHeight = true; private bool redesignDikeShoulder = true; private Segment segment; private SensorLocation sensorLocation; private string shoulderEmbankmentMaterial = ""; private double slopeAdaptionEndCotangent = 6.0; private double slopeAdaptionStartCotangent = 3.0; private double slopeAdaptionStepCotangent = 0.5; private double slopeDampingPiezometricHeightPolderSide; private SoilSurfaceProfile soilSurfaceProfile; private StabilityDesignMethod stabilityDesignMethod = StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption; private double stabilityShoulderGrowDeltaX = 2.0; private double stabilityShoulderGrowSlope = 1.0 / 3; private double stabilitySlopeAdaptionDeltaX = 2.0; private MStabZonesType stabilityZoneType = MStabZonesType.NoZones; private SurfaceLine2 surfaceLine2; private double trafficLoad; private double? degreeOfConsolidation; private bool useNewDikeSlopeInside; private bool useNewDikeSlopeOutside; private bool useNewDikeTopWidth; private bool useNewDitchDefinition; private bool useNewMaxHeightShoulderAsFraction; private bool useNewMinDistanceDikeToeStartDitch; private bool useNewShoulderBaseSlope; private bool useNewShoulderTopSlope; private double xRdDikeLine; private double xSoilGeometry2DOrigin; private double xrd; private double yrd; private IntrusionVerticalWaterPressureType? intrusionVerticalWaterPressure = IntrusionVerticalWaterPressureType.Standard; public Location() { SoilList = null; } /// /// Initializes a new instance of the class. /// /// The name. public Location(string name) : this() { this.name = name; } public bool HasSensorData { get { return sensorLocation != null; } } [Browsable(false)] [XmlOldName("SensorData")] public virtual SensorLocation SensorLocation { get { return sensorLocation; } set { sensorLocation = value; sensorLocation.Location = this; } } [Browsable(false)] public virtual bool AreLocalXZObjectsCreated { get { return areLocalXZObjectsCreated; } set { DataEventPublisher.BeforeChange(this, "AreLocalXZObjectsCreated"); areLocalXZObjectsCreated = value; DataEventPublisher.AfterChange(this, "AreLocalXZObjectsCreated"); } } [Label("Name")] [PropertyOrder(0, 1)] [ReadOnly(true)] [Category(AllCategory)] public virtual string Name { get { return name; } set { DataEventPublisher.BeforeChange(this, "Name"); name = value; DataEventPublisher.AfterChange(this, "Name"); } } [Label("Description")] [Category(DikeCategory)] [PropertyOrder(1, 10)] public virtual string Description { get { return description; } set { DataEventPublisher.BeforeChange(this, "Description"); description = value; DataEventPublisher.AfterChange(this, "Description"); } } [Unit(UnitType.Length)] [Label("X location (RDS)")] [Description("Location according to Rijksdriehoekstelsel")] [Format("F3")] [ReadOnly(true)] [PropertyOrder(1, 1)] [Category(AllCategory)] public virtual double XRd { get { return xrd; } set { DataEventPublisher.BeforeChange(this, "XRd"); xrd = value; DataEventPublisher.AfterChange(this, "XRd"); } } [Unit(UnitType.Length)] [Label("Y location (RDS)")] [Description("Location according to Rijksdriehoekstelsel")] [Format("F3")] [ReadOnly(true)] [PropertyOrder(1, 1)] [Category(AllCategory)] public virtual double YRd { get { return yrd; } set { DataEventPublisher.BeforeChange(this, "YRd"); yrd = value; DataEventPublisher.AfterChange(this, "YRd"); } } public virtual double XRdDikeLine { get { return xRdDikeLine; } set { this.SetAndNotify2(out xRdDikeLine, value, x => x.XRdDikeLine); } } [Browsable(false)] public virtual double XSoilGeometry2DOrigin { get { return xSoilGeometry2DOrigin; } set { DataEventPublisher.BeforeChange(this, "XSoilGeometry2DOrigin"); xSoilGeometry2DOrigin = value; DataEventPublisher.AfterChange(this, "XSoilGeometry2DOrigin"); } } [Unit(UnitType.PressurePerLength)] [Label("Traffic load")] [Description("Traffic load")] [Format("F3")] [Category(DikeCategory)] [PropertyOrder(1, 20)] public virtual double TrafficLoad { get { return trafficLoad; } set { DataEventPublisher.BeforeChange(this, "TrafficLoad"); trafficLoad = value; DataEventPublisher.AfterChange(this, "TrafficLoad"); } } [Unit(UnitType.Percentage)] [Format("F3")] [Category(DikeCategory)] [PropertyOrder(1, 21)] public virtual double? TL_DegreeOfConsolidation { get { return degreeOfConsolidation; } set { DataEventPublisher.BeforeChange(this, "TL_DegreeOfConsolidation"); degreeOfConsolidation = value; DataEventPublisher.AfterChange(this, "TL_DegreeOfConsolidation"); } } [Browsable(false)] public virtual PL1Line PL1Line { get { return pL1Line; } set { DataEventPublisher.BeforeChange(this, "PL1Line"); pL1Line = value; DataEventPublisher.AfterChange(this, "PL1Line"); } } [Browsable(false)] public virtual PL1Line LocalXZPL1Line { get { return localXZPL1Line; } set { DataEventPublisher.BeforeChange(this, "LocalXZPL1Line"); localXZPL1Line = value; DataEventPublisher.AfterChange(this, "LocalXZPL1Line"); } } /// /// TODO /// /// Composite relationship. [Validate] public virtual SurfaceLine2 LocalXZSurfaceLine2 { get { return localXzSurfaceLine; } set { this.SetAndNotify2(out localXzSurfaceLine, value, l => l.LocalXZSurfaceLine2); } } /// /// Gets or sets the Segment /// [PropertyOrder(1, 6)] [Label("Segment")] [Category(DikeCategory)] [ReadOnly(true)] public virtual string SegmentId { get; set; } /// /// Gets or sets the Segment /// [Browsable(false)] public virtual Segment Segment { get { return segment; } set { DataEventPublisher.BeforeChange(this, "Segment"); segment = value; DataEventPublisher.AfterChange(this, "Segment"); } } /// /// Gets or sets the surface line /// [Browsable(false)] public virtual SurfaceLine2 SurfaceLine2 { get { return surfaceLine2; } set { this.SetAndNotify2(out surfaceLine2, value, l => l.SurfaceLine2); } } /// /// /// [Unit(UnitType.Length)] [Label("Minimum circle depth")] [Format("F2")] [PropertyOrder(4, 4)] [Minimum(0)] [Maximum(10000)] [Category(DikeCategory)] public virtual double MinimalCircleDepth { get { return minimalCircleDepth; } set { DataEventPublisher.BeforeChange(this, "MinimalCircleDepth"); minimalCircleDepth = value; DataEventPublisher.AfterChange(this, "MinimalCircleDepth"); } } [Unit(UnitType.Length)] [Label("Distance to Entrypoint")] [Description("Distance from toe of dike to entry point of river in deep sandlayer")] [Format("F2")] [PropertyOrder(2, 12)] public virtual double DistanceToEntryPoint { get { return distanceToEntryPoint; } set { DataEventPublisher.BeforeChange(this, "DistanceToEntryPoint"); distanceToEntryPoint = value; DataEventPublisher.AfterChange(this, "DistanceToEntryPoint"); } } [Label("Slope damping factor")] [Description("The tangent of the slope damping for piezometric height polderSide (for PL3 and PL4)")] [Format("F3")] [Category(WaterCategory)] [PropertyOrder(2, 14)] public virtual double SlopeDampingPiezometricHeightPolderSide { get { return slopeDampingPiezometricHeightPolderSide; } set { DataEventPublisher.BeforeChange(this, "SlopeDampingPiezometricHeightPolderSide"); slopeDampingPiezometricHeightPolderSide = value; DataEventPublisher.AfterChange(this, "SlopeDampingPiezometricHeightPolderSide"); } } [Label("Dike")] [ReadOnly(true)] [Category(DikeCategory)] [PropertyOrder(1, 4)] public string DikeRingId { get; set; } = ""; [Browsable(false)] public string SurfaceLineId { get; set; } = ""; [Browsable(false)] public SoilList SoilList { get; set; } [Browsable(false)] public string MapForSoilGeometries2D { get; set; } = ""; [Browsable(false)] public virtual IList Gauges { get; set; } = new List(); [Browsable(false)] public virtual IList GaugePLLines { get; set; } = new List(); [Browsable(false)] public bool UsesGauges { get { return GaugePLLines != null && GaugePLLines.Count > 0 && Gauges != null; } } [Browsable(false)] public double GaugeMissVal { get; set; } [Label("Redesign dike height")] [PropertyOrder(7, 1)] [Category(DesignCategory)] public bool RedesignDikeHeight { get { return redesignDikeHeight; } set { DataEventPublisher.BeforeChange(this, "RedesignDikeHeight"); redesignDikeHeight = value; DataEventPublisher.AfterChange(this, "RedesignDikeHeight"); } } [Label("Redesign dike shoulder")] [PropertyOrder(7, 2)] [Category(DesignCategory)] public bool RedesignDikeShoulder { get { return redesignDikeShoulder; } set { DataEventPublisher.BeforeChange(this, "RedesignDikeShoulder"); redesignDikeShoulder = value; DataEventPublisher.AfterChange(this, "RedesignDikeShoulder"); } } [Label("Stability design method")] [PropertyOrder(7, 3)] [Category(DesignCategory)] public StabilityDesignMethod StabilityDesignMethod { get { return stabilityDesignMethod; } set { DataEventPublisher.BeforeChange(this, "StabilityDesignMethod"); stabilityDesignMethod = value; DataEventPublisher.AfterChange(this, "StabilityDesignMethod"); } } [Label("Start value for design of slope")] [PropertyOrder(7, 4)] [Format("F2")] [Category(DesignCategory)] public double SlopeAdaptionStartCotangent { get { return slopeAdaptionStartCotangent; } set { DataEventPublisher.BeforeChange(this, "SlopeAdaptionStartCotangent"); slopeAdaptionStartCotangent = value; DataEventPublisher.AfterChange(this, "SlopeAdaptionStartCotangent"); } } [Label("End value for design of slope")] [PropertyOrder(7, 5)] [Format("F2")] [Category(DesignCategory)] public double SlopeAdaptionEndCotangent { get { return slopeAdaptionEndCotangent; } set { DataEventPublisher.BeforeChange(this, "SlopeAdaptionEndCotangent"); slopeAdaptionEndCotangent = value; DataEventPublisher.AfterChange(this, "SlopeAdaptionEndCotangent"); } } [Label("Step value for design of slope")] [PropertyOrder(7, 6)] [Format("F2")] [Category(DesignCategory)] public double SlopeAdaptionStepCotangent { get { return slopeAdaptionStepCotangent; } set { DataEventPublisher.BeforeChange(this, "SlopeAdaptionStepCotangent"); slopeAdaptionStepCotangent = value; DataEventPublisher.AfterChange(this, "SlopeAdaptionStepCotangent"); } } [Description("Use the value for new width of dike top")] [PropertyOrder(7, 7)] [Format("F2")] [Category(DesignCategory)] public bool UseNewDikeTopWidth { get { return useNewDikeTopWidth; } set { DataEventPublisher.BeforeChange(this, "UseNewDikeTopWidth"); useNewDikeTopWidth = value; DataEventPublisher.AfterChange(this, "UseNewDikeTopWidth"); } } [Description("Value for new width of dike top")] [PropertyOrder(7, 8)] [Format("F2")] [Category(DesignCategory)] public double NewDikeTopWidth { get { return newDikeTopWidth; } set { DataEventPublisher.BeforeChange(this, "NewDikeTopWidth"); newDikeTopWidth = value; DataEventPublisher.AfterChange(this, "NewDikeTopWidth"); } } [Description("Use the value for new angle of the inside slope")] [PropertyOrder(7, 9)] [Format("F2")] [Category(DesignCategory)] public bool UseNewDikeSlopeInside { get { return useNewDikeSlopeInside; } set { DataEventPublisher.BeforeChange(this, "UseNewDikeSlopeInside"); useNewDikeSlopeInside = value; DataEventPublisher.AfterChange(this, "UseNewDikeSlopeInside"); } } [Description("Value for new angle of the inside slope")] [PropertyOrder(7, 10)] [Format("F2")] [Category(DesignCategory)] public double NewDikeSlopeInside { get { return newDikeSlopeInside; } set { DataEventPublisher.BeforeChange(this, "NewDikeSlopeInside"); newDikeSlopeInside = value; DataEventPublisher.AfterChange(this, "NewDikeSlopeInside"); } } [Description("Use the value for new angle of the outside slope")] [PropertyOrder(7, 11)] [Format("F2")] [Category(DesignCategory)] public bool UseNewDikeSlopeOutside { get { return useNewDikeSlopeOutside; } set { DataEventPublisher.BeforeChange(this, "UseNewDikeSlopeOutside"); useNewDikeSlopeOutside = value; DataEventPublisher.AfterChange(this, "UseNewDikeSlopeOutside"); } } [Description("Value for new angle of the outside slope")] [PropertyOrder(7, 12)] [Format("F2")] [Category(DesignCategory)] public double NewDikeSlopeOutside { get { return newDikeSlopeOutside; } set { DataEventPublisher.BeforeChange(this, "NewDikeSlopeOutside"); newDikeSlopeOutside = value; DataEventPublisher.AfterChange(this, "NewDikeSlopeOutside"); } } [Description("Use the value for new angle of the top slope of shoulder")] [PropertyOrder(7, 13)] [Format("F2")] [Category(DesignCategory)] public bool UseNewShoulderTopSlope { get { return useNewShoulderTopSlope; } set { DataEventPublisher.BeforeChange(this, "UseNewShoulderTopSlope"); useNewShoulderTopSlope = value; DataEventPublisher.AfterChange(this, "UseNewShoulderTopSlope"); } } [Description("Value for new angle of the top slope of shoulder")] [PropertyOrder(7, 14)] [Format("F2")] [Category(DesignCategory)] public double NewShoulderTopSlope { get { return newShoulderTopSlope; } set { DataEventPublisher.BeforeChange(this, "NewShoulderTopSlope"); newShoulderTopSlope = value; DataEventPublisher.AfterChange(this, "NewShoulderTopSlope"); } } [Description("Use the value for new angle of the base slope of shoulder")] [PropertyOrder(7, 15)] [Format("F2")] [Category(DesignCategory)] public bool UseNewShoulderBaseSlope { get { return useNewShoulderBaseSlope; } set { DataEventPublisher.BeforeChange(this, "UseNewShoulderBaseSlope"); useNewShoulderBaseSlope = value; DataEventPublisher.AfterChange(this, "UseNewShoulderBaseSlope"); } } [Description("Value for new angle of the base slope of shoulder")] [PropertyOrder(7, 16)] [Format("F2")] [Category(DesignCategory)] public double NewShoulderBaseSlope { get { return newShoulderBaseSlope; } set { DataEventPublisher.BeforeChange(this, "NewShoulderBaseSlope"); newShoulderBaseSlope = value; DataEventPublisher.AfterChange(this, "NewShoulderBaseSlope"); } } [Label("Use the value for new allowed height of shoulder as fraction of dike height")] [PropertyOrder(7, 17)] [Format("F2")] [Category(DesignCategory)] public bool UseNewMaxHeightShoulderAsFraction { get { return useNewMaxHeightShoulderAsFraction; } set { DataEventPublisher.BeforeChange(this, "UseNewMaxHeightShoulderAsFraction"); useNewMaxHeightShoulderAsFraction = value; DataEventPublisher.AfterChange(this, "UseNewMaxHeightShoulderAsFraction"); } } [Description("Value for new allowed height of shoulder as fraction of dike height")] [PropertyOrder(7, 18)] [Format("F2")] [Category(DesignCategory)] public double NewMaxHeightShoulderAsFraction { get { return newMaxHeightShoulderAsFraction; } set { DataEventPublisher.BeforeChange(this, "NewMaxHeightShoulderAsFraction"); newMaxHeightShoulderAsFraction = value; DataEventPublisher.AfterChange(this, "NewMaxHeightShoulderAsFraction"); } } [Description("Use the value for new minimum distance dike toe - start ditch")] [PropertyOrder(7, 19)] [Format("F2")] [Category(DesignCategory)] public bool UseNewMinDistanceDikeToeStartDitch { get { return useNewMinDistanceDikeToeStartDitch; } set { DataEventPublisher.BeforeChange(this, "UseNewMinDistanceDikeToeStartDitch"); useNewMinDistanceDikeToeStartDitch = value; DataEventPublisher.AfterChange(this, "UseNewMinDistanceDikeToeStartDitch"); } } [Description("Value for new minimum distance dike toe - start ditch")] [PropertyOrder(7, 20)] [Format("F2")] [Category(DesignCategory)] public double NewMinDistanceDikeToeStartDitch { get { return newMinDistanceDikeToeStartDitch; } set { DataEventPublisher.BeforeChange(this, "NewMinDistanceDikeToeStartDitch"); newMinDistanceDikeToeStartDitch = value; DataEventPublisher.AfterChange(this, "NewMinDistanceDikeToeStartDitch"); } } [Description("Use the values for new ditch definition")] [PropertyOrder(7, 21)] [Format("F2")] [Category(DesignCategory)] public bool UseNewDitchDefinition { get { return useNewDitchDefinition; } set { DataEventPublisher.BeforeChange(this, "UseNewDitchDefinition"); useNewDitchDefinition = value; DataEventPublisher.AfterChange(this, "UseNewDitchDefinition"); } } [Description("Value for new width of ditch bottom")] [PropertyOrder(7, 22)] [Format("F2")] [Category(DesignCategory)] public double NewWidthDitchBottom { get { return newWidthDitchBottom; } set { DataEventPublisher.BeforeChange(this, "NewWidthDitchBottom"); newWidthDitchBottom = value; DataEventPublisher.AfterChange(this, "NewWidthDitchBottom"); } } [Description("Value for new angle of ditch slopes")] [PropertyOrder(7, 23)] [Format("F2")] [Category(DesignCategory)] public double NewSlopeAngleDitch { get { return newSlopeAngleDitch; } set { DataEventPublisher.BeforeChange(this, "newSlopeAngleDitch"); newSlopeAngleDitch = value; DataEventPublisher.AfterChange(this, "newSlopeAngleDitch"); } } [Description("Value for new depth of ditch bottom")] [PropertyOrder(7, 24)] [Format("F2")] [Category(DesignCategory)] public double NewDepthDitch { get { return newDepthDitch; } set { DataEventPublisher.BeforeChange(this, "NewDepthDitch"); newDepthDitch = value; DataEventPublisher.AfterChange(this, "NewDepthDitch"); } } [ReadOnly(true)] [Validate] public List Scenarios { get; } = new List(); [Browsable(false)] [XmlIgnore] public static DamProjectType DamProjectType { get; set; } = DamProjectType.Calamity; /// /// Assemble a list of key/value pairs with the relevant parameters for the location /// /// public Dictionary GetParametersAsNameValuePairs() { var numberFormatInfo = new NumberFormatInfo(); numberFormatInfo.NumberDecimalSeparator = "."; var nameValuePairs = new Dictionary(); nameValuePairs.Add(LocationParameterNames.DikeRingId, DikeRingId); nameValuePairs.Add(LocationParameterNames.SurfaceLineId, SurfaceLineId); nameValuePairs.Add(LocationParameterNames.Description, Description); nameValuePairs.Add(LocationParameterNames.XRd, XRd.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.YRd, YRd.ToString(numberFormatInfo)); if (Segment != null) { nameValuePairs.Add(LocationParameterNames.SegmentId, Segment.Name); } else { nameValuePairs.Add(LocationParameterNames.SegmentId, SegmentId); } if (SurfaceLine2 != null) { nameValuePairs[LocationParameterNames.SurfaceLineId] = SurfaceLine2.Name; } if (PL1Line != null) { nameValuePairs.Add(LocationParameterNames.PL1LineId, PL1Line.Name); } nameValuePairs.Add(LocationParameterNames.XSoilGeometry2DOrigin, XSoilGeometry2DOrigin.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.DikeEmbankmentMaterial, DikeEmbankmentMaterial); nameValuePairs.Add(LocationParameterNames.ShoulderEmbankmentMaterial, ShoulderEmbankmentMaterial); nameValuePairs.Add(LocationParameterNames.DampingFactorPL3, DampingFactorPL3.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.DampingFactorPL4, DampingFactorPL4.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.PenetrationLength, PenetrationLength.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.PLLineCreationMethod, PLLineCreationMethod.ToString()); if (IntrusionVerticalWaterPressure.HasValue) { nameValuePairs.Add(LocationParameterNames.IntrusionVerticalWaterPressure, IntrusionVerticalWaterPressure.Value.ToString()); } nameValuePairs.Add(LocationParameterNames.StabilityShoulderGrowSlope, StabilityShoulderGrowSlope.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.StabilityShoulderGrowDeltaX, StabilityShoulderGrowDeltaX.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.StabilitySlopeAdaptionDeltaX, StabilitySlopeAdaptionDeltaX.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.TrafficLoad, TrafficLoad.ToString(numberFormatInfo)); if (TL_DegreeOfConsolidation.HasValue) { nameValuePairs.Add(LocationParameterNames.TL_DegreeOfConsolidation, TL_DegreeOfConsolidation.Value.ToString(numberFormatInfo)); } nameValuePairs.Add(LocationParameterNames.MinimalCircleDepth, MinimalCircleDepth.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.DistanceToEntryPoint, DistanceToEntryPoint.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.StabilityZoneType, StabilityZoneType.ToString()); nameValuePairs.Add(LocationParameterNames.ForbiddenZoneFactor, ForbiddenZoneFactor.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.SlopeDampingPiezometricHeightPolderSide, SlopeDampingPiezometricHeightPolderSide.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.StabilityDesignMethod, StabilityDesignMethod.ToString()); nameValuePairs.Add(LocationParameterNames.SlopeAdaptionStartCotangent, SlopeAdaptionStartCotangent.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.SlopeAdaptionEndCotangent, SlopeAdaptionEndCotangent.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.SlopeAdaptionStepCotangent, SlopeAdaptionStepCotangent.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewDepthDitch, NewDepthDitch.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewDikeSlopeInside, NewDikeSlopeInside.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewDikeSlopeOutside, NewDikeSlopeOutside.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewDikeTopWidth, NewDikeTopWidth.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewMaxHeightShoulderAsFraction, NewMaxHeightShoulderAsFraction.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewMinDistanceDikeToeStartDitch, NewMinDistanceDikeToeStartDitch.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewShoulderBaseSlope, NewShoulderBaseSlope.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewShoulderTopSlope, NewShoulderTopSlope.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewSlopeAngleDitch, NewSlopeAngleDitch.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.NewWidthDitchBottom, NewWidthDitchBottom.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.UseNewDikeSlopeInside, UseNewDikeSlopeInside.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewDikeSlopeOutside, UseNewDikeSlopeOutside.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewDikeTopWidth, UseNewDikeTopWidth.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewDitchDefinition, UseNewDitchDefinition.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewMaxHeightShoulderAsFraction, UseNewMaxHeightShoulderAsFraction.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewMinDistanceDikeToeStartDitch, UseNewMinDistanceDikeToeStartDitch.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewShoulderBaseSlope, UseNewShoulderBaseSlope.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewShoulderTopSlope, UseNewShoulderTopSlope.ToString()); return nameValuePairs; } public void AddNewSensorData() { var factory = new SensorFactory(); SensorLocation = factory.CreateSensorLocation(this); } [Validate] public ValidationResult[] AscendingLocalXZSurfaceLine() { if (LocalXZSurfaceLine2 != null) { return new SurfaceLine2Validator().ValidateCharacteristicPointsAreOrdered(LocalXZSurfaceLine2).ToArray(); } return new ValidationResult[0]; } /// /// Gets the dike embankment soil. /// /// public Soil GetDikeEmbankmentSoil() { if (String.IsNullOrEmpty(DikeEmbankmentMaterial)) { return null; } return SoilList.GetSoilByName(DikeEmbankmentMaterial); } /// /// Gets the shoulder embankment soil. /// /// public Soil GetShoulderEmbankmentSoil() { if (String.IsNullOrEmpty(ShoulderEmbankmentMaterial)) { return null; } return SoilList.GetSoilByName(ShoulderEmbankmentMaterial); } /// /// Gets the most probable profile. If there are no elements in the it returns null /// and leave the handling over to the caller /// /// The soil profile public SoilProfile1D GetMostProbableProfile(FailureMechanismSystemType? segmentFailureMechanismType) { if (Segment == null) { throw new ArgumentNullException(String.Format(ThrowHelper.GetResourceString(StringResourceNames.LocationHasNoSegment), Name)); } return Segment.GetMostProbableProfile(segmentFailureMechanismType); } /// /// Gets the most probable profile. If there are no elements in the it returns null /// and leave the handling over to the caller /// /// The soil profile public string GetMostProbableGeometry2DName(FailureMechanismSystemType? segmentFailureMechanismType) { if (Segment == null) { throw new ArgumentNullException(String.Format(ThrowHelper.GetResourceString(StringResourceNames.LocationHasNoSegment), Name)); } return Segment.GetMostProbableGeometry2DName(segmentFailureMechanismType); } /// /// Gets the soil profile probability. /// /// The soil profile. /// Type of the segment failure mechanism. /// /// public double? GetSoilProfileProbability(SoilProfile1D soilProfile, FailureMechanismSystemType? segmentFailureMechanismType) { if (Segment == null) { throw new ArgumentNullException(String.Format(ThrowHelper.GetResourceString(StringResourceNames.LocationHasNoSegment), Name)); } return Segment.GetSoilProfileProbability(soilProfile, segmentFailureMechanismType); } /// /// Gets the soil geometry2 d probability. /// /// Name of the soil geometry2 d. /// Type of the segment failure mechanism. /// /// public double? GetSoilGeometry2DProbability(string soilGeometry2DName, FailureMechanismSystemType? segmentFailureMechanismType) { if (Segment == null) { throw new ArgumentNullException(String.Format(ThrowHelper.GetResourceString(StringResourceNames.LocationHasNoSegment), Name)); } return Segment.GetSoilGeometry2DProbability(soilGeometry2DName, segmentFailureMechanismType); } /// /// Gets a sorted list of soil geometry probabilities for a certain failure mechanism type /// /// The failure mechanism type /// List of geometry probabilities public List GetGeometryProbabilities(FailureMechanismSystemType failureMechanismType) { var geometryProbabilities = new List(); if (Segment != null) { foreach (SoilGeometryProbability existingGeometryProbability in Segment.SoilProfileProbabilities) { if (existingGeometryProbability.SegmentFailureMechanismType.HasValue && existingGeometryProbability.SegmentFailureMechanismType.Value == failureMechanismType) { geometryProbabilities.Add(existingGeometryProbability); } } geometryProbabilities.Sort(); } return geometryProbabilities; } /// /// Gets the combination of the surface line and soil profile for a given failure mechanism and index /// /// Failure mechanism type /// The index indicates the ranking in probability /// The probability of the soil surface profile /// The soil surface profile public SoilSurfaceProfile GetSoilSurfaceProfile(FailureMechanismSystemType failureMechanismType, int index, out double probability) { List soilGeometryProbabilities = GetGeometryProbabilities(failureMechanismType); SoilGeometryProbability soilGeometryProbability = index < soilGeometryProbabilities.Count ? soilGeometryProbabilities[index] : null; SoilProfile1D originalProfile = soilGeometryProbability?.SoilProfile; probability = soilGeometryProbability?.Probability ?? 0; if (soilSurfaceProfile == null || originalProfile == null || !(soilSurfaceProfile.SoilProfile.Name == originalProfile.Name && soilSurfaceProfile.SoilProfile.LayerCount == originalProfile.LayerCount) || !(soilSurfaceProfile.SurfaceLine2.Name == LocalXZSurfaceLine2.Name && soilSurfaceProfile.SurfaceLine2.CharacteristicPoints.Count == LocalXZSurfaceLine2.CharacteristicPoints.Count)) { Soil dikeSoil = SoilList.GetSoilByName(DikeEmbankmentMaterial); if (soilSurfaceProfile == null) { soilSurfaceProfile = new SoilSurfaceProfile(); } // Do not assign the orginal soilprofile, because it will be changed in the class SoilSurfaceProfile SoilProfile1D soilProfile1D; if (originalProfile == null) { soilProfile1D = new SoilProfile1D(SurfaceLine2.Geometry.GetMaxZ(), -10, dikeSoil) { Name = soilGeometryProbability?.SoilGeometry2DName }; } else { soilProfile1D = new SoilProfile1D(); soilProfile1D.Assign(originalProfile); } soilSurfaceProfile.SoilProfile = soilProfile1D; soilSurfaceProfile.SurfaceLine2 = LocalXZSurfaceLine2; soilSurfaceProfile.DikeEmbankmentMaterial = GetDikeEmbankmentSoil(); foreach (SoilLayer2D layer in soilSurfaceProfile.Surfaces) { if (layer.Soil == null) { layer.Soil = dikeSoil; } } } return soilSurfaceProfile; } public void AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(SurfaceLine2 adaptedSurfaceLine) { if ((LocalXZPL1Line != null) && (LocalXZPL1Line.Points.Count > 1)) { GeometryPoint lastPointPL1Line = LocalXZPL1Line.Points.Last(); GeometryPoint lastPointSurfaceLine = adaptedSurfaceLine.Geometry.Points.Last(); lastPointPL1Line.X = lastPointSurfaceLine.X; GeometryPoint firstPointPL1Line = LocalXZPL1Line.Points.First(); GeometryPoint firstPointSurfaceLine = adaptedSurfaceLine.Geometry.Points.First(); firstPointPL1Line.X = firstPointSurfaceLine.X; } } public void SetParameterFromNameValuePair(string parameterName, string parameterValue) { var numberFormatInfo = new NumberFormatInfo(); numberFormatInfo.NumberDecimalSeparator = "."; if (parameterName.Equals(LocationParameterNames.DikeRingId)) { DikeRingId = parameterValue; } if (parameterName.Equals(LocationParameterNames.Description)) { Description = parameterValue; } if (parameterName.Equals(LocationParameterNames.XRd)) { XRd = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.YRd)) { YRd = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.SegmentId)) { SegmentId = parameterValue; } if (parameterName.Equals(LocationParameterNames.SurfaceLineId)) { SurfaceLineId = parameterValue; } if (parameterName.Equals(LocationParameterNames.XSoilGeometry2DOrigin)) { XSoilGeometry2DOrigin = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.DikeEmbankmentMaterial)) { DikeEmbankmentMaterial = parameterValue; } if (parameterName.Equals(LocationParameterNames.ShoulderEmbankmentMaterial)) { ShoulderEmbankmentMaterial = parameterValue; } if (parameterName.Equals(LocationParameterNames.DampingFactorPL3)) { DampingFactorPL3 = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.DampingFactorPL4)) { DampingFactorPL4 = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.PenetrationLength)) { PenetrationLength = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.PLLineCreationMethod)) { PLLineCreationMethod = (PLLineCreationMethod) Enum.Parse(typeof(PLLineCreationMethod), parameterValue); } if (parameterName.Equals(LocationParameterNames.IntrusionVerticalWaterPressure)) { IntrusionVerticalWaterPressure = (IntrusionVerticalWaterPressureType) Enum.Parse(typeof(IntrusionVerticalWaterPressureType), parameterValue); } if (parameterName.Equals(LocationParameterNames.StabilityShoulderGrowSlope)) { StabilityShoulderGrowSlope = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.StabilityShoulderGrowDeltaX)) { StabilityShoulderGrowDeltaX = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.StabilitySlopeAdaptionDeltaX)) { StabilitySlopeAdaptionDeltaX = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.TrafficLoad)) { TrafficLoad = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.TL_DegreeOfConsolidation)) { TL_DegreeOfConsolidation = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.MinimalCircleDepth)) { MinimalCircleDepth = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.DistanceToEntryPoint)) { DistanceToEntryPoint = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.StabilityZoneType)) { StabilityZoneType = (MStabZonesType) Enum.Parse(typeof(MStabZonesType), parameterValue); } if (parameterName.Equals(LocationParameterNames.ForbiddenZoneFactor)) { ForbiddenZoneFactor = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.SlopeDampingPiezometricHeightPolderSide)) { SlopeDampingPiezometricHeightPolderSide = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.StabilityDesignMethod)) { StabilityDesignMethod = (StabilityDesignMethod) Enum.Parse(typeof(StabilityDesignMethod), parameterValue); } if (parameterName.Equals(LocationParameterNames.SlopeAdaptionStartCotangent)) { SlopeAdaptionStartCotangent = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.SlopeAdaptionEndCotangent)) { SlopeAdaptionEndCotangent = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.SlopeAdaptionStepCotangent)) { SlopeAdaptionStepCotangent = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewDepthDitch)) { NewDepthDitch = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewDikeSlopeInside)) { NewDikeSlopeInside = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewDikeSlopeOutside)) { NewDikeSlopeOutside = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewDikeTopWidth)) { NewDikeTopWidth = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewMaxHeightShoulderAsFraction)) { NewMaxHeightShoulderAsFraction = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewMinDistanceDikeToeStartDitch)) { NewMinDistanceDikeToeStartDitch = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewShoulderBaseSlope)) { NewShoulderBaseSlope = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewShoulderTopSlope)) { NewShoulderTopSlope = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewSlopeAngleDitch)) { NewSlopeAngleDitch = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.NewWidthDitchBottom)) { NewWidthDitchBottom = Convert.ToDouble(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.UseNewDikeSlopeInside)) { UseNewDikeSlopeInside = Convert.ToBoolean(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.UseNewDikeSlopeOutside)) { UseNewDikeSlopeOutside = Convert.ToBoolean(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.UseNewDikeTopWidth)) { UseNewDikeTopWidth = Convert.ToBoolean(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.UseNewDitchDefinition)) { UseNewDitchDefinition = Convert.ToBoolean(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.UseNewMaxHeightShoulderAsFraction)) { UseNewMaxHeightShoulderAsFraction = Convert.ToBoolean(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.UseNewMinDistanceDikeToeStartDitch)) { UseNewMinDistanceDikeToeStartDitch = Convert.ToBoolean(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.UseNewShoulderBaseSlope)) { UseNewShoulderBaseSlope = Convert.ToBoolean(parameterValue, numberFormatInfo); } if (parameterName.Equals(LocationParameterNames.UseNewShoulderTopSlope)) { UseNewShoulderTopSlope = Convert.ToBoolean(parameterValue, numberFormatInfo); } } public override string ToString() { return Name; } public void Dispose() { if (surfaceLine != null) { surfaceLine.Dispose(); } if (LocalXZSurfaceLine2 != null) { LocalXZSurfaceLine2.Dispose(); } } public ICollection GetDomain(string property) { switch (property) { case "PLLineCreationMethod": return new[] { PLLineCreationMethod.ExpertKnowledgeRRD, PLLineCreationMethod.ExpertKnowledgeLinearInDike }; case "IntrusionVerticalWaterPressure": return new[] { this.Translate("Standard"), this.Translate("Linear"), this.Translate("FullHydroStatic"), this.Translate("HydroStatic"), this.Translate("SemiTimeDependent") }; default: return null; } } public void Repair(object subject, string property, string id) { if (subject is Location) { if (id == "AssignMinValue" && property == "NewDikeTopWidth") { NewDikeTopWidth = newDikeTopWidthMinValue; } if (id == "AssignMinValue" && property == "NewDikeSlopeInside") { NewDikeSlopeInside = newDikeSlopeInsideMinValue; } if (id == "AssignMinValue" && property == "NewDikeSlopeOutside") { NewDikeSlopeOutside = newDikeSlopeOutsideMinValue; } if (id == "AssignMinValue" && property == "PenetrationLength") { PenetrationLength = penetrationLenghtMinValue; } } } public string GetRepairDescription(object subject, string property, string id) { if (id == "ZoneTypeSafety" && property == "StabilityZoneType") { return LocalizationManager.GetTranslatedText(this, "NoRequiredSafetyForZonesRepair"); } if (id == "AssignMinValue") { return LocalizationManager.GetTranslatedText(this, "AssignMinValue"); } if (id == "AssignMaxValue") { return LocalizationManager.GetTranslatedText(this, "AssignMaxValue"); } return ""; } #region IGeographic Members [Label("Zone type")] [Description("Type of zone to be used in stability calculations")] [PropertyOrder(4, 10)] [Category(AllCategory)] public MStabZonesType StabilityZoneType { get { return stabilityZoneType; } set { DataEventPublisher.BeforeChange(this, "StabilityZoneType"); stabilityZoneType = value; DataEventPublisher.AfterChange(this, "StabilityZoneType"); } } [Label("Forbidden zone factor")] [Description("Factor of zone to be used in stability calculations")] [Format("F2")] [Unit(UnitType.None)] [Minimum(0.0)] [Maximum(1.0)] [PropertyOrder(4, 11)] [Category(AllCategory)] public double ForbiddenZoneFactor { get { return forbiddenZoneFactor; } set { DataEventPublisher.BeforeChange(this, "ForbiddenZoneFactor"); forbiddenZoneFactor = value; DataEventPublisher.AfterChange(this, "ForbiddenZoneFactor"); } } [XmlIgnore] [Browsable(false)] public double X { get { return XRd; } set { XRd = value; } } [XmlIgnore] [Browsable(false)] public double Y { get { return YRd; } set { YRd = value; } } [Validate] public ValidationResult[] ValidateDikeEmbankmentMaterial() { if (DamProjectType == DamProjectType.Design && DamProjectCalculationSpecification.SelectedAnalysisType == AnalysisType.AdaptGeometry && !HasValidDikeEmbankmentMaterial()) { return new[] { new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "NoDikeEmbankmentMaterial"), this) }; } return new ValidationResult[0]; } [Validate] public ValidationResult[] ValidateLocationNewDikeTopWidth() { if (DamProjectType == DamProjectType.Design) { if ((UseNewDikeTopWidth) && (NewDikeTopWidth < newDikeTopWidthMinValue)) { return new[] { new ValidationResult(ValidationResultType.Error, String.Format(LocalizationManager.GetTranslatedText(this, "NewDikeTopWidthRangeError"), newDikeTopWidthMinValue), this, "NewDikeTopWidth", "AssignMinValue", this) }; } } return new ValidationResult[0]; } [Validate] public ValidationResult[] ValidateLocationNewDikeSlopeInside() { if (DamProjectType == DamProjectType.Design) { if ((UseNewDikeSlopeInside) && (NewDikeSlopeInside < newDikeSlopeInsideMinValue)) { return new[] { new ValidationResult(ValidationResultType.Error, String.Format(LocalizationManager.GetTranslatedText(this, "NewDikeSlopeInsideRangeError"), newDikeSlopeInsideMinValue), this, "NewDikeSlopeInside", "AssignMinValue", this) }; } } return new ValidationResult[0]; } [Validate] public ValidationResult[] ValidateLocationNewDikeSlopeOutside() { if (DamProjectType == DamProjectType.Design) { if ((UseNewDikeSlopeOutside) && (NewDikeSlopeOutside < newDikeSlopeOutsideMinValue)) { return new[] { new ValidationResult(ValidationResultType.Error, String.Format(LocalizationManager.GetTranslatedText(this, "NewDikeSlopeOutsideRangeError"), newDikeSlopeOutsideMinValue), this, "NewDikeSlopeOutside", "AssignMinValue", this) }; } } return new ValidationResult[0]; } /// /// Validates the use of the penetration length. /// /// Validation result [Validate] public ValidationResult[] ValidateLocationUseOfPenetrationLength() { string header = LocalizationManager.GetTranslatedText(this, "IntrusionVerticalWaterPressure"); string selectedModel = LocalizationManager.GetTranslatedText(this, IntrusionVerticalWaterPressure.ToString()); if ((PenetrationLength > 0) && (IntrusionVerticalWaterPressure != IntrusionVerticalWaterPressureType.SemiTimeDependent)) { return new[] { new ValidationResult(ValidationResultType.Warning, String.Format(LocalizationManager.GetTranslatedText(this, "UseOfPenetrationLengthWithoutSemiTimeDependentModel"), header, selectedModel), this, "PenetrationLength", "AssignMinValue", this) }; } if (PenetrationLength.IsLessThanOrEqualTo(0, 1e-6) && (IntrusionVerticalWaterPressure == IntrusionVerticalWaterPressureType.SemiTimeDependent)) { return new[] { new ValidationResult(ValidationResultType.Warning, String.Format(LocalizationManager.GetTranslatedText(this, "UseOfSemiTimeDependentModelWithoutPenetrationLength"), header, selectedModel), this) }; } return new ValidationResult[0]; } [Validate] public ValidationResult[] ValidateShoulderEmbankmentMaterial() { if (DamProjectType == DamProjectType.Design && DamProjectCalculationSpecification.SelectedAnalysisType == AnalysisType.AdaptGeometry && !HasValidShoulderEmbankmentMaterial()) { return new[] { new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "NoShoulderEmbankmentMaterial"), this) }; } return new ValidationResult[0]; } /// /// Validates the location has segment. /// /// [Validate] public ValidationResult[] ValidateLocationHasSegment() { if (Segment == null) { return new[] { new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "LocationHasNoSegment"), this) }; } return new ValidationResult[0]; } [Validate] public ValidationResult[] ValidateDikeEmbankmentMaterialDefinedIfSurfacelineAboveSoilProfile() { if (IsSurfaceLineAboveSoilProfile() && !HasValidDikeEmbankmentMaterial()) { return new[] { new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "NoDikeEmbankmentMaterialAndNeeded"), this) }; } return new ValidationResult[0]; } /// /// Check if DikeEmbankmentMaterial is defined and is available as soil /// /// private bool HasValidDikeEmbankmentMaterial() { return !String.IsNullOrEmpty(DikeEmbankmentMaterial) && GetDikeEmbankmentSoil() != null; } /// /// Check if ShoulderEmbankmentMaterial is defined and is available as soil /// /// private bool HasValidShoulderEmbankmentMaterial() { return !String.IsNullOrEmpty(ShoulderEmbankmentMaterial) && GetShoulderEmbankmentSoil() != null; } /// /// Determine if surfaceline is higher than any of the 1D soilprofiles /// /// private bool IsSurfaceLineAboveSoilProfile() { var isSurfaceLineAboveSoilProfile = false; if (Segment != null) { foreach (SoilGeometryProbability soilGeometryProbability in Segment.SoilProfileProbabilities) { SoilProfile1D soilProfile = soilGeometryProbability.SoilProfile; if (soilProfile != null) { isSurfaceLineAboveSoilProfile = isSurfaceLineAboveSoilProfile || (LocalXZSurfaceLine2.Geometry.GetMaxZ() > soilGeometryProbability.SoilProfile.TopLevel); } } } return isSurfaceLineAboveSoilProfile; } #endregion #region Design parameters [Label("Dike emb. material")] [Description("Dike embankment material")] [Category(AllCategory)] [PropertyOrder(5, 1)] public virtual string DikeEmbankmentMaterial { get { return dikeEmbankmentMaterial; } set { DataEventPublisher.BeforeChange(this, "DikeEmbankmentMaterial"); dikeEmbankmentMaterial = value; DataEventPublisher.AfterChange(this, "DikeEmbankmentMaterial"); } } [Label("Shoulder emb. material")] [Description("Shoulder embankment material")] [Category(DesignCategory)] [PropertyOrder(5, 2)] public virtual string ShoulderEmbankmentMaterial { get { return shoulderEmbankmentMaterial; } set { DataEventPublisher.BeforeChange(this, "ShoulderEmbankmentMaterial"); shoulderEmbankmentMaterial = value; DataEventPublisher.AfterChange(this, "ShoulderEmbankmentMaterial"); } } [Unit(UnitType.None)] [Label("Shoulder growth slope")] [Description("Shoulder growth slope for stability design")] [Format("F4")] [Category(DesignCategory)] [PropertyOrder(5, 3)] public virtual double StabilityShoulderGrowSlope { get { return stabilityShoulderGrowSlope; } set { DataEventPublisher.BeforeChange(this, "StabilityShoulderGrowSlope"); stabilityShoulderGrowSlope = value; DataEventPublisher.AfterChange(this, "StabilityShoulderGrowSlope"); } } [Unit(UnitType.Length)] [Label("Shoulder growth delta X")] [Description("Shoulder growth delta X for stability design")] [Format("F2")] [Category(DesignCategory)] [PropertyOrder(5, 4)] public virtual double StabilityShoulderGrowDeltaX { get { return stabilityShoulderGrowDeltaX; } set { DataEventPublisher.BeforeChange(this, "StabilityShoulderGrowDeltaX"); stabilityShoulderGrowDeltaX = value ; DataEventPublisher.AfterChange(this, "StabilityShoulderGrowDeltaX"); } } [Unit(UnitType.Length)] [Label("Slope adaption delta X")] [Description("Slope adaption delta X for stability design")] [Format("F2")] [Category(DesignCategory)] [PropertyOrder(5, 5)] public virtual double StabilitySlopeAdaptionDeltaX { get { return stabilitySlopeAdaptionDeltaX; } set { DataEventPublisher.BeforeChange(this, "StabilitySlopeAdaptionDeltaX"); stabilitySlopeAdaptionDeltaX = value; DataEventPublisher.AfterChange(this, "StabilitySlopeAdaptionDeltaX"); } } #endregion #region PLLine creation parameters /// /// Gets or sets the pl line creation method. /// /// /// The pl line creation method. /// [Label("PL-Line creation")] [Description("PL-Line creation method")] [Format("F3")] [Category(WaterCategory)] [PropertyOrder(3, 1)] public virtual PLLineCreationMethod PLLineCreationMethod { get { return pLLineCreationMethod; } set { DataEventPublisher.BeforeChange(this, "PLLineCreationMethod"); pLLineCreationMethod = value; DataEventPublisher.AfterChange(this, "PLLineCreationMethod"); } } /// /// Gets or sets the damping factor pl 3. /// /// /// The damping factor pl 3. /// [Unit(UnitType.None)] [Label("Damping factor PL3")] [Description("Damping factor PL3")] [Format("F3")] [Category(WaterCategory)] [PropertyOrder(2, 11)] [Minimum(0.0)] [Maximum(1.0)] public virtual double DampingFactorPL3 { get { return dampingFactorPL3; } set { DataEventPublisher.BeforeChange(this, "DampingFactorPL3"); dampingFactorPL3 = value; DataEventPublisher.AfterChange(this, "DampingFactorPL3"); } } /// /// Gets or sets the damping factor pl 4. /// /// /// The damping factor pl 4. /// [Unit(UnitType.None)] [Label("Damping factor PL4")] [Description("Damping factor PL4")] [Format("F3")] [Category(WaterCategory)] [PropertyOrder(2, 12)] [Minimum(0.0)] [Maximum(1.0)] public virtual double DampingFactorPL4 { get { return dampingFactorPL4; } set { DataEventPublisher.BeforeChange(this, "DampingFactorPL4"); dampingFactorPL4 = value; DataEventPublisher.AfterChange(this, "DampingFactorPL4"); } } /// /// Gets or sets the length of the penetration. /// /// /// The length of the penetration. /// [Unit(UnitType.Length)] [Label("Penetration length")] [Description("Penetration length (for PL2)")] [Format("F3")] [Category(WaterCategory)] [Minimum(0.0)] [PropertyOrder(2, 13)] public virtual double PenetrationLength { get { return penetrationLength; } set { DataEventPublisher.BeforeChange(this, "PenetrationLength"); penetrationLength = value; DataEventPublisher.AfterChange(this, "PenetrationLength"); } } /// /// Gets or sets the intrusion vertical water pressure. /// /// /// The intrusion vertical water pressure. /// [Category(WaterCategory)] [PropertyOrder(3, 18)] public IntrusionVerticalWaterPressureType? IntrusionVerticalWaterPressure { get { return intrusionVerticalWaterPressure; } set { DataEventPublisher.BeforeChange(this, x => x.IntrusionVerticalWaterPressure); intrusionVerticalWaterPressure = value; DataEventPublisher.AfterChange(this, x => x.IntrusionVerticalWaterPressure); } } #endregion #region IVisibleEnabled Members public bool IsEnabled(string property) { return true; } public bool IsVisible(string property) { bool isDesign = IsDesign(); // TODO: These string literals below should be replaced with the constants defined in LocationParameterNames switch (property) { case "ShoulderEmbankmentMaterial": return isDesign; case "StabilityShoulderGrowSlope": return isDesign; case "StabilityShoulderGrowDeltaX": return isDesign; case "StabilitySlopeAdaptionDeltaX": return isDesign; case "IntrusionVerticalWaterPressure": return true; case "RedesignDikeHeight": return isDesign; case "RedesignDikeShoulder": return isDesign; // these will always be shown case "StabilityDesignMethod": return true; case "SlopeAdaptionStartCotangent": return true; case "SlopeAdaptionEndCotangent": return true; case "SlopeAdaptionStepCotangent": return true; case "Name": return true; case "XRd": return true; case "YRd": return true; case "DikeRingId": return true; case "SegmentId": return true; case "Description": return true; case "TrafficLoad": return true; case "TL_DegreeOfConsolidation": return true; case "DampingFactorPL3": return true; case "DampingFactorPL4": return true; case "PenetrationLength": return true; case "SlopeDampingPiezometricHeightPolderSide": return true; case "PLLineCreationMethod": return true; case "MinimalCircleDepth": return true; case "StabilityZoneType": return true; case "DikeEmbankmentMaterial": return true; case "DistanceToEntryPoint": return isDesign; case "HasSensorData": return false; case "XRdDikeLine": return false; // The following design parameters are only visible for design option and when that design option does not involve the special Rijnland option. case "NewDikeTopWidth": case "UseNewDikeTopWidth": case "NewDikeSlopeInside": case "UseNewDikeSlopeInside": case "NewDikeSlopeOutside": case "UseNewDikeSlopeOutside": case "NewShoulderTopSlope": case "UseNewShoulderTopSlope": case "NewShoulderBaseSlope": case "UseNewShoulderBaseSlope": case "NewMaxHeightShoulderAsFraction": case "UseNewMaxHeightShoulderAsFraction": case "NewMinDistanceDikeToeStartDitch": case "UseNewMinDistanceDikeToeStartDitch": case "UseNewDitchDefinition": case "NewWidthDitchBottom": case "NewDepthDitch": case "NewSlopeAngleDitch": return isDesign && StabilityDesignMethod != StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption; default: return true; } } private bool IsDesign() { bool isDesign = (DamProjectType == DamProjectType.Design); return isDesign; } private bool ArePlLineCreationExpertKnowledgeParametersNeeded() { bool arePlLineCreationExpertKnowledgeParametersNeeded = PLLineCreationMethod == PLLineCreationMethod.ExpertKnowledgeRRD || PLLineCreationMethod == PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD; return arePlLineCreationExpertKnowledgeParametersNeeded; } #endregion #region Backwards compatibility #pragma warning disable CS0618 // Type or member is obsolete private SurfaceLine surfaceLine; #pragma warning restore CS0618 // Type or member is obsolete [Obsolete("Do not use this property; Only exists for backwards compatibility.", true)] [Browsable(false)] public virtual SurfaceLine LocalXZSurfaceLine { get { return null; } set { // Convert persisted 'old style surfaceline' into the new format, and discard the old one. LocalXZSurfaceLine2 = new OldSurfaceLineToNewConverter().Convert(value); value.Dispose(); } } /// /// Gets or sets the surface line /// /// Aggregate relationship from . [Browsable(false)] [Obsolete("Do not use this property; Exists only for backwards compatibility.", true)] public virtual SurfaceLine SurfaceLine { get { return surfaceLine; } set { surfaceLine = value; } } /// /// Allows this location instance to update its /// property if an old-style surfaceline was persisted. /// /// The potential replacement candidate for a persisted /// old-style surfaceline. public void SetNewSurfaceLineIfMatchesWithOldPersistedSurfaceLine(SurfaceLine2 otherSurfaceline) { if (surfaceLine != null && Equals(otherSurfaceline.Name, surfaceLine.Name)) { SurfaceLine2 = otherSurfaceline; surfaceLine.Dispose(); surfaceLine = null; } } #endregion }