using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Io.XmlInput; //using Deltares.DamEngine.Io.XmlInput; //using Deltares.DamEngine.Io.XmlOutput; using Input = Deltares.DamEngine.Io.XmlInput.Input; namespace Deltares.DamEngine.Interface { public class FillXmlInputFromDam { public static Input CreateInput(DamProjectData damProjectData) { Input input = new Input(); input.DamProjectType = ConversionHelper.ConvertToInputDamProjectType(damProjectData.DamProjectType); int locationCount = damProjectData.Dike.Locations.Count; input.Locations = new Io.XmlInput.Location[locationCount]; for (int i = 0; i < locationCount; i++) { var location = damProjectData.Dike.Locations[i]; input.Locations[i] = new Io.XmlInput.Location(); var waternetOptions = new Io.XmlInput.LocationWaternetOptions(); waternetOptions.PhreaticLineCreationMethod = ConversionHelper.ConvertToInputPhreaticLineCreationMethod(location.ModelParametersForPLLines.PLLineCreationMethod); waternetOptions.IntrusionVerticalWaterPressure = ConversionHelper.ConvertToInputIntrusionVerticalWaterPressure(location.IntrusionVerticalWaterPressure?? IntrusionVerticalWaterPressureType.Standard); waternetOptions.PolderLevel = location.PolderLevel; waternetOptions.DampingFactorPL3 = location.ModelParametersForPLLines.DampingFactorPL4; waternetOptions.DampingFactorPL4 = location.ModelParametersForPLLines.DampingFactorPL3; waternetOptions.PenetrationLength = location.ModelParametersForPLLines.PenetrationLength; waternetOptions.Pl1BelowCrestMiddleSpecified = location.PlLineOffsetBelowDikeCrestMiddle.HasValue; waternetOptions.Pl1BelowCrestMiddle = location.PlLineOffsetBelowDikeCrestMiddle ?? 0.0; waternetOptions.Pl1FactorBelowShoulderCrestSpecified = location.UsePlLineOffsetFactorBelowShoulderCrest ?? false; waternetOptions.Pl1FactorBelowShoulderCrest = location.PlLineOffsetFactorBelowShoulderCrest ?? 0.0; waternetOptions.DryPl1BelowCrestMiddleSpecified = location.PlLineOffsetDryBelowDikeCrestMiddle.HasValue; waternetOptions.DryPl1BelowCrestMiddle = location.PlLineOffsetDryBelowDikeCrestMiddle ?? 0.0; waternetOptions.DryPl1FactorBelowShoulderCrestSpecified = location.UsePlLineOffsetDryFactorBelowShoulderCrest ?? false; waternetOptions.DryPl1FactorBelowShoulderCrest = location.PlLineOffsetDryFactorBelowShoulderCrest??0.0; waternetOptions.HeadPl2Specified = location.HeadPl2.HasValue; waternetOptions.HeadPl2 = location.HeadPl2 ?? 0.0; waternetOptions.HeadPl3Specified = location.HeadPl3.HasValue; waternetOptions.HeadPl3 = location.HeadPl3 ?? 0.0; waternetOptions.HeadPl4Specified = location.HeadPl4.HasValue; waternetOptions.HeadPl4 = location.HeadPl4 ?? 0.0; waternetOptions.SlopeDampingFactor = location.SlopeDampingPiezometricHeightPolderSide; waternetOptions.Pl1BelowCrestRiverside = location.PlLineOffsetBelowDikeTopAtRiver; waternetOptions.Pl1BelowCrestPolderside = location.PlLineOffsetBelowDikeTopAtPolder; waternetOptions.Pl1BelowShoulderCrestPolderside = location.PlLineOffsetBelowShoulderBaseInside; waternetOptions.Pl1BelowToeDikePolderside = location.PlLineOffsetBelowDikeToeAtPolder; input.Locations[i].WaternetOptions = waternetOptions; } return input; } } }