Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectData.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectData.cs (.../DamProjectData.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectData.cs (.../DamProjectData.cs) (revision 6880) @@ -242,9 +242,15 @@ { if (jobs.Count == 0) { - var dikeJob = DikeJob as CompositeJob; - foreach (LocationJob locationJob in dikeJob.Jobs) + var compositeJob = DikeJob as CompositeJob; + if (compositeJob == null) { + return jobs; + } + + foreach (DamJob damJob in compositeJob.Jobs) + { + var locationJob = (LocationJob) damJob; jobs.Add(locationJob); } } Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikeImporterTests.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikeImporterTests.cs (.../DikeImporterTests.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikeImporterTests.cs (.../DikeImporterTests.cs) (revision 6880) @@ -55,17 +55,23 @@ // Check Dike Assert.That(dike, Is.Not.Null); - - //Check locations - Assert.That(dike.Locations, Has.Count.EqualTo(2)); + Assert.Multiple(() => + { - // Check Soilprofiles - Assert.That(dike.SoilProfiles, Has.Count.EqualTo(23)); + //Check locations + Assert.That(dike.Locations, Has.Count.EqualTo(2)); + + // Check Soilprofiles + Assert.That(dike.SoilProfiles, Has.Count.EqualTo(23)); + }); SoilProfile1D soilProfile = dike.SoilProfiles.First(x => x.Name.Equals("25_2_1_bz_4")); - Assert.That(soilProfile.Layers[0].Soil.Name, Is.EqualTo("kade")); + Assert.Multiple(() => + { + Assert.That(soilProfile.Layers[0].Soil.Name, Is.EqualTo("kade")); - //Check Soils - Assert.That(dike.SoilList.Soils, Has.Count.EqualTo(51)); + //Check Soils + Assert.That(dike.SoilList.Soils, Has.Count.EqualTo(51)); + }); Soil soil = dike.SoilList.Soils[dike.SoilList.GetSoilIndexByName("kade")]; Assert.That(soil.AbovePhreaticLevel, Is.EqualTo(17.0).Within(cTolerance)); @@ -295,7 +301,7 @@ Assert.That(dike, Is.Not.Null); //Check locations - Assert.That(dike.Locations.Count, Is.EqualTo(2)); + Assert.That(dike.Locations, Has.Count.EqualTo(2)); } [Test] @@ -321,16 +327,22 @@ // Check Dike Assert.That(dike, Is.Not.Null); - - //Check locations - Assert.That(dike.Locations.Count, Is.EqualTo(2)); + Assert.Multiple(() => + { - // Check Soilprofiles - // Count is 43: 23 (imported) + 7 (generated for first location) + 13 (generated for second location) - Assert.That(dike.SoilProfiles.Count, Is.EqualTo(43)); + //Check locations + Assert.That(dike.Locations, Has.Count.EqualTo(2)); + + // Check Soilprofiles + // Count is 43: 23 (imported) + 7 (generated for first location) + 13 (generated for second location) + Assert.That(dike.SoilProfiles, Has.Count.EqualTo(43)); + }); SoilProfile1D soilProfile = dike.SoilProfiles.First(x => x.Name.Equals("25_2_1_bz_4")); - Assert.That(soilProfile.Layers[0].Soil.Name, Is.EqualTo("kade")); - Assert.That(soilProfile.TopLevel, Is.EqualTo(60.0)); + Assert.Multiple(() => + { + Assert.That(soilProfile.Layers[0].Soil.Name, Is.EqualTo("kade")); + Assert.That(soilProfile.TopLevel, Is.EqualTo(60.0)); + }); // Check if all profiles are made absolute from relative foreach (Location location in dike.Locations) @@ -394,11 +406,14 @@ Assert.That(dike, Is.Not.Null); //Check locations - Assert.That(dike.Locations.Count, Is.EqualTo(2)); - Assert.That(dike.Locations[0].StabilityZoneType, Is.EqualTo(StabilityZoneType.NoZones)); - Assert.That(dike.Locations[0].ForbiddenZoneFactor, Is.EqualTo(0.5).Within(cTolerance)); - Assert.That(dike.Locations[1].StabilityZoneType, Is.EqualTo(StabilityZoneType.ForbiddenZone)); - Assert.That(dike.Locations[1].ForbiddenZoneFactor, Is.EqualTo(0.9).Within(cTolerance)); + Assert.That(dike.Locations, Has.Count.EqualTo(2)); + Assert.Multiple(() => + { + Assert.That(dike.Locations[0].StabilityZoneType, Is.EqualTo(StabilityZoneType.NoZones)); + Assert.That(dike.Locations[0].ForbiddenZoneFactor, Is.EqualTo(0.5).Within(cTolerance)); + Assert.That(dike.Locations[1].StabilityZoneType, Is.EqualTo(StabilityZoneType.ForbiddenZone)); + Assert.That(dike.Locations[1].ForbiddenZoneFactor, Is.EqualTo(0.9).Within(cTolerance)); + }); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (.../Dike.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (.../Dike.cs) (revision 6880) @@ -81,14 +81,8 @@ public virtual IList Segments { - get - { - return segments; - } - set - { - segments = value; - } + get => segments; + set => segments = value; } public virtual IList BackgroundRepositoryFeatures @@ -104,27 +98,6 @@ } } - // [XmlIgnore] - // [Browsable(false)] - // [ReadOnly(true)] - // [Label("Locations")] - // public List Locations - // { - // get - // { - // if (locations == null) - // { - // locations = new List(); - // if (Dike != null) - // { - // locations.AddRange(Dike.Locations); - // } - // } - // - // return locations; - // } - // } - public virtual string MapForSoilGeometries2D { get; set; } [Label("Waterlevel timeseries filename")] @@ -159,7 +132,7 @@ public Segment GetSegmentByName(string segmentId) { - Segment segment = segments.Where(x => ((x.Name == segmentId))).FirstOrDefault(); + Segment segment = segments.FirstOrDefault(x => ((x.Name == segmentId))); return segment; } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (.../DataPluginImporter.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (.../DataPluginImporter.cs) (revision 6880) @@ -1067,7 +1067,7 @@ if (Dike.Locations.Count > 0) { - Dike.Name = Dike.Locations.First().DikeRingId; + Dike.Name = Dike.Locations[0].DikeRingId; } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 6880) @@ -300,15 +300,12 @@ /// Name of the map. public void AssignGeometry2DMapnameIfNotAssigned(string mapName) { - if (damProjectData.Dike != null) + if (damProjectData.Dike != null && String.IsNullOrEmpty(damProjectData.Dike.MapForSoilGeometries2D)) { - if (String.IsNullOrEmpty(damProjectData.Dike.MapForSoilGeometries2D)) + damProjectData.Dike.MapForSoilGeometries2D = mapName; + foreach (Location location in damProjectData.Dike.Locations) { - damProjectData.Dike.MapForSoilGeometries2D = mapName; - foreach (Location location in damProjectData.Dike.Locations) - { - location.MapForSoilGeometries2D = mapName; - } + location.MapForSoilGeometries2D = mapName; } } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeImporter.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeImporter.cs (.../DikeImporter.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeImporter.cs (.../DikeImporter.cs) (revision 6880) @@ -114,29 +114,6 @@ } /// - /// Gets the import CSV log messages. - /// - /// - /// The import CSV log messages. - /// - private List ImportCsvLogMessages { get; } = new(); - - /// - /// Creates the data plugin. - /// - /// The data folder. - /// The data source container. - /// - private static DataPluginImporter CreateDataPlugin(string dataFolder, DataSourceContainer dataSourceContainer) - { - var plugin = new DataPluginImporter(); - plugin.SetDataSources(dataFolder, dataSourceContainer.DataSourceList); - plugin.Attributes = dataSourceContainer.DataAttributes; - - return plugin; - } - - /// /// Imports the data for one dike ring. /// /// The dam project folder. @@ -162,8 +139,77 @@ ImportBackground(); return importedDike; } + + /// + /// Imports the data for dike ring. + /// + /// The soils as imported from the csv file + /// The aquifers as imported from the csv file + /// The dike ring identifier. + /// + private Dike ImportDataForDikeRing(List importedCsvSoils, IEnumerable importedCsvAquifers, string dikeRingId) + { + var importDike = new Dike + { + Name = dikeRingId + }; + ImportSoils(importDike); + ImportSoilProfiles1D(importDike); + + ImportAquifers(importedCsvAquifers, importDike); + + ImportSegments(importDike); + + ImportSurfaceLines(importDike); + + ImportModelParameters(importDike); + + ImportLocations(importDike); + + ImportScenarios(importDike); + + // Use InvokeWithoutPublishingEvents for performance reasons after introducing SurfaceLine2 + DataEventPublisher.InvokeWithoutPublishingEvents(() => + { + var dikeCoordinateSystemConverter = new DikeCoordinateSystemConverter(); + if (importDike.Locations.Count > 0) + { + dikeCoordinateSystemConverter.CreateLocalXZObjects(importDike); + } + }); + + ImportCsvLogMessages.AddRange(importDike.MakeDataConsistent(importedCsvSoils)); + + DisposeImportedItem(); + + return importDike; + } + /// + /// Gets the import CSV log messages. + /// + /// + /// The import CSV log messages. + /// + private List ImportCsvLogMessages { get; } = new(); + + /// + /// Creates the data plugin. + /// + /// The data folder. + /// The data source container. + /// + private static DataPluginImporter CreateDataPlugin(string dataFolder, DataSourceContainer dataSourceContainer) + { + var plugin = new DataPluginImporter(); + plugin.SetDataSources(dataFolder, dataSourceContainer.DataSourceList); + plugin.Attributes = dataSourceContainer.DataAttributes; + + return plugin; + } + + /// /// Imports the soils. /// /// The dike. @@ -210,52 +256,6 @@ return soil; } - /// - /// Imports the data for dike ring. - /// - /// The soils as imported from the csv file - /// The aquifers as imported from the csv file - /// The dike ring identifier. - /// - private Dike ImportDataForDikeRing(List importedCsvSoils, IEnumerable importedCsvAquifers, string dikeRingId) - { - var dike = new Dike - { - Name = dikeRingId - }; - ImportSoils(dike); - - ImportSoilProfiles1D(dike); - - ImportAquifers(importedCsvAquifers, dike); - - ImportSegments(dike); - - ImportSurfaceLines(dike); - - ImportModelParameters(dike); - - ImportLocations(dike); - - ImportScenarios(dike); - - // Use InvokeWithoutPublishingEvents for performance reasons after introducing SurfaceLine2 - DataEventPublisher.InvokeWithoutPublishingEvents(() => - { - var dikeCoordinateSystemConverter = new DikeCoordinateSystemConverter(); - if (dike.Locations.Count > 0) - { - dikeCoordinateSystemConverter.CreateLocalXZObjects(dike); - } - }); - - ImportCsvLogMessages.AddRange(dike.MakeDataConsistent(importedCsvSoils)); - - DisposeImportedItem(); - - return dike; - } - private void DisposeImportedItem() { importer.DisposeImportedItem(); Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikePostProcessRelativeProfilesTest.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikePostProcessRelativeProfilesTest.cs (.../DikePostProcessRelativeProfilesTest.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikePostProcessRelativeProfilesTest.cs (.../DikePostProcessRelativeProfilesTest.cs) (revision 6880) @@ -121,7 +121,7 @@ return dike; } - public void PostProcessDike(double offset) + private static void PostProcessDike(double offset) { using (Dike dike = CreateDike(offset)) { @@ -140,16 +140,22 @@ // If there is no move, than there is no added layer if (Math.Abs(offset) < cTolerance) { - Assert.That(soilProfile1D.TopLevel, Is.EqualTo(1.0 + offset).Within(cTolerance)); - Assert.That(soilProfile1D.Layers[1].TopLevel, Is.EqualTo(-1.0 + offset).Within(cTolerance)); - Assert.That(soilProfile1D.BottomLevel, Is.EqualTo(-10.0 + offset).Within(cTolerance)); + Assert.Multiple(() => + { + Assert.That(soilProfile1D.TopLevel, Is.EqualTo(1.0 + offset).Within(cTolerance)); + Assert.That(soilProfile1D.Layers[1].TopLevel, Is.EqualTo(-1.0 + offset).Within(cTolerance)); + Assert.That(soilProfile1D.BottomLevel, Is.EqualTo(-10.0 + offset).Within(cTolerance)); + }); } else { - // If there is a move, than there is one added (top) layer - Assert.That(soilProfile1D.TopLevel, Is.EqualTo(2.0 + offset).Within(cTolerance)); - Assert.That(soilProfile1D.Layers[2].TopLevel, Is.EqualTo(-1.0 + offset).Within(cTolerance)); - Assert.That(soilProfile1D.BottomLevel, Is.EqualTo(-10.0 + offset).Within(cTolerance)); + Assert.Multiple(() => + { + // If there is a move, than there is one added (top) layer + Assert.That(soilProfile1D.TopLevel, Is.EqualTo(2.0 + offset).Within(cTolerance)); + Assert.That(soilProfile1D.Layers[2].TopLevel, Is.EqualTo(-1.0 + offset).Within(cTolerance)); + Assert.That(soilProfile1D.BottomLevel, Is.EqualTo(-10.0 + offset).Within(cTolerance)); + }); } } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (.../CombineImportedData.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (.../CombineImportedData.cs) (revision 6880) @@ -119,18 +119,15 @@ throw new CombineImportedDataException(damProjectDataNotAssignedForImport); } - if (Dike != null) - { - TransferLocationsData(Dike); - TransferSoilProfilesData(Dike); - TransferAquifersData(Dike); - TransferSegmentData(Dike); - TransferSigmaTauCurveData(Dike); // Should be done before TransferSoilData(), because the SigmaTauCurveData is used there - TransferSuTableData(Dike); // Should be done before TransferSoilData(), because the SuTableCurveData is used there - TransferSoilData(Dike); - // Use InvokeWithoutPublishingEvents for performance reasons after introducing SurfaceLine2 - DataEventPublisher.InvokeWithoutPublishingEvents(() => { TransferSurfaceLines(Dike); }); - } + TransferLocationsData(Dike); + TransferSoilProfilesData(Dike); + TransferAquifersData(Dike); + TransferSegmentData(Dike); + TransferSigmaTauCurveData(Dike); // Should be done before TransferSoilData(), because the SigmaTauCurveData is used there + TransferSuTableData(Dike); // Should be done before TransferSoilData(), because the SuTableCurveData is used there + TransferSoilData(Dike); + // Use InvokeWithoutPublishingEvents for performance reasons after introducing SurfaceLine2 + DataEventPublisher.InvokeWithoutPublishingEvents(() => { TransferSurfaceLines(Dike); }); } public void AddScenarioDataToDike() @@ -772,111 +769,119 @@ foreach (CsvImporterLocations.LocationRecord locationRecord in LocationRecords) { - //if (locationRecord.DikeRingId.Equals(dike.Name)) + + if (ValidateLocationId(locationRecord)) { - // Check if id is defined - if (String.IsNullOrEmpty(locationRecord.LocationId)) + continue; + } + + // See if location already exist; else create one and add it to the dike + Location location = dike.Locations.FirstOrDefault(s => s.Name == locationRecord.LocationId); + if (location == null) + { + var errorInrecord = false; + location = new Location(); + + location.Name = locationRecord.LocationId; + location.SurfaceLineId = locationRecord.SurfaceLineId; + location.SegmentId = locationRecord.SegmentId; + + if (locationRecord.DikeRingId != null) { - AddErrorMessage("noIdLocationRecordError", locationRecord); - continue; + location.DikeRingId = locationRecord.DikeRingId; } - // See if location already exist; else create one and add it to the dike - Location location = dike.Locations.FirstOrDefault(s => s.Name == locationRecord.LocationId); - if (location == null) + if (location.DampingFactorPL3 < 0 || location.DampingFactorPL3 > 1) { - var errorInrecord = false; - location = new Location(); + AddErrorMessage("DampingFactorPl3BeyondLimits", locationRecord); + errorInrecord = true; + } - location.Name = locationRecord.LocationId; - location.SurfaceLineId = locationRecord.SurfaceLineId; - location.SegmentId = locationRecord.SegmentId; + if (location.DampingFactorPL4 < 0 || location.DampingFactorPL4 > 1) + { + AddErrorMessage("DampingFactorPl4BeyondLimits", locationRecord); + errorInrecord = true; + } - if (locationRecord.DikeRingId != null) - { - location.DikeRingId = locationRecord.DikeRingId; - } + if (null != locationRecord.DikeEmbankmentMaterial) + { + location.DikeEmbankmentMaterial = locationRecord.DikeEmbankmentMaterial; + } - if (location.DampingFactorPL3 < 0 || location.DampingFactorPL3 > 1) - { - AddErrorMessage("DampingFactorPl3BeyondLimits", locationRecord); - errorInrecord = true; - } + if (null != locationRecord.ShoulderEmbankmentMaterial) + { + location.ShoulderEmbankmentMaterial = locationRecord.ShoulderEmbankmentMaterial; + } - if (location.DampingFactorPL4 < 0 || location.DampingFactorPL4 > 1) - { - AddErrorMessage("DampingFactorPl4BeyondLimits", locationRecord); - errorInrecord = true; - } + location.XRd = locationRecord.GeoX.GetValueOrDefault(location.XRd); + location.YRd = locationRecord.GeoY.GetValueOrDefault(location.YRd); + location.XSoilGeometry2DOrigin = locationRecord.XSoilGeometry2DOrigin.GetValueOrDefault(location.XSoilGeometry2DOrigin); + location.DampingFactorPL3 = locationRecord.DampingFactorPl3.GetValueOrDefault(location.DampingFactorPL3); + location.DampingFactorPL4 = locationRecord.DampingFactorPl4.GetValueOrDefault(location.DampingFactorPL4); + location.PenetrationLength = locationRecord.PenetrationLength.GetValueOrDefault(location.PenetrationLength); + location.TrafficLoad = locationRecord.TrafficLoad.GetValueOrDefault(location.TrafficLoad); + location.TrafficLoadDistributionAngle = locationRecord.TrafficLoadDistributionAngle; + location.PLLineCreationMethod = locationRecord.PLLineCreationMethod.GetValueOrDefault(location.PLLineCreationMethod); + if (locationRecord.IntrusionVerticalWaterPressure.HasValue) + { + location.IntrusionVerticalWaterPressure = locationRecord.IntrusionVerticalWaterPressure.Value; + } - if (null != locationRecord.DikeEmbankmentMaterial) - { - location.DikeEmbankmentMaterial = locationRecord.DikeEmbankmentMaterial; - } + location.StabilityShoulderGrowSlope = locationRecord.StabilityShoulderGrowSlope.GetValueOrDefault(location.StabilityShoulderGrowSlope); + location.StabilityShoulderGrowDeltaX = locationRecord.StabilityShoulderGrowDeltaX.GetValueOrDefault(location.StabilityShoulderGrowDeltaX); + location.StabilitySlopeAdaptionDeltaX = locationRecord.StabilitySlopeAdaptionDeltaX.GetValueOrDefault(location.StabilitySlopeAdaptionDeltaX); + location.MinimalCircleDepth = locationRecord.MinimalCircleDepth.GetValueOrDefault(location.MinimalCircleDepth); + location.DistanceToEntryPoint = locationRecord.DistanceToEntryPoint.GetValueOrDefault(location.DistanceToEntryPoint); + location.SlopeDampingPiezometricHeightPolderSide = locationRecord.SlopeDampingPiezometricHeightPolderSide.GetValueOrDefault(location.SlopeDampingPiezometricHeightPolderSide); + location.StabilityDesignMethod = locationRecord.StabilityDesignMethod.GetValueOrDefault(location.StabilityDesignMethod); + location.SlopeAdaptionStartCotangent = locationRecord.SlopeAdaptionStartCotangent.GetValueOrDefault(location.SlopeAdaptionStartCotangent); + location.SlopeAdaptionEndCotangent = locationRecord.SlopeAdaptionEndCotangent.GetValueOrDefault(location.SlopeAdaptionEndCotangent); + location.SlopeAdaptionStepCotangent = locationRecord.SlopeAdaptionStepCotangent.GetValueOrDefault(location.SlopeAdaptionStepCotangent); + location.StabilityZoneType = locationRecord.StabilityZoneType.GetValueOrDefault(location.StabilityZoneType); + location.ForbiddenZoneFactor = locationRecord.ForbiddenZoneFactor.GetValueOrDefault(location.ForbiddenZoneFactor); + location.NewDepthDitch = locationRecord.NewDepthDitch.GetValueOrDefault(location.NewDepthDitch); + location.NewDikeSlopeInside = locationRecord.NewDikeSlopeInside.GetValueOrDefault(location.NewDikeSlopeInside); + location.NewDikeSlopeOutside = locationRecord.NewDikeSlopeOutside.GetValueOrDefault(location.NewDikeSlopeOutside); + location.NewDikeTopWidth = locationRecord.NewDikeTopWidth.GetValueOrDefault(location.NewDikeTopWidth); + location.NewMaxHeightShoulderAsFraction = locationRecord.NewMaxHeightShoulderAsFraction.GetValueOrDefault(location.NewMaxHeightShoulderAsFraction); + location.NewMinDistanceDikeToeStartDitch = locationRecord.NewMinDistanceDikeToeStartDitch.GetValueOrDefault(location.NewMinDistanceDikeToeStartDitch); + location.NewShoulderBaseSlope = locationRecord.NewShoulderBaseSlope.GetValueOrDefault(location.NewShoulderBaseSlope); + location.NewShoulderTopSlope = locationRecord.NewShoulderTopSlope.GetValueOrDefault(location.NewShoulderTopSlope); + location.NewSlopeAngleDitch = locationRecord.NewSlopeAngleDitch.GetValueOrDefault(location.NewSlopeAngleDitch); + location.NewWidthDitchBottom = locationRecord.NewWidthDitchBottom.GetValueOrDefault(location.NewWidthDitchBottom); + location.UseNewDikeSlopeInside = locationRecord.UseNewDikeSlopeInside.GetValueOrDefault(location.UseNewDikeSlopeInside); + location.UseNewDikeSlopeOutside = locationRecord.UseNewDikeSlopeOutside.GetValueOrDefault(location.UseNewDikeSlopeOutside); + location.UseNewDikeTopWidth = locationRecord.UseNewDikeTopWidth.GetValueOrDefault(location.UseNewDikeTopWidth); + location.UseNewDitchDefinition = locationRecord.UseNewDitchDefinition.GetValueOrDefault(location.UseNewDitchDefinition); + location.UseNewMaxHeightShoulderAsFraction = locationRecord.UseNewMaxHeightShoulderAsFraction.GetValueOrDefault(location.UseNewMaxHeightShoulderAsFraction); + location.UseNewMinDistanceDikeToeStartDitch = locationRecord.UseNewMinDistanceDikeToeStartDitch.GetValueOrDefault(location.UseNewMinDistanceDikeToeStartDitch); + location.UseNewShoulderBaseSlope = locationRecord.UseNewShoulderBaseSlope.GetValueOrDefault(location.UseNewShoulderBaseSlope); + location.UseNewShoulderTopSlope = locationRecord.UseNewShoulderTopSlope.GetValueOrDefault(location.UseNewShoulderTopSlope); - if (null != locationRecord.ShoulderEmbankmentMaterial) - { - location.ShoulderEmbankmentMaterial = locationRecord.ShoulderEmbankmentMaterial; - } - - location.XRd = locationRecord.GeoX.GetValueOrDefault(location.XRd); - location.YRd = locationRecord.GeoY.GetValueOrDefault(location.YRd); - location.XSoilGeometry2DOrigin = locationRecord.XSoilGeometry2DOrigin.GetValueOrDefault(location.XSoilGeometry2DOrigin); - location.DampingFactorPL3 = locationRecord.DampingFactorPl3.GetValueOrDefault(location.DampingFactorPL3); - location.DampingFactorPL4 = locationRecord.DampingFactorPl4.GetValueOrDefault(location.DampingFactorPL4); - location.PenetrationLength = locationRecord.PenetrationLength.GetValueOrDefault(location.PenetrationLength); - location.TrafficLoad = locationRecord.TrafficLoad.GetValueOrDefault(location.TrafficLoad); - location.TrafficLoadDistributionAngle = locationRecord.TrafficLoadDistributionAngle; - location.PLLineCreationMethod = locationRecord.PLLineCreationMethod.GetValueOrDefault(location.PLLineCreationMethod); - if (locationRecord.IntrusionVerticalWaterPressure.HasValue) - { - location.IntrusionVerticalWaterPressure = locationRecord.IntrusionVerticalWaterPressure.Value; - } - - location.StabilityShoulderGrowSlope = locationRecord.StabilityShoulderGrowSlope.GetValueOrDefault(location.StabilityShoulderGrowSlope); - location.StabilityShoulderGrowDeltaX = locationRecord.StabilityShoulderGrowDeltaX.GetValueOrDefault(location.StabilityShoulderGrowDeltaX); - location.StabilitySlopeAdaptionDeltaX = locationRecord.StabilitySlopeAdaptionDeltaX.GetValueOrDefault(location.StabilitySlopeAdaptionDeltaX); - location.MinimalCircleDepth = locationRecord.MinimalCircleDepth.GetValueOrDefault(location.MinimalCircleDepth); - location.DistanceToEntryPoint = locationRecord.DistanceToEntryPoint.GetValueOrDefault(location.DistanceToEntryPoint); - location.SlopeDampingPiezometricHeightPolderSide = locationRecord.SlopeDampingPiezometricHeightPolderSide.GetValueOrDefault(location.SlopeDampingPiezometricHeightPolderSide); - location.StabilityDesignMethod = locationRecord.StabilityDesignMethod.GetValueOrDefault(location.StabilityDesignMethod); - location.SlopeAdaptionStartCotangent = locationRecord.SlopeAdaptionStartCotangent.GetValueOrDefault(location.SlopeAdaptionStartCotangent); - location.SlopeAdaptionEndCotangent = locationRecord.SlopeAdaptionEndCotangent.GetValueOrDefault(location.SlopeAdaptionEndCotangent); - location.SlopeAdaptionStepCotangent = locationRecord.SlopeAdaptionStepCotangent.GetValueOrDefault(location.SlopeAdaptionStepCotangent); - location.StabilityZoneType = locationRecord.StabilityZoneType.GetValueOrDefault(location.StabilityZoneType); - location.ForbiddenZoneFactor = locationRecord.ForbiddenZoneFactor.GetValueOrDefault(location.ForbiddenZoneFactor); - location.NewDepthDitch = locationRecord.NewDepthDitch.GetValueOrDefault(location.NewDepthDitch); - location.NewDikeSlopeInside = locationRecord.NewDikeSlopeInside.GetValueOrDefault(location.NewDikeSlopeInside); - location.NewDikeSlopeOutside = locationRecord.NewDikeSlopeOutside.GetValueOrDefault(location.NewDikeSlopeOutside); - location.NewDikeTopWidth = locationRecord.NewDikeTopWidth.GetValueOrDefault(location.NewDikeTopWidth); - location.NewMaxHeightShoulderAsFraction = locationRecord.NewMaxHeightShoulderAsFraction.GetValueOrDefault(location.NewMaxHeightShoulderAsFraction); - location.NewMinDistanceDikeToeStartDitch = locationRecord.NewMinDistanceDikeToeStartDitch.GetValueOrDefault(location.NewMinDistanceDikeToeStartDitch); - location.NewShoulderBaseSlope = locationRecord.NewShoulderBaseSlope.GetValueOrDefault(location.NewShoulderBaseSlope); - location.NewShoulderTopSlope = locationRecord.NewShoulderTopSlope.GetValueOrDefault(location.NewShoulderTopSlope); - location.NewSlopeAngleDitch = locationRecord.NewSlopeAngleDitch.GetValueOrDefault(location.NewSlopeAngleDitch); - location.NewWidthDitchBottom = locationRecord.NewWidthDitchBottom.GetValueOrDefault(location.NewWidthDitchBottom); - location.UseNewDikeSlopeInside = locationRecord.UseNewDikeSlopeInside.GetValueOrDefault(location.UseNewDikeSlopeInside); - location.UseNewDikeSlopeOutside = locationRecord.UseNewDikeSlopeOutside.GetValueOrDefault(location.UseNewDikeSlopeOutside); - location.UseNewDikeTopWidth = locationRecord.UseNewDikeTopWidth.GetValueOrDefault(location.UseNewDikeTopWidth); - location.UseNewDitchDefinition = locationRecord.UseNewDitchDefinition.GetValueOrDefault(location.UseNewDitchDefinition); - location.UseNewMaxHeightShoulderAsFraction = locationRecord.UseNewMaxHeightShoulderAsFraction.GetValueOrDefault(location.UseNewMaxHeightShoulderAsFraction); - location.UseNewMinDistanceDikeToeStartDitch = locationRecord.UseNewMinDistanceDikeToeStartDitch.GetValueOrDefault(location.UseNewMinDistanceDikeToeStartDitch); - location.UseNewShoulderBaseSlope = locationRecord.UseNewShoulderBaseSlope.GetValueOrDefault(location.UseNewShoulderBaseSlope); - location.UseNewShoulderTopSlope = locationRecord.UseNewShoulderTopSlope.GetValueOrDefault(location.UseNewShoulderTopSlope); - - if (!errorInrecord) - { - dike.Locations.Add(location); - } - else - { - location.Dispose(); - } + if (!errorInrecord) + { + dike.Locations.Add(location); } + else + { + location.Dispose(); + } } } } + private bool ValidateLocationId(CsvImporterLocations.LocationRecord locationRecord) + { + // Check if id is defined + if (String.IsNullOrEmpty(locationRecord.LocationId)) + { + AddErrorMessage("noIdLocationRecordError", locationRecord); + return true; + } + + return false; + } + private void AddErrorMessage(string errorMessageTranslationId, CsvImporterLocations.LocationRecord locationRecord) { AddErrorMessage(errorMessageTranslationId, locationRecord.LocationRecordId); Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/CsvImportDirectorTests.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/CsvImportDirectorTests.cs (.../CsvImportDirectorTests.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/CsvImportDirectorTests.cs (.../CsvImportDirectorTests.cs) (revision 6880) @@ -162,25 +162,31 @@ { Assert.That(dike, Is.Not.Null); - Assert.That(dike.SoilProfiles.Count, Is.EqualTo(2), "SoilProfiles.Count"); + Assert.Multiple(() => + { + Assert.That(dike.SoilProfiles, Has.Count.EqualTo(2), "SoilProfiles.Count"); - Assert.That(dike.Segments.Count, Is.EqualTo(2), "Segments.Count"); + Assert.That(dike.Segments, Has.Count.EqualTo(2), "Segments.Count"); - Assert.That(dike.SurfaceLines2.Count, Is.EqualTo(1), "SurfaceLines.Count"); + Assert.That(dike.SurfaceLines2, Has.Count.EqualTo(1), "SurfaceLines.Count"); - Assert.That(dike.Locations.Count, Is.EqualTo(1)); - Assert.That(dike.Locations[0].Name, Is.EqualTo("LOC1")); - Assert.That(dike.Locations[0].SurfaceLine2.Name, Is.EqualTo("D1")); - Assert.That(dike.Locations[0].Segment.Name, Is.EqualTo("1")); - Assert.That(dike.Locations[0].XRd, Is.EqualTo(414.950)); - Assert.That(dike.Locations[0].YRd, Is.EqualTo(91.850)); - Assert.That(dike.Locations[0].XSoilGeometry2DOrigin, Is.EqualTo(14.0)); - Assert.That(dike.Locations[0].DikeEmbankmentMaterial, Is.EqualTo("ophoogmateriaaldijk")); - Assert.That(dike.Locations[0].ShoulderEmbankmentMaterial, Is.EqualTo("ophoogmateriaalberm")); - Assert.That(dike.Locations[0].DampingFactorPL3, Is.EqualTo(0.31)); - Assert.That(dike.Locations[0].DampingFactorPL4, Is.EqualTo(0.41)); - Assert.That(dike.SurfaceLines2[0].CharacteristicPoints.Count(cp => cp.CharacteristicPointType != CharacteristicPointType.None), Is.EqualTo(13)); - Assert.That(dike.SurfaceLines2[0].CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchPolderSide), Is.Not.Null); + Assert.That(dike.Locations, Has.Count.EqualTo(1)); + }); + Assert.Multiple(() => + { + Assert.That(dike.Locations[0].Name, Is.EqualTo("LOC1")); + Assert.That(dike.Locations[0].SurfaceLine2.Name, Is.EqualTo("D1")); + Assert.That(dike.Locations[0].Segment.Name, Is.EqualTo("1")); + Assert.That(dike.Locations[0].XRd, Is.EqualTo(414.950)); + Assert.That(dike.Locations[0].YRd, Is.EqualTo(91.850)); + Assert.That(dike.Locations[0].XSoilGeometry2DOrigin, Is.EqualTo(14.0)); + Assert.That(dike.Locations[0].DikeEmbankmentMaterial, Is.EqualTo("ophoogmateriaaldijk")); + Assert.That(dike.Locations[0].ShoulderEmbankmentMaterial, Is.EqualTo("ophoogmateriaalberm")); + Assert.That(dike.Locations[0].DampingFactorPL3, Is.EqualTo(0.31)); + Assert.That(dike.Locations[0].DampingFactorPL4, Is.EqualTo(0.41)); + Assert.That(dike.SurfaceLines2[0].CharacteristicPoints.Count(cp => cp.CharacteristicPointType != CharacteristicPointType.None), Is.EqualTo(13)); + Assert.That(dike.SurfaceLines2[0].CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchPolderSide), Is.Not.Null); + }); } } @@ -194,8 +200,11 @@ public void SoilProfilesOfImportedDikeHaveCorrectProbability() { Dike dike = ImportDirector.Construct(importFolder, null); - Assert.That(dike.Segments[0].GetSoilProfileProbability(dike.SoilProfiles[0], FailureMechanismSystemType.StabilityInside), Is.EqualTo(80)); - Assert.That(dike.Segments[0].GetSoilProfileProbability(dike.SoilProfiles[1], FailureMechanismSystemType.Piping), Is.EqualTo(100)); + Assert.Multiple(() => + { + Assert.That(dike.Segments[0].GetSoilProfileProbability(dike.SoilProfiles[0], FailureMechanismSystemType.StabilityInside), Is.EqualTo(80)); + Assert.That(dike.Segments[0].GetSoilProfileProbability(dike.SoilProfiles[1], FailureMechanismSystemType.Piping), Is.EqualTo(100)); + }); } /// Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeJobImporter.cs =================================================================== diff -u -r6873 -r6880 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeJobImporter.cs (.../DikeJobImporter.cs) (revision 6873) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeJobImporter.cs (.../DikeJobImporter.cs) (revision 6880) @@ -27,7 +27,7 @@ { if (dikeJob.GetType() == typeof(DikeJob)) { - foreach (DamJob locationJob in ((DikeJob) dikeJob).Jobs) + foreach (DamJob locationJob in dikeJob.Jobs) { if (locationJob.GetType() == typeof(LocationJob)) {