Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs =================================================================== diff -u -r6813 -r6873 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (.../Dike.cs) (revision 6813) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (.../Dike.cs) (revision 6873) @@ -28,8 +28,10 @@ using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; using Deltares.Geotechnics.Validation; +using Deltares.Maps; using Deltares.Standard; using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; using Deltares.Standard.Extensions; using Deltares.Standard.Language; using Deltares.Standard.Logging; @@ -50,6 +52,11 @@ [TrackChanges] public class Dike : IVisibleEnabled, IDisposable { + private readonly FeatureRepository backgroundRepository; + private IList featureList; + private IList segments; + private string waterLevelTimeSeriesFileName; + private IList locations; private SoilList soilList; @@ -61,15 +68,101 @@ Name = "Dijkring"; MapForSoilGeometries2D = ""; + featureList = new List(); + backgroundRepository = new FeatureRepository(); + segments = new List(); + locations = new List(); soilProfiles = new List(); SurfaceLines2 = new List(); soilList = new SoilList(); damSoils = new List(); } + + public virtual IList Segments + { + get + { + return segments; + } + set + { + segments = value; + } + } + + public virtual IList BackgroundRepositoryFeatures + { + get + { + return featureList; + } + set + { + featureList = value; + FillBackGroundRepos(); + } + } + // [XmlIgnore] + // [Browsable(false)] + // [ReadOnly(true)] + // [Label("Locations")] + // public List Locations + // { + // get + // { + // if (locations == null) + // { + // locations = new List(); + // if (Dike != null) + // { + // locations.AddRange(Dike.Locations); + // } + // } + // + // return locations; + // } + // } + public virtual string MapForSoilGeometries2D { get; set; } + + [Label("Waterlevel timeseries filename")] + public string WaterLevelTimeSeriesFileName + { + get + { + return waterLevelTimeSeriesFileName; + } + set + { + DataEventPublisher.BeforeChange(this, "WaterLevelTimeSeriesFileName"); + waterLevelTimeSeriesFileName = value; + DataEventPublisher.AfterChange(this, "WaterLevelTimeSeriesFileName"); + } + } + public void FillFeatureList() + { + foreach (IFeature feature in backgroundRepository.Features) + { + var featureStr = new BackgroundRepositoryFeature(); + featureStr.Feature = feature.WktFormat; + featureList.Add(featureStr); + } + } + + public void AddBackgroundGeometry(IFeature geometry) + { + backgroundRepository.Add(geometry); + } + + public Segment GetSegmentByName(string segmentId) + { + Segment segment = segments.Where(x => ((x.Name == segmentId))).FirstOrDefault(); + return segment; + } + public virtual string Name { get; set; } /// @@ -78,6 +171,9 @@ /// /// The locations. /// + [Browsable(false)] + [ReadOnly(true)] + [Label("Locations")] public virtual IList Locations { get => locations; @@ -419,7 +515,11 @@ public bool IsVisible(string property) { - return true; + switch (property) + { + case "WaterLevelTimeSeriesFileName": return Location.DamProjectType == DamProjectType.DamLiveConfiguration; + default: return true; + } } public bool IsEnabled(string property) @@ -513,6 +613,18 @@ return errorSoils; } + + private void FillBackGroundRepos() + { + if (featureList != null) + { + backgroundRepository.Clear(); + foreach (BackgroundRepositoryFeature s in featureList) + { + backgroundRepository.Add(Feature.Create(s.Feature)); + } + } + } /// /// Removes all locations which have profiles that have invalid soils