Index: dam clients/DamUI/trunk/src/Dam/Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs =================================================================== diff -u -r552 -r569 --- dam clients/DamUI/trunk/src/Dam/Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs (.../FillXmlInputFromDamUiTests.cs) (revision 552) +++ dam clients/DamUI/trunk/src/Dam/Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs (.../FillXmlInputFromDamUiTests.cs) (revision 569) @@ -32,6 +32,7 @@ using NUnit.Framework; using Location = Deltares.Dam.Data.Location; using Soil = Deltares.Geotechnics.Soils.Soil; +using SoilProfile1D = Deltares.Geotechnics.Soils.SoilProfile1D; namespace Deltares.Dam.Tests.DamEngineIo { @@ -71,6 +72,7 @@ Dike dike = damProjectData.WaterBoard.Dikes[0]; FillSurfaceLines(dike); FillSoils(dike); + FillSoilProfiles1D(dike); AddLocations(dike); return damProjectData; } @@ -187,6 +189,39 @@ surfaceLine.AddCharacteristicPoint(geometryPoint, characteristicPointType); } + private static void FillSoilProfiles1D(Dike dike) + { + dike.SoilProfiles = new List(); + const int profilesCount = 2; + for (int i = 0; i < profilesCount; i++) + { + var profile = new SoilProfile1D(); + profile.Name = "Profile1D " + (i + 1).ToString(); + profile.BottomLevel = -21.12 * (i + 1); + const int layerCount = 3; + for (int j = 0; j < layerCount; j++) + { + var layer = new SoilLayer1D + { + Name = "Layer" + (j + 1).ToString(), + Soil = dike.SoilList.Soils[j], + TopLevel = 1 * -j + }; + if (j < 2) + { + layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; + layer.IsAquifer = false; + } + else + { + layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; + layer.IsAquifer = true; + } + profile.Layers.Add(layer); + } + dike.SoilProfiles.Add(profile); + } + } private void CompareDamProjectData(DamProjectData actual, DamProjectData expected) { var compare = new CompareLogic { Config = { MaxDifferences = 100 } }; @@ -199,7 +234,6 @@ "LocalXZSheetPilePoint", "SoilbaseDB", "LocalXZSurfaceLine", - "SoilLayer1D", "SoildatabaseName", "MapForSoilGeometries2D" }; Index: dam clients/DamUI/trunk/src/Dam/Data/DamEngineIo/FillDamUiFromXmlInput.cs =================================================================== diff -u -r552 -r569 --- dam clients/DamUI/trunk/src/Dam/Data/DamEngineIo/FillDamUiFromXmlInput.cs (.../FillDamUiFromXmlInput.cs) (revision 552) +++ dam clients/DamUI/trunk/src/Dam/Data/DamEngineIo/FillDamUiFromXmlInput.cs (.../FillDamUiFromXmlInput.cs) (revision 569) @@ -28,6 +28,7 @@ using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; using Soil = Deltares.Geotechnics.Soils.Soil; +using SoilProfile1D = Deltares.Geotechnics.Soils.SoilProfile1D; using SurfaceLine = Deltares.DamEngine.Io.XmlInput.SurfaceLine; namespace Deltares.Dam.Data.DamEngineIo @@ -56,6 +57,7 @@ dike.SoilList = new SoilList(); TransferSoils(input.Soils, dike.SoilList); TransferLocations(input.Locations, dike.Locations, dike.SurfaceLines2); + TransferSoilProfiles1D(input.SoilProfiles1D, dike.SoilProfiles, dike.SoilList); return damProjectData; } @@ -192,5 +194,40 @@ dikeLocations.Add(location); } } + private static void TransferSoilProfiles1D(DamEngine.Io.XmlInput.SoilProfile1D[] inputSoilProfiles1D, + IList dikeSoilProfiles, SoilList soils) + { + if (inputSoilProfiles1D != null) + { + for (int i = 0; i < inputSoilProfiles1D.Length; i++) + { + var soilProfile1D = new SoilProfile1D(); + var inputSoilProfile1D = inputSoilProfiles1D[i]; + soilProfile1D.Name = inputSoilProfile1D.Name; + soilProfile1D.BottomLevel = inputSoilProfile1D.BottomLevel; + AddLayers(inputSoilProfile1D, soilProfile1D, soils); + dikeSoilProfiles.Add(soilProfile1D); + } + } + } + + private static void AddLayers(DamEngine.Io.XmlInput.SoilProfile1D inputSoilProfile1D, SoilProfile1D soilProfile1D, SoilList soils) + { + if (inputSoilProfile1D != null) + { + for (int i = 0; i < inputSoilProfile1D.Layers.Length; i++) + { + var layer = new SoilLayer1D(); + var inputLayer = inputSoilProfile1D.Layers[i]; + layer.Name = inputLayer.Name; + layer.Soil = soils.GetSoilByName(inputLayer.SoilName); + layer.TopLevel = inputLayer.TopLevel; + layer.IsAquifer = inputLayer.IsAquifer; + layer.WaterpressureInterpolationModel = ConversionHelper.ConvertToWaterpressureInterpolationModel( + inputLayer.WaterpressureInterpolationModel); + soilProfile1D.Layers.Add(layer); + } + } + } } }