using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using Deltares.Geotechnics; using Deltares.Geotechnics.ConePenetrationTest; using Deltares.Geotechnics.GeotechnicalGeometry; using Deltares.Geotechnics.Mechanisms; using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; using Deltares.Standard.Language; using Deltares.Standard.Validation; namespace Deltares.DeltaModel { /// /// Container of all key data, such as soil profiles, dike lines and revetment location and properties /// public class DeltaModel : IDomain, IVisibleEnabled { private readonly IDictionary ListDictionary = new Dictionary(); /// /// Initializes a new instance of the class. /// Initializes all collections /// public DeltaModel() { Regions = RegisterList(); AsphaltRegions = RegisterList(); BlockRevetmentRegions = RegisterList(); DikeLines = RegisterList(); CharacteristicLines = RegisterList(); SoilProfiles1D = RegisterList(); SoilProfiles2D = RegisterList(); SoilSegments = RegisterList(); CPTs = RegisterList(); CPTLookup1Ds = RegisterList(); CPTLookup2Ds = RegisterList(); Borings = RegisterList(); BoringLookup1Ds = RegisterList(); BoringLookup2Ds = RegisterList(); AsphaltZones = RegisterList(); RoughnessZones = RegisterList(); Structures = RegisterList(); BreakWaters = RegisterList(); PiezometricHeads = RegisterList(); WaveZones = RegisterList(); SurfaceLines = RegisterList(); SchematizedSurfaceLines = RegisterList(); Soils = new SoilList(); Soils.Soils = RegisterList(); HydraulicBoundaries = RegisterList(); BlockRevetmentCrossSections = RegisterList(); ListDictionary[typeof(TimeGeometryPointString)] = SurfaceLines; } /// /// Collection Regions /// A region is a geographic region, which comprises dike lines /// public List Regions { get; private set; } /// /// Collection of asphalt regions. /// [Mechanism(Mechanism.None, Mechanism.AsphaltRevetment)] public List AsphaltRegions { get; private set; } /// /// Collection of block revetment regions. /// [Mechanism(Mechanism.None, Mechanism.BlockRevetment)] public List BlockRevetmentRegions { get; private set; } /// /// Collection Dikelines /// A dike line is a ‘backbone’ of a dike and applicable for all failure mechanisms. The user can select points along the dike line to view properties such as a name. /// Points have global XYZ-coordinates and local L-coordinates along dike line. Locations can have name (labels) or L-coordinate indications (km-pole) /// public List DikeLines { get; private set; } /// /// Collection of characteristic lines, grouped per characteristic point type /// public List CharacteristicLines { get; private set; } /// /// Collection of characteristic points, grouped per characteristic point type /// public List CharacteristicPoints { get; private set; } /// /// Collection subsoil profiles (1D) /// The sub soil library contains a List of 1D soil profiles. /// Data for crossSection view /// [Mechanism(Mechanism.None, Mechanism.Piping, Mechanism.Stability, Mechanism.Dunes)] public List SoilProfiles1D { get; private set; } /// /// Collection subsoil profiles (2D) /// The sub soil library contains a List of 2D soil profiles. /// Data for crossSection view /// [Mechanism(Mechanism.None, Mechanism.Piping, Mechanism.Stability)] public List SoilProfiles2D { get; private set; } /// /// Collection (stochastic) soil segments /// Stochastic soil segment is line segment linked to a collection of 1D/2D soil profiles, each having a given probability of occurence /// public List SoilSegments { get; private set; } /// /// Collection CPTs (Cone Pressure Tests) /// public List CPTs { get; private set; } /// /// Collection CPT to SoilProfile1D relationships /// public List CPTLookup1Ds { get; private set; } /// /// Collection CPT to SoilProfile2D relationships /// public List CPTLookup2Ds { get; private set; } /// /// Collection Borings (Bore hole tests) /// public List Borings { get; private set; } /// /// Collection Boring to SoilProfile1D relationships /// public List BoringLookup1Ds { get; private set; } /// /// Collection Boring to SoilProfile2D relationships /// public List BoringLookup2Ds { get; private set; } /// /// Collection roughness zones /// Roughness zones are map polygons which are overlayed with the dike line and surfacelines to determine the roughness of surfaceline segments. /// [Mechanism(Mechanism.None)] [XmlOldName("Revetments")] public List RoughnessZones { get; private set; } /// /// Collection asphalt revetment zones /// Revetment zones are map polygons which are overlayed with the dike line and surfacelines to determine the asphalt characteristics of surfaceline segments. /// [Mechanism(Mechanism.None)] public List AsphaltZones { get; private set; } /// /// Collection structures /// Hydraulic Structures like gates, concrete defense walls, etc /// Structurs are line objects and have a begin and endpoint (location points). /// [ReadOnly(true)] [Mechanism(Mechanism.None)] public List Structures { get; private set; } /// /// Collection breakwater lines /// Breakwaters like dam caisson, rubble mound, are line objects. They have a begin and end point (location points). /// [Mechanism(Mechanism.Overtopping)] public List BreakWaters { get; private set; } /// /// Collection piezometric heads /// Piezometric Head is imported with key-data in the map editor as polygons. It is applied to all cross sections inside a particular polygon. /// [Mechanism(Mechanism.None, Mechanism.Piping, Mechanism.Stability)] public List PiezometricHeads { get; private set; } /// /// Collection of wave zone areas /// Wave zones are imported with key-data in the map editor as dike sections. It is applied to all cross sections inside a particular polygon. /// [Mechanism(Mechanism.None, Mechanism.Overtopping, Mechanism.BlockRevetment)] public List WaveZones { get; private set; } /// /// Gets the surface lines. /// public List SurfaceLines { get; private set; } /// /// Gets the surface lines. /// public List SchematizedSurfaceLines { get; private set; } /// /// Gets the soils /// [Mechanism(Mechanism.None, Mechanism.Piping, Mechanism.Stability)] [Label("SoilTypes")] public SoilList Soils { get; set; } /// /// List of boundary conditions from HydraRing dBase /// [ReadOnly(true)] [Browsable(false)] [Mechanism(Mechanism.AssessmentLevel, Mechanism.Overtopping, Mechanism.BlockRevetment, Mechanism.AsphaltRevetment, Mechanism.Structures)] public List HydraulicBoundaries { get; private set; } /// /// List of revetment crossections from Steentoets /// [ReadOnly(true)] [Browsable(false)] [Mechanism(Mechanism.None)] public List BlockRevetmentCrossSections { get; private set; } /// /// Default Fillmaterial to use when combining soil profile and surfaceline /// [Mechanism(Mechanism.None, Mechanism.Piping, Mechanism.Stability)] public Soil DefaultDikeEmbankmentMaterial { get; set; } /// /// Gets the list of the type. /// /// The type. /// List containing objects with given type /// no list available for type public IList GetListForType(Type type) { IList list; ListDictionary.TryGetValue(type, out list); if (list == null) { throw new ArgumentException("no list available for type " + type); } return list; } /// /// Sends an event for lists with stochasts /// public void UpdateListsWithStochasts() { foreach (var list in new IList[] { Soils.Soils, PiezometricHeads, Structures, BreakWaters, RoughnessZones }) { DataEventPublisher.DataListModified(list); } } /// /// Clears all lists. /// public virtual void ClearAllLists() { foreach (var list in ListDictionary.Values) { list.Clear(); DataEventPublisher.DataListModified(list); } } #region IDomain Members /// /// Gives a choice list for a certain property /// /// Property /// Choice list public ICollection GetDomain(string property) { switch (property) { case "Region": return Regions; case "Soil": return Soils.Soils; case "SoilProfile": return SoilProfiles1D; case "SurfaceLine": return SurfaceLines; case "PiezometricHead": case "PiezometricHead3": case "PiezometricHead4": return PiezometricHeads; case "BreakWater": case "BreakWaters": return BreakWaters; case "Structure": case "Structures": return Structures; case "RevetmentZone": case "RevetmentZones": return RoughnessZones; case "HydraulicBoundaries": return HydraulicBoundaries; default: return null; } } #endregion #region IVisibleEnabled Members /// /// Determines whether the specified property is enabled. /// /// The property. /// whether the specified property is enabled public bool IsEnabled(string propertyName) { return true; } /// /// Determines whether the specified property is visible. /// /// The property. /// whether the specified property is visible public bool IsVisible(string property) { return MechanismSupport.IsMechanismVisible(typeof(DeltaModel), property); } #endregion #region Validation /// /// Validates the delta model = checks if hydraulic boundaries are present /// /// validation result of delta model [Validate] public ValidationResult[] ValidateDeltaModel() { var results = new List(); //Hydraulic conditions if (HydraulicBoundaries.Count == 0) { results.Add(BuildErrorValidationResultForThis("NoHydraulicBoundariesMessage")); } return results.ToArray(); } /// /// returns a build error validation result for delta model. /// /// The message. /// build error private ValidationResult BuildErrorValidationResultForThis(string message) { return new ValidationResult(ValidationResultType.Error, this.Translate(message), this); } #endregion /// /// Initializes collections of given type /// /// given type /// registered list = initialized collection private List RegisterList() { var list = new List(); ListDictionary[typeof(T)] = list; return list; } } }