Index: dam engine/trunk/src/Deltares.DamEngine.Interface/FillXmlInputFromDam.cs =================================================================== diff -u -r545 -r548 --- dam engine/trunk/src/Deltares.DamEngine.Interface/FillXmlInputFromDam.cs (.../FillXmlInputFromDam.cs) (revision 545) +++ dam engine/trunk/src/Deltares.DamEngine.Interface/FillXmlInputFromDam.cs (.../FillXmlInputFromDam.cs) (revision 548) @@ -40,6 +40,7 @@ /// public static Input CreateInput(DamProjectData damProjectData) { + ValidateDamProjectData(damProjectData); Input input = new Input(); input.DamProjectType = ConversionHelper.ConvertToInputDamProjectType(damProjectData.DamProjectType); Dike dike = damProjectData.Dike; @@ -54,6 +55,34 @@ return input; } + private static void ValidateDamProjectData(DamProjectData damProjectData) + { + if (damProjectData.Dike == null) + { + throw new NullReferenceException("No dike defined in this project"); + } + if (damProjectData.Dike.Locations == null) + { + throw new NullReferenceException("No locations defined in this project"); + } + if (damProjectData.Dike.SurfaceLines2 == null) + { + throw new NullReferenceException("No surfacelines defined in this project"); + } + if (damProjectData.Dike.SoilList == null) + { + throw new NullReferenceException("No soils defined in this project"); + } + if (damProjectData.Dike.SoilList.Soils == null) + { + throw new NullReferenceException("No soils defined in this project"); + } + if (damProjectData.Dike.SoilProfiles == null) + { + throw new NullReferenceException("No soilprofiles1D defined in this project"); + } + } + private static void TransferSoils(List soils, Soil[] inputSoils) { for (int i = 0; i < soils.Count; i++) @@ -180,8 +209,7 @@ } } - private static void TransferSoilProfiles1D(IList dikeSoilProfiles, - Io.XmlInput.SoilProfile1D[] inputSoilProfiles1D) + private static void TransferSoilProfiles1D(IList dikeSoilProfiles, Io.XmlInput.SoilProfile1D[] inputSoilProfiles1D) { var profilesCount = dikeSoilProfiles.Count; for (int i = 0; i < profilesCount; i++) Index: dam engine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs =================================================================== diff -u -r545 -r548 --- dam engine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs (.../FillDamFromXmlInput.cs) (revision 545) +++ dam engine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs (.../FillDamFromXmlInput.cs) (revision 548) @@ -47,6 +47,7 @@ /// public static DamProjectData CreateDamProjectData(Input input) { + ValidateInput(input); var damProjectData = new DamProjectData { DamProjectType = ConversionHelper.ConvertToDamProjectType(input.DamProjectType), @@ -65,6 +66,22 @@ return damProjectData; } + private static void ValidateInput(Input input) + { + if (input.Locations == null) + { + throw new NullReferenceException("No locations defined in the input"); + } + if (input.SurfaceLines == null) + { + throw new NullReferenceException("No surfacelines defined in the input"); + } + if (input.Soils == null) + { + throw new NullReferenceException("No soils defined in the input"); + } + } + /// /// Postprocess: connect all objects ///