Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj
===================================================================
diff -u -r6701 -r6713
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 6701)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 6713)
@@ -52,7 +52,7 @@
-
+
Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs
===================================================================
diff -u -r6436 -r6713
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (.../DataPluginImporter.cs) (revision 6436)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (.../DataPluginImporter.cs) (revision 6713)
@@ -29,7 +29,6 @@
using Deltares.Dam.Data.Importers;
using Deltares.Dam.Data.IO;
using Deltares.Geometry;
-using Deltares.Geotechnics.IO;
using Deltares.Geotechnics.Soils;
using Deltares.Geotechnics.SurfaceLines;
using Deltares.Maps;
Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/SoilParameterNames.cs
===================================================================
diff -u
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/SoilParameterNames.cs (revision 0)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/SoilParameterNames.cs (revision 6713)
@@ -0,0 +1,244 @@
+// Copyright (C) Stichting Deltares 2025. 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.Collections.Generic;
+
+namespace Deltares.Dam.Data
+{
+ ///
+ /// Soil Parameter Names (String constants)
+ ///
+ public static class SoilParameterNames
+ {
+ public const string Color = "SoilColor";
+
+ // Piping deterministic
+ public const string SoilType = "SoilSoilType";
+ public const string DiameterD70 = "SoilDiameterD70";
+ public const string WhitesConstant = "SoilWhitesConstant";
+ public const string BeddingAngle = "SoilBeddingAngle";
+ public const string PermeabKx = "SoilPermeabKx";
+ public const string IsAquifer = "SoilIsAquifer"; // name of the former soilparameter IsAquifer. That is now moved to SoilLayer.
+
+ // Piping probabilistic
+ public const string StdDiameterD70 = "SoilStdDiameterD70";
+ public const string DistDiameterD70 = "SoilDistDiameterD70";
+ public const string StdPermeabKx = "SoilStdPermeabKx";
+ public const string DistPermeabKx = "SoilDistPermeabKx";
+ public const string StdWhitesConstant = "SoilStdWhitesConstant";
+ public const string DistWhitesConstant = "SoilDistWhitesConstant";
+ public const string StdBeddingAngle = "SoilStdBeddingAngle";
+ public const string DistBeddingAngle = "SoilDistBeddingAngle";
+
+ // Stability
+ ///
+ /// The above phreatic level
+ ///
+ public const string AbovePhreaticLevel = "SoilGamDry";
+
+ ///
+ /// The dist above phreatic level
+ ///
+ public const string DistAbovePhreaticLevel = "SoilDistGamDry";
+
+ ///
+ /// The standard above phreatic level
+ ///
+ public const string StdAbovePhreaticLevel = "SoilStdGamDry";
+
+ ///
+ /// The below phreatic level
+ ///
+ public const string BelowPhreaticLevel = "SoilGamWet";
+
+ ///
+ /// The dist below phreatic level
+ ///
+ public const string DistBelowPhreaticLevel = "SoilDistGamWet";
+
+ ///
+ /// The standard below phreatic level
+ ///
+ public const string StdBelowPhreaticLevel = "SoilStdGamWet";
+
+ public const string OvenDry = "SoilGamOvenDry";
+ public const string ExcessPorePressure = "SoilExcessPorePressure";
+ public const string PorePressureFactor = "SoilPorePressureFactor";
+ public const string Cohesion = "SoilCohesion";
+ public const string Phi = "SoilPhi";
+ public const string CuTop = "SoilCuTop";
+ public const string CuGradient = "SoilCuGradient";
+ public const string RatioCuPc = "SoilRatioCuPc";
+ public const string RatioCuPcPassive = "SoilRatioCuPcPassive";
+ public const string RatioCuPcActive = "SoilRatioCuPcActive";
+ public const string ShearStrengthModel = "SoilShearStrengthModel";
+ public const string MatStrengthType = "SoilMatStrengthType";
+ public const string ProbInputValues = "SoilProbInputValues";
+ public const string UseProbDefaults = "SoilUseProbDefaults";
+ public const string StdCohesion = "SoilStdCohesion";
+ public const string StdPhi = "SoilStdPhi";
+ public const string StdPn = "SoilStdPn";
+ public const string StdPOP = "SoilStdPOP";
+ public const string DistCohesion = "SoilDistCohesion";
+ public const string DistPhi = "SoilDistPhi";
+ public const string DistStressTable = "SoilDistStressTable";
+ public const string DistPn = "SoilDistPn";
+ public const string DistPOP = "SoilDistPOP";
+ public const string CorrelationCPhi = "SoilCorrelationCPhi";
+ public const string POP = "SoilPOP";
+ public const string StrengthIncreaseExponent = "SoilStrengthIncreaseExponent";
+ public const string StrengthIncreaseExponentOld = "StrengthIncreaseExponent"; // This is used in MSoilbase 14.1
+ public const string OCR = "SoilOCR";
+ public const string DesignPartialCohesion = "SoilDesignPartialCohesion";
+ public const string DesignStdCohesion = "SoilDesignStdCohesion";
+ public const string DesignPartialPhi = "SoilDesignPartialPhi";
+ public const string DesignStdPhi = "SoilDesignStdPhi";
+ public const string DesignPartialStressTable = "SoilDesignPartialStressTable";
+ public const string DesignStdStressTable = "SoilDesignStdStressTable";
+ public const string DesignPartialPOP = "SoilDesignPartialPOP";
+ public const string DesignStdPOP = "SoilDesignStdPOP";
+ public const string DesignPartialRRatio = "SoilDesignPartialRRatio";
+ public const string DesignStdRRatio = "SoilDesignStdRRatio";
+ public const string SoilGroup = "SoilSoilGroup";
+ public const string UseSoilType = "SoilUseSoilType";
+ public const string RRatio = "SoilRRatio";
+ public const string StdRRatio = "SoilStdRRatio";
+ public const string DistRRatio = "SoilDistRRatio";
+ public const string StdRatioCuPc = "SoilStdRatioCuPc";
+ public const string DistRatioCuPc = "SoilDistRatioCuPc";
+ public const string StressTableName = "SoilStressTableName";
+ public const string SuTableName = "SoilSuTableName";
+ public const string BondStressTableName = "SoilBondStressTableName";
+
+ public const string EMod = "EMod";
+
+ ///
+ /// The diameter D15
+ ///
+ public const string DiameterD15 = "SoilDiameterD15";
+
+ ///
+ /// The diameter D50
+ ///
+ public const string DiameterD50 = "SoilDiameterD50";
+
+ ///
+ /// The porosity
+ ///
+ public const string Porosity = "SoilPorosity";
+
+ ///
+ /// The use pop
+ ///
+ public const string UsePop = "IsPopCalculated";
+
+ ///
+ /// Gets the parameter names.
+ ///
+ ///
+ /// The parameter names.
+ ///
+ public static IList ParameterNames
+ {
+ get
+ {
+ return FillNamesList();
+ }
+ }
+
+ private static List FillNamesList()
+ {
+ var parameterNames = new List
+ {
+ Color,
+ SoilType,
+ DiameterD70,
+ WhitesConstant,
+ BeddingAngle,
+ PermeabKx,
+ IsAquifer,
+ StdDiameterD70,
+ DistDiameterD70,
+ StdPermeabKx,
+ DistPermeabKx,
+ StdWhitesConstant,
+ DistWhitesConstant,
+ StdBeddingAngle,
+ DistBeddingAngle,
+ AbovePhreaticLevel,
+ DistAbovePhreaticLevel,
+ StdAbovePhreaticLevel,
+ BelowPhreaticLevel,
+ DistBelowPhreaticLevel,
+ StdBelowPhreaticLevel,
+ OvenDry,
+ ExcessPorePressure,
+ PorePressureFactor,
+ Cohesion,
+ Phi,
+ RatioCuPc,
+ RatioCuPcPassive,
+ RatioCuPcActive,
+ ShearStrengthModel,
+ UseProbDefaults,
+ StdCohesion,
+ StdPhi,
+ StdPn,
+ StdPOP,
+ DistCohesion,
+ DistPhi,
+ DistStressTable,
+ DistPn,
+ DistPOP,
+ CorrelationCPhi,
+ POP,
+ StrengthIncreaseExponent,
+ OCR,
+ DesignPartialCohesion,
+ DesignStdCohesion,
+ DesignPartialPhi,
+ DesignStdPhi,
+ DesignPartialStressTable,
+ DesignStdStressTable,
+ DesignPartialPOP,
+ DesignStdPOP,
+ DesignPartialRRatio,
+ DesignStdRRatio,
+ SoilGroup,
+ UseSoilType,
+ RRatio,
+ StdRRatio,
+ DistRRatio,
+ StdRatioCuPc,
+ DistRatioCuPc,
+ EMod,
+ StressTableName,
+ SuTableName,
+ BondStressTableName,
+ DiameterD15,
+ DiameterD50,
+ Porosity,
+ UsePop
+ };
+ return parameterNames;
+ }
+ }
+}
\ No newline at end of file
Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs
===================================================================
diff -u -r6436 -r6713
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (.../WaterBoardImporter.cs) (revision 6436)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (.../WaterBoardImporter.cs) (revision 6713)
@@ -27,7 +27,6 @@
using Deltares.Dam.Data.DataPlugins.Configuration;
using Deltares.Geometry;
using Deltares.Geotechnics.GeotechnicalGeometry;
-using Deltares.Geotechnics.IO;
using Deltares.Geotechnics.Soils;
using Deltares.Geotechnics.SurfaceLines;
using Deltares.Maps;
Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/SoilUtils.cs
===================================================================
diff -u
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/SoilUtils.cs (revision 0)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/SoilUtils.cs (revision 6713)
@@ -0,0 +1,1324 @@
+// Copyright (C) Stichting Deltares 2025. 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.Generic;
+using System.Drawing;
+using System.Globalization;
+using Deltares.Geotechnics.Soils;
+using Deltares.Probabilistic;
+
+namespace Deltares.Dam.Data
+{
+ ///
+ /// Exception when soil type is not found
+ ///
+ ///
+ public class SoilTypeNotFoundException : Exception {}
+
+ ///
+ /// SoilUtils contains some general utility functions that were moved here from the Soil class (also used by DAM) as they are considered obsolete
+ ///
+ public static class SoilUtils
+ {
+ ///
+ /// The Soiltypes that are stored in the database
+ ///
+ private enum SoilBaseSoilType
+ {
+ Gravel = 1,
+ Sand = 2,
+ Loam = 3,
+ Clay = 4,
+ Peat = 5,
+ TertClay = 6,
+ SandyLoam = 7,
+ ClayeySand = 8
+ }
+
+ private static readonly Soil DefaultSoil = new Soil();
+
+ ///
+ /// Gets the database parameter list.
+ ///
+ /// The soil.
+ /// The dictionary containing the database parameters
+ public static Dictionary GetDatabaseParameterList(Soil soil)
+ {
+ var nameValuePairs = new Dictionary
+ {
+ {
+ SoilParameterNames.Color, soil.Color.ToArgb()
+ },
+ {
+ SoilParameterNames.SoilType, (int) soil.SoilType
+ }
+ };
+
+ // General
+ // Piping
+ if (soil.GetPropertyIsAssigned("DiameterD70"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DiameterD70, soil.DiameterD70);
+ }
+
+ if (soil.GetPropertyIsAssigned("WhitesConstant"))
+ {
+ nameValuePairs.Add(SoilParameterNames.WhitesConstant, soil.WhitesConstant);
+ }
+
+ if (soil.GetPropertyIsAssigned("BeddingAngle"))
+ {
+ nameValuePairs.Add(SoilParameterNames.BeddingAngle, soil.BeddingAngle);
+ }
+
+ if (soil.GetPropertyIsAssigned("PermeabKx"))
+ {
+ nameValuePairs.Add(SoilParameterNames.PermeabKx, soil.PermeabKx);
+ }
+
+ // // IsAquifer property has moved to SoilLayer
+ //if (soil.GetPropertyIsAssigned("IsAquifer"))
+ // nameValuePairs.Add(SoilParameterNames.IsAquifer, ToInt(isAquifer));
+
+ if (soil.GetPropertyIsAssigned("StdDiameterD70"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StdDiameterD70, soil.DiameterD70Stochast.Deviation);
+ }
+
+ if (soil.GetPropertyIsAssigned("DistDiameterD70"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DistDiameterD70, (int) soil.DiameterD70Stochast.DistributionType);
+ }
+
+ if (soil.GetPropertyIsAssigned("StdPermeabKx"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StdPermeabKx, soil.PermeabKxStochast.Deviation);
+ }
+
+ if (soil.GetPropertyIsAssigned("StdWhitesConstant"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StdWhitesConstant, soil.WhitesConstantStochast.Deviation);
+ }
+
+ if (soil.GetPropertyIsAssigned("DistPermeabKx"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DistPermeabKx, (int) soil.PermeabKxStochast.DistributionType);
+ }
+
+ if (soil.GetPropertyIsAssigned("DistWhitesConstant"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DistWhitesConstant, (int) soil.WhitesConstantStochast.DistributionType);
+ }
+
+ if (soil.GetPropertyIsAssigned("DistBeddingAngle"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DistBeddingAngle, (int) soil.BeddingAngleStochast.DistributionType);
+ }
+
+ if (soil.GetPropertyIsAssigned("StdBeddingAngle"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StdBeddingAngle, soil.BeddingAngleStochast.Deviation);
+ }
+
+ // Stability
+ if (soil.GetPropertyIsAssigned("AbovePhreaticLevel"))
+ {
+ nameValuePairs.Add(SoilParameterNames.AbovePhreaticLevel, soil.AbovePhreaticLevel);
+ }
+
+ if (soil.GetPropertyIsAssigned("BelowPhreaticLevel"))
+ {
+ nameValuePairs.Add(SoilParameterNames.BelowPhreaticLevel, soil.BelowPhreaticLevel);
+ }
+
+ if (soil.GetPropertyIsAssigned("DryUnitWeight"))
+ {
+ nameValuePairs.Add(SoilParameterNames.OvenDry, soil.DryUnitWeight);
+ }
+
+ if (soil.GetPropertyIsAssigned("ExcessPorePressure"))
+ {
+ nameValuePairs.Add(SoilParameterNames.ExcessPorePressure, soil.ExcessPorePressure);
+ }
+
+ if (soil.GetPropertyIsAssigned("PorePressureFactor"))
+ {
+ nameValuePairs.Add(SoilParameterNames.PorePressureFactor, soil.PorePressureFactor);
+ }
+
+ if (soil.GetPropertyIsAssigned("Cohesion"))
+ {
+ nameValuePairs.Add(SoilParameterNames.Cohesion, soil.Cohesion);
+ }
+
+ if (soil.GetPropertyIsAssigned("FrictionAngle"))
+ {
+ nameValuePairs.Add(SoilParameterNames.Phi, soil.FrictionAngle);
+ }
+
+ if (soil.GetPropertyIsAssigned("CuTop"))
+ {
+ nameValuePairs.Add(SoilParameterNames.CuTop, soil.CuTop);
+ }
+
+ if (soil.GetPropertyIsAssigned("CuGradient"))
+ {
+ nameValuePairs.Add(SoilParameterNames.CuGradient, soil.CuGradient);
+ }
+
+ if (soil.GetPropertyIsAssigned("RatioCuPc"))
+ {
+ nameValuePairs.Add(SoilParameterNames.RatioCuPc, soil.RatioCuPc);
+ }
+
+ if (soil.GetPropertyIsAssigned("RatioCuPcActive"))
+ {
+ nameValuePairs.Add(SoilParameterNames.RatioCuPcActive, soil.RatioCuPcActive);
+ }
+
+ if (soil.GetPropertyIsAssigned("RatioCuPcPassive"))
+ {
+ nameValuePairs.Add(SoilParameterNames.RatioCuPcPassive, soil.RatioCuPcPassive);
+ }
+
+ if (soil.GetPropertyIsAssigned("ShearStrengthModel"))
+ {
+ nameValuePairs.Add(SoilParameterNames.ShearStrengthModel, (int) soil.ShearStrengthModel);
+ }
+
+ if (soil.GetPropertyIsAssigned("useDefaultProbabilisticValues"))
+ {
+ nameValuePairs.Add(SoilParameterNames.UseProbDefaults, ToInt(soil.UseDefaultProbabilisticValues));
+ }
+
+ if (soil.CohesionStochast.Deviation != DefaultSoil.CohesionStochast.Deviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.StdCohesion, soil.CohesionStochast.Deviation);
+ }
+
+ if (soil.FrictionAngleStochast.Deviation != DefaultSoil.FrictionAngleStochast.Deviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.StdPhi, soil.FrictionAngleStochast.Deviation);
+ }
+
+ if (soil.PnStochast.Deviation != DefaultSoil.PnStochast.Deviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.StdPn, soil.PnStochast.Deviation);
+ }
+
+ if (soil.POPStochast.Deviation != DefaultSoil.POPStochast.Deviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.StdPOP, soil.POPStochast.Deviation);
+ }
+
+ if (soil.CohesionStochast.DistributionType != DefaultSoil.CohesionStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistCohesion, (int) soil.CohesionStochast.DistributionType);
+ }
+
+ if (soil.FrictionAngleStochast.DistributionType != DefaultSoil.FrictionAngleStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistPhi, (int) soil.FrictionAngleStochast.DistributionType);
+ }
+
+ if (soil.StressTableStochast.DistributionType != DefaultSoil.StressTableStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistStressTable, (int) soil.StressTableStochast.DistributionType);
+ }
+
+ if (soil.PnStochast.DistributionType != DefaultSoil.PnStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistPn, (int) soil.PnStochast.DistributionType);
+ }
+
+ if (soil.POPStochast.DistributionType != DefaultSoil.POPStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistPOP, (int) soil.POPStochast.DistributionType);
+ }
+
+ if (soil.GetPropertyIsAssigned("CorrelationCPhi"))
+ {
+ nameValuePairs.Add(SoilParameterNames.CorrelationCPhi, soil.CorrelationCPhi);
+ }
+
+ if (soil.GetPropertyIsAssigned("POP"))
+ {
+ nameValuePairs.Add(SoilParameterNames.POP, soil.POP);
+ }
+
+ if (soil.GetPropertyIsAssigned("StrengthIncreaseExponent"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StrengthIncreaseExponent, soil.StrengthIncreaseExponent);
+ }
+
+ if (soil.CohesionStochast.DesignFactor != DefaultSoil.CohesionStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialCohesion, soil.CohesionStochast.DesignFactor);
+ }
+
+ if (soil.CohesionStochast.DesignDeviation != DefaultSoil.CohesionStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdCohesion, soil.CohesionStochast.DesignDeviation);
+ }
+
+ if (soil.FrictionAngleStochast.DesignFactor != DefaultSoil.FrictionAngleStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialPhi, soil.FrictionAngleStochast.DesignFactor);
+ }
+
+ if (soil.FrictionAngleStochast.DesignDeviation != DefaultSoil.FrictionAngleStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdPhi, soil.FrictionAngleStochast.DesignDeviation);
+ }
+
+ if (soil.StressTableStochast.DesignFactor != DefaultSoil.StressTableStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialStressTable, soil.StressTableStochast.DesignFactor);
+ }
+
+ if (soil.StressTableStochast.DesignDeviation != DefaultSoil.StressTableStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdStressTable, soil.StressTableStochast.DesignDeviation);
+ }
+
+ if (soil.POPStochast.DesignFactor != DefaultSoil.POPStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialPOP, soil.POPStochast.DesignFactor);
+ }
+
+ if (soil.POPStochast.DesignDeviation != DefaultSoil.POPStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdPOP, soil.POPStochast.DesignDeviation);
+ }
+
+ if (soil.RRatioStochast.DesignFactor != DefaultSoil.RRatioStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialRRatio, soil.RRatioStochast.DesignFactor);
+ }
+
+ if (soil.RRatioStochast.DesignDeviation != DefaultSoil.RRatioStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdRRatio, soil.RRatioStochast.DesignDeviation);
+ }
+
+ if (soil.GetPropertyIsAssigned("SoilGroup"))
+ {
+ nameValuePairs.Add(SoilParameterNames.SoilGroup, soil.SoilGroup);
+ }
+
+ if (soil.GetPropertyIsAssigned("UseSoilType"))
+ {
+ nameValuePairs.Add(SoilParameterNames.UseSoilType, ToInt(soil.UseSoilType));
+ }
+
+ if (soil.GetPropertyIsAssigned("RRatio"))
+ {
+ nameValuePairs.Add(SoilParameterNames.RRatio, soil.RRatio);
+ }
+
+ return nameValuePairs;
+ }
+
+ ///
+ /// Get a list of all soil parameters
+ ///
+ /// list of name/value pair strings with soil parameters
+ public static Dictionary GetParametersAsNameValuePairs(Soil soil)
+ {
+ var numberFormatInfo = new NumberFormatInfo
+ {
+ NumberDecimalSeparator = "."
+ };
+ // General
+ var nameValuePairs = new Dictionary
+ {
+ {
+ SoilParameterNames.Color, soil.Color.ToArgb().ToString(numberFormatInfo)
+ },
+ {
+ SoilParameterNames.SoilType, soil.SoilType.ToString()
+ }
+ };
+ // Piping
+ if (soil.GetPropertyIsAssigned("DiameterD70"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DiameterD70, soil.DiameterD70.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("WhitesConstant"))
+ {
+ nameValuePairs.Add(SoilParameterNames.WhitesConstant, soil.WhitesConstant.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("BeddingAngle"))
+ {
+ nameValuePairs.Add(SoilParameterNames.BeddingAngle, soil.BeddingAngle.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("PermeabKx"))
+ {
+ nameValuePairs.Add(SoilParameterNames.PermeabKx, soil.PermeabKx.ToString(numberFormatInfo));
+ }
+
+ // // IsAquifer property has moved to SoilLayer
+ // if (soil.GetPropertyIsAssigned("IsAquifer"))
+ // nameValuePairs.Add(SoilParameterNames.IsAquifer, soil.IsAquifer.ToString(numberFormatInfo));
+
+ if (soil.GetPropertyIsAssigned("StdDiameterD70"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StdDiameterD70, soil.DiameterD70Stochast.Deviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("DistDiameterD70"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DistDiameterD70, soil.DiameterD70Stochast.DistributionType.ToString());
+ }
+
+ if (soil.GetPropertyIsAssigned("StdPermeabKx"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StdPermeabKx, soil.PermeabKxStochast.Deviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("StdWhitesConstant"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StdWhitesConstant, soil.WhitesConstantStochast.Deviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("DistPermeabKx"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DistPermeabKx, soil.PermeabKxStochast.DistributionType.ToString());
+ }
+
+ if (soil.GetPropertyIsAssigned("DistWhitesConstant"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DistWhitesConstant, soil.WhitesConstantStochast.DistributionType.ToString());
+ }
+
+ if (soil.GetPropertyIsAssigned("DistBeddingAngle"))
+ {
+ nameValuePairs.Add(SoilParameterNames.DistBeddingAngle, soil.BeddingAngleStochast.DistributionType.ToString());
+ }
+
+ if (soil.GetPropertyIsAssigned("StdBeddingAngle"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StdBeddingAngle, soil.BeddingAngleStochast.Deviation.ToString(numberFormatInfo));
+ }
+
+ // Stability
+ if (soil.GetPropertyIsAssigned("AbovePhreaticLevel"))
+ {
+ nameValuePairs.Add(SoilParameterNames.AbovePhreaticLevel, soil.AbovePhreaticLevel.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("BelowPhreaticLevel"))
+ {
+ nameValuePairs.Add(SoilParameterNames.BelowPhreaticLevel, soil.BelowPhreaticLevel.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("DryUnitWeight"))
+ {
+ nameValuePairs.Add(SoilParameterNames.OvenDry, soil.DryUnitWeight.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("ExcessPorePressure"))
+ {
+ nameValuePairs.Add(SoilParameterNames.ExcessPorePressure, soil.ExcessPorePressure.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("PorePressureFactor"))
+ {
+ nameValuePairs.Add(SoilParameterNames.PorePressureFactor, soil.PorePressureFactor.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("Cohesion"))
+ {
+ nameValuePairs.Add(SoilParameterNames.Cohesion, soil.Cohesion.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("FrictionAngle"))
+ {
+ nameValuePairs.Add(SoilParameterNames.Phi, soil.FrictionAngle.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("RatioCuPc"))
+ {
+ nameValuePairs.Add(SoilParameterNames.RatioCuPc, soil.RatioCuPc.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("RatioCuPcActive"))
+ {
+ nameValuePairs.Add(SoilParameterNames.RatioCuPcActive, soil.RatioCuPcActive.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("RatioCuPcPassive"))
+ {
+ nameValuePairs.Add(SoilParameterNames.RatioCuPcPassive, soil.RatioCuPcPassive.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("ShearStrengthModel"))
+ {
+ nameValuePairs.Add(SoilParameterNames.ShearStrengthModel, soil.ShearStrengthModel.ToString());
+ }
+
+ if (soil.GetPropertyIsAssigned("useDefaultProbabilisticValues"))
+ {
+ nameValuePairs.Add(SoilParameterNames.UseProbDefaults, soil.UseDefaultProbabilisticValues.ToString(numberFormatInfo));
+ }
+
+ if (soil.CohesionStochast.Deviation != DefaultSoil.CohesionStochast.Deviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.StdCohesion, soil.CohesionStochast.Deviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.FrictionAngleStochast.Deviation != DefaultSoil.FrictionAngleStochast.Deviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.StdPhi, soil.FrictionAngleStochast.Deviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.PnStochast.Deviation != DefaultSoil.PnStochast.Deviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.StdPn, soil.PnStochast.Deviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.POPStochast.Deviation != DefaultSoil.POPStochast.Deviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.StdPOP, soil.POPStochast.Deviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.CohesionStochast.DistributionType != DefaultSoil.CohesionStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistCohesion, soil.CohesionStochast.DistributionType.ToString());
+ }
+
+ if (soil.FrictionAngleStochast.DistributionType != DefaultSoil.FrictionAngleStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistPhi, soil.FrictionAngleStochast.DistributionType.ToString());
+ }
+
+ if (soil.StressTableStochast.DistributionType != DefaultSoil.StressTableStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistStressTable, soil.StressTableStochast.DistributionType.ToString());
+ }
+
+ if (soil.PnStochast.DistributionType != DefaultSoil.PnStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistPn, soil.PnStochast.DistributionType.ToString());
+ }
+
+ if (soil.POPStochast.DistributionType != DefaultSoil.POPStochast.DistributionType)
+ {
+ nameValuePairs.Add(SoilParameterNames.DistPOP, soil.POPStochast.DistributionType.ToString());
+ }
+
+ if (soil.GetPropertyIsAssigned("CorrelationCPhi"))
+ {
+ nameValuePairs.Add(SoilParameterNames.CorrelationCPhi, soil.CorrelationCPhi.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("POP"))
+ {
+ nameValuePairs.Add(SoilParameterNames.POP, soil.POP.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("StrengthIncreaseExponent"))
+ {
+ nameValuePairs.Add(SoilParameterNames.StrengthIncreaseExponent, soil.StrengthIncreaseExponent.ToString(numberFormatInfo));
+ }
+
+ if (soil.CohesionStochast.DesignFactor != DefaultSoil.CohesionStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialCohesion, soil.CohesionStochast.DesignFactor.ToString(numberFormatInfo));
+ }
+
+ if (soil.CohesionStochast.DesignDeviation != DefaultSoil.CohesionStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdCohesion, soil.CohesionStochast.DesignDeviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.FrictionAngleStochast.DesignFactor != DefaultSoil.FrictionAngleStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialPhi, soil.FrictionAngleStochast.DesignFactor.ToString(numberFormatInfo));
+ }
+
+ if (soil.FrictionAngleStochast.DesignDeviation != DefaultSoil.FrictionAngleStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdPhi, soil.FrictionAngleStochast.DesignDeviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.StressTableStochast.DesignFactor != DefaultSoil.StressTableStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialStressTable, soil.StressTableStochast.DesignFactor.ToString(numberFormatInfo));
+ }
+
+ if (soil.StressTableStochast.DesignDeviation != DefaultSoil.StressTableStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdStressTable, soil.StressTableStochast.DesignDeviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.POPStochast.DesignFactor != DefaultSoil.POPStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialPOP, soil.POPStochast.DesignFactor.ToString(numberFormatInfo));
+ }
+
+ if (soil.POPStochast.DesignDeviation != DefaultSoil.POPStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdPOP, soil.POPStochast.DesignDeviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.RRatioStochast.DesignFactor != DefaultSoil.RRatioStochast.DesignFactor)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignPartialRRatio, soil.RRatioStochast.DesignFactor.ToString(numberFormatInfo));
+ }
+
+ if (soil.RRatioStochast.DesignDeviation != DefaultSoil.RRatioStochast.DesignDeviation)
+ {
+ nameValuePairs.Add(SoilParameterNames.DesignStdRRatio, soil.RRatioStochast.DesignDeviation.ToString(numberFormatInfo));
+ }
+
+ if (soil.GetPropertyIsAssigned("SoilGroup"))
+ {
+ nameValuePairs.Add(SoilParameterNames.SoilGroup, soil.SoilGroup.ToString(numberFormatInfo));
+ }
+
+ if (soil.UseSoilType != DefaultSoil.UseSoilType)
+ {
+ nameValuePairs.Add(SoilParameterNames.UseSoilType, soil.UseSoilType.ToString());
+ }
+
+ if (soil.GetPropertyIsAssigned("RRatio"))
+ {
+ nameValuePairs.Add(SoilParameterNames.RRatio, soil.RRatio.ToString(numberFormatInfo));
+ }
+
+ return nameValuePairs;
+ }
+
+ ///
+ /// Set soil property to value
+ ///
+ /// The soil.
+ /// Name of the parameter.
+ /// The parameter value.
+ ///
+ ///
+ public static void SetSoilParameter(Soil soil, string parameterName, double parameterValue)
+ {
+ switch (parameterName)
+ {
+ case SoilParameterNames.Color:
+ Color colorBGR = Color.FromArgb((int) parameterValue);
+ soil.Color = Color.FromArgb(255, colorBGR.B, colorBGR.G, colorBGR.R);
+ break;
+ case SoilParameterNames.SoilType:
+ var soilBaseSoilType = (SoilBaseSoilType) Math.Round(parameterValue);
+ switch (soilBaseSoilType)
+ {
+ case SoilBaseSoilType.Gravel:
+ soil.SoilType = SoilType.Gravel;
+ break;
+ case SoilBaseSoilType.Sand:
+ soil.SoilType = SoilType.Sand;
+ break;
+ case SoilBaseSoilType.Loam:
+ soil.SoilType = SoilType.Loam;
+ break;
+ case SoilBaseSoilType.Clay:
+ soil.SoilType = SoilType.Clay;
+ break;
+ case SoilBaseSoilType.Peat:
+ soil.SoilType = SoilType.Peat;
+ break;
+ case SoilBaseSoilType.TertClay:
+ soil.SoilType = SoilType.Clay;
+ break;
+ case SoilBaseSoilType.SandyLoam:
+ soil.SoilType = SoilType.Loam;
+ break;
+ case SoilBaseSoilType.ClayeySand:
+ soil.SoilType = SoilType.Sand;
+ break;
+ default:
+ throw new SoilTypeNotFoundException();
+ }
+
+ break;
+ case SoilParameterNames.DiameterD70:
+ soil.DiameterD70 = parameterValue * 1e-6;
+ soil.DiameterD70Stochast.Mean = parameterValue * 1e-6;
+ soil.DiameterD70Stochast.ActualValue = parameterValue * 1e-6;
+ break;
+ case SoilParameterNames.DiameterD50:
+ soil.DiameterD50 = parameterValue * 1e-3;
+ soil.DiameterD50Stochast.Mean = parameterValue * 1e-3;
+ soil.DiameterD50Stochast.ActualValue = parameterValue * 1e-3;
+ break;
+ case SoilParameterNames.DiameterD15:
+ soil.DiameterD15 = parameterValue * 1e-3;
+ break;
+ case SoilParameterNames.Porosity:
+ soil.Porosity = parameterValue;
+ break;
+ case SoilParameterNames.WhitesConstant:
+ soil.WhitesConstant = parameterValue;
+ soil.WhitesConstantStochast.Mean = parameterValue;
+ soil.WhitesConstantStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.BeddingAngle:
+ soil.BeddingAngle = parameterValue;
+ soil.BeddingAngleStochast.Mean = parameterValue;
+ soil.BeddingAngleStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.PermeabKx:
+ soil.PermeabKx = parameterValue;
+ soil.PermeabKxStochast.Mean = parameterValue;
+ soil.PermeabKxStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.StdDiameterD70:
+ soil.DiameterD70Stochast.Deviation = parameterValue * 1e-6;
+ break;
+ case SoilParameterNames.DistAbovePhreaticLevel:
+ soil.AbovePhreaticLevelStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.DistBelowPhreaticLevel:
+ soil.BelowPhreaticLevelStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.StdAbovePhreaticLevel:
+ soil.AbovePhreaticLevelStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.StdBelowPhreaticLevel:
+ soil.BelowPhreaticLevelStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.DistDiameterD70:
+ soil.DiameterD70Stochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.StdPermeabKx:
+ soil.PermeabKxStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.DistPermeabKx:
+ soil.PermeabKxStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.StdWhitesConstant:
+ soil.WhitesConstantStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.DistWhitesConstant:
+ soil.WhitesConstantStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.StdBeddingAngle:
+ soil.BeddingAngleStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.DistBeddingAngle:
+ soil.BeddingAngleStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.AbovePhreaticLevel:
+ soil.AbovePhreaticLevel = parameterValue;
+ soil.AbovePhreaticLevelStochast.Mean = parameterValue;
+ soil.AbovePhreaticLevelStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.BelowPhreaticLevel:
+ soil.BelowPhreaticLevel = parameterValue;
+ soil.BelowPhreaticLevelStochast.Mean = parameterValue;
+ soil.BelowPhreaticLevelStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.OvenDry:
+ soil.DryUnitWeight = parameterValue;
+ break;
+ case SoilParameterNames.ExcessPorePressure:
+ soil.ExcessPorePressure = parameterValue;
+ break;
+ case SoilParameterNames.PorePressureFactor:
+ soil.PorePressureFactor = parameterValue;
+ break;
+ case SoilParameterNames.Cohesion:
+ soil.Cohesion = parameterValue;
+ soil.CohesionStochast.Mean = parameterValue;
+ soil.CohesionStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.Phi:
+ soil.FrictionAngle = parameterValue;
+ soil.FrictionAngleStochast.Mean = parameterValue;
+ soil.FrictionAngleStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.RatioCuPc:
+ soil.RatioCuPc = parameterValue;
+ soil.RatioCuPcStochast.Mean = parameterValue;
+ soil.RatioCuPcStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.RatioCuPcActive:
+ soil.RatioCuPcActive = parameterValue;
+ soil.RatioCuPcActiveStochast.Mean = parameterValue;
+ soil.RatioCuPcActiveStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.RatioCuPcPassive:
+ soil.RatioCuPcPassive = parameterValue;
+ soil.RatioCuPcPassiveStochast.Mean = parameterValue;
+ soil.RatioCuPcPassiveStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.StrengthIncreaseExponent:
+ case SoilParameterNames.StrengthIncreaseExponentOld:
+ soil.StrengthIncreaseExponent = parameterValue;
+ soil.StrengthIncreaseExponentStochast.Mean = parameterValue;
+ soil.StrengthIncreaseExponentStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.ShearStrengthModel:
+ // in the MSoilbase the identifier for ShearStrengthModel was MatStrengthType, so also check on this identifier
+ case SoilParameterNames.MatStrengthType:
+ // The numbers that are read from a file are 0-based
+ // During the read of the file the numbers are converted to 1-based.
+ // So
+ // For the next version of DGeoSTab (16.2) an extra model is added (parameterValue = 8; modelnumber in file = 7)
+ // This needs to be handled by setting model to Su Calc and UsePop to false.
+ const int offset1Based = 1;
+ if (Convert.ToInt32(parameterValue) == 8 + offset1Based)
+ {
+ soil.UseDefaultShearStrengthModel = false;
+ soil.ShearStrengthModel = ShearStrengthModel.CuCalculated;
+ soil.UsePop = true;
+ }
+ else
+ {
+ ShearStrengthModel shearStrengthModel = DoubleToMatStrengthType(parameterValue);
+ // When shearStrengthModel == ShearStrengthModel.None in the original DGeoStability it meant that the default value should be used
+ // In the current soil class we have a boolean that indicates that the default (projectwide) value should be used)
+ soil.UseDefaultShearStrengthModel = shearStrengthModel == ShearStrengthModel.None;
+ soil.ShearStrengthModel = shearStrengthModel;
+ soil.UsePop = false;
+ }
+
+ break;
+ case SoilParameterNames.UseProbDefaults:
+ soil.UseDefaultProbabilisticValues = DoubleToBool(parameterValue);
+ break;
+ case SoilParameterNames.StdCohesion:
+ soil.CohesionStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.StdPhi:
+ soil.FrictionAngleStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.StdPn:
+ soil.PnStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.StdPOP:
+ soil.POPStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.DistCohesion:
+ soil.CohesionStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.DistPhi:
+ soil.FrictionAngleStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.DistStressTable:
+ soil.StressTableStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.DistPn:
+ soil.PnStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.DistPOP:
+ soil.POPStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.StdRatioCuPc:
+ soil.RatioCuPcStochast.Deviation = parameterValue;
+ break;
+ case SoilParameterNames.DistRatioCuPc:
+ soil.RatioCuPcStochast.DistributionType = DoubleToDistribution(parameterValue);
+ break;
+ case SoilParameterNames.CorrelationCPhi:
+ soil.CorrelationCPhi = parameterValue;
+ break;
+ case SoilParameterNames.POP:
+ soil.POPStochast.Mean = parameterValue;
+ soil.POPStochast.ActualValue = parameterValue;
+ break;
+ case SoilParameterNames.UsePop:
+ soil.UsePop = Math.Abs(parameterValue - 1) < 1e-3;
+ break;
+ case SoilParameterNames.DesignPartialCohesion:
+ soil.CohesionStochast.DesignFactor = parameterValue;
+ break;
+ case SoilParameterNames.DesignStdCohesion:
+ soil.CohesionStochast.DesignDeviation = parameterValue;
+ break;
+ case SoilParameterNames.DesignPartialPhi:
+ soil.FrictionAngleStochast.DesignFactor = parameterValue;
+ break;
+ case SoilParameterNames.DesignStdPhi:
+ soil.FrictionAngleStochast.DesignDeviation = parameterValue;
+ break;
+ case SoilParameterNames.DesignPartialStressTable:
+ soil.StressTableStochast.DesignFactor = parameterValue;
+ break;
+ case SoilParameterNames.DesignStdStressTable:
+ soil.StressTableStochast.DesignDeviation = parameterValue;
+ break;
+ case SoilParameterNames.DesignPartialPOP:
+ soil.POPStochast.DesignFactor = parameterValue;
+ break;
+ case SoilParameterNames.DesignStdPOP:
+ soil.POPStochast.DesignDeviation = parameterValue;
+ break;
+ case SoilParameterNames.DesignPartialRRatio:
+ soil.RRatioStochast.DesignFactor = parameterValue;
+ break;
+ case SoilParameterNames.DesignStdRRatio:
+ soil.RRatioStochast.DesignDeviation = parameterValue;
+ break;
+ case SoilParameterNames.SoilGroup:
+ soil.SoilGroup = DoubleToInt(parameterValue);
+ break;
+ case SoilParameterNames.UseSoilType:
+ soil.UseSoilType = DoubleToBool(parameterValue);
+ break;
+ case SoilParameterNames.RRatio:
+ soil.RRatio = parameterValue;
+ soil.RRatioStochast.Mean = parameterValue;
+ soil.RRatioStochast.ActualValue = parameterValue;
+ break;
+
+ // Use following (debug) code to see which parameters are not handled yet
+ //default:
+ // Debug.WriteLine(@"WARNING: Unknown Soil Parameter: " + parameterName);
+ // break;
+ }
+ }
+
+ ///
+ /// Convert double to int
+ ///
+ ///
+ /// The converted boolean value
+ public static bool DoubleToBool(double value)
+ {
+ return (int) Math.Round(value) != 0;
+ }
+
+ ///
+ /// Set a soil property according to name/value string pair.
+ ///
+ /// Name of property
+ /// (String) value of property
+ public static void SetParameterFromNameValuePair(Soil soil, string parameterName, string parameterValue)
+ {
+ var numberFormatInfo = new NumberFormatInfo
+ {
+ NumberDecimalSeparator = "."
+ };
+ if (parameterName.Equals(SoilParameterNames.Color))
+ {
+ soil.Color = Color.FromArgb(Convert.ToInt32(parameterValue));
+
+ // Below 2 lines are needed to correctly read from old .sti files, but then code in GetDatabaseParameterList should also be changed
+ //Color colorBGR = Color.FromArgb(Convert.ToInt32(parameterValue));
+ //soil.Color = Color.FromArgb(255, colorBGR.B, colorBGR.G, colorBGR.R);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.SoilType))
+ {
+ soil.SoilType = (SoilType) Enum.Parse(typeof(SoilType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DiameterD70))
+ {
+ soil.DiameterD70 = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.WhitesConstant))
+ {
+ soil.WhitesConstant = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.BeddingAngle))
+ {
+ soil.BeddingAngle = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.PermeabKx))
+ {
+ soil.PermeabKx = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ // // IsAquifer property has moved to SoilLayer
+ //if (parameterName.Equals(SoilParameterNames.IsAquifer))
+ //{
+ // parameterValue = AdaptNumericBooleanInput(parameterValue);
+ // soil.isAquifer = Convert.ToBoolean(parameterValue);
+ //}
+
+ if (parameterName.Equals(SoilParameterNames.StdDiameterD70))
+ {
+ soil.DiameterD70Stochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo) * 1e-6;
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistDiameterD70))
+ {
+ soil.DiameterD70Stochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdPermeabKx))
+ {
+ soil.PermeabKxStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistPermeabKx))
+ {
+ soil.PermeabKxStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdWhitesConstant))
+ {
+ soil.WhitesConstantStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistWhitesConstant))
+ {
+ soil.WhitesConstantStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdBeddingAngle))
+ {
+ soil.BeddingAngleStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistBeddingAngle))
+ {
+ soil.BeddingAngleStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.AbovePhreaticLevel))
+ {
+ soil.AbovePhreaticLevel = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.BelowPhreaticLevel))
+ {
+ soil.BelowPhreaticLevel = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.OvenDry))
+ {
+ soil.DryUnitWeight = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.ExcessPorePressure))
+ {
+ soil.ExcessPorePressure = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.PorePressureFactor))
+ {
+ soil.PorePressureFactor = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.Cohesion))
+ {
+ soil.Cohesion = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.Phi))
+ {
+ soil.FrictionAngle = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.RatioCuPc))
+ {
+ soil.RatioCuPc = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.RatioCuPcActive))
+ {
+ soil.RatioCuPcActive = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.RatioCuPcPassive))
+ {
+ soil.RatioCuPcPassive = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.ShearStrengthModel))
+ {
+ soil.ShearStrengthModel = (ShearStrengthModel) Enum.Parse(typeof(ShearStrengthModel), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.MatStrengthType))
+ {
+ soil.ShearStrengthModel = (ShearStrengthModel) Enum.Parse(typeof(ShearStrengthModel), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.UseProbDefaults))
+ {
+ parameterValue = AdaptNumericBooleanInput(parameterValue);
+ soil.UseDefaultProbabilisticValues = Convert.ToBoolean(parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdCohesion))
+ {
+ soil.CohesionStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdPhi))
+ {
+ soil.FrictionAngleStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdPn))
+ {
+ soil.PnStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdPOP))
+ {
+ soil.POPStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistCohesion))
+ {
+ soil.CohesionStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistPhi))
+ {
+ soil.FrictionAngleStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistStressTable))
+ {
+ soil.StressTableStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistPn))
+ {
+ soil.PnStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistPOP))
+ {
+ soil.POPStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.CorrelationCPhi))
+ {
+ soil.CorrelationCPhi = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.CorrelationCPhi))
+ {
+ soil.CorrelationCPhi = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.POP))
+ {
+ soil.POP = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StrengthIncreaseExponent))
+ {
+ soil.StrengthIncreaseExponent = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignPartialCohesion))
+ {
+ soil.CohesionStochast.DesignFactor = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignStdCohesion))
+ {
+ soil.CohesionStochast.DesignDeviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignPartialPhi))
+ {
+ soil.FrictionAngleStochast.DesignFactor = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignStdPhi))
+ {
+ soil.FrictionAngleStochast.DesignDeviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignPartialStressTable))
+ {
+ soil.StressTableStochast.DesignFactor = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignStdStressTable))
+ {
+ soil.StressTableStochast.DesignDeviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignPartialPOP))
+ {
+ soil.POPStochast.DesignFactor = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignStdPOP))
+ {
+ soil.POPStochast.DesignDeviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignPartialRRatio))
+ {
+ soil.RRatioStochast.DesignFactor = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DesignStdRRatio))
+ {
+ soil.RRatioStochast.DesignDeviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.SoilGroup))
+ {
+ soil.SoilGroup = Convert.ToInt32(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.UseSoilType))
+ {
+ parameterValue = AdaptNumericBooleanInput(parameterValue);
+ soil.UseSoilType = Convert.ToBoolean(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.RRatio))
+ {
+ soil.RRatio = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdRRatio))
+ {
+ soil.RRatioStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistRRatio))
+ {
+ soil.RRatioStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.StdRatioCuPc))
+ {
+ soil.RatioCuPcStochast.Deviation = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.DistRatioCuPc))
+ {
+ soil.RatioCuPcStochast.DistributionType = (DistributionType) Enum.Parse(typeof(DistributionType), parameterValue);
+ }
+
+ if (parameterName.Equals(SoilParameterNames.EMod))
+ {
+ soil.EMod = Convert.ToDouble(parameterValue, numberFormatInfo);
+ }
+ }
+
+ ///
+ /// Convert a double value to Distribution type
+ ///
+ /// The value.
+ /// The converted distribution value
+ private static DistributionType DoubleToDistribution(double value)
+ {
+ int intValue = (int) Math.Round(value) - 1;
+ if (Enum.IsDefined(typeof(DistributionType), intValue))
+ {
+ return (DistributionType) intValue;
+ }
+
+ return DistributionType.Deterministic;
+ }
+
+ ///
+ /// Convert a double value to ShearStrengthModel type
+ ///
+ /// The value.
+ ///
+ /// The converted ShearStrengthModel
+ ///
+ private static ShearStrengthModel DoubleToMatStrengthType(double value)
+ {
+ return (ShearStrengthModel) Math.Round(value);
+ }
+
+ ///
+ /// Convert double to int
+ ///
+ ///
+ /// The converted int value
+ private static int DoubleToInt(double value)
+ {
+ return (int) Math.Round(value);
+ }
+
+ private static double ToInt(bool b)
+ {
+ return b ? 1 : 0;
+ }
+
+ ///
+ /// Enables the input of 0 and 1 as booleans
+ ///
+ ///
+ /// true for 1 and false for 0
+ private static string AdaptNumericBooleanInput(string parameterValue)
+ {
+ string result = parameterValue;
+ if (parameterValue == "0")
+ {
+ result = "false";
+ }
+
+ if (parameterValue == "1")
+ {
+ result = "true";
+ }
+
+ return result;
+ }
+
+ ///
+ /// This list in this class contains the property names of all parameters that are NOT to written to the database!
+ /// When adding a parameter which should not be stored in the database, add its name to this list (in FillNamesList)!
+ ///
+ public static class NonDatabaseParameters
+ {
+ ///
+ /// Gets the parameter names.
+ ///
+ ///
+ /// The parameter names.
+ ///
+ public static IList ParameterNames
+ {
+ get
+ {
+ return FillNamesList();
+ }
+ }
+
+ ///
+ /// Fills the names list.
+ ///
+ ///
+ private static List FillNamesList()
+ {
+ var parameterNames = new List();
+ parameterNames.Add("Porosity");
+ parameterNames.Add("");
+ return parameterNames;
+ }
+ }
+ }
+}
\ No newline at end of file