Index: data/D-Soil Model/SOS-data/SOSDatabase.soil =================================================================== diff -u -r109 -r361 Binary files differ Index: src/Deltares.DSoilModel.Data/DSoilModelProject.cs =================================================================== diff -u -r287 -r361 --- src/Deltares.DSoilModel.Data/DSoilModelProject.cs (.../DSoilModelProject.cs) (revision 287) +++ src/Deltares.DSoilModel.Data/DSoilModelProject.cs (.../DSoilModelProject.cs) (revision 361) @@ -11,14 +11,13 @@ using Deltares.Geotechnics.IO; using Deltares.Geotechnics.IO.Importers; using Deltares.Geotechnics.Mechanisms; -using Deltares.MStab; using Deltares.MStab.IO.Classic; +using Deltares.Probabilistic; using Deltares.Soilbase; using Deltares.Stability; using Deltares.Standard; using Deltares.Standard.EventPublisher; using Deltares.Standard.Forms; -using Deltares.Standard.IO.Xml; using Deltares.Standard.Language; using Deltares.Standard.Logging; using Deltares.Standard.Maps; @@ -398,6 +397,7 @@ /// public void ReadSoilProfiles1DFromFile(string fileName) { + var soilsCount = Soils.Soils.Count; var importer = new SosSoilProfilesImporter(); List profiles = importer.ReadSoilProfiles(fileName, Soils); foreach (var profile in profiles) @@ -406,6 +406,7 @@ } if (importer.ErrorMessages.Count > 0) { + // log the messages DataEventPublisher.InvokeAndPublish(() => { foreach (var msg in importer.ErrorMessages) @@ -414,6 +415,12 @@ } }); } + // missing soils may have been added ? + if (Soils.Soils.Count > soilsCount) + { + DataEventPublisher.DataListModified(Soils.Soils); + } + } /// @@ -925,6 +932,31 @@ private void DataEventPublisher_OnDataListModified(object sender, PublishEventArgs e) { + if (sender is List) + { + var args = e as DataListModifiedArgs; + if (args != null && (args.Action == ListModifyAction.Add || args.Action == ListModifyAction.Insert) && e.Objects.Length > 0) + { + // check the added soil(s) + foreach (var item in e.Objects) + { + var soil = item as Soil; + if (soil != null) + { + CheckSoilDefaults(soil); + } + } + } + else + { + // check all soils (event may be the result of an import action with missing soils) + foreach (var soil in Soils.Soils) + { + CheckSoilDefaults(soil); + } + } + } + if (sender == SoilSegments) { FilterSegments(); @@ -949,6 +981,21 @@ } } } + private void CheckSoilDefaults(Soil soil) + { + // see functional design document, some stochasts have a specific distribution type + if (soil.GetOrdinaryParameters().Count == 0 && soil.GetStochasticParameters().Count == 0) + { + soil.AbovePhreaticLevelStochast.DistributionType = DistributionType.LogNormal; + soil.AbovePhreaticLevelStochast.Shift = 0; + soil.BelowPhreaticLevelStochast.DistributionType = DistributionType.LogNormal; + soil.BelowPhreaticLevelStochast.Shift = 10.0; + soil.DiameterD70Stochast.DistributionType = DistributionType.LogNormal; + soil.DiameterD70Stochast.Shift = 10; + soil.PermeabKxStochast.DistributionType = DistributionType.LogNormal; + soil.PermeabKxStochast.Shift = 10.0; + } + } private void FilterSegments() {