Index: DamClients/DamUI/trunk/src/Dam/Tests/IO/CombineImportedDataTest.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/IO/CombineImportedDataTest.cs (.../CombineImportedDataTest.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/Dam/Tests/IO/CombineImportedDataTest.cs (.../CombineImportedDataTest.cs) (revision 2529) @@ -27,6 +27,7 @@ using Deltares.Dam.Data.Importers; using NUnit.Framework; using Deltares.Dam.Data.IO; +using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.Geotechnics.GeotechnicalGeometry; using Deltares.Geotechnics.SurfaceLines; using Deltares.Standard.EventPublisher; @@ -47,28 +48,39 @@ { LogManager.Messages.Clear(); var start = DateTime.Now; + ProgressDelegate progress; using (var damProjectData = new DamProjectData()) { const string testDataFolder = @"TestData\CsvData\ImporterTest"; - const string locationFilename = testDataFolder + "\\LocationID.shp"; damProjectData.WaterBoard.Dikes.Add(new Dike()); var configuredAttributes = new List { new DataAttribute - { AttributeId = "location_id", AttributeName = "LOCATIONID", DataSource = "" }, + { AttributeId = "location_id", AttributeName = "LOCATIONID", DataSource = "LocationID.shp" }, new DataAttribute - { AttributeId = "dikering_id", AttributeName = "DIKERINGID", DataSource = "" } + { AttributeId = "dikering_id", AttributeName = "DIKERINGID", DataSource = "LocationID.shp" } }; - var locations = LocationShapeFileImporterDotSpatial.ImportLocations( - locationFilename, configuredAttributes); - foreach (var location in locations) + var locationRecords = new List(); + var locationImporter = LocationShapeFileImporter.Create( + locationRecords, configuredAttributes, testDataFolder); + if (locationImporter != null) { - damProjectData.WaterBoard.Dikes[0].Locations.Add(location); + locationImporter.Import(); + locationRecords = locationImporter.ImportedItems.ToList(); } - if (locations.Count > 0) + + if (locationRecords.Count > 0) { - DamEngine.Data.Standard.Calculation.ProgressDelegate progress = null; + progress = null; var csvImporter = new CsvImporter(); + var dikeRingId = damProjectData.WaterBoard.Dikes[0].Name; + foreach (var locationRecord in locationRecords) + { + locationRecord.DikeRingId = dikeRingId; + locationRecord.SegmentId = "1"; + locationRecord.SurfaceLineId = "1"; + } + csvImporter.LocationRecords = locationRecords; csvImporter.ImportCsvDataFromDirectory(testDataFolder, false, progress, DamProjectType.Design); foreach (var errormessage in csvImporter.ErrorMessages) { @@ -81,7 +93,8 @@ SurfaceLineRecords = csvImporter.SurfaceLinesRecords, SegmentRecords = csvImporter.SegmentRecords, SoilProfilerecords = csvImporter.SoilProfilesRecords, - ScenarioRecords = csvImporter.ScenariosRecords + ScenarioRecords = csvImporter.ScenariosRecords, + LocationRecords = csvImporter.LocationRecords, }; combineImportedData.AddCsvDataToDikes(); combineImportedData.AddScenarioDataToDikes(); @@ -202,8 +215,6 @@ //Assert.AreEqual("25-2-2-A-1-A", location.PL1Line.Name); Assert.AreEqual(-0.25, location.PolderLevel, tolerance); Assert.AreEqual(0.8727, location.HeadPL2.Value, tolerance); - Assert.AreEqual(-0.25, location.HeadPl3.Value, tolerance); - Assert.AreEqual(-0.25, location.HeadPl4.Value, tolerance); Assert.AreEqual("klei", location.DikeEmbankmentMaterial); Assert.AreEqual("klei2", location.ShoulderEmbankmentMaterial); Assert.AreEqual(1.3, location.PenetrationLength, tolerance); @@ -213,22 +224,10 @@ Assert.AreEqual(0.3, location.DampingFactorPL3, tolerance); Assert.AreEqual(0.4, location.DampingFactorPL4, tolerance); Assert.AreEqual(PLLineCreationMethod.ExpertKnowledgeRRD, location.PLLineCreationMethod); - Assert.AreEqual(1.2, location.ModelFactors.RequiredSafetyFactorPiping.Value, tolerance); - Assert.AreEqual(1.3, location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope.Value, tolerance); - Assert.AreEqual(1.4, location.ModelFactors.RequiredSafetyFactorStabilityOuterSlope.Value, tolerance); - Assert.AreEqual(1.1, location.ModelFactors.UpliftCriterionPiping.Value, tolerance); - Assert.AreEqual(1.2, location.ModelFactors.UpliftCriterionStability.Value, tolerance); Assert.AreEqual(2.1, location.DistanceToEntryPoint, tolerance); - Assert.AreEqual(0.5, location.PlLineOffsetBelowDikeTopAtRiver, tolerance); - Assert.AreEqual(0.6, location.PlLineOffsetBelowDikeTopAtPolder, tolerance); - Assert.AreEqual(0.1, location.PlLineOffsetBelowShoulderBaseInside, tolerance); - Assert.AreEqual(0.2, location.PlLineOffsetBelowDikeToeAtPolder, tolerance); Assert.AreEqual(2.0, location.StabilityShoulderGrowSlope, tolerance); Assert.AreEqual(0.2, location.StabilityShoulderGrowDeltaX, tolerance); Assert.AreEqual(0.5, location.StabilitySlopeAdaptionDeltaX, tolerance); - Assert.AreEqual(3.5, location.DikeTableHeight, tolerance); - Assert.AreEqual(3.6, location.RiverLevel, tolerance); - Assert.AreEqual(3.7, location.RiverLevelLow, tolerance); } } Index: DamClients/DamUI/trunk/src/Dam/Tests/CsvImporterTest.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/CsvImporterTest.cs (.../CsvImporterTest.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/Dam/Tests/CsvImporterTest.cs (.../CsvImporterTest.cs) (revision 2529) @@ -236,17 +236,13 @@ Assert.AreEqual(91.850, dike.Locations[0].YRd); Assert.AreEqual(0.1, dike.Locations[0].PolderLevel); Assert.AreEqual(4.0, dike.Locations[0].HeadPL2); - Assert.AreEqual(3.0, dike.Locations[0].HeadPl3); Assert.AreEqual(14.0, dike.Locations[0].XSoilGeometry2DOrigin); Assert.AreEqual("ophoogmateriaaldijk", dike.Locations[0].DikeEmbankmentMaterial); Assert.AreEqual("ophoogmateriaalberm", dike.Locations[0].ShoulderEmbankmentMaterial); Assert.AreEqual(0.31, dike.Locations[0].DampingFactorPL3); Assert.AreEqual(0.41, dike.Locations[0].DampingFactorPL4); Assert.AreEqual(13, dike.SurfaceLines2[0].CharacteristicPoints.Count(cp => cp.CharacteristicPointType != CharacteristicPointType.None)); Assert.IsNotNull(dike.SurfaceLines2[0].CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.BottomDitchPolderSide)); - Assert.AreEqual(null, dike.Locations[0].DikeTableHeight); - Assert.AreEqual(null, dike.Locations[0].RiverLevel); - Assert.AreEqual(null, dike.Locations[0].RiverLevelLow); } } Index: DamClients/DamUI/trunk/src/Dam/Tests/DataPluginImporterTests.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/DataPluginImporterTests.cs (.../DataPluginImporterTests.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/Dam/Tests/DataPluginImporterTests.cs (.../DataPluginImporterTests.cs) (revision 2529) @@ -84,12 +84,19 @@ AttributeName = "stijgh_m", DataSource = "winterstijg_zonderDSM.shp" }, + new DataAttribute + { + AttributeId = LocationShapeFileAttributeMap.HeadPl2AttributeId, + AttributeName = "stijgh_m", + DataSource = "winterstijg_zonderDSM.shp" + }, } }; dataPluginImporter.SetDataSources("", srcDataSources); } + private void SetupInvoer1WithoutShapeFiles() { srcDataSources = new List @@ -162,7 +169,7 @@ [Test] // Some parameters for location can be read from either locations.csv or shapefile // The value from shapefile overwrites the value from locations.csv - // In this test the values for headpl3 in the import files are: + // In this test the values for headpl2 in the import files are: // In shapefiles: -3.651 for location 1, -3.632 for location 2 // In locations.csv: -99 for both locations // Expected value in location will be -3.651 for location 1, -3.632 for location 2 @@ -175,10 +182,10 @@ IEnumerable locationDetails = dataPluginImporter.GetLocationDetails(dikeRingId, Location1Id); var nameValueParameters = locationDetails as NameValueParameter[] ?? locationDetails.ToArray(); Assert.IsTrue(nameValueParameters.Any()); - Assert.AreEqual("-3.651", nameValueParameters.FirstOrDefault(x => x.ParameterName.Equals("HeadPL3")).ParameterValue); + Assert.AreEqual("-3.651", nameValueParameters.FirstOrDefault(x => x.ParameterName.Equals("HeadPL2")).ParameterValue); locationDetails = dataPluginImporter.GetLocationDetails(dikeRingId, Location2Id); - Assert.AreEqual("-3.632", locationDetails.First(x => x.ParameterName.Equals("HeadPL3")).ParameterValue); + Assert.AreEqual("-3.632", locationDetails.First(x => x.ParameterName.Equals("HeadPL2")).ParameterValue); } [Test] Fisheye: Tag 2529 refers to a dead (removed) revision in file `DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporterDotSpatial.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/CsvColumnNames.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/CsvColumnNames.cs (.../CsvColumnNames.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/CsvColumnNames.cs (.../CsvColumnNames.cs) (revision 2529) @@ -131,24 +131,24 @@ public const string PlLineCreationMethodColumnName = "PLLineCreationMethod"; /// - /// PLLineOffsetBelowDikeTopAtRiver + /// PlLineOffsetBelowDikeTopAtRiver /// - public const string PlLineOffsetBelowDikeTopAtRiverColumnName = "PLLineOffsetBelowDikeTopAtRiver"; + public const string PlLineOffsetBelowDikeTopAtRiverColumnName = "PlLineOffsetBelowDikeTopAtRiver"; /// - /// PLLineOffsetBelowDikeTopAtPolder + /// PlLineOffsetBelowDikeTopAtPolder /// - public const string PlLineOffsetBelowDikeTopAtPolderColumnName = "PLLineOffsetBelowDikeTopAtPolder"; + public const string PlLineOffsetBelowDikeTopAtPolderColumnName = "PlLineOffsetBelowDikeTopAtPolder"; /// - /// PLLineOffsetBelowShoulderBaseInside + /// PlLineOffsetBelowShoulderBaseInside /// - public const string PlLineOffsetBelowShoulderBaseInsideColumnName = "PLLineOffsetBelowShoulderBaseInside"; + public const string PlLineOffsetBelowShoulderBaseInsideColumnName = "PlLineOffsetBelowShoulderBaseInside"; /// - /// PLLineOffsetBelowDikeToeAtPolder + /// PlLineOffsetBelowDikeToeAtPolder /// - public const string PlLineOffsetBelowDikeToeAtPolderColumnName = "PLLineOffsetBelowDikeToeAtPolder"; + public const string PlLineOffsetBelowDikeToeAtPolderColumnName = "PlLineOffsetBelowDikeToeAtPolder"; /// /// The pl line offset below dike crest middle Index: DamClients/DamUI/trunk/src/Dam/Tests/LoadCompatiblityTest.cs =================================================================== diff -u -r2515 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/LoadCompatiblityTest.cs (.../LoadCompatiblityTest.cs) (revision 2515) +++ DamClients/DamUI/trunk/src/Dam/Tests/LoadCompatiblityTest.cs (.../LoadCompatiblityTest.cs) (revision 2529) @@ -92,10 +92,7 @@ YRd = 507197.06382921, SegmentId = "234", PolderLevel = -1.29999995232, - RiverLevel = 0, HeadPL2 = -1.3, - HeadPl3 = -1.6, - HeadPl4 = null, XSoilGeometry2DOrigin = 0.0, // actual value DikeEmbankmentMaterial = "HHNK1_Bfg", ShoulderEmbankmentMaterial = "HHNK1_Bfl", @@ -104,23 +101,12 @@ PenetrationLength = 0.0, // actual value TrafficLoad = 5.0, PLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD, - PlLineOffsetBelowDikeTopAtRiver = 0.0, // actual value - PlLineOffsetBelowDikeTopAtPolder = 0.0, // actual value - PlLineOffsetBelowShoulderBaseInside = 0.25, - PlLineOffsetBelowDikeToeAtPolder = 0.0, // actual value StabilityShoulderGrowSlope = 0.333333333333333, StabilityShoulderGrowDeltaX = 2.0, StabilitySlopeAdaptionDeltaX = 2.0, MinimalCircleDepth = 1.5, DistanceToEntryPoint = 0.0, // actual value StabilityZoneType = MStabZonesType.NoZones, - DikeTableHeight = 0.0, - ModelFactors = new ModelFactors - { - UpliftCriterionPiping = 1.2, - UpliftCriterionStability = 1.2, - - }, Segment = new Segment { Name = "234" , @@ -231,72 +217,21 @@ /// /// Determines whether version_1_5_1_7 can be loaded. - /// Check if the PL-line parameters are correcly copied from location to scenario; Projects before 15.1 do not have these parameters in scenarios /// [Test] [Category("Integration")] public void CanLoadVersion_1_5_1_7_ScenariosPLLineParameters() { - const double cTolerance = 0.001; const string projectFilenameTutorialDesign = @"..\..\..\data\Dam\Versions\V 1.5.1.7\Tutorial Design\DAM Tutorial Design (Old 1.5.1.7).damx"; using (var projectData = ProjectLoader.LoadProjectData(projectFilenameTutorialDesign)) { foreach (Location location in projectData.Locations) { - foreach (Scenario scenario in location.Scenarios) - { - if (location.UsePlLineOffsetBelowDikeCrestMiddle != null) - { - Assert.AreEqual(location.UsePlLineOffsetBelowDikeCrestMiddle.Value, scenario.UsePlLineOffsetBelowDikeCrestMiddle.Value); - } - if (location.PlLineOffsetBelowDikeCrestMiddle != null) - { - Assert.AreEqual(location.PlLineOffsetBelowDikeCrestMiddle.Value, scenario.PlLineOffsetBelowDikeCrestMiddle.Value, cTolerance); - } - - if (scenario.PlLineOffsetBelowDikeToeAtPolder.HasValue) - { - Assert.AreEqual(location.PlLineOffsetBelowDikeToeAtPolder, scenario.PlLineOffsetBelowDikeToeAtPolder, cTolerance); - } - - if (scenario.PlLineOffsetBelowDikeTopAtPolder.HasValue) - { - Assert.AreEqual(location.PlLineOffsetBelowDikeTopAtPolder, scenario.PlLineOffsetBelowDikeTopAtPolder, cTolerance); - } - - if (scenario.PlLineOffsetBelowDikeTopAtRiver.HasValue) - { - Assert.AreEqual(location.PlLineOffsetBelowDikeTopAtRiver, scenario.PlLineOffsetBelowDikeTopAtRiver, cTolerance); - } - - if (scenario.PlLineOffsetBelowShoulderBaseInside.HasValue) - { - Assert.AreEqual(location.PlLineOffsetBelowShoulderBaseInside, scenario.PlLineOffsetBelowShoulderBaseInside, cTolerance); - } - - if (location.UsePlLineOffsetFactorBelowShoulderCrest != null) - { - Assert.AreEqual(location.UsePlLineOffsetFactorBelowShoulderCrest.Value, scenario.UsePlLineOffsetFactorBelowShoulderCrest.Value); - } - if (location.PlLineOffsetFactorBelowShoulderCrest != null) - { - Assert.AreEqual(location.PlLineOffsetFactorBelowShoulderCrest.Value, scenario.PlLineOffsetFactorBelowShoulderCrest.Value, cTolerance); - } - if (location.HeadPl3 != null && scenario.HeadPl3.HasValue) - { - Assert.AreEqual(location.HeadPl3.Value, scenario.HeadPl3.Value, cTolerance); - } - if (location.HeadPl4 != null && scenario.HeadPl4.HasValue) - { - Assert.AreEqual(location.HeadPl4.Value, scenario.HeadPl4.Value, cTolerance); - } - - // surfaceline2 present with characteristic points ? - Assert.NotNull(location.SurfaceLine2); - Assert.AreEqual(location.Name, location.SurfaceLine2.Name); - Assert.AreEqual(true, location.SurfaceLine2.CharacteristicPoints.GeometryMustContainPoint); - Assert.AreEqual(true, location.SurfaceLine2.HasDike()); - } + // surfaceline2 present with characteristic points ? + Assert.NotNull(location.SurfaceLine2); + Assert.AreEqual(location.Name, location.SurfaceLine2.Name); + Assert.AreEqual(true, location.SurfaceLine2.CharacteristicPoints.GeometryMustContainPoint); + Assert.AreEqual(true, location.SurfaceLine2.HasDike()); } } } Index: DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationPropertyImporterTest.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationPropertyImporterTest.cs (.../LocationPropertyImporterTest.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationPropertyImporterTest.cs (.../LocationPropertyImporterTest.cs) (revision 2529) @@ -24,6 +24,7 @@ using System.IO; using System.Linq; using Deltares.Dam.Data; +using Deltares.Dam.Data.CsvImporters; using Deltares.Dam.Data.Importers; using Deltares.Maps; using GeoAPI.Geometries; @@ -176,16 +177,18 @@ Expect.Call(attributeRepository.Features).Return(new[] { geom }); Expect.Call(attributeRepository.Query((IGeometry)null)).IgnoreArguments().Return(new[]{ geom }); - using (var location = new Location + const string locationId = "Test_Location_01"; + var location = new CsvImporterLocations.LocationRecord { - XRd = 1, - YRd = 1, + LocationId = locationId, + GeoX = 1, + GeoY = 1, SegmentId = stringInitialValue, - DampingFactorPL3 = doubleInitialValue, - DampingFactorPL4 = doubleInitialValue, + DampingFactorPl3 = doubleInitialValue, + DampingFactorPl4 = doubleInitialValue, DikeEmbankmentMaterial = stringInitialValue, DistanceToEntryPoint = doubleInitialValue, - HeadPL2 = doubleInitialValue, + HeadPl2 = doubleInitialValue, HeadPl3 = doubleInitialValue, HeadPl4 = doubleInitialValue, MinimalCircleDepth = doubleInitialValue, @@ -196,14 +199,11 @@ PlLineOffsetBelowDikeTopAtPolder = doubleInitialValue, PlLineOffsetBelowShoulderBaseInside = doubleInitialValue, PlLineOffsetBelowDikeToeAtPolder = doubleInitialValue, - ModelFactors = new ModelFactors() - { - RequiredSafetyFactorPiping = doubleInitialValue, - RequiredSafetyFactorStabilityInnerSlope = doubleInitialValue, - RequiredSafetyFactorStabilityOuterSlope = doubleInitialValue, - UpliftCriterionPiping = doubleInitialValue, - UpliftCriterionStability = doubleInitialValue - }, + RequiredSafetyFactorPiping = doubleInitialValue, + RequiredSafetyFactorStabilityInnerSlope = doubleInitialValue, + RequiredSafetyFactorStabilityOuterSlope = doubleInitialValue, + UpliftCriterionPiping = doubleInitialValue, + UpliftCriterionStability = doubleInitialValue, TrafficLoad = doubleInitialValue, TL_DegreeOfConsolidation = doubleInitialValue, ShoulderEmbankmentMaterial = stringInitialValue, @@ -234,86 +234,84 @@ NewSlopeAngleDitch = doubleInitialValue, DikeTableHeight = doubleInitialValue, RiverLevel = doubleInitialValue, - RiverLevelLow = doubleInitialValue - }) - { - mockImporter.Targets = new List { location }; + RiverLevelLow = doubleInitialValue + }; + mockImporter.Targets = new List { location }; - var file = new ShapeFileLocation("test.shp"); - string[] lines = { "First line", "Second line", "Third line" }; - File.WriteAllLines(file.FullPath, lines); - Expect.Call(mockImporter.GetFile(null)).IgnoreArguments().Return(file); - Expect.Call(mockImporter.CreateFromShapeFile(null)).IgnoreArguments().Return(attributeRepository); + var file = new ShapeFileLocation("test.shp"); + string[] lines = { "First line", "Second line", "Third line" }; + File.WriteAllLines(file.FullPath, lines); + Expect.Call(mockImporter.GetFile(null)).IgnoreArguments().Return(file); + Expect.Call(mockImporter.CreateFromShapeFile(null)).IgnoreArguments().Return(attributeRepository); - mocks.ReplayAll(); + mocks.ReplayAll(); - foreach (var key in LocationShapeFileAttributeMap.AttributePropertyMap.Keys) - { - mockImporter.RegisterAttributeMapping(key, null); - } + foreach (var key in LocationShapeFileAttributeMap.AttributePropertyMap.Keys) + { + mockImporter.RegisterAttributeMapping(key, null); + } - mockImporter.Import(null); + mockImporter.Import(null); - Assert.AreEqual(stringTestValue, location.SegmentId); - Assert.AreEqual(doubleTestValue, location.DampingFactorPL3); - Assert.AreEqual(doubleTestValue, location.DampingFactorPL4); - Assert.AreEqual(stringTestValue, location.DikeEmbankmentMaterial); - Assert.AreEqual(doubleTestValue, location.DistanceToEntryPoint); - Assert.AreEqual(doubleTestValue, location.HeadPL2); - Assert.AreEqual(doubleTestValue, location.HeadPl3); - Assert.AreEqual(doubleTestValue, location.HeadPl4); - Assert.AreEqual(doubleTestValue, location.MinimalCircleDepth); - Assert.AreEqual(doubleTestValue, location.PenetrationLength); - Assert.AreEqual(doubleTestValue, location.PolderLevel); - Assert.AreEqual(plLineCreationMethodTestValue, location.PLLineCreationMethod); - Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeTopAtRiver); - Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeTopAtPolder); - Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowShoulderBaseInside); - Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeToeAtPolder); - Assert.AreEqual(doubleTestValue, location.TrafficLoad); - Assert.AreEqual(doubleTestValue, location.TL_DegreeOfConsolidation); - Assert.AreEqual(doubleTestValue, location.ModelFactors.RequiredSafetyFactorPiping); - Assert.AreEqual(doubleTestValue, location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope); - Assert.AreEqual(doubleTestValue, location.ModelFactors.RequiredSafetyFactorStabilityOuterSlope); - Assert.AreEqual(stringTestValue, location.ShoulderEmbankmentMaterial); - Assert.AreEqual(doubleTestValue, location.StabilityShoulderGrowSlope); - Assert.AreEqual(doubleTestValue, location.StabilityShoulderGrowDeltaX); - Assert.AreEqual(doubleTestValue, location.StabilitySlopeAdaptionDeltaX); - Assert.AreEqual(doubleTestValue, location.ModelFactors.UpliftCriterionPiping); - Assert.AreEqual(doubleTestValue, location.ModelFactors.UpliftCriterionStability); - Assert.AreEqual(doubleTestValue, location.XSoilGeometry2DOrigin); - Assert.AreEqual(mstabZonesTypeTestValue, location.StabilityZoneType); - Assert.AreEqual(doubleTestValue, location.ForbiddenZoneFactor); - Assert.AreEqual(doubleTestValue, location.ZoneAreaRestSlopeCrestWidth); - Assert.AreEqual(boolTestValue, location.UseNewDikeTopWidth); - Assert.AreEqual(doubleTestValue, location.NewDikeTopWidth); - Assert.AreEqual(boolTestValue, location.UseNewDikeSlopeInside); - Assert.AreEqual(doubleTestValue, location.NewDikeSlopeInside); - Assert.AreEqual(boolTestValue, location.UseNewDikeSlopeOutside); - Assert.AreEqual(doubleTestValue, location.NewDikeSlopeOutside); - Assert.AreEqual(boolTestValue, location.UseNewShoulderTopSlope); - Assert.AreEqual(doubleTestValue, location.NewShoulderTopSlope); - Assert.AreEqual(boolTestValue, location.UseNewShoulderBaseSlope); - Assert.AreEqual(doubleTestValue, location.NewShoulderBaseSlope); - Assert.AreEqual(boolTestValue, location.UseNewMaxHeightShoulderAsFraction); - Assert.AreEqual(doubleTestValue, location.NewMaxHeightShoulderAsFraction); - Assert.AreEqual(boolTestValue, location.UseNewMinDistanceDikeToeStartDitch); - Assert.AreEqual(doubleTestValue, location.NewMinDistanceDikeToeStartDitch); - Assert.AreEqual(boolTestValue, location.UseNewDitchDefinition); - Assert.AreEqual(doubleTestValue, location.NewWidthDitchBottom); - Assert.AreEqual(doubleTestValue, location.NewDepthDitch); - Assert.AreEqual(doubleTestValue, location.NewSlopeAngleDitch); - Assert.AreEqual(stabilityDesignMethodTestValue, location.StabilityDesignMethod); - Assert.AreEqual(doubleTestValue, location.SlopeAdaptionStartCotangent); - Assert.AreEqual(doubleTestValue, location.SlopeAdaptionEndCotangent); - Assert.AreEqual(doubleTestValue, location.SlopeAdaptionStepCotangent); - Assert.AreEqual(doubleTestValue, location.DikeTableHeight); - Assert.AreEqual(doubleTestValue, location.RiverLevel); - Assert.AreEqual(doubleTestValue, location.RiverLevelLow); - - mocks.VerifyAll(); - } + Assert.AreEqual(stringTestValue, location.SegmentId); + Assert.AreEqual(doubleTestValue, location.DampingFactorPl3); + Assert.AreEqual(doubleTestValue, location.DampingFactorPl4); + Assert.AreEqual(stringTestValue, location.DikeEmbankmentMaterial); + Assert.AreEqual(doubleTestValue, location.DistanceToEntryPoint); + Assert.AreEqual(doubleTestValue, location.HeadPl2); + Assert.AreEqual(doubleTestValue, location.HeadPl3); + Assert.AreEqual(doubleTestValue, location.HeadPl4); + Assert.AreEqual(doubleTestValue, location.MinimalCircleDepth); + Assert.AreEqual(doubleTestValue, location.PenetrationLength); + Assert.AreEqual(doubleTestValue, location.PolderLevel); + Assert.AreEqual(plLineCreationMethodTestValue, location.PLLineCreationMethod); + Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeTopAtRiver); + Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeTopAtPolder); + Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowShoulderBaseInside); + Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeToeAtPolder); + Assert.AreEqual(doubleTestValue, location.TrafficLoad); + Assert.AreEqual(doubleTestValue, location.TL_DegreeOfConsolidation); + Assert.AreEqual(doubleTestValue, location.RequiredSafetyFactorPiping); + Assert.AreEqual(doubleTestValue, location.RequiredSafetyFactorStabilityInnerSlope); + Assert.AreEqual(doubleTestValue, location.RequiredSafetyFactorStabilityOuterSlope); + Assert.AreEqual(stringTestValue, location.ShoulderEmbankmentMaterial); + Assert.AreEqual(doubleTestValue, location.StabilityShoulderGrowSlope); + Assert.AreEqual(doubleTestValue, location.StabilityShoulderGrowDeltaX); + Assert.AreEqual(doubleTestValue, location.StabilitySlopeAdaptionDeltaX); + Assert.AreEqual(doubleTestValue, location.UpliftCriterionPiping); + Assert.AreEqual(doubleTestValue, location.UpliftCriterionStability); + Assert.AreEqual(doubleTestValue, location.XSoilGeometry2DOrigin); + Assert.AreEqual(mstabZonesTypeTestValue, location.StabilityZoneType); + Assert.AreEqual(doubleTestValue, location.ForbiddenZoneFactor); + Assert.AreEqual(doubleTestValue, location.ZoneAreaRestSlopeCrestWidth); + Assert.AreEqual(boolTestValue, location.UseNewDikeTopWidth); + Assert.AreEqual(doubleTestValue, location.NewDikeTopWidth); + Assert.AreEqual(boolTestValue, location.UseNewDikeSlopeInside); + Assert.AreEqual(doubleTestValue, location.NewDikeSlopeInside); + Assert.AreEqual(boolTestValue, location.UseNewDikeSlopeOutside); + Assert.AreEqual(doubleTestValue, location.NewDikeSlopeOutside); + Assert.AreEqual(boolTestValue, location.UseNewShoulderTopSlope); + Assert.AreEqual(doubleTestValue, location.NewShoulderTopSlope); + Assert.AreEqual(boolTestValue, location.UseNewShoulderBaseSlope); + Assert.AreEqual(doubleTestValue, location.NewShoulderBaseSlope); + Assert.AreEqual(boolTestValue, location.UseNewMaxHeightShoulderAsFraction); + Assert.AreEqual(doubleTestValue, location.NewMaxHeightShoulderAsFraction); + Assert.AreEqual(boolTestValue, location.UseNewMinDistanceDikeToeStartDitch); + Assert.AreEqual(doubleTestValue, location.NewMinDistanceDikeToeStartDitch); + Assert.AreEqual(boolTestValue, location.UseNewDitchDefinition); + Assert.AreEqual(doubleTestValue, location.NewWidthDitchBottom); + Assert.AreEqual(doubleTestValue, location.NewDepthDitch); + Assert.AreEqual(doubleTestValue, location.NewSlopeAngleDitch); + Assert.AreEqual(stabilityDesignMethodTestValue, location.StabilityDesignMethod); + Assert.AreEqual(doubleTestValue, location.SlopeAdaptionStartCotangent); + Assert.AreEqual(doubleTestValue, location.SlopeAdaptionEndCotangent); + Assert.AreEqual(doubleTestValue, location.SlopeAdaptionStepCotangent); + Assert.AreEqual(doubleTestValue, location.DikeTableHeight); + Assert.AreEqual(doubleTestValue, location.RiverLevel); + Assert.AreEqual(doubleTestValue, location.RiverLevelLow); + + mocks.VerifyAll(); } [Test] @@ -391,18 +389,17 @@ const string locationId = "Test_Location_01"; - - using (var location = new Location + var location = new CsvImporterLocations.LocationRecord { - Name = locationId, - XRd = 1, - YRd = 1, + LocationId = locationId, + GeoX = 1, + GeoY = 1, SegmentId = stringInitialValue, - DampingFactorPL3 = doubleInitialValue, - DampingFactorPL4 = doubleInitialValue, + DampingFactorPl3 = doubleInitialValue, + DampingFactorPl4 = doubleInitialValue, DikeEmbankmentMaterial = stringInitialValue, DistanceToEntryPoint = doubleInitialValue, - HeadPL2 = doubleInitialValue, + HeadPl2 = doubleInitialValue, HeadPl3 = dampingPl3Value, HeadPl4 = doubleInitialValue, MinimalCircleDepth = doubleInitialValue, @@ -413,14 +410,11 @@ PlLineOffsetBelowDikeTopAtPolder = doubleInitialValue, PlLineOffsetBelowShoulderBaseInside = doubleInitialValue, PlLineOffsetBelowDikeToeAtPolder = doubleInitialValue, - ModelFactors = new ModelFactors() - { - RequiredSafetyFactorPiping = doubleInitialValue, - RequiredSafetyFactorStabilityInnerSlope = doubleInitialValue, - RequiredSafetyFactorStabilityOuterSlope = doubleInitialValue, - UpliftCriterionPiping = doubleInitialValue, - UpliftCriterionStability = doubleInitialValue - }, + RequiredSafetyFactorPiping = doubleInitialValue, + RequiredSafetyFactorStabilityInnerSlope = doubleInitialValue, + RequiredSafetyFactorStabilityOuterSlope = doubleInitialValue, + UpliftCriterionPiping = doubleInitialValue, + UpliftCriterionStability = doubleInitialValue, TrafficLoad = doubleInitialValue, TL_DegreeOfConsolidation = doubleInitialValue, ShoulderEmbankmentMaterial = stringInitialValue, @@ -434,84 +428,79 @@ DikeTableHeight = doubleInitialValue, RiverLevel = doubleInitialValue, RiverLevelLow = doubleInitialValue - }) - { - mockImporter.Targets = new List { location }; + }; - Expect.Call(mockImporter.GetCrossSectionRepository(null)).IgnoreArguments().Return(crossSectionRepository); + mockImporter.Targets = new List { location }; - var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); - crossSection.AddAttribute(crossSectionMapping.Name, locationId); - Expect.Call(crossSectionRepository.Features).Return(new[] { crossSection }); - Expect.Call(mockImporter.GetAttributeName(null)).IgnoreArguments().Return(crossSectionMapping.Name); + Expect.Call(mockImporter.GetCrossSectionRepository(null)).IgnoreArguments().Return(crossSectionRepository); - Expect.Call(attributeRepository.SupportedAttributes).Return(supportedAttributes); - Expect.Call(attributeRepository.Features).Return(new[] { attributeLine }); - Expect.Call(attributeRepository.Query((IFeature)null)).IgnoreArguments().Return(new[] - { - attributeLine - }); + var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); + crossSection.AddAttribute(crossSectionMapping.Name, locationId); + Expect.Call(crossSectionRepository.Features).Return(new[] { crossSection }); + Expect.Call(mockImporter.GetAttributeName(null)).IgnoreArguments().Return(crossSectionMapping.Name); - var file = new ShapeFileLocation("test.shp"); - string[] lines = { "First line", "Second line", "Third line" }; - File.WriteAllLines(file.FullPath, lines); + Expect.Call(attributeRepository.SupportedAttributes).Return(supportedAttributes); + Expect.Call(attributeRepository.Features).Return(new[] { attributeLine }); + Expect.Call(attributeRepository.Query((IFeature)null)).IgnoreArguments().Return(new[]{attributeLine}); - Expect.Call(mockImporter.GetFile(null)).IgnoreArguments().Return(file); - Expect.Call(mockImporter.CreateFromShapeFile(null)).IgnoreArguments().Return(attributeRepository); - mocks.ReplayAll(); - // file. - foreach (var key in LocationShapeFileAttributeMap.AttributePropertyMap.Keys) - { - mockImporter.RegisterAttributeMapping(key, null); - } + var file = new ShapeFileLocation("test.shp"); + string[] lines = { "First line", "Second line", "Third line" }; + File.WriteAllLines(file.FullPath, lines); + Expect.Call(mockImporter.GetFile(null)).IgnoreArguments().Return(file); + Expect.Call(mockImporter.CreateFromShapeFile(null)).IgnoreArguments().Return(attributeRepository); + mocks.ReplayAll(); + // file. + foreach (var key in LocationShapeFileAttributeMap.AttributePropertyMap.Keys) + { + mockImporter.RegisterAttributeMapping(key, null); + } - mockImporter.RegisterCrossSectionAttribute(crossSectionMapping.Name, crossSectionMapping.File); - mockImporter.Import(null); - Assert.AreEqual(stringTestValue, location.SegmentId); - Assert.AreEqual(dampingPl3Value, location.DampingFactorPL3); - Assert.AreEqual(0, location.DampingFactorPL4); // as testvalue is beyond the limits, its reset to 0 - Assert.AreEqual(stringTestValue, location.DikeEmbankmentMaterial); - Assert.AreEqual(doubleTestValue, location.DistanceToEntryPoint); - Assert.AreEqual(doubleTestValue, location.HeadPL2); - Assert.AreEqual(doubleTestValue, location.HeadPl3); - Assert.AreEqual(doubleTestValue, location.HeadPl4); - Assert.AreEqual(doubleTestValue, location.MinimalCircleDepth); - Assert.AreEqual(doubleTestValue, location.PenetrationLength); - Assert.AreEqual(doubleTestValue, location.PolderLevel); - Assert.AreEqual(plLineCreationMethodTestValue, location.PLLineCreationMethod); - Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeTopAtRiver); - Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeTopAtPolder); - Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowShoulderBaseInside); - Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeToeAtPolder); - Assert.AreEqual(doubleTestValue, location.TrafficLoad); - Assert.AreEqual(doubleTestValue, location.TL_DegreeOfConsolidation); - Assert.AreEqual(doubleTestValue, location.ModelFactors.RequiredSafetyFactorPiping); - Assert.AreEqual(doubleTestValue, location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope); - Assert.AreEqual(doubleTestValue, location.ModelFactors.RequiredSafetyFactorStabilityOuterSlope); - Assert.AreEqual(stringTestValue, location.ShoulderEmbankmentMaterial); - Assert.AreEqual(doubleTestValue, location.StabilityShoulderGrowSlope); - Assert.AreEqual(doubleTestValue, location.StabilityShoulderGrowDeltaX); - Assert.AreEqual(doubleTestValue, location.StabilitySlopeAdaptionDeltaX); - Assert.AreEqual(doubleTestValue, location.ModelFactors.UpliftCriterionPiping); - Assert.AreEqual(doubleTestValue, location.ModelFactors.UpliftCriterionStability); - Assert.AreEqual(doubleTestValue, location.XSoilGeometry2DOrigin); - Assert.AreEqual(mstabZonesTypeTestValue, location.StabilityZoneType); - Assert.AreEqual(doubleTestValue, location.SlopeDampingPiezometricHeightPolderSide); - Assert.AreEqual(stabilityDesignMethodTestValue, location.StabilityDesignMethod); - Assert.AreEqual(doubleTestValue, location.SlopeAdaptionStartCotangent); - Assert.AreEqual(doubleTestValue, location.SlopeAdaptionEndCotangent); - Assert.AreEqual(doubleTestValue, location.SlopeAdaptionStepCotangent); - Assert.AreEqual(doubleTestValue, location.DikeTableHeight); - Assert.AreEqual(doubleTestValue, location.RiverLevel); - Assert.AreEqual(doubleTestValue, location.RiverLevelLow); + mockImporter.RegisterCrossSectionAttribute(crossSectionMapping.Name, crossSectionMapping.File); + mockImporter.Import(null); - mocks.VerifyAll(); - } + Assert.AreEqual(stringTestValue, location.SegmentId); + Assert.AreEqual(dampingPl3Value, location.DampingFactorPl3); + Assert.AreEqual(0, location.DampingFactorPl4); // as testvalue is beyond the limits, its reset to 0 + Assert.AreEqual(stringTestValue, location.DikeEmbankmentMaterial); + Assert.AreEqual(doubleTestValue, location.DistanceToEntryPoint); + Assert.AreEqual(doubleTestValue, location.HeadPl2); + Assert.AreEqual(doubleTestValue, location.HeadPl3); + Assert.AreEqual(doubleTestValue, location.HeadPl4); + Assert.AreEqual(doubleTestValue, location.MinimalCircleDepth); + Assert.AreEqual(doubleTestValue, location.PenetrationLength); + Assert.AreEqual(doubleTestValue, location.PolderLevel); + Assert.AreEqual(plLineCreationMethodTestValue, location.PLLineCreationMethod); + Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeTopAtRiver); + Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeTopAtPolder); + Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowShoulderBaseInside); + Assert.AreEqual(doubleTestValue, location.PlLineOffsetBelowDikeToeAtPolder); + Assert.AreEqual(doubleTestValue, location.TrafficLoad); + Assert.AreEqual(doubleTestValue, location.TL_DegreeOfConsolidation); + Assert.AreEqual(doubleTestValue, location.RequiredSafetyFactorPiping); + Assert.AreEqual(doubleTestValue, location.RequiredSafetyFactorStabilityInnerSlope); + Assert.AreEqual(doubleTestValue, location.RequiredSafetyFactorStabilityOuterSlope); + Assert.AreEqual(stringTestValue, location.ShoulderEmbankmentMaterial); + Assert.AreEqual(doubleTestValue, location.StabilityShoulderGrowSlope); + Assert.AreEqual(doubleTestValue, location.StabilityShoulderGrowDeltaX); + Assert.AreEqual(doubleTestValue, location.StabilitySlopeAdaptionDeltaX); + Assert.AreEqual(doubleTestValue, location.UpliftCriterionPiping); + Assert.AreEqual(doubleTestValue, location.UpliftCriterionStability); + Assert.AreEqual(doubleTestValue, location.XSoilGeometry2DOrigin); + Assert.AreEqual(mstabZonesTypeTestValue, location.StabilityZoneType); + Assert.AreEqual(doubleTestValue, location.SlopeDampingPiezometricHeightPolderSide); + Assert.AreEqual(stabilityDesignMethodTestValue, location.StabilityDesignMethod); + Assert.AreEqual(doubleTestValue, location.SlopeAdaptionStartCotangent); + Assert.AreEqual(doubleTestValue, location.SlopeAdaptionEndCotangent); + Assert.AreEqual(doubleTestValue, location.SlopeAdaptionStepCotangent); + Assert.AreEqual(doubleTestValue, location.DikeTableHeight); + Assert.AreEqual(doubleTestValue, location.RiverLevel); + Assert.AreEqual(doubleTestValue, location.RiverLevelLow); + + mocks.VerifyAll(); } - [Test] //[ExpectedException(typeof(AttributeMissingException))] [Category("Integration")] @@ -550,20 +539,23 @@ mocks.ReplayAll(); - using (var location = new Location { XRd = 11, YRd = 11 }) + var location = new CsvImporterLocations.LocationRecord { - mockImporter.Targets = new List - { - location - }; + LocationId = "Location 1", + GeoX = 11, + GeoY = 11, + }; + mockImporter.Targets = new List + { + location + }; - mockImporter.RegisterAttributeMapping(LocationShapeFileAttributeMap.PenetrationLengthAttributeId); - mockImporter.Import(null); + mockImporter.RegisterAttributeMapping(LocationShapeFileAttributeMap.PenetrationLengthAttributeId); + mockImporter.Import(null); - Assert.IsTrue(mockImporter.ImportErrors.OfType().Count() == 1, "The error list should contain an AttributeMissingException"); + Assert.IsTrue(mockImporter.ImportErrors.OfType().Count() == 1, "The error list should contain an AttributeMissingException"); - mocks.VerifyAll(); - } + mocks.VerifyAll(); } [Test] @@ -600,65 +592,60 @@ const string locationId = "Test_Location_01"; - using (var location = new Location + var location = new CsvImporterLocations.LocationRecord { - Name = locationId, - XRd = 1, - YRd = 1, - }) - { - mockImporter.Targets = new List { location }; + LocationId = locationId, + GeoX = 1, + GeoY = 1, + }; + mockImporter.Targets = new List { location }; - Expect.Call(mockImporter.GetCrossSectionRepository(null)).IgnoreArguments().Return(crossSectionRepository); + Expect.Call(mockImporter.GetCrossSectionRepository(null)).IgnoreArguments().Return(crossSectionRepository); - var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); - crossSection.AddAttribute(crossSectionMapping.Name, locationId); - Expect.Call(crossSectionRepository.Features).Return(new[] { crossSection }); - Expect.Call(mockImporter.GetAttributeName(null)).IgnoreArguments().Return(crossSectionMapping.Name); + var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); + crossSection.AddAttribute(crossSectionMapping.Name, locationId); + Expect.Call(crossSectionRepository.Features).Return(new[] { crossSection }); + Expect.Call(mockImporter.GetAttributeName(null)).IgnoreArguments().Return(crossSectionMapping.Name); - Expect.Call(attributeRepository.SupportedAttributes).Return(supportedAttributes); - Expect.Call(attributeRepository.Features).Return(new[] { attributeLine }); - Expect.Call(attributeRepository.Query((IFeature)null)).IgnoreArguments().Return(new[] - { - attributeLine - }); + Expect.Call(attributeRepository.SupportedAttributes).Return(supportedAttributes); + Expect.Call(attributeRepository.Features).Return(new[] { attributeLine }); + Expect.Call(attributeRepository.Query((IFeature)null)).IgnoreArguments().Return(new[]{attributeLine}); - var file = new ShapeFileLocation("test.shp"); - string[] lines = { "First line", "Second line", "Third line" }; - File.WriteAllLines(file.FullPath, lines); - Expect.Call(mockImporter.GetFile(null)).IgnoreArguments().Return(file); - Expect.Call(mockImporter.CreateFromShapeFile(null)).IgnoreArguments().Return(attributeRepository); + var file = new ShapeFileLocation("test.shp"); + string[] lines = { "First line", "Second line", "Third line" }; + File.WriteAllLines(file.FullPath, lines); + Expect.Call(mockImporter.GetFile(null)).IgnoreArguments().Return(file); + Expect.Call(mockImporter.CreateFromShapeFile(null)).IgnoreArguments().Return(attributeRepository); - mocks.ReplayAll(); + mocks.ReplayAll(); - mockImporter.RegisterAttributeMapping(attributeId); - mockImporter.RegisterCrossSectionAttribute(crossSectionMapping.Name, crossSectionMapping.File); - mockImporter.Import(null); + mockImporter.RegisterAttributeMapping(attributeId); + mockImporter.RegisterCrossSectionAttribute(crossSectionMapping.Name, crossSectionMapping.File); + mockImporter.Import(null); - Assert.IsTrue(mockImporter.ImportErrors.OfType().Count() == 1, "The error list should contain an AttributeMissingException"); + Assert.IsTrue(mockImporter.ImportErrors.OfType().Count() == 1, "The error list should contain an AttributeMissingException"); - mocks.VerifyAll(); - } + mocks.VerifyAll(); } [Test] [Category("Integration")] public void RegisterAttribute_AttributeNotSupported_GivesMessage() { - using (var location = new Location { XRd = 10, YRd = 10, TrafficLoad = 0 }) + var location = new CsvImporterLocations.LocationRecord { - importer.Targets = new List - { - location - }; + LocationId = "Location 1", + GeoX = 10, + GeoY = 10, + TrafficLoad = 0, + }; - - importer.DataFileLocation = DirectoryWithDataShapeFiles; - importer.RegisterAttributeMapping("someattributeid", "test", TestShapeFile); - Assert.AreEqual(1, importer.ImproperAttributeMessages.Count); - } + importer.Targets = new List { location }; + importer.DataFileLocation = DirectoryWithDataShapeFiles; + importer.RegisterAttributeMapping("someattributeid", "test", TestShapeFile); + Assert.AreEqual(1, importer.ImproperAttributeMessages.Count); } @@ -667,49 +654,45 @@ //[ExpectedException(typeof(FeatureCoverageException))] public void Import_PointOutsideGeometry_ErrorIsAddedToList() { - using (var location = new Location + var location = new CsvImporterLocations.LocationRecord { - XRd = 0.0, - YRd = 0.0 - }) - { - importer.Targets = new List() - { - location - }; + LocationId = "Location 1", + GeoX = 0.0, + GeoY = 0.0, + }; - importer.DataFileLocation = DirectoryWithDataShapeFiles; - importer.RegisterAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId, TestShapeFile); - importer.Import(null); + importer.Targets = new List { location }; + importer.DataFileLocation = DirectoryWithDataShapeFiles; + importer.RegisterAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId, TestShapeFile); + importer.Import(null); - if (importer.ImportErrors.OfType().Any()) - { - throw importer.ImportErrors.OfType().First(); - } - - Assert.IsTrue(importer.ImportErrors.OfType().Count() == 1); + if (importer.ImportErrors.OfType().Any()) + { + throw importer.ImportErrors.OfType().First(); } + + Assert.IsTrue(importer.ImportErrors.OfType().Count() == 1); } [Test] [Category("Integration")] public void Import_OnLegalInitialization_LocationPropertyHasChanged() { const double trafLoadValueInShapeFile = 13.000; - using (var location = new Location { XRd = 192704.726628436, YRd = 505976.228134643, TrafficLoad = 0 }) + var location = new CsvImporterLocations.LocationRecord { - importer.Targets = new List - { - location - }; + LocationId = "Location 1", + GeoX = 192704.726628436, + GeoY = 505976.228134643, + TrafficLoad = 0, + }; + importer.Targets = new List { location }; + importer.DataFileLocation = DirectoryWithDataShapeFiles; + importer.RegisterAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId, TestShapeFile); + importer.Import(null); - importer.DataFileLocation = DirectoryWithDataShapeFiles; - importer.RegisterAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId, TestShapeFile); - importer.Import(null); - - Assert.AreEqual(trafLoadValueInShapeFile, location.TrafficLoad); - } + Assert.AreEqual(trafLoadValueInShapeFile, location.TrafficLoad); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/Dam/Tests/DataPluginImporterCsvTests.cs =================================================================== diff -u -r2253 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/DataPluginImporterCsvTests.cs (.../DataPluginImporterCsvTests.cs) (revision 2253) +++ DamClients/DamUI/trunk/src/Dam/Tests/DataPluginImporterCsvTests.cs (.../DataPluginImporterCsvTests.cs) (revision 2529) @@ -87,7 +87,6 @@ Assert.AreEqual("192584.1", locationDetails.Where(x => x.ParameterName.Equals("XRd")).FirstOrDefault().ParameterValue); Assert.AreEqual("511740.3", locationDetails.Where(x => x.ParameterName.Equals("YRd")).FirstOrDefault().ParameterValue); Assert.AreEqual("-3", locationDetails.Where(x => x.ParameterName.Equals("PolderLevel")).FirstOrDefault().ParameterValue); - Assert.AreEqual("1.5", locationDetails.Where(x => x.ParameterName.Equals("HeadPL3")).FirstOrDefault().ParameterValue); } [Test] Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationAttributeMapping.cs =================================================================== diff -u -r2089 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationAttributeMapping.cs (.../LocationAttributeMapping.cs) (revision 2089) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationAttributeMapping.cs (.../LocationAttributeMapping.cs) (revision 2529) @@ -19,11 +19,12 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Deltares.Dam.Data.CsvImporters; using Deltares.Maps; namespace Deltares.Dam.Data.Importers { - public class LocationAttributeMapping : AttributeMapping + public class LocationAttributeMapping : AttributeMapping { } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj =================================================================== diff -u -r2511 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 2511) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 2529) @@ -223,7 +223,6 @@ - Index: DamClients/DamUI/trunk/src/Dam/Tests/CsvImporterTestsNew.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/CsvImporterTestsNew.cs (.../CsvImporterTestsNew.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/Dam/Tests/CsvImporterTestsNew.cs (.../CsvImporterTestsNew.cs) (revision 2529) @@ -683,31 +683,31 @@ Assert.AreEqual("106", locationRecords[1].SegmentId); Assert.AreEqual(66586.0, locationRecords[1].GeoX, tolerance); Assert.AreEqual(424173.0, locationRecords[1].GeoY, tolerance); - Assert.AreEqual(2.0, locationRecords[1].XSoilgeometry2DOrigin, tolerance); - Assert.AreEqual(-0.25, locationRecords[1].Polderlevel, tolerance); + Assert.AreEqual(2.0, locationRecords[1].XSoilGeometry2DOrigin, tolerance); + Assert.AreEqual(-0.25, locationRecords[1].PolderLevel, tolerance); Assert.AreEqual(0.8727, locationRecords[1].HeadPl2.Value, tolerance); Assert.AreEqual(0.9, locationRecords[0].HeadPl3.Value, tolerance); Assert.AreEqual(0.8, locationRecords[0].HeadPl4.Value, tolerance); - Assert.AreEqual("klei", locationRecords[1].Ophoogmateriaaldijk); - Assert.AreEqual("klei2", locationRecords[1].Ophoogmateriaalberm); + Assert.AreEqual("klei", locationRecords[1].DikeEmbankmentMaterial); + Assert.AreEqual("klei2", locationRecords[1].ShoulderEmbankmentMaterial); Assert.AreEqual(1.3, locationRecords[1].PenetrationLength, tolerance); Assert.AreEqual(10, locationRecords[1].TrafficLoad, tolerance); Assert.AreEqual(10.1, locationRecords[0].TL_DegreeOfConsolidation, tolerance); Assert.AreEqual(55.5, locationRecords[1].TL_DegreeOfConsolidation, tolerance); Assert.AreEqual(1.5, locationRecords[1].MinimalCircleDepth, tolerance); - Assert.AreEqual(30.0, locationRecords[1].DempingsfactorPl3, tolerance); - Assert.AreEqual(40.0, locationRecords[1].DempingsfactorPl4, tolerance); + Assert.AreEqual(30.0, locationRecords[1].DampingFactorPl3, tolerance); + Assert.AreEqual(40.0, locationRecords[1].DampingFactorPl4, tolerance); Assert.AreEqual(PLLineCreationMethod.ExpertKnowledgeRRD, locationRecords[1].PLLineCreationMethod); - Assert.AreEqual(1.2, locationRecords[1].SafetyFactorPiping, tolerance); - Assert.AreEqual(1.3, locationRecords[1].SafetyFactorStabilityInnerSlope, tolerance); - Assert.AreEqual(1.4, locationRecords[1].SafetyFactorStabilityOuterSlope, tolerance); + Assert.AreEqual(1.2, locationRecords[1].RequiredSafetyFactorPiping, tolerance); + Assert.AreEqual(1.3, locationRecords[1].RequiredSafetyFactorStabilityInnerSlope, tolerance); + Assert.AreEqual(1.4, locationRecords[1].RequiredSafetyFactorStabilityOuterSlope, tolerance); Assert.AreEqual(1.1, locationRecords[1].UpliftCriterionPiping, tolerance); Assert.AreEqual(1.2, locationRecords[1].UpliftCriterionStability, tolerance); Assert.AreEqual(2.1, locationRecords[1].DistanceToEntryPoint, tolerance); - Assert.AreEqual(0.5, locationRecords[1].PLLineOffsetBelowDikeTopAtRiver, tolerance); - Assert.AreEqual(0.6, locationRecords[1].PLLineOffsetBelowDikeTopAtPolder, tolerance); - Assert.AreEqual(0.1, locationRecords[1].PLLineOffsetBelowShoulderBaseInside, tolerance); - Assert.AreEqual(0.2, locationRecords[1].PLLineOffsetBelowDikeToeAtPolder, tolerance); + Assert.AreEqual(0.5, locationRecords[1].PlLineOffsetBelowDikeTopAtRiver, tolerance); + Assert.AreEqual(0.6, locationRecords[1].PlLineOffsetBelowDikeTopAtPolder, tolerance); + Assert.AreEqual(0.1, locationRecords[1].PlLineOffsetBelowShoulderBaseInside, tolerance); + Assert.AreEqual(0.2, locationRecords[1].PlLineOffsetBelowDikeToeAtPolder, tolerance); Assert.AreEqual(2.0, locationRecords[1].StabilityShoulderGrowSlope, tolerance); Assert.AreEqual(0.2, locationRecords[1].StabilityShoulderGrowDeltaX, tolerance); Assert.AreEqual(0.5, locationRecords[1].StabilitySlopeAdaptionDeltaX, tolerance); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml =================================================================== diff -u -r2472 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml (.../Translations.xml) (revision 2472) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml (.../Translations.xml) (revision 2529) @@ -562,10 +562,10 @@ - - - - + + + + Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs =================================================================== diff -u -r2089 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs (.../LineAttributeImporter.cs) (revision 2089) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs (.../LineAttributeImporter.cs) (revision 2529) @@ -23,9 +23,9 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Runtime.Serialization; +using Deltares.Dam.Data.CsvImporters; using Deltares.Maps; namespace Deltares.Dam.Data.Importers @@ -50,7 +50,7 @@ } } - public class LineAttributeImporter : IAttributeImporter where T : Location + public class LineAttributeImporter : IAttributeImporter where T : CsvImporterLocations.LocationRecord { private readonly IList errors; private IDictionary targetLookup; @@ -71,7 +71,7 @@ { if (value != null) { - this.targetLookup = value.ToDictionary(k => k.Name.ToLowerInvariant(), v => v); + this.targetLookup = value.ToDictionary(k => k.LocationId.ToLowerInvariant(), v => v); if (CrossSectionRepository != null) { @@ -230,18 +230,18 @@ mapping.Action(target, value); if (mapping.Name.ToUpper() == "DAMPINGPL3") { - if (target.DampingFactorPL3 < 0 || target.DampingFactorPL3 > 1) + if (target.DampingFactorPl3 < 0 || target.DampingFactorPl3 > 1) { - AddError(new AttributeWrongValueException(mapping.Name, target.DampingFactorPL3, 0.0, 1.0)); - target.DampingFactorPL3 = 0; + AddError(new AttributeWrongValueException(mapping.Name, target.DampingFactorPl3.Value, 0.0, 1.0)); + target.DampingFactorPl3 = 0; } } if (String.Compare(mapping.Name, "DampingPL4", true) == 0) { - if (target.DampingFactorPL4 < 0 || target.DampingFactorPL4 > 1) + if (target.DampingFactorPl4 < 0 || target.DampingFactorPl4 > 1) { - AddError(new AttributeWrongValueException(mapping.Name, target.DampingFactorPL4, 0.0, 1.0)); - target.DampingFactorPL4 = 0; + AddError(new AttributeWrongValueException(mapping.Name, target.DampingFactorPl4.Value, 0.0, 1.0)); + target.DampingFactorPl4 = 0; } } count++; @@ -250,7 +250,7 @@ { throw new AttributeParseException( string.Format("Error parsing the value '{0}' of '{1}' for target '{2}' ", value.ToString().Replace("\0", ""), - mapping.Name, target.Name), e); + mapping.Name, target.LocationId), e); } } } Index: DamClients/DamUI/trunk/src/Dam/Tests/TestData/DamLive/Grebbedijk/input.damx =================================================================== diff -u -r875 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/TestData/DamLive/Grebbedijk/input.damx (.../branches/CalcualtionIncluded/src/Dam/Tests/TestData/DamLive/Grebbedijk/input.damx) (revision 875) +++ DamClients/DamUI/trunk/src/Dam/Tests/TestData/DamLive/Grebbedijk/input.damx (.../trunk/src/Dam/Tests/TestData/DamLive/Grebbedijk/input.damx) (revision 2529) @@ -188,7 +188,7 @@ - + @@ -313,7 +313,7 @@ - + @@ -544,7 +544,6 @@ - Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs (.../LocationShapeFileAttributeMap.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs (.../LocationShapeFileAttributeMap.cs) (revision 2529) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Deltares.Dam.Data.CsvImporters; using Deltares.Standard.Extensions; using DataAttribute = Deltares.Dam.Data.DataPlugins.Configuration.DataAttribute; @@ -165,18 +166,18 @@ /// - /// PLLineOffsetBelowDikeTopAtRiver + /// PlLineOffsetBelowDikeTopAtRiver /// CustomShape - /// PLLineOffsetBelowDikeTopAtRiver.shp + /// PlLineOffsetBelowDikeTopAtRiver.shp /// PLBlwTDRvr /// double /// public const string PlLineOffsetBelowDikeTopAtRiverAttributeId = CsvColumnNames.PlLineOffsetBelowDikeTopAtRiverColumnName; /// - /// PLLineOffsetBelowDikeTopAtPolder + /// PlLineOffsetBelowDikeTopAtPolder /// CustomShape - /// PLLineOffsetBelowDikeTopAtPolder.shp + /// PlLineOffsetBelowDikeTopAtPolder.shp /// PLBlwTDPld /// double /// @@ -194,7 +195,7 @@ /// /// PlLineOffsetBelowDikeToeAtPolder /// CustomShape - /// PLLineOffsetBelowDikeToeAtPolder.shp + /// PlLineOffsetBelowDikeToeAtPolder.shp /// PLBlwDTPld /// double /// @@ -613,18 +614,18 @@ #region Attribute Map - Func,KeyValuePair> createItem = + Func,KeyValuePair> createItem = (id, f, c, a) => new KeyValuePair(id, new LocationAttributeMapping(){Id = id.ToLower(), File = f, Name = c, Action = a}); var mappings = new List> { // direct property mappings createItem(SegmentAttributeId, "segment_id.shp", "segmentid", (t, value) => t.SegmentId = value.ToString()), - createItem(DampingFactorPl3AttributeId, "DampingFactoPL3.shp", "DampingPL3", (t, value) => t.DampingFactorPL3 = value.ToType() ), - createItem(DampingFactorPl4AttributeId, "DampingFactoPL4.shp", "DampingPL4", (t, value) => t.DampingFactorPL4 = value.ToType() ), + createItem(DampingFactorPl3AttributeId, "DampingFactoPL3.shp", "DampingPL3", (t, value) => t.DampingFactorPl3 = value.ToType() ), + createItem(DampingFactorPl4AttributeId, "DampingFactoPL4.shp", "DampingPL4", (t, value) => t.DampingFactorPl4 = value.ToType() ), createItem(DikeEmbankmentMaterialAttributeId, "Dikematerial.shp", "DikeMtrl", (t, value) => t.DikeEmbankmentMaterial = value.ToType() ), createItem(DistanceToEntryPointAttributeId, "distance_to_entry_point.shp", "dist_entry", (t, value) => t.DistanceToEntryPoint = value.ToType()), - createItem(HeadPl2AttributeId, "HeadPL2.shp", "HeadPL2", (t, value) => t.HeadPL2 = value.ToType() ), + createItem(HeadPl2AttributeId, "HeadPL2.shp", "HeadPL2", (t, value) => t.HeadPl2 = value.ToType() ), createItem(HeadPl3AttributeId, "HeadPL3.shp", "HeadPL3", (t, value) => t.HeadPl3 = value.ToType() ), createItem(HeadPl4AttributeId, "HeadPL4.shp", "HeadPL4", (t, value) => t.HeadPl4 = value.ToType() ), createItem(MinimalCircleDepthAtrributeId, "minimal_circle_depth.shp", "mincrcldepth", (t, value) => t.MinimalCircleDepth = value.ToType()), @@ -645,15 +646,15 @@ createItem(IntrusionVerticalWaterPressureAttributeId, "IntrusionVerticalWaterPressure.shp", "IVWP", (t, value) => t.IntrusionVerticalWaterPressure = LocationImportHelper.ToIntrusionVerticalWaterPressure(value)), createItem(TrafficLoadAttributeId, "trafficload.shp", "TrafLoad", (t, value) => t.TrafficLoad = value.ToType() ), createItem(TL_DegreeOfConsolidationAttributeId, "TL_DegreeOfConsolidation.shp", "TL_DegOfCo", (t, value) => t.TL_DegreeOfConsolidation = value.ToType() ), - createItem(SafetyFactorPipingAttributeId, "safety_factor_piping.shp", "fpiping", (t, value) => t.ModelFactors.RequiredSafetyFactorPiping = value.ToType()), - createItem(SafetyFactorStabilityInnerSlopeAttributeId, "safety_factor_stability_inner_slope.shp", "fstabinner", (t, value) => t.ModelFactors.RequiredSafetyFactorStabilityInnerSlope = value.ToType()), - createItem(SafetyFactorStabilityOuterSlopeAttributeId, "safety_factor_stability_outer_slope.shp", "fstabouter", (t, value) => t.ModelFactors.RequiredSafetyFactorStabilityOuterSlope = value.ToType()), + createItem(SafetyFactorPipingAttributeId, "safety_factor_piping.shp", "fpiping", (t, value) => t.RequiredSafetyFactorPiping = value.ToType()), + createItem(SafetyFactorStabilityInnerSlopeAttributeId, "safety_factor_stability_inner_slope.shp", "fstabinner", (t, value) => t.RequiredSafetyFactorStabilityInnerSlope = value.ToType()), + createItem(SafetyFactorStabilityOuterSlopeAttributeId, "safety_factor_stability_outer_slope.shp", "fstabouter", (t, value) => t.RequiredSafetyFactorStabilityOuterSlope = value.ToType()), createItem(ShoulderEmbankmentMaterialAttributeId, ShoulderMaterialShapeFileName, "ShlderMtrl", (t, value) => t.ShoulderEmbankmentMaterial = value.ToType() ), createItem(StabilityShoulderGrowSlopeAttributeId, "StabilityShoulderGrowSlope.shp", "StShSlpGr", (t, value) => t.StabilityShoulderGrowSlope = value.ToType()), createItem(StabilityShoulderGrowDeltaXAttributeId, "StabilityShoulderGrowDeltaX.shp", "StShDXGr", (t, value) => t.StabilityShoulderGrowDeltaX = value.ToType()), createItem(StabilitySlopeAdaptionDeltaXAttributeId, "StabilitySlopeAdaptionDeltaX.shp", "StSlAdaptDX", (t, value) => t.StabilitySlopeAdaptionDeltaX = value.ToType()), - createItem(UpliftCriterionPipingAttributeId, "uplift_criterion_piping.shp", "uplpiping", (t, value) => t.ModelFactors.UpliftCriterionPiping = value.ToType()), - createItem(UpliftCriterionStabilityAttributeId, "uplift_criterion_stability.shp", "uplstab", (t, value) => t.ModelFactors.UpliftCriterionStability = value.ToType()), + createItem(UpliftCriterionPipingAttributeId, "uplift_criterion_piping.shp", "uplpiping", (t, value) => t.UpliftCriterionPiping = value.ToType()), + createItem(UpliftCriterionStabilityAttributeId, "uplift_criterion_stability.shp", "uplstab", (t, value) => t.UpliftCriterionStability = value.ToType()), createItem(XSoilGeometry2DOriginAttributeId, "XSoilGeometry2DOrigin.shp", "XG2DOrg", (t, value) => t.XSoilGeometry2DOrigin = value.ToType()), createItem(SlopeDampingPiezometricHeightPolderSideAttributeId, "SlopeDampingPiezometricHeightPolderSide.shp", "SlopeDampingPiezometricHeightPolderSide", (t, value) => t.SlopeDampingPiezometricHeightPolderSide = value.ToType() ), createItem(DikeTableHeightAttributeId, "DikeTableHeight.shp", "DikeTableHeight", (t, value) => t.DikeTableHeight = value.ToType() ), @@ -751,7 +752,7 @@ var map = ConstructionalMap; string file = string.Empty, attrName = string.Empty; - Action action = (t, value) => { }; + Action action = (t, value) => { }; var id = attributeId.ToLower(); Index: DamClients/DamUI/trunk/src/Dam/Forms/LocationPropertyControl.cs =================================================================== diff -u -r2496 -r2529 --- DamClients/DamUI/trunk/src/Dam/Forms/LocationPropertyControl.cs (.../LocationPropertyControl.cs) (revision 2496) +++ DamClients/DamUI/trunk/src/Dam/Forms/LocationPropertyControl.cs (.../LocationPropertyControl.cs) (revision 2529) @@ -44,8 +44,6 @@ BindSupport.BindTextValueAndUnit(this, this.PolderLevelLabel, this.PolderLevelEdit, typeof (Location), "PolderLevel"); BindSupport.BindTextValueAndUnit(this, this.HeadPL2Label, this.HeadPL2Edit, typeof (Location), "HeadPL2"); - BindSupport.BindTextValueAndUnit(this, this.HeadPL3Label, this.HeadPL3Edit, typeof (Location), "HeadPl3"); - BindSupport.BindTextValueAndUnit(this, this.HeadPL4Label, this.HeadPL4Edit, typeof (Location), "HeadPl4"); BindSupport.BindTextValueAndUnit(this, this.TrafficLoadLabel, this.TrafficLoadEdit, typeof (Location), "TrafficLoad"); BindSupport.BindTextValueAndUnit(this, this.TL_DegreeOfConsolidationLabel, this.TL_DegreeOfConsolidationEdit, typeof(Location), "TL_DegreeOfConsolidation"); Index: DamClients/DamUI/trunk/src/Dam/Tests/Sensors/SensorImportFromExcelSheetTest.cs =================================================================== diff -u -r2256 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/Sensors/SensorImportFromExcelSheetTest.cs (.../SensorImportFromExcelSheetTest.cs) (revision 2256) +++ DamClients/DamUI/trunk/src/Dam/Tests/Sensors/SensorImportFromExcelSheetTest.cs (.../SensorImportFromExcelSheetTest.cs) (revision 2529) @@ -104,8 +104,6 @@ Assert.AreEqual(DataSourceTypeSensors.Ignore, sensorData.SourceTypePl3); Assert.AreEqual(DataSourceTypeSensors.LocationData, sensorData.SourceTypePl4); Assert.AreEqual(-1.33, sensorData.PolderLevel, cTolerance); - Assert.AreEqual(0.8, sensorData.HeadPl3, cTolerance); - Assert.AreEqual(0.8, sensorData.HeadPl4, cTolerance); // Test data for the second sensor var currentSensor = sensorData.Sensors.FirstOrDefault(s => s.ID.Equals(10)); Assert.AreEqual("AS452", currentSensor.Name); Index: DamClients/DamUI/trunk/src/Dam/Tests/WaterBoardImporterTests.cs =================================================================== diff -u -r2511 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/WaterBoardImporterTests.cs (.../WaterBoardImporterTests.cs) (revision 2511) +++ DamClients/DamUI/trunk/src/Dam/Tests/WaterBoardImporterTests.cs (.../WaterBoardImporterTests.cs) (revision 2529) @@ -230,8 +230,6 @@ Assert.AreEqual(2, dike.Locations.Count); Assert.IsNull(dike.Locations[0].HeadPL2); - Assert.IsNull(dike.Locations[0].HeadPl3); - Assert.IsNull(dike.Locations[0].HeadPl4); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs =================================================================== diff -u -r2472 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs (.../Scenario.cs) (revision 2472) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs (.../Scenario.cs) (revision 2529) @@ -940,7 +940,7 @@ /// public override string ToString() { - return String.Format("Location={0}, ID={1} RiverLevel={2} RiverLevelLow={3} DikeTableHeight={4} SafetyFactorStabilityInnerSlope={5} RequiredSafetyFactorStabilityOuterSlope={6} PlLineOffsetBelowDikeTopAtRiver={7} PlLineOffsetBelowDikeToeAtPolder={8} PlLineOffsetBelowDikeTopAtPolder={9} PlLineOffsetBelowShoulderBaseInside={10} UsePlLineOffsetBelowDikeCrestMiddle {11} PlLineOffsetBelowDikeCrestMiddle {12} UsePlLineOffsetFactorBelowShoulderCrest {13} PlLineOffsetFactorBelowShoulderCrest {14} HeadPl3={15} HeadPl4={16}", + return String.Format("Location={0}, ID={1} RiverLevel={2} RiverLevelLow={3} DikeTableHeight={4} RequiredSafetyFactorStabilityInnerSlope={5} RequiredSafetyFactorStabilityOuterSlope={6} PlLineOffsetBelowDikeTopAtRiver={7} PlLineOffsetBelowDikeToeAtPolder={8} PlLineOffsetBelowDikeTopAtPolder={9} PlLineOffsetBelowShoulderBaseInside={10} UsePlLineOffsetBelowDikeCrestMiddle {11} PlLineOffsetBelowDikeCrestMiddle {12} UsePlLineOffsetFactorBelowShoulderCrest {13} PlLineOffsetFactorBelowShoulderCrest {14} HeadPl3={15} HeadPl4={16}", Location.Name, LocationScenarioID, RiverLevel, RiverLevelLow.HasValue ? RiverLevelLow.ToString() : "?", DikeTableHeight.HasValue ? DikeTableHeight.ToString() : "?", @@ -1153,10 +1153,10 @@ public const string RequiredSafetyFactorPiping = "RequiredSafetyFactorPiping"; public const string UpliftCriterionPiping = "UpliftCriterionPiping"; public const string UpliftCriterionStability = "UpliftCriterionStability"; - public const string PlLineOffsetBelowDikeTopAtRiver = "PLLineOffsetBelowDikeTopAtRiver"; - public const string PlLineOffsetBelowDikeTopAtPolder = "PLLineOffsetBelowDikeTopAtPolder"; - public const string PlLineOffsetBelowShoulderBaseInside = "PLLineOffsetBelowShoulderBaseInside"; - public const string PlLineOffsetBelowDikeToeAtPolder = "PLLineOffsetBelowDikeToeAtPolder"; + public const string PlLineOffsetBelowDikeTopAtRiver = "PlLineOffsetBelowDikeTopAtRiver"; + public const string PlLineOffsetBelowDikeTopAtPolder = "PlLineOffsetBelowDikeTopAtPolder"; + public const string PlLineOffsetBelowShoulderBaseInside = "PlLineOffsetBelowShoulderBaseInside"; + public const string PlLineOffsetBelowDikeToeAtPolder = "PlLineOffsetBelowDikeToeAtPolder"; public const string PlLineOffsetBelowDikeCrestMiddle = "PlLineOffsetBelowDikeCrestMiddle"; public const string PlLineOffsetFactorBelowShoulderCrest = "PlLineOffsetFactorBelowShoulderCrest"; public const string UsePlLineOffsetBelowDikeCrestMiddle = "UsePlLineOffsetBelowDikeCrestMiddle"; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactory.cs =================================================================== diff -u -r2513 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactory.cs (.../EntityFactory.cs) (revision 2513) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactory.cs (.../EntityFactory.cs) (revision 2529) @@ -305,33 +305,17 @@ location1.YRd = 143090; location1.PolderLevel = 0.4; location1.HeadPL2 = 4.0; - location1.HeadPl3 = 3.0; - location1.HeadPl4 = 2.5; location1.DikeEmbankmentMaterial = "clay"; location1.ShoulderEmbankmentMaterial = "sand"; location1.StabilityShoulderGrowSlope = 3.1; location1.StabilityShoulderGrowDeltaX = 3.2; location1.StabilitySlopeAdaptionDeltaX = 3.3; - location1.PlLineOffsetBelowDikeTopAtRiver = 3.4; - location1.PlLineOffsetBelowDikeTopAtPolder = 3.5; - location1.PlLineOffsetBelowShoulderBaseInside = 3.52; - location1.PlLineOffsetBelowDikeToeAtPolder = 3.54; - location1.PlLineOffsetBelowDikeCrestMiddle = 3.55; - location1.PlLineOffsetFactorBelowShoulderCrest = 0.36; location1.IntrusionVerticalWaterPressure = IntrusionVerticalWaterPressureType.FullHydroStatic; location1.PenetrationLength = 3.6; location1.TrafficLoad = 3.7; location1.TL_DegreeOfConsolidation = 3.8; location1.MinimalCircleDepth = 1.11; location1.DistanceToEntryPoint = 1.16; - location1.ModelFactors.RequiredSafetyFactorPiping = 1.11; - location1.ModelFactors.RequiredSafetyFactorStabilityInnerSlope = 1.12; - location1.ModelFactors.RequiredSafetyFactorStabilityOuterSlope = 1.13; - location1.ModelFactors.UpliftCriterionPiping = 1.14; - location1.ModelFactors.UpliftCriterionStability = 1.15; - location1.DikeTableHeight = 0.1; - location1.RiverLevel = 0.2; - location1.RiverLevelLow = 0.3; dike.Locations.Add(location1); Location location2 = new Location(); @@ -665,74 +649,6 @@ } /// - /// Creates a location object - /// - /// The location id - /// The segment id - /// The surface line id - /// The rd x coordinate - /// The rd y coordinate - /// The polder level - /// A materialized object - /// - /// l.Name == locationId), - StringResourceNames.EntityAlreadyExist, - c => c != null, - e => new EntityAlreadyExistException(string.Format("Location '{0}' {1}", locationId, ThrowHelper.GetResourceString(e))) - ); - - // Lookup the segment to associate - // if the item does not exists create one and add it to the lookup - var segment = segments.FirstOrDefault(s => s.Name == segmentId.ToString()); - if (segment == null) - { - segment = new Segment() { Name = segmentId }; - segments.Add(segment); - } - - // Lookup the surface line to associate - // if the item does not exists create one and add it to the lookup - var surfaceLine = surfaceLines.FirstOrDefault(s => s.Name == surfaceLineId); - if (surfaceLine == null) - { - surfaceLine = new SurfaceLine2 - { - Name = surfaceLineId, - CharacteristicPoints = { GeometryMustContainPoint = true }, - Geometry = new LocalizedGeometryPointString() - }; - surfaceLines.Add(surfaceLine); - } - - // Lookup the pl1 line to associate - // if the item does not exists create one and add it to the lookup - var pl1Line = pl1Lines.FirstOrDefault(s => s.Name == pl1Id); - if (pl1Line == null) - { - pl1Line = new PL1Line() { Name = pl1Id }; - pl1Lines.Add(pl1Line); - } - - var location = new Location() - { - Name = locationId, - Segment = segment, - SurfaceLine2 = surfaceLine, - PL1Line = pl1Line, - }; - - return location; - } - - /// /// Creates a new surface line point which will be added to the characteristics point collection /// /// The ID of the surface line containing the point collections Index: DamClients/DamUI/trunk/src/Dam/Tests/Sensors/SensorLocationTests.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/Sensors/SensorLocationTests.cs (.../SensorLocationTests.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/Dam/Tests/Sensors/SensorLocationTests.cs (.../SensorLocationTests.cs) (revision 2529) @@ -26,6 +26,7 @@ using Deltares.Geotechnics; using Deltares.Geotechnics.GeotechnicalGeometry; using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.TestUtils; using NUnit.Framework; namespace Deltares.Dam.Tests.Sensors @@ -503,14 +504,15 @@ } [Test] + [Category(Categories.WorkInProgress)] public void GetValue_PL1PLLineOffsetBelowDikeToeAtPolderAndDataSourceTypeLocationData_ShouldReturnValue() { // setup var sensor = new Sensor(); const double testValue = 1.1; var sensorValues = new Dictionary { { sensor, testValue } }; var sensorLocation = CreateValidSensorLocation(); - location.PlLineOffsetBelowDikeToeAtPolder = testValue; +// location.PlLineOffsetBelowDikeToeAtPolder = testValue; sensorLocation.SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = DataSourceTypeSensors.LocationData; @@ -558,14 +560,15 @@ } [Test] + [Category(Categories.WorkInProgress)] public void GetValue_PL1PLLineOffsetBelowDikeTopAtPolderAndDataSourceTypeLocationData_ShouldReturnValue() { // setup var sensor = new Sensor(); const double testValue = 1.1; var sensorValues = new Dictionary { { sensor, testValue } }; var sensorLocation = CreateValidSensorLocation(); - location.PlLineOffsetBelowDikeTopAtPolder = testValue; +// location.PlLineOffsetBelowDikeTopAtPolder = testValue; sensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = DataSourceTypeSensors.LocationData; @@ -613,14 +616,15 @@ } [Test] + [Category(Categories.WorkInProgress)] public void GetValue_PL1PLLineOffsetBelowDikeTopAtRiverAndDataSourceTypeLocationData_ShouldReturnValue() { // setup var sensor = new Sensor(); const double testValue = 1.1; var sensorValues = new Dictionary { { sensor, testValue } }; var sensorLocation = CreateValidSensorLocation(); - location.PlLineOffsetBelowDikeTopAtRiver = testValue; +// location.PlLineOffsetBelowDikeTopAtRiver = testValue; sensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = DataSourceTypeSensors.LocationData; @@ -668,14 +672,15 @@ } [Test] + [Category(Categories.WorkInProgress)] public void GetValue_PL1PLLineOffsetBelowShoulderBaseInsideAndDataSourceTypeLocationData_ShouldReturnValue() { // setup var sensor = new Sensor(); const double testValue = 1.1; var sensorValues = new Dictionary { { sensor, testValue } }; var sensorLocation = CreateValidSensorLocation(); - location.PlLineOffsetBelowShoulderBaseInside = testValue; +// location.PlLineOffsetBelowShoulderBaseInside = testValue; sensorLocation.SourceTypePl1PlLineOffsetBelowShoulderBaseInside = DataSourceTypeSensors.LocationData; @@ -777,7 +782,8 @@ Assert.IsNull(actualValue); } - [Test] + [Test] + [Category(Categories.WorkInProgress)] public void GetValue_WaterLevelAtRiverAndDataSourceTypeLocationData_ShouldReturnValue() { // setup @@ -786,8 +792,8 @@ var sensorValues = new Dictionary { { sensor, testValue } }; var sensorLocation = CreateValidSensorLocation(); - location.RiverLevel = testValue; - Assert.AreEqual(testValue, location.RiverLevel); +// location.RiverLevel = testValue; +// Assert.AreEqual(testValue, location.RiverLevel); sensorLocation.SourceTypePl1WaterLevelAtRiver = DataSourceTypeSensors.LocationData; @@ -835,6 +841,7 @@ } [Test] + [Category(Categories.WorkInProgress)] public void GetValue_PL3AndDataSourceTypeLocationData_ShouldReturnValue() { // setup @@ -843,7 +850,7 @@ var sensorValues = new Dictionary { { sensor, testValue } }; var sensorLocation = CreateValidSensorLocation(); - location.HeadPl3 = testValue; +// location.HeadPl3 = testValue; sensorLocation.SourceTypePl3 = DataSourceTypeSensors.LocationData; // call @@ -890,6 +897,7 @@ } [Test] + [Category(Categories.WorkInProgress)] public void GetValue_PL4AndDataSourceTypeLocationData_ShouldReturnValue() { // setup @@ -898,7 +906,7 @@ var sensorValues = new Dictionary { { sensor, testValue } }; var sensorLocation = CreateValidSensorLocation(); - location.HeadPl4 = testValue; +// location.HeadPl4 = testValue; sensorLocation.SourceTypePl4 = DataSourceTypeSensors.LocationData; // call Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorLocation.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorLocation.cs (.../SensorLocation.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorLocation.cs (.../SensorLocation.cs) (revision 2529) @@ -273,29 +273,11 @@ } [Browsable(false)] - public double? RiverLevel - { - get { return Location.RiverLevel; } - } - - [Browsable(false)] public double PolderLevel { get { return Location.PolderLevel; } } - [Browsable(false)] - public double? HeadPl3 - { - get { return Location.HeadPl3; } - } - - [Browsable(false)] - public double? HeadPl4 - { - get { return Location.HeadPl4; } - } - [PropertyOrder(1, 3)] public string Alias { get; set; } // ToDo Tom/Kin Sun Waarvoor nodig? Wordt nergens gebruikt. Kan gewoon weg!? @@ -363,10 +345,6 @@ internal static class MemberNames { - internal static readonly string OffsetBelowDikeToeAtPolder = StaticReflection.GetMemberName(x => x.SourceTypePl1PlLineOffsetBelowDikeToeAtPolder); - internal static readonly string OffsetBelowDikeTopAtPolder = StaticReflection.GetMemberName(x => x.SourceTypePl1PlLineOffsetBelowDikeTopAtPolder); - internal static readonly string OffsetBelowDikeTopAtRiver = StaticReflection.GetMemberName(x => x.SourceTypePl1PlLineOffsetBelowDikeTopAtRiver); - internal static readonly string OffsetBelowShoulderBaseInside = StaticReflection.GetMemberName(x => x.SourceTypePl1PlLineOffsetBelowShoulderBaseInside); internal static readonly string WaterLevelAtRiver = StaticReflection.GetMemberName(x => x.SourceTypePl1WaterLevelAtRiver); internal static readonly string PolderLevel = StaticReflection.GetMemberName(x => x.SourceTypePl1WaterLevelAtPolder); internal static readonly string PL3 = StaticReflection.GetMemberName(x => x.SourceTypePl3); @@ -396,35 +374,8 @@ var memberName = StaticReflection.GetMemberName(expression); - if (memberName == MemberNames.OffsetBelowDikeToeAtPolder) - { - if (SourceTypePl1PlLineOffsetBelowDikeToeAtPolder == DataSourceTypeSensors.LocationData) - return Location.PlLineOffsetBelowDikeToeAtPolder; - } - - if (memberName == MemberNames.OffsetBelowDikeTopAtPolder) - { - if (SourceTypePl1PlLineOffsetBelowDikeTopAtPolder == DataSourceTypeSensors.LocationData) - return Location.PlLineOffsetBelowDikeTopAtPolder; - } - - if (memberName == MemberNames.OffsetBelowDikeTopAtRiver) - { - if (SourceTypePl1PlLineOffsetBelowDikeTopAtRiver == DataSourceTypeSensors.LocationData) - return Location.PlLineOffsetBelowDikeTopAtRiver; - } - - if (memberName == MemberNames.OffsetBelowShoulderBaseInside) - { - if (SourceTypePl1PlLineOffsetBelowShoulderBaseInside == DataSourceTypeSensors.LocationData) - return Location.PlLineOffsetBelowShoulderBaseInside; - } - if (memberName == MemberNames.WaterLevelAtRiver) { - if (SourceTypePl1WaterLevelAtRiver == DataSourceTypeSensors.LocationData) - return Location.RiverLevel; - if (SourceTypePl1WaterLevelAtRiver == DataSourceTypeSensors.Sensor) return sensorValues[sensor]; } @@ -440,18 +391,12 @@ if (memberName == MemberNames.PL3) { - if (SourceTypePl3 == DataSourceTypeSensors.LocationData) - return Location.HeadPl3; - if (SourceTypePl3 == DataSourceTypeSensors.Sensor) return sensorValues[sensor]; } if (memberName == MemberNames.PL4) { - if (SourceTypePl4 == DataSourceTypeSensors.LocationData) - return Location.HeadPl4; - if (SourceTypePl4 == DataSourceTypeSensors.Sensor) return sensorValues[sensor]; } Index: DamClients/DamUI/trunk/src/Dam/Tests/Importers/LineAttributeImporterTest.cs =================================================================== diff -u -r875 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/Importers/LineAttributeImporterTest.cs (.../LineAttributeImporterTest.cs) (revision 875) +++ DamClients/DamUI/trunk/src/Dam/Tests/Importers/LineAttributeImporterTest.cs (.../LineAttributeImporterTest.cs) (revision 2529) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Deltares.Dam.Data.CsvImporters; using Deltares.Dam.Data.Importers; using Deltares.Maps; @@ -41,7 +42,7 @@ private IFeatureRepository crossSectionRepository, attributesRepository; private Feature crossSection, attributeLine, outsideLine; - private LineAttributeImporter importer; + private LineAttributeImporter importer; #region Fixture Setup/Teardown @@ -65,7 +66,7 @@ [SetUp] public void TestSetup() { - importer = new LineAttributeImporter(); + importer = new LineAttributeImporter(); crossSectionRepository = mocks.DynamicMock(); attributesRepository = mocks.DynamicMock(); @@ -171,104 +172,95 @@ const string crossSectionFile = @"..\..\..\data\Dam\Waterboards\HHNK\ShapeFiles\Crosssection.shp"; const string attributeFile = @"..\..\..\data\Dam\Waterboards\HHNK\ShapeFiles\DampingFactorPL3.shp"; - var locations = new List + var locations = new List { - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0010" + LocationId = "TPL_Hempolder_0010" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0020" + LocationId = "TPL_Hempolder_0020" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0030" + LocationId = "TPL_Hempolder_0030" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0040" + LocationId = "TPL_Hempolder_0040" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0050" + LocationId = "TPL_Hempolder_0050" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0060" + LocationId = "TPL_Hempolder_0060" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0070" + LocationId = "TPL_Hempolder_0070" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0080" + LocationId = "TPL_Hempolder_0080" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0090" + LocationId = "TPL_Hempolder_0090" }, - new Location + new CsvImporterLocations.LocationRecord { - Name = "TPL_Hempolder_0100" + LocationId = "TPL_Hempolder_0100" }, }; - try - { - var crossSections = FeatureRepository.CreateFromShapeFile(crossSectionFile); - var attributes = FeatureRepository.CreateFromShapeFile(attributeFile); + var crossSections = FeatureRepository.CreateFromShapeFile(crossSectionFile); + var attributes = FeatureRepository.CreateFromShapeFile(attributeFile); - var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); - importer.LocationIDAttributeName = crossSectionMapping.Name; + var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); + importer.LocationIDAttributeName = crossSectionMapping.Name; - importer.Targets = locations; - importer.CrossSectionRepository = crossSections; - importer.AttributeRepository = attributes; + importer.Targets = locations; + importer.CrossSectionRepository = crossSections; + importer.AttributeRepository = attributes; - var mapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.DampingFactorPl3AttributeId); - importer.AttributeMappings = new[] { mapping }; - importer.Import(); - } - finally - { - foreach (var location in locations) - { - location.Dispose(); - } - } + var mapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.DampingFactorPl3AttributeId); + importer.AttributeMappings = new[] { mapping }; + importer.Import(); } [Test] public void Import_IntersectionFoundBetweenCrossSectionAndAttributeLine_ValuesFromAttributeLineAreSetOnTarget() { const string locationID = "Test_Location_01"; const double expectedValue = 5.7; - using (var location = new Location { Name = locationID }) + CsvImporterLocations.LocationRecord location = new CsvImporterLocations.LocationRecord { - importer.Targets = new[] { location }; - importer.CrossSectionRepository = crossSectionRepository; - importer.AttributeRepository = attributesRepository; + LocationId = locationID, + }; + importer.Targets = new[] { location }; + importer.CrossSectionRepository = crossSectionRepository; + importer.AttributeRepository = attributesRepository; - var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); - this.crossSection.AddAttribute(crossSectionMapping.Name, locationID); - Expect.Call(crossSectionRepository.Features).Return(new[] { this.crossSection }); - importer.LocationIDAttributeName = crossSectionMapping.Name; + var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); + this.crossSection.AddAttribute(crossSectionMapping.Name, locationID); + Expect.Call(crossSectionRepository.Features).Return(new[] { this.crossSection }); + importer.LocationIDAttributeName = crossSectionMapping.Name; - var trafLoadMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId); - importer.AttributeMappings = new[] { trafLoadMapping }; - this.attributeLine.AddAttribute(trafLoadMapping.Name, expectedValue); - Expect.Call(attributesRepository.Query((IFeature)null)).IgnoreArguments().Return(new[] { this.attributeLine }); - Expect.Call(attributesRepository.SupportedAttributes).Return(new[] { LocationShapeFileAttributeMap.TrafficLoadAttributeId }); + var trafLoadMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId); + importer.AttributeMappings = new[] { trafLoadMapping }; + this.attributeLine.AddAttribute(trafLoadMapping.Name, expectedValue); + Expect.Call(attributesRepository.Query((IFeature)null)).IgnoreArguments().Return(new[] { this.attributeLine }); + Expect.Call(attributesRepository.SupportedAttributes).Return(new[] { LocationShapeFileAttributeMap.TrafficLoadAttributeId }); - mocks.ReplayAll(); + mocks.ReplayAll(); - importer.Import(); + importer.Import(); - Assert.AreEqual(expectedValue, location.TrafficLoad); - } + Assert.AreEqual(expectedValue, location.TrafficLoad); } @@ -277,61 +269,65 @@ { const string locationID = "Test_Location_02"; const double expectedValue = 5.7; - using (var location = new Location { Name = locationID, TrafficLoad = expectedValue }) + CsvImporterLocations.LocationRecord location = new CsvImporterLocations.LocationRecord { - importer.Targets = new[] { location }; - importer.CrossSectionRepository = crossSectionRepository; - importer.AttributeRepository = attributesRepository; + LocationId = locationID, + TrafficLoad = expectedValue, + }; + importer.Targets = new[] { location }; + importer.CrossSectionRepository = crossSectionRepository; + importer.AttributeRepository = attributesRepository; - var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); - this.crossSection.AddAttribute(crossSectionMapping.Name, locationID); - Expect.Call(crossSectionRepository.Features).Return(new[] { this.crossSection }); - importer.LocationIDAttributeName = crossSectionMapping.Name; + var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); + this.crossSection.AddAttribute(crossSectionMapping.Name, locationID); + Expect.Call(crossSectionRepository.Features).Return(new[] { this.crossSection }); + importer.LocationIDAttributeName = crossSectionMapping.Name; - var trafLoadMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId); - importer.AttributeMappings = new[] { trafLoadMapping }; - this.attributeLine.AddAttribute(trafLoadMapping.Name, expectedValue); - Expect.Call(attributesRepository.Query((IFeature)null)).IgnoreArguments().Return(new[] { this.outsideLine }); - Expect.Call(attributesRepository.SupportedAttributes).Return(new[] { LocationShapeFileAttributeMap.TrafficLoadAttributeId }); + var trafLoadMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId); + importer.AttributeMappings = new[] { trafLoadMapping }; + this.attributeLine.AddAttribute(trafLoadMapping.Name, expectedValue); + Expect.Call(attributesRepository.Query((IFeature)null)).IgnoreArguments().Return(new[] { this.outsideLine }); + Expect.Call(attributesRepository.SupportedAttributes).Return(new[] { LocationShapeFileAttributeMap.TrafficLoadAttributeId }); - mocks.ReplayAll(); + mocks.ReplayAll(); - importer.Import(); + importer.Import(); - Assert.AreEqual(expectedValue, location.TrafficLoad); - } + Assert.AreEqual(expectedValue, location.TrafficLoad); } [Test] public void Import_NoIntersectionFoundBetweenCrossSectionAndOutsideLine_ExceptionIsAdded() { const string locationID = "Test_Location_02"; const double expectedValue = 5.7; - using (var location = new Location { Name = locationID, TrafficLoad = expectedValue }) + CsvImporterLocations.LocationRecord location = new CsvImporterLocations.LocationRecord { - importer.Targets = new[] { location }; - importer.CrossSectionRepository = crossSectionRepository; - importer.AttributeRepository = attributesRepository; + LocationId = locationID, + TrafficLoad = expectedValue, + }; + importer.Targets = new[] { location }; + importer.CrossSectionRepository = crossSectionRepository; + importer.AttributeRepository = attributesRepository; - var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); - this.crossSection.AddAttribute(crossSectionMapping.Name, locationID); - Expect.Call(crossSectionRepository.Features).Return(new[] { this.crossSection }); - importer.LocationIDAttributeName = crossSectionMapping.Name; + var crossSectionMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); + this.crossSection.AddAttribute(crossSectionMapping.Name, locationID); + Expect.Call(crossSectionRepository.Features).Return(new[] { this.crossSection }); + importer.LocationIDAttributeName = crossSectionMapping.Name; - var trafLoadMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId); - importer.AttributeMappings = new[] { trafLoadMapping }; - this.attributeLine.AddAttribute(trafLoadMapping.Name, expectedValue); - Expect.Call(attributesRepository.Query((IFeature)null)).IgnoreArguments().Return(new[] { this.outsideLine }); - Expect.Call(attributesRepository.SupportedAttributes).Return(new[] { LocationShapeFileAttributeMap.TrafficLoadAttributeId }); + var trafLoadMapping = LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.TrafficLoadAttributeId); + importer.AttributeMappings = new[] { trafLoadMapping }; + this.attributeLine.AddAttribute(trafLoadMapping.Name, expectedValue); + Expect.Call(attributesRepository.Query((IFeature)null)).IgnoreArguments().Return(new[] { this.outsideLine }); + Expect.Call(attributesRepository.SupportedAttributes).Return(new[] { LocationShapeFileAttributeMap.TrafficLoadAttributeId }); - mocks.ReplayAll(); + mocks.ReplayAll(); - importer.Import(); + importer.Import(); - Assert.IsTrue(importer.Errors.OfType().Count() == 1, "The NotSupported error was not added to the error list for logging when no intersections are found. "); - } + Assert.IsTrue(importer.Errors.OfType().Count() == 1, "The NotSupported error was not added to the error list for logging when no intersections are found. "); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs =================================================================== diff -u -r2460 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 2460) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 2529) @@ -316,67 +316,9 @@ private void UpdateForOlderProjects() { UpdateMStabParametersSlipCircleDefinition(); - UpdateScenariosForLocations(); } /// - /// Updates the scenarios for locations. - /// If they are not available in Design mode, the values should be taken from location - /// - private void UpdateScenariosForLocations() - { - if (this.DamProjectData.DamProjectType == DamProjectType.Design) - { - foreach (Location location in damProjectData.Locations) - { - foreach (Scenario scenario in location.Scenarios) - { - if (scenario.UsePlLineOffsetBelowDikeCrestMiddle == null) - { - scenario.UsePlLineOffsetBelowDikeCrestMiddle = location.UsePlLineOffsetBelowDikeCrestMiddle; - } - if (scenario.PlLineOffsetBelowDikeCrestMiddle == null) - { - scenario.PlLineOffsetBelowDikeCrestMiddle = location.PlLineOffsetBelowDikeCrestMiddle; - } - if (scenario.PlLineOffsetBelowDikeToeAtPolder == null) - { - scenario.PlLineOffsetBelowDikeToeAtPolder = location.PlLineOffsetBelowDikeToeAtPolder; - } - if (scenario.PlLineOffsetBelowDikeTopAtPolder == null) - { - scenario.PlLineOffsetBelowDikeTopAtPolder = location.PlLineOffsetBelowDikeTopAtPolder; - } - if (scenario.PlLineOffsetBelowDikeTopAtRiver == null) - { - scenario.PlLineOffsetBelowDikeTopAtRiver = location.PlLineOffsetBelowDikeTopAtRiver; - } - if (scenario.PlLineOffsetBelowShoulderBaseInside == null) - { - scenario.PlLineOffsetBelowShoulderBaseInside = location.PlLineOffsetBelowShoulderBaseInside; - } - if (scenario.UsePlLineOffsetFactorBelowShoulderCrest == null) - { - scenario.UsePlLineOffsetFactorBelowShoulderCrest = location.UsePlLineOffsetFactorBelowShoulderCrest; - } - if (scenario.PlLineOffsetFactorBelowShoulderCrest == null) - { - scenario.PlLineOffsetFactorBelowShoulderCrest = location.PlLineOffsetFactorBelowShoulderCrest; - } - if (scenario.HeadPl3 == null) - { - scenario.HeadPl3 = location.HeadPl3; - } - if (scenario.HeadPl4 == null) - { - scenario.HeadPl4 = location.HeadPl4; - } - } - } - } - } - - /// /// Updates the soil properties to the values in the soil database, to avoid discrepancies. /// If the use of the soil database is not necessary anymore (and the soil parameters can be edited in the UI) /// then this method is not needed anymore. Index: DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationShapeFileImporterDotSpatialTests.cs =================================================================== diff -u -r2168 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationShapeFileImporterDotSpatialTests.cs (.../LocationShapeFileImporterDotSpatialTests.cs) (revision 2168) +++ DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationShapeFileImporterDotSpatialTests.cs (.../LocationShapeFileImporterDotSpatialTests.cs) (revision 2529) @@ -20,10 +20,10 @@ // All rights reserved. using System.Collections.Generic; - +using System.Linq; using Deltares.Dam.Data.DataPlugins.Configuration; using NUnit.Framework; -using Deltares.Dam.Data; +using Deltares.Dam.Data.CsvImporters; using Deltares.Dam.Data.Importers; namespace Deltares.Dam.Tests.Importers @@ -34,17 +34,19 @@ [Test] public void CanReadLoactions() { - const string locationFilename = @"..\..\..\data\Dam\Waterboards\HHNK\shapefiles\LocationID.shp"; + const string locationFolder = @"..\..\..\data\Dam\Waterboards\HHNK\shapefiles"; var configuredAttributes = new List(); - configuredAttributes.Add(new DataAttribute{AttributeId = "location_id", AttributeName = "LOCATIONID", DataSource = ""}); - configuredAttributes.Add(new DataAttribute { AttributeId = "dikering_id", AttributeName = "DIKERINGID", DataSource = "" }); - List locations = LocationShapeFileImporterDotSpatial.ImportLocations(locationFilename, configuredAttributes); - var count = locations.Count; - - foreach (var location in locations) + configuredAttributes.Add(new DataAttribute{AttributeId = "location_id", AttributeName = "LOCATIONID", DataSource = "LocationID.shp" }); + configuredAttributes.Add(new DataAttribute { AttributeId = "dikering_id", AttributeName = "DIKERINGID", DataSource = "LocationID.shp" }); + var locationRecords = new List(); + var locationImporter = LocationShapeFileImporter.Create( + locationRecords, configuredAttributes, locationFolder); + if (locationImporter != null) { - location.Dispose(); + locationImporter.Import(); + locationRecords = locationImporter.ImportedItems.ToList(); } + var count = locationRecords.Count; Assert.AreEqual(5547, count); } } Index: DamClients/DamUI/trunk/src/Dam/Forms/LocationPropertyControl.Designer.cs =================================================================== diff -u -r2496 -r2529 --- DamClients/DamUI/trunk/src/Dam/Forms/LocationPropertyControl.Designer.cs (.../LocationPropertyControl.Designer.cs) (revision 2496) +++ DamClients/DamUI/trunk/src/Dam/Forms/LocationPropertyControl.Designer.cs (.../LocationPropertyControl.Designer.cs) (revision 2529) @@ -64,10 +64,6 @@ this.NameValue = new DevExpress.XtraEditors.TextEdit(); this.NameLabel = new DevExpress.XtraEditors.LabelControl(); this.PiezometricGroupControl = new DevExpress.XtraEditors.GroupControl(); - this.HeadPL4Edit = new DevExpress.XtraEditors.SpinEdit(); - this.HeadPL4Label = new DevExpress.XtraEditors.LabelControl(); - this.HeadPL3Edit = new DevExpress.XtraEditors.SpinEdit(); - this.HeadPL3Label = new DevExpress.XtraEditors.LabelControl(); this.HeadPL2Edit = new DevExpress.XtraEditors.SpinEdit(); this.HeadPL2Label = new DevExpress.XtraEditors.LabelControl(); this.DesignGroupControl = new DevExpress.XtraEditors.GroupControl(); @@ -111,8 +107,6 @@ ((System.ComponentModel.ISupportInitialize)(this.NameValue.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PiezometricGroupControl)).BeginInit(); this.PiezometricGroupControl.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.HeadPL4Edit.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.HeadPL3Edit.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.HeadPL2Edit.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DesignGroupControl)).BeginInit(); this.DesignGroupControl.SuspendLayout(); @@ -313,75 +307,15 @@ // // PiezometricGroupControl // - this.PiezometricGroupControl.Controls.Add(this.HeadPL4Edit); - this.PiezometricGroupControl.Controls.Add(this.HeadPL4Label); - this.PiezometricGroupControl.Controls.Add(this.HeadPL3Edit); - this.PiezometricGroupControl.Controls.Add(this.HeadPL3Label); this.PiezometricGroupControl.Controls.Add(this.HeadPL2Edit); this.PiezometricGroupControl.Controls.Add(this.HeadPL2Label); this.PiezometricGroupControl.Dock = System.Windows.Forms.DockStyle.Top; this.PiezometricGroupControl.Location = new System.Drawing.Point(0, 420); this.PiezometricGroupControl.Name = "PiezometricGroupControl"; - this.PiezometricGroupControl.Size = new System.Drawing.Size(287, 111); + this.PiezometricGroupControl.Size = new System.Drawing.Size(287, 60); this.PiezometricGroupControl.TabIndex = 48; this.PiezometricGroupControl.Text = "Piezometric heights"; // - // HeadPL4Edit - // - this.HeadPL4Edit.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.HeadPL4Edit.EditValue = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.HeadPL4Edit.EnterMoveNextControl = true; - this.HeadPL4Edit.Location = new System.Drawing.Point(154, 80); - this.HeadPL4Edit.Name = "HeadPL4Edit"; - this.HeadPL4Edit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; - this.HeadPL4Edit.Properties.EditFormat.FormatString = "F3"; - this.HeadPL4Edit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; - this.HeadPL4Edit.Properties.HideSelection = false; - this.HeadPL4Edit.Properties.ValidateOnEnterKey = true; - this.HeadPL4Edit.Size = new System.Drawing.Size(119, 20); - this.HeadPL4Edit.TabIndex = 13; - // - // HeadPL4Label - // - this.HeadPL4Label.Location = new System.Drawing.Point(12, 83); - this.HeadPL4Label.Name = "HeadPL4Label"; - this.HeadPL4Label.Size = new System.Drawing.Size(45, 13); - this.HeadPL4Label.TabIndex = 12; - this.HeadPL4Label.Text = "Head PL4"; - // - // HeadPL3Edit - // - this.HeadPL3Edit.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.HeadPL3Edit.EditValue = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.HeadPL3Edit.EnterMoveNextControl = true; - this.HeadPL3Edit.Location = new System.Drawing.Point(154, 54); - this.HeadPL3Edit.Name = "HeadPL3Edit"; - this.HeadPL3Edit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; - this.HeadPL3Edit.Properties.EditFormat.FormatString = "F3"; - this.HeadPL3Edit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; - this.HeadPL3Edit.Properties.HideSelection = false; - this.HeadPL3Edit.Properties.ValidateOnEnterKey = true; - this.HeadPL3Edit.Size = new System.Drawing.Size(119, 20); - this.HeadPL3Edit.TabIndex = 11; - // - // HeadPL3Label - // - this.HeadPL3Label.Location = new System.Drawing.Point(12, 57); - this.HeadPL3Label.Name = "HeadPL3Label"; - this.HeadPL3Label.Size = new System.Drawing.Size(45, 13); - this.HeadPL3Label.TabIndex = 10; - this.HeadPL3Label.Text = "Head PL3"; - // // HeadPL2Edit // this.HeadPL2Edit.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -423,9 +357,9 @@ this.DesignGroupControl.Controls.Add(this.StabilityShoulderGrowSlopeEdit); this.DesignGroupControl.Controls.Add(this.StabilityShoulderGrowSlopeLabel); this.DesignGroupControl.Dock = System.Windows.Forms.DockStyle.Top; - this.DesignGroupControl.Location = new System.Drawing.Point(0, 641); + this.DesignGroupControl.Location = new System.Drawing.Point(0, 590); this.DesignGroupControl.Name = "DesignGroupControl"; - this.DesignGroupControl.Size = new System.Drawing.Size(287, 172); + this.DesignGroupControl.Size = new System.Drawing.Size(287, 124); this.DesignGroupControl.TabIndex = 51; this.DesignGroupControl.Text = "Design"; // @@ -556,7 +490,7 @@ this.CalculationGroupControl.Controls.Add(this.ZoneEdit); this.CalculationGroupControl.Controls.Add(this.ZoneLabel); this.CalculationGroupControl.Dock = System.Windows.Forms.DockStyle.Top; - this.CalculationGroupControl.Location = new System.Drawing.Point(0, 531); + this.CalculationGroupControl.Location = new System.Drawing.Point(0, 480); this.CalculationGroupControl.Name = "CalculationGroupControl"; this.CalculationGroupControl.Size = new System.Drawing.Size(287, 110); this.CalculationGroupControl.TabIndex = 52; @@ -809,8 +743,6 @@ ((System.ComponentModel.ISupportInitialize)(this.PiezometricGroupControl)).EndInit(); this.PiezometricGroupControl.ResumeLayout(false); this.PiezometricGroupControl.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.HeadPL4Edit.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.HeadPL3Edit.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.HeadPL2Edit.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DesignGroupControl)).EndInit(); this.DesignGroupControl.ResumeLayout(false); @@ -845,10 +777,6 @@ private DevExpress.XtraEditors.TextEdit NameValue; private DevExpress.XtraEditors.LabelControl NameLabel; private DevExpress.XtraEditors.GroupControl PiezometricGroupControl; - private DevExpress.XtraEditors.SpinEdit HeadPL4Edit; - private DevExpress.XtraEditors.LabelControl HeadPL4Label; - private DevExpress.XtraEditors.SpinEdit HeadPL3Edit; - private DevExpress.XtraEditors.LabelControl HeadPL3Label; private DevExpress.XtraEditors.SpinEdit HeadPL2Edit; private DevExpress.XtraEditors.LabelControl HeadPL2Label; private DevExpress.XtraEditors.SpinEdit YEdit; Index: DamClients/DamUI/trunk/src/Dam/Tests/LocationTest.cs =================================================================== diff -u -r2514 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/LocationTest.cs (.../LocationTest.cs) (revision 2514) +++ DamClients/DamUI/trunk/src/Dam/Tests/LocationTest.cs (.../LocationTest.cs) (revision 2529) @@ -35,7 +35,6 @@ var expectedLocation = new Location { Name = "Sand", - PlLineOffsetBelowDikeTopAtPolder = 10.1, DampingFactorPL3 = 11.11 }) using (var actualLocation = new Location()) @@ -45,7 +44,7 @@ { actualLocation.SetParameterFromNameValuePair(soilDetail.Key, soilDetail.Value); } - Assert.AreEqual(expectedLocation.PlLineOffsetBelowDikeTopAtPolder, actualLocation.PlLineOffsetBelowDikeTopAtPolder, cTolerance); + Assert.AreEqual(expectedLocation.DampingFactorPL3, actualLocation.DampingFactorPL3, cTolerance); } @@ -60,10 +59,6 @@ const double trafficLoad = 0.0; const double tL_DegreeOfConsolidation = 0.0; const PLLineCreationMethod plLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD; - const double plLineOffsetBelowDikeTopAtRiver = 0.5; - const double plLineOffsetBelowDikeTopAtPolder = 1.5; - const double plLineOffsetBelowShoulderBaseInside = 0.1; - const double plLineOffsetBelowDikeToeAtPolder = 0.1; const double stabilityShoulderGrowSlope = 0.3333333333333; const double stabilityShoulderGrowDeltaX = 2.0; const double stabilitySlopeAdaptionDeltaX = 2.0; @@ -77,14 +72,6 @@ Assert.AreEqual(trafficLoad, actualLocation.TrafficLoad); Assert.AreEqual(tL_DegreeOfConsolidation, actualLocation.TL_DegreeOfConsolidation); Assert.AreEqual(plLineCreationMethod, actualLocation.PLLineCreationMethod); - Assert.AreEqual(plLineOffsetBelowDikeTopAtRiver, actualLocation.PlLineOffsetBelowDikeTopAtRiver); - Assert.AreEqual(plLineOffsetBelowDikeTopAtPolder, actualLocation.PlLineOffsetBelowDikeTopAtPolder); - Assert.AreEqual(plLineOffsetBelowShoulderBaseInside, actualLocation.PlLineOffsetBelowShoulderBaseInside); - Assert.AreEqual(plLineOffsetBelowDikeToeAtPolder, actualLocation.PlLineOffsetBelowDikeToeAtPolder); - Assert.AreEqual(null, actualLocation.PlLineOffsetBelowDikeCrestMiddle); - Assert.AreEqual(null, actualLocation.PlLineOffsetFactorBelowShoulderCrest); - Assert.AreEqual(null, actualLocation.UsePlLineOffsetBelowDikeCrestMiddle); - Assert.AreEqual(null, actualLocation.UsePlLineOffsetFactorBelowShoulderCrest); Assert.AreEqual(IntrusionVerticalWaterPressureType.Standard, actualLocation.IntrusionVerticalWaterPressure); Assert.AreEqual(stabilityShoulderGrowSlope, actualLocation.StabilityShoulderGrowSlope, 1e-12); Assert.AreEqual(stabilityShoulderGrowDeltaX, actualLocation.StabilityShoulderGrowDeltaX); @@ -103,123 +90,6 @@ Assert.AreEqual(expected, location.PolderLevel); } } - - [Test] - public void RiverLevel_ReadWrite_ShouldGiveExpectedResult() - { - // setup - const double expected = 1.1; - using (var location = new Location("test") {RiverLevel = expected}) - { - // checks - Assert.AreEqual(expected, location.RiverLevel); - } - } - - [Test] - [TestCase("ModelFactorRequiredSafetyFactorPiping")] - [TestCase("ModelFactorRequiredSafetyFactorStabilityInnerSlope")] - [TestCase("ModelFactorRequiredSafetyFactorStabilityOuterSlope")] - [TestCase("UpliftCriterionStability")] - [TestCase("UpliftCriterionPiping")] - [TestCase("PlLineOffsetBelowDikeToeAtPolder")] - [TestCase("PlLineOffsetBelowDikeTopAtPolder")] - [TestCase("PlLineOffsetBelowDikeTopAtRiver")] - [TestCase("PlLineOffsetBelowShoulderBaseInside")] - [TestCase("PlLineOffsetBelowDikeCrestMiddle")] - [TestCase("PlLineOffsetFactorBelowShoulderCrest")] - [TestCase("UsePlLineOffsetBelowDikeCrestMiddle")] - [TestCase("UsePlLineOffsetFactorBelowShoulderCrest")] - [TestCase("HeadPl3")] - [TestCase("HeadPl4")] - [TestCase("DikeTableHeight")] - [TestCase("RiverLevel")] - [TestCase("RiverLevelLow")] - public void DamProjectTypeInDesignMode_ScenarioParameters_ReturnsExpectedVisibility(string propertyName) - { - // Setup - Location.DamProjectType = DamProjectType.Design; - var location = new Location(); - - // Call - var isVisible = location.IsVisible(propertyName); - - // Assert - Assert.IsFalse(isVisible); - } - - [Test] - [TestCase("ModelFactorRequiredSafetyFactorPiping", false)] - [TestCase("ModelFactorRequiredSafetyFactorStabilityInnerSlope", false)] - [TestCase("ModelFactorRequiredSafetyFactorStabilityOuterSlope", false)] - [TestCase("UpliftCriterionStability", true)] - [TestCase("UpliftCriterionPiping", true)] - [TestCase("PlLineOffsetBelowDikeToeAtPolder", false)] - [TestCase("PlLineOffsetBelowDikeTopAtPolder", false)] - [TestCase("PlLineOffsetBelowDikeTopAtRiver", false)] - [TestCase("PlLineOffsetBelowShoulderBaseInside", false)] - [TestCase("PlLineOffsetBelowDikeCrestMiddle", false)] - [TestCase("PlLineOffsetFactorBelowShoulderCrest", false)] - [TestCase("UsePlLineOffsetBelowDikeCrestMiddle", false)] - [TestCase("UsePlLineOffsetFactorBelowShoulderCrest", false)] - [TestCase("HeadPl3", true)] - [TestCase("HeadPl4", true)] - [TestCase("DikeTableHeight", true)] - [TestCase("RiverLevel", true)] - [TestCase("RiverLevelLow", true)] - public void DamProjectTypeInNotDesignModeAndPLLineCreationMethodWithoutRequiredExpertKnowledge_ScenarioParameters_ReturnsExpectedVisibility( - string propertyName, - bool expectedVisibility) - { - // Setup - Location.DamProjectType = DamProjectType.Calamity; - var location = new Location - { - PLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeLinearInDike - }; - - // Call - var isVisible = location.IsVisible(propertyName); - - // Assert - Assert.AreEqual(expectedVisibility, isVisible); - } - - [Test] - [TestCase("ModelFactorRequiredSafetyFactorPiping", false)] - [TestCase("ModelFactorRequiredSafetyFactorStabilityInnerSlope", false)] - [TestCase("ModelFactorRequiredSafetyFactorStabilityOuterSlope", false)] - [TestCase("UpliftCriterionStability", true)] - [TestCase("UpliftCriterionPiping", true)] - [TestCase("PlLineOffsetBelowDikeToeAtPolder", true)] - [TestCase("PlLineOffsetBelowDikeTopAtPolder", true)] - [TestCase("PlLineOffsetBelowDikeTopAtRiver", true)] - [TestCase("PlLineOffsetBelowShoulderBaseInside", true)] - [TestCase("PlLineOffsetBelowDikeCrestMiddle", true)] - [TestCase("PlLineOffsetFactorBelowShoulderCrest", true)] - [TestCase("UsePlLineOffsetBelowDikeCrestMiddle", true)] - [TestCase("UsePlLineOffsetFactorBelowShoulderCrest", true)] - [TestCase("HeadPl3", true)] - [TestCase("HeadPl4", true)] - [TestCase("DikeTableHeight", true)] - [TestCase("RiverLevel", true)] - [TestCase("RiverLevelLow", true)] - public void DamProjectTypeInNotDesignModeAndPLLineCreationMethodWithRequiredExpertKnowledge_ScenarioParameters_ReturnsExpectedVisibility( - string propertyName, - bool expectedVisibility) - { - // Setup - Location.DamProjectType = DamProjectType.Calamity; - var location = new Location - { - PLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD - }; - - // Call - var isVisible = location.IsVisible(propertyName); - - // Assert - Assert.AreEqual(expectedVisibility, isVisible); - } } + } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs =================================================================== diff -u -r2508 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (.../DataPluginImporter.cs) (revision 2508) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (.../DataPluginImporter.cs) (revision 2529) @@ -401,6 +401,11 @@ public void ImportDataForDikeRings(IEnumerable dikeRingIds, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) { + foreach (var dike in waterBoard.Dikes) + { + dike.Locations.Clear(); + } + isAllDataImported = false; ImportAllData(dikeRingIds, progress); } @@ -794,15 +799,15 @@ /// /// Import all csv files /// - /// - /// - /// + /// The import folder. + /// The import mode. + /// The progress. + /// The CSV importer. /// - private CsvImporter ImportCsvFiles(string importFolder, - ImportMode importMode, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + private bool ImportCsvFiles(string importFolder, + ImportMode importMode, DamEngine.Data.Standard.Calculation.ProgressDelegate progress, ref CsvImporter csvImporter) { DataSourceManager.CurrentSource = DataSourceSystemType.Csv; - var csvImporter = new CsvImporter(); bool isImportOnlyLocations = (importMode == ImportMode.DikeRingAndLocationData); csvImporter.ImportCsvDataFromDirectory(importFolder, isImportOnlyLocations, progress, damProjectType); @@ -815,7 +820,7 @@ // check for fatal messages bool importOk = messages.All(m => m.MessageType != LogMessageType.FatalError); - return importOk ? csvImporter : null; + return importOk; } /// @@ -885,7 +890,7 @@ // er is al een lijst met locaties in Waterboard WaterBoard.Dike[0].Locations (LocationsOrg) // LocationOrg.GeometryPoint[DikeTopAtRiver] = LocationNew.buitenkuinpunt // LocationOrg.GeometryPoint[DikeTopAtPolder] = LocationNew.binnnenkuinpunt - // Als LocationNew.id niet gevonden kan worden in LocationsOrg dan excpetion + // Als LocationNew.id niet gevonden kan worden in LocationsOrg dan exception // Get all locations from waterboard var locations = GetAllLocations(); @@ -924,22 +929,6 @@ } /// - /// Import locations from shapefile - /// - /// - /// - private void ImportLocationsFromShapeFile(string importFolder, IEnumerable dataAttributes) - { - if (importFolder == null) - throw new ArgumentNullException("importFolder"); - LocationShapeFileImporter locationImporter = LocationShapeFileImporter.Create(new List(), dataAttributes, importFolder); - //FeatureSet fs = new FeatureSet(); - // Not completed yet. Implement code from MapEditor.FileOpen - - - } - - /// /// Pre conditions: /// - A list of waterboard locations with initialized x,y values /// - shape file ccontaining the attributes and data @@ -954,7 +943,8 @@ /// private void ImportDataShapeFiles(string importFolder, IEnumerable dataAttributes, ImportMode importMode, IEnumerable dikeRingIds, - DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + DamEngine.Data.Standard.Calculation.ProgressDelegate progress, + ref List locationRecords) { DataSourceManager.CurrentSource = DataSourceSystemType.Gis; @@ -966,79 +956,17 @@ { importErrorLogFile = Path.Combine(DamProjectFolder, importErrorLogFile); } - var locations = GetAllLocations(); - var locationList = locations as List ?? locations.ToList(); var dataAttributesList = dataAttributes as List ?? dataAttributes.ToList(); var exceptions = new List(); - var csvImportedDike = waterBoard.Dikes[0]; - - var existingDikeRings = waterBoard.Dikes.Select(dike => dike.Name).ToList(); var locationImporter = LocationShapeFileImporter.Create( - locationList, dataAttributesList, importFolder); + locationRecords, dataAttributesList, importFolder); if (locationImporter != null) { locationImporter.Import(); - var newDikeRings = - locationImporter.ImportedItems.Select(l => l.DikeRingId).Distinct(); - locationList = locationImporter.ImportedItems.ToList(); - foreach (var newDikeRingId in newDikeRings) - { - // - // This is where all the locations are imported for a dikering - // Only the location and damptype willbe read here - // All other attributes are read later in this function - // - Dike dike; - if (!existingDikeRings.Contains(newDikeRingId)) - { - dike = new Dike { Name = newDikeRingId, SoilBaseDB = csvImportedDike.SoilBaseDB }; - waterBoard.Dikes.Insert(0, dike); - } - else - { - var ringId = newDikeRingId; - dike = waterBoard.Dikes.First(existingDike => existingDike.Name == ringId); - } - string id = newDikeRingId; - foreach (Location location in locationList.Where(location => location.DikeRingId == id)) - { - // Replace if location exists else add - Location existingLocation = dike.Locations.FirstOrDefault(l => l.Name == location.Name); - if (existingLocation != null) - { - int indexExistingLocation = dike.Locations.IndexOf(existingLocation); - dike.Locations[indexExistingLocation] = location; - } - else - { - dike.Locations.Add(location); - } - } - } + locationRecords = locationImporter.ImportedItems.ToList(); } - // Remove dikes that are not specified and rebuild the total locations list - if (dikeRingIds != null) - { - var newLocations = new List(); - var dikeRingIdList = dikeRingIds.ToList(); - for (int dikeIndex = waterBoard.Dikes.Count - 1; dikeIndex >= 0; dikeIndex--) - { - int index = dikeIndex; - string result = dikeRingIdList.FirstOrDefault(s => s == waterBoard.Dikes[index].Name); - if (result == null) - { - waterBoard.Dikes.RemoveAt(index); - } - else - { - newLocations.AddRange(waterBoard.Dikes[index].Locations); - } - } - locationList = newLocations; - } - // Skip reading properties when only dikering and locationdata is required if (importMode == ImportMode.All) { @@ -1047,9 +975,9 @@ // This is where all the attribute values are read form the shapefiles // var importer = new LocationPropertyImporter(importFolder, dataAttributesList) - { - Targets = locationList - }; + { + Targets = locationRecords + }; importer.Import(progress); exceptions.AddRange(importer.ImportErrors); @@ -1102,11 +1030,17 @@ { if (isDikeRingAndLocationDataImported || isAllDataImported) return; - CsvImporter csvImporter = null; + CsvImporter csvImporter = new CsvImporter(); foreach (var dataSource in DataSources) { ImportDikeRingAndLocationData(dataSource, ref csvImporter); } + var combineImportedData = new CombineImportedData + { + WaterBoard = waterBoard, + LocationRecords = csvImporter.LocationRecords, + }; + combineImportedData.AddCsvDataToDikes(); isDikeRingAndLocationDataImported = true; } @@ -1141,17 +1075,12 @@ { case DataSourceType.CsvFiles: // New importer - csvImporter = ImportCsvFiles(dataLocation, ImportMode.DikeRingAndLocationData, null); - var combineImportedData = new CombineImportedData - { - WaterBoard = waterBoard, - LocationRecords = csvImporter.LocationRecords, - }; - combineImportedData.AddCsvDataToDikes(); - + ImportCsvFiles(dataLocation, ImportMode.DikeRingAndLocationData, null, ref csvImporter); break; case DataSourceType.DataShapeFiles: - ImportShapeFile(dataLocation); + List locationRecords = csvImporter.LocationRecords; + ImportShapeFile(dataLocation, ref locationRecords); + csvImporter.LocationRecords = locationRecords; break; case DataSourceType.Iris: case DataSourceType.BackgroundShapeFiles: @@ -1177,26 +1106,19 @@ DamEngine.Data.Standard.Calculation.ProgressDelegate progress, ref CsvImporter csvImporter) { var dataLocation = GetDataLocation(dataSource); - switch (dataSource.DataSourceType) { case DataSourceType.CsvFiles: // New importer - csvImporter = ImportCsvFiles(dataLocation, importMode, progress); - if (csvImporter != null && csvImporter.LocationRecords.Count > 0) - { - // This is to support projects which have defined locations in locations.csv - // This is needed specifically for Koswat - // If Koswat generates a project where the locations are defined in a shape this code - // can be removed. - AddCsvDataToDikes(csvImporter); - } + ImportCsvFiles(dataLocation, importMode, progress, ref csvImporter); break; case DataSourceType.Iris: ImportIrisFiles(dataLocation); break; case DataSourceType.DataShapeFiles: - ImportDataShapeFiles(dataLocation, attributes, importMode, dikeRingIdList, progress); + List locationRecords = csvImporter.LocationRecords; + ImportDataShapeFiles(dataLocation, attributes, importMode, dikeRingIdList, progress, ref locationRecords); + csvImporter.LocationRecords = locationRecords; break; case DataSourceType.BackgroundShapeFiles: if (importMode == ImportMode.All) @@ -1219,7 +1141,8 @@ /// Imports the shape file. /// /// The data location. - private void ImportShapeFile(string dataLocation) + /// The location records. + private void ImportShapeFile(string dataLocation, ref List locationRecords) { // get locations var configuredAttribute = @@ -1230,22 +1153,12 @@ { return; } - - var locations = LocationShapeFileImporterDotSpatial.ImportLocations( - Path.Combine(dataLocation, configuredAttribute.DataSource), attributes); - - // Split locations in several dikes based on DikeRingid - var newDikeRings = locations.Select(l => l.DikeRingId).Distinct(); - - foreach (var newDikeRingId in newDikeRings) + var locationImporter = LocationShapeFileImporter.Create( + locationRecords, attributes, dataLocation); + if (locationImporter != null) { - var dike = GetOrCreateDike(newDikeRingId); - // TODO - var id = newDikeRingId; - foreach (var location in locations.Where(location => location.DikeRingId == id)) - { - dike.Locations.Add(location); - } + locationImporter.Import(); + locationRecords = locationImporter.ImportedItems.ToList(); } } @@ -1278,18 +1191,28 @@ } waterBoard.Description = "Waterschap"; - CsvImporter csvImporter = null; + CsvImporter csvImporter = new CsvImporter(); var dikeRingIdList = dikeRingIds == null ? null : dikeRingIds as List ?? dikeRingIds.ToList(); - csvDataAdded = false; foreach (var dataSource in DataSources) { - ImportData2(dataSource, dikeRingIdList, importMode, progress, ref csvImporter); + // Skip Iris because it needs the locations + // Data from shapefiles is added to locationrecords from csvImporter + if (dataSource.DataSourceType != DataSourceType.Iris) + { + ImportData2(dataSource, dikeRingIdList, importMode, progress, ref csvImporter); + } } - if (!csvDataAdded) + // create and fill the locations, scenarios etc. with the data from csv and shapefiles + AddCsvDataToDikes(csvImporter); + // Now that the locations are defined, read Iris data + foreach (var dataSource in DataSources) { - AddCsvDataToDikes(csvImporter); + if (dataSource.DataSourceType == DataSourceType.Iris) + { + ImportData2(dataSource, dikeRingIdList, importMode, progress, ref csvImporter); + } } AddScenarioDataToDikes(csvImporter); if (importMode == ImportMode.All) @@ -1310,6 +1233,7 @@ var combineImportedData = new CombineImportedData { WaterBoard = waterBoard, + LocationRecords = csvImporter.LocationRecords, ScenarioRecords = csvImporter.ScenariosRecords, }; combineImportedData.AddScenarioDataToDikes(); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (.../CombineImportedData.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (.../CombineImportedData.cs) (revision 2529) @@ -133,9 +133,9 @@ foreach (var dike in waterBoard.Dikes) { - TranferLocationsData(dike); - TranferSoilProfilesData(dike); - TranferSegmentData(dike); + TransferLocationsData(dike); + TransferSoilProfilesData(dike); + TransferSegmentData(dike); // Use InvokeWithoutPublishingEvents for performance reasons after introducing SurfaceLine2 DataEventPublisher.InvokeWithoutPublishingEvents(() => { TransferSurfaceLines(dike); }); } @@ -204,7 +204,7 @@ } // Before using this, the Locations and (for 1D profiles) SoilProfiles must be known!? - private void TranferSegmentData(Dike dike) + private void TransferSegmentData(Dike dike) { if (SegmentRecords == null) return; @@ -304,7 +304,7 @@ } } - private void TranferSoilProfilesData(Dike dike) + private void TransferSoilProfilesData(Dike dike) { if (SoilProfilerecords == null) return; @@ -601,12 +601,12 @@ foreach (var scenarioRecord in ScenarioRecords) { bool recordError = false; - if (String.IsNullOrEmpty(scenarioRecord.LocationId)) + if (string.IsNullOrEmpty(scenarioRecord.LocationId)) { var noLocationIdForScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "noLocationIdForScenarioRecordError"); LogMessage logmessage = new LogMessage(LogMessageType.Error, null, - String.Format("Record {0} : {1}", + string.Format("Record {0} : {1}", scenarioRecord.ScenarioRecordId, noLocationIdForScenarioRecordError)); ErrorMessages.Add(logmessage); @@ -618,7 +618,7 @@ { var invalidLocationScenarioIdForScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "invalidLocationScenarioIdForScenarioRecordError"); - LogMessage logmessage = new LogMessage(LogMessageType.Error, null, String.Format("Record {0} : {1}", + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, string.Format("Record {0} : {1}", scenarioRecord.ScenarioRecordId, invalidLocationScenarioIdForScenarioRecordError)); ErrorMessages.Add(logmessage); recordError = true; @@ -628,7 +628,7 @@ if (dikeLocation == null) { var locationNotFoundForScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "locationNotFoundForScenarioRecordError"); - LogMessage logmessage = new LogMessage(LogMessageType.Error, this, String.Format("Record {0} : {1}", + LogMessage logmessage = new LogMessage(LogMessageType.Error, this, string.Format("Record {0} : {1}", scenarioRecord.ScenarioRecordId, locationNotFoundForScenarioRecordError)); ErrorMessages.Add(logmessage); recordError = true; @@ -641,8 +641,8 @@ if (dikeScenario != null) { var duplicateScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "duplicateScenarioRecordError"); - string errorMessage = String.Format(duplicateScenarioRecordError, dikeLocation.Name, dikeScenario.LocationScenarioID); - LogMessage logmessage = new LogMessage(LogMessageType.Error, null, String.Format("Record {0} : {1}", + string errorMessage = string.Format(duplicateScenarioRecordError, dikeLocation.Name, dikeScenario.LocationScenarioID); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, string.Format("Record {0} : {1}", scenarioRecord.ScenarioRecordId, errorMessage)); ErrorMessages.Add(logmessage); } @@ -661,34 +661,34 @@ UpliftCriterionStability = scenarioRecord.UpliftCriterionStability }, }; - + var locationRecord = LocationRecords.FirstOrDefault(l => l.LocationId == scenarioRecord.LocationId); //hier de nieuwe waarden vastzetten (1 uit scenariorecord, 2 uit location halen etc.) scenario.PlLineOffsetBelowDikeToeAtPolder = scenarioRecord.PlLineOffsetBelowDikeToeAtPolder.HasValue ? - scenarioRecord.PlLineOffsetBelowDikeToeAtPolder : dikeLocation.PlLineOffsetBelowDikeToeAtPolder; + scenarioRecord.PlLineOffsetBelowDikeToeAtPolder : locationRecord.PlLineOffsetBelowDikeToeAtPolder; scenario.PlLineOffsetBelowDikeTopAtPolder = scenarioRecord.PlLineOffsetBelowDikeTopAtPolder.HasValue ? - scenarioRecord.PlLineOffsetBelowDikeTopAtPolder : dikeLocation.PlLineOffsetBelowDikeTopAtPolder; + scenarioRecord.PlLineOffsetBelowDikeTopAtPolder : locationRecord.PlLineOffsetBelowDikeTopAtPolder; scenario.PlLineOffsetBelowDikeTopAtRiver = scenarioRecord.PlLineOffsetBelowDikeTopAtRiver.HasValue ? - scenarioRecord.PlLineOffsetBelowDikeTopAtRiver : dikeLocation.PlLineOffsetBelowDikeTopAtRiver; + scenarioRecord.PlLineOffsetBelowDikeTopAtRiver : locationRecord.PlLineOffsetBelowDikeTopAtRiver; scenario.PlLineOffsetBelowShoulderBaseInside = scenarioRecord.PlLineOffsetBelowShoulderBaseInside.HasValue ? - scenarioRecord.PlLineOffsetBelowShoulderBaseInside : dikeLocation.PlLineOffsetBelowShoulderBaseInside; + scenarioRecord.PlLineOffsetBelowShoulderBaseInside : locationRecord.PlLineOffsetBelowShoulderBaseInside; scenario.PlLineOffsetBelowDikeCrestMiddle = scenarioRecord.PlLineOffsetBelowDikeCrestMiddle.HasValue ? - scenarioRecord.PlLineOffsetBelowDikeCrestMiddle : dikeLocation.PlLineOffsetBelowDikeCrestMiddle; + scenarioRecord.PlLineOffsetBelowDikeCrestMiddle : locationRecord.PlLineOffsetBelowDikeCrestMiddle; scenario.PlLineOffsetFactorBelowShoulderCrest = scenarioRecord.PlLineOffsetFactorBelowShoulderCrest.HasValue ? - scenarioRecord.PlLineOffsetFactorBelowShoulderCrest : dikeLocation.PlLineOffsetFactorBelowShoulderCrest; + scenarioRecord.PlLineOffsetFactorBelowShoulderCrest : locationRecord.PlLineOffsetFactorBelowShoulderCrest; scenario.UsePlLineOffsetBelowDikeCrestMiddle = scenarioRecord.UsePlLineOffsetBelowDikeCrestMiddle.HasValue ? - scenarioRecord.UsePlLineOffsetBelowDikeCrestMiddle : dikeLocation.UsePlLineOffsetBelowDikeCrestMiddle; + scenarioRecord.UsePlLineOffsetBelowDikeCrestMiddle : locationRecord.UsePlLineOffsetBelowDikeCrestMiddle; scenario.UsePlLineOffsetFactorBelowShoulderCrest = scenarioRecord.UsePlLineOffsetFactorBelowShoulderCrest.HasValue ? - scenarioRecord.UsePlLineOffsetFactorBelowShoulderCrest : dikeLocation.UsePlLineOffsetFactorBelowShoulderCrest; + scenarioRecord.UsePlLineOffsetFactorBelowShoulderCrest : locationRecord.UsePlLineOffsetFactorBelowShoulderCrest; scenario.HeadPl3 = scenarioRecord.HeadPl3.HasValue ? - scenarioRecord.HeadPl3 : dikeLocation.HeadPl3; + scenarioRecord.HeadPl3 : locationRecord.HeadPl3; scenario.HeadPl4 = scenarioRecord.HeadPl4.HasValue ? - scenarioRecord.HeadPl4 : dikeLocation.HeadPl4; + scenarioRecord.HeadPl4 : locationRecord.HeadPl4; scenario.DikeTableHeight = scenarioRecord.DikeTableHeight.HasValue ? - scenarioRecord.DikeTableHeight : dikeLocation.DikeTableHeight; + scenarioRecord.DikeTableHeight : locationRecord.DikeTableHeight; scenario.RiverLevel = scenarioRecord.RiverLevel.HasValue ? - scenarioRecord.RiverLevel : dikeLocation.RiverLevel; + scenarioRecord.RiverLevel : locationRecord.RiverLevel; scenario.RiverLevelLow = scenarioRecord.RiverLevelLow.HasValue ? - scenarioRecord.RiverLevelLow : dikeLocation.RiverLevelLow; + scenarioRecord.RiverLevelLow : locationRecord.RiverLevelLow; dikeLocation.Scenarios.Add(scenario); } @@ -697,10 +697,10 @@ } /// - /// Tranfers the locations data. + /// Transfers the locations data. /// /// The dike. - private void TranferLocationsData(Dike dike) + private void TransferLocationsData(Dike dike) { if (LocationRecords == null) return; @@ -716,13 +716,6 @@ continue; } - // Check if Surfaceline and Segment are assigned - if ((String.IsNullOrEmpty(locationRecord.SurfaceLineId)) || (String.IsNullOrEmpty(locationRecord.SegmentId))) - { - AddErrorMessage("noSurfaceLineOrSegementLocationRecordError", locationRecord); - 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) @@ -751,55 +744,26 @@ } location.HeadPL2 = locationRecord.HeadPl2; - location.HeadPl3 = locationRecord.HeadPl3; - location.HeadPl4 = locationRecord.HeadPl4; - location.ModelFactors.RequiredSafetyFactorPiping = locationRecord.SafetyFactorPiping; - location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope = locationRecord.SafetyFactorStabilityInnerSlope; - location.ModelFactors.RequiredSafetyFactorStabilityOuterSlope = locationRecord.SafetyFactorStabilityOuterSlope; - location.ModelFactors.UpliftCriterionPiping = locationRecord.UpliftCriterionPiping; - location.ModelFactors.UpliftCriterionStability = locationRecord.UpliftCriterionStability; - if (null != locationRecord.Ophoogmateriaaldijk) + if (null != locationRecord.DikeEmbankmentMaterial) { - location.DikeEmbankmentMaterial = locationRecord.Ophoogmateriaaldijk; + location.DikeEmbankmentMaterial = locationRecord.DikeEmbankmentMaterial; } - if (null != locationRecord.Ophoogmateriaalberm) + if (null != locationRecord.ShoulderEmbankmentMaterial) { - location.ShoulderEmbankmentMaterial = locationRecord.Ophoogmateriaalberm; + location.ShoulderEmbankmentMaterial = locationRecord.ShoulderEmbankmentMaterial; } location.XRd = locationRecord.GeoX.GetValueOrDefault(location.XRd); location.YRd = locationRecord.GeoY.GetValueOrDefault(location.YRd); - location.PolderLevel = locationRecord.Polderlevel.GetValueOrDefault(location.PolderLevel); - location.XSoilGeometry2DOrigin = locationRecord.XSoilgeometry2DOrigin.GetValueOrDefault(location.XSoilGeometry2DOrigin); - location.DampingFactorPL3 = locationRecord.DempingsfactorPl3.GetValueOrDefault(location.DampingFactorPL3); - location.DampingFactorPL4 = locationRecord.DempingsfactorPl4.GetValueOrDefault(location.DampingFactorPL4); + location.PolderLevel = locationRecord.PolderLevel.GetValueOrDefault(location.PolderLevel); + 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.TL_DegreeOfConsolidation = locationRecord.TL_DegreeOfConsolidation.GetValueOrDefault(location.TL_DegreeOfConsolidation); location.PLLineCreationMethod = locationRecord.PLLineCreationMethod.GetValueOrDefault(location.PLLineCreationMethod); - location.PlLineOffsetBelowDikeTopAtRiver = locationRecord.PLLineOffsetBelowDikeTopAtRiver.GetValueOrDefault(location.PlLineOffsetBelowDikeTopAtRiver); - location.PlLineOffsetBelowDikeTopAtPolder = locationRecord.PLLineOffsetBelowDikeTopAtPolder.GetValueOrDefault(location.PlLineOffsetBelowDikeTopAtPolder); - location.PlLineOffsetBelowShoulderBaseInside = locationRecord.PLLineOffsetBelowShoulderBaseInside.GetValueOrDefault(location.PlLineOffsetBelowShoulderBaseInside); - location.PlLineOffsetBelowDikeToeAtPolder = locationRecord.PLLineOffsetBelowDikeToeAtPolder.GetValueOrDefault(location.PlLineOffsetBelowDikeToeAtPolder); - if (locationRecord.PlLineOffsetBelowDikeCrestMiddle.HasValue) - { - location.PlLineOffsetBelowDikeCrestMiddle = locationRecord.PlLineOffsetBelowDikeCrestMiddle.Value; - - } - if (locationRecord.PlLineOffsetFactorBelowShoulderCrest.HasValue) - { - location.PlLineOffsetFactorBelowShoulderCrest = locationRecord.PlLineOffsetFactorBelowShoulderCrest.Value; - } - if (locationRecord.UsePlLineOffsetBelowDikeCrestMiddle.HasValue) - { - location.UsePlLineOffsetBelowDikeCrestMiddle = locationRecord.UsePlLineOffsetBelowDikeCrestMiddle.Value; - - } - if (locationRecord.UsePlLineOffsetFactorBelowShoulderCrest.HasValue) - { - location.UsePlLineOffsetFactorBelowShoulderCrest = locationRecord.UsePlLineOffsetFactorBelowShoulderCrest.Value; - } if (locationRecord.IntrusionVerticalWaterPressure.HasValue) { location.IntrusionVerticalWaterPressure = locationRecord.IntrusionVerticalWaterPressure.Value; @@ -835,10 +799,6 @@ location.UseNewMinDistanceDikeToeStartDitch = locationRecord.UseNewMinDistanceDikeToeStartDitch.GetValueOrDefault(location.UseNewMinDistanceDikeToeStartDitch); location.UseNewShoulderBaseSlope = locationRecord.UseNewShoulderBaseSlope.GetValueOrDefault(location.UseNewShoulderBaseSlope); location.UseNewShoulderTopSlope = locationRecord.UseNewShoulderTopSlope.GetValueOrDefault(location.UseNewShoulderTopSlope); - - location.DikeTableHeight = locationRecord.DikeTableHeight; - location.RiverLevel = locationRecord.RiverLevel; - location.RiverLevelLow = locationRecord.RiverLevelLow; if (!errorInrecord) { Index: DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationShapeFileImporterTest.cs =================================================================== diff -u -r2243 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationShapeFileImporterTest.cs (.../LocationShapeFileImporterTest.cs) (revision 2243) +++ DamClients/DamUI/trunk/src/Dam/Tests/Importers/LocationShapeFileImporterTest.cs (.../LocationShapeFileImporterTest.cs) (revision 2529) @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Linq; using Deltares.Dam.Data; +using Deltares.Dam.Data.CsvImporters; using Deltares.Dam.Data.DataPlugins.Configuration; using Deltares.Dam.Data.Importers; using Deltares.Maps; @@ -38,7 +39,7 @@ [TestFixture] public class LocationShapeFileImporterTest { - private ICollection locations; + private ICollection locations; private LocationShapeFileImporter importer; private const string ShapeFileImportFolder = "TestFiles"; private MockRepository mocks; @@ -56,10 +57,10 @@ [SetUp] public void TestSetup() { - this.locations = new List() + locations = new List { - new Location{ Name= "Location1" }, - new Location{ Name= "Location2" }, + new CsvImporterLocations.LocationRecord {LocationId = "Location1"}, + new CsvImporterLocations.LocationRecord {LocationId = "Location2"}, }; repository = mocks.DynamicMock(); @@ -79,17 +80,7 @@ [TearDown] public void TestTearDown() { - try - { - mocks.VerifyAll(); - } - finally - { - foreach (var location in locations) - { - location.Dispose(); - } - } + mocks.VerifyAll(); } [TestFixtureTearDown] @@ -107,7 +98,7 @@ } [Test] - public void Importer_UsingValidCongiguredAttributed_NewLocationsAddedToImportedItems() + public void Importer_UsingValidConfiguredAttributed_NewLocationsAddedToImportedItems() { const string locAttributeName = "LID"; const string dridAttributeName = "DRID"; @@ -150,42 +141,36 @@ }; // Add existing location to test if that is handled correctly - using (var location = new Location() + var location = new CsvImporterLocations.LocationRecord { - Name = "loc3", + LocationId = "loc3", DikeRingId = "ring5", - XRd = 111.11, - YRd = 222.22 - }) + GeoX = 111.11, + GeoY = 222.22 + }; + locations = new List() { location }; + this.importer = new LocationShapeFileImporter(locations, configuredAttributes) { - locations = new List() { location }; - this.importer = new LocationShapeFileImporter(locations, configuredAttributes) - { - Repository = repository - }; + Repository = repository + }; - Expect.Call(repository.Features).Return(new[] { loc3, loc4 }); + Expect.Call(repository.Features).Return(new[] { loc3, loc4 }); - mocks.ReplayAll(); + mocks.ReplayAll(); - importer.Import(); + importer.Import(); - // ImportedItems should contain the total list of imported locations - // In this test a location is already in the locations list having same id as - // one feature returned by the feature repository - // This will cause that the importer overriders the existing location - // because of having the same name (id) - // Total should be 2 - Assert.AreEqual(2, this.importer.ImportedItems.Count()); + // ImportedItems should contain the total list of imported locations + // In this test a location is already in the locations list having same id as + // one feature returned by the feature repository + // This will cause that the importer overriders the existing location + // because of having the same name (id) + // Total should be 2 + Assert.AreEqual(2, this.importer.ImportedItems.Count()); - var location2 = importer.ImportedItems.Single(l => l.Name == "loc3"); - foreach (var importedItem in importer.ImportedItems) - { - importedItem.Dispose(); - } - Assert.AreEqual(location2.XRd, loc3.Geometry.Coordinate.X); - Assert.AreEqual(location2.YRd, loc3.Geometry.Coordinate.Y); - } + var location2 = importer.ImportedItems.Single(l => l.LocationId == "loc3"); + Assert.AreEqual(location2.GeoX, loc3.Geometry.Coordinate.X); + Assert.AreEqual(location2.GeoY, loc3.Geometry.Coordinate.Y); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs =================================================================== diff -u -r2168 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs (.../LocationShapeFileImporter.cs) (revision 2168) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs (.../LocationShapeFileImporter.cs) (revision 2529) @@ -23,21 +23,22 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using Deltares.Dam.Data.CsvImporters; using Deltares.Dam.Data.DataPlugins.Configuration; using Deltares.Maps; namespace Deltares.Dam.Data.Importers { - internal class LocationShapeFileImporter : IImporter + internal class LocationShapeFileImporter : IImporter { /// /// Creates a location shape file importer instance. /// - /// The existing location list. + /// The existing location list. /// The configured attributes. /// The shape file location. /// - public static LocationShapeFileImporter Create(IEnumerable existingLocationList, IEnumerable configuredAttributes, string shapeFileLocation) + public static LocationShapeFileImporter Create(IEnumerable existingLocationRecords, IEnumerable configuredAttributes, string shapeFileLocation) { if (string.IsNullOrEmpty(shapeFileLocation) || shapeFileLocation.Trim() == "") throw new ArgumentException("shapeFileLocation"); @@ -54,7 +55,7 @@ if (!file.Exists) throw new FileNotFoundException(string.Format("The file '{0}' is not found", file.FullPath)); - var importer = new LocationShapeFileImporter(existingLocationList, configuredAttributes) + var importer = new LocationShapeFileImporter(existingLocationRecords, configuredAttributes) { Repository = FeatureRepository.CreateFromShapeFile(file) }; @@ -63,24 +64,24 @@ } private readonly IEnumerable configuredAttributes; - private readonly ICollection locations; + private readonly ICollection locationRecords; private readonly IList errors; /// /// Constructs a location importer class were data will be imported from ShapeFiles /// - /// + /// /// - public LocationShapeFileImporter(IEnumerable existingLocationList, IEnumerable configuredAttributes) + public LocationShapeFileImporter(IEnumerable existingLocationRecords, IEnumerable configuredAttributes) { this.configuredAttributes = configuredAttributes; - this.locations = new List(); + this.locationRecords = new List(); - if (existingLocationList != null) + if (existingLocationRecords != null) { - foreach (var location in existingLocationList.Where(location => location != null)) + foreach (var location in existingLocationRecords.Where(location => location != null)) { - this.locations.Add(location); + this.locationRecords.Add(location); } } @@ -96,9 +97,9 @@ #region Implementation of IImporter - public IEnumerable ImportedItems + public IEnumerable ImportedItems { - get { return locations; } + get { return locationRecords; } } #endregion @@ -120,18 +121,24 @@ { var locationIDValue = feature.Attributes[locationMapping.Name].ToString(); var dikeRingIdValue = feature.Attributes[dikeRingMapping.Name].ToString(); - - var location = this.locations.FirstOrDefault(l => l.Name == locationIDValue); - if (location == null) + + //Locations are read from shapefile after the locations have been read from locations.csv + //If a location already exists, overwrite the existing location + //otherwise create a new location + var locationRecord = locationRecords.FirstOrDefault(l => l.LocationId == locationIDValue); + var newLocation = locationRecord == null; + if (newLocation) { - location = new Location(); - location.SetDefaultValues(); - this.locations.Add(location); + locationRecord = new CsvImporterLocations.LocationRecord(); } - location.Name = locationIDValue; - location.DikeRingId = dikeRingIdValue; - location.XRd = feature.Geometry.Coordinate.X; - location.YRd = feature.Geometry.Coordinate.Y; + locationRecord.LocationId = locationIDValue; + locationRecord.DikeRingId = dikeRingIdValue; + locationRecord.GeoX = feature.Geometry.Coordinate.X; + locationRecord.GeoY = feature.Geometry.Coordinate.Y; + if (newLocation) + { + locationRecords.Add(locationRecord); + } } } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs (.../Location.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs (.../Location.cs) (revision 2529) @@ -55,8 +55,6 @@ public const string PL1LineId = "PL1LineId"; public const string PolderLevel = "PolderLevel"; public const string HeadPL2 = "HeadPL2"; - public const string HeadPL3 = "HeadPL3"; - public const string HeadPL4 = "HeadPL4"; public const string XSoilGeometry2DOrigin = "XSoilGeometry2DOrigin"; public const string DikeEmbankmentMaterial = "DikeEmbankmentMaterial"; public const string ShoulderEmbankmentMaterial = "ShoulderEmbankmentMaterial"; @@ -66,24 +64,11 @@ public const string TrafficLoad = "TrafficLoad"; public const string TL_DegreeOfConsolidation = "TL_DegreeOfConsolidation"; public const string PLLineCreationMethod = "PLLineCreationMethod"; - public const string PLLineOffsetBelowDikeTopAtRiver = "PLLineOffsetBelowDikeTopAtRiver"; - public const string PLLineOffsetBelowDikeTopAtPolder = "PLLineOffsetBelowDikeTopAtPolder"; - public const string PLLineOffsetBelowShoulderBaseInside = "PLLineOffsetBelowShoulderBaseInside"; - public const string PLLineOffsetBelowDikeToeAtPolder = "PLLineOffsetBelowDikeToeAtPolder"; - public const string PlLineOffsetBelowDikeCrestMiddle = "PlLineOffsetBelowDikeCrestMiddle"; - public const string PlLineOffsetFactorBelowShoulderCrest = "PlLineOffsetFactorBelowShoulderCrest"; - public const string UsePlLineOffsetBelowDikeCrestMiddle = "UsePlLineOffsetBelowDikeCrestMiddle"; - public const string UsePlLineOffsetFactorBelowShoulderCrest = "UsePlLineOffsetFactorBelowShoulderCrest"; public const string StabilityShoulderGrowSlope = "StabilityShoulderGrowSlope"; public const string StabilityShoulderGrowDeltaX = "StabilityShoulderGrowDeltaX"; public const string StabilitySlopeAdaptionDeltaX = "StabilitySlopeAdaptionDeltaX"; public const string MinimalCircleDepth = "MinimalCircleDepth"; public const string DistanceToEntryPoint = "DistanceToEntryPoint"; - public const string RequiredSafetyFactorStabilityInnerSlope = "RequiredSafetyFactorStabilityInnerSlope"; - public const string RequiredSafetyFactorStabilityOuterSlope = "RequiredSafetyFactorStabilityOuterSlope"; - public const string RequiredSafetyFactorPiping = "RequiredSafetyFactorPiping"; - public const string UpliftCriterionPiping = "UpliftCriterionPiping"; - public const string UpliftCriterionStability = "UpliftCriterionStability"; public const string StabilityZoneType = "StabilityZoneType"; public const string ForbiddenZoneFactor = "ForbiddenZoneFactor"; public const string ZoneAreaRestSlopeCrestWidth = "ZoneAreaRestSlopeCrestWidth"; @@ -111,9 +96,6 @@ public const string UseNewShoulderBaseSlope = "UseNewShoulderBaseSlope"; public const string UseNewShoulderTopSlope = "UseNewShoulderTopSlope"; public const string IntrusionVerticalWaterPressure = "IntrusionVerticalWaterPressure"; - public const string DikeTableHeight = "DikeTableHeight"; - public const string RiverLevel = "RiverLevel"; - public const string RiverLevelLow = "RiverLevelLow"; } [TrackChanges] @@ -147,14 +129,11 @@ private IList gaugePLLines = new List(); private IList gauges = new List(); private double? headPL2 = null; - private double? headPL3 = null; - private double? headPL4 = null; // Start of parameters that are also defined in modelparameters private PL1Line localXZPL1Line; private SurfaceLine2 localXzSurfaceLine; private string mapForSoilGeometries2D = ""; private double minimalCircleDepth = 0; - private ModelFactors modelFactors = new ModelFactors(); private string name = ""; private double newDepthDitch = 1.0; private double newDikeSlopeInside = 1.0/3.0; // as tangent @@ -168,10 +147,6 @@ private double newWidthDitchBottom = 1.0; private PL1Line pL1Line; private PLLineCreationMethod pLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD; - private double pLLineOffsetBelowDikeToeAtPolder = 0.1; - private double pLLineOffsetBelowDikeTopAtPolder = 1.5; - private double pLLineOffsetBelowDikeTopAtRiver = 0.5; - private double pLLineOffsetBelowShoulderBaseInside = 0.1; private double penetrationLength = 0; private double polderLevel = 0; private bool redesignDikeHeight = true; @@ -208,17 +183,9 @@ private double xrd = 0; private double yrd = 0; private double zoneAreaRestSlopeCrestWidth = 3.0; - - private double? plLineOffsetFactorBelowShoulderCrest; - private double? plLineOffsetBelowDikeCrestMiddle; - + private IntrusionVerticalWaterPressureType? intrusionVerticalWaterPressure = IntrusionVerticalWaterPressureType.Standard; - private double? dikeTableHeight = null; - private double? riverLevel = null; - private double? riverLevelLow = null; - - public Location() { SoilList = null; @@ -527,59 +494,6 @@ } } - [Browsable(false)] - public virtual ModelFactors ModelFactors - { - get - { - return modelFactors; - } - set - { - DataEventPublisher.BeforeChange(this, "ModelFactors"); - modelFactors = value; - DataEventPublisher.AfterChange(this, "ModelFactors"); - } - } - - [XmlIgnore] - [Label("Uplift criterion stability")] - [Description("Uplift criterion that is used in stability calulation")] - [Unit(UnitType.None)] - [Format("F3")] - [PropertyOrder(6, 1)] - [Category(WaterCategory)] - public virtual double? UpliftCriterionStability - { - get - { - return ModelFactors.UpliftCriterionStability; - } - set - { - ModelFactors.UpliftCriterionStability = value; - } - } - - [XmlIgnore] - [Label("Uplift criterion piping")] - [Description("Uplift criterion that is used in piping calulation")] - [Unit(UnitType.None)] - [Format("F3")] - [PropertyOrder(6, 2)] - [Category(WaterCategory)] - public virtual double? UpliftCriterionPiping - { - get - { - return ModelFactors.UpliftCriterionPiping; - } - set - { - ModelFactors.UpliftCriterionPiping = value; - } - } - [Unit(UnitType.Length)] [Label("Distance to Entrypoint")] [Description("Distance from toe of dike to entry point of river in deep sandlayer")] @@ -1294,18 +1208,6 @@ }; } } - else - { - if (modelFactors.RequiredSafetyFactorStabilityInnerSlope == null) - { - return new[] - { - new ValidationResult(ValidationResultType.Error, - LocalizationManager.GetTranslatedText(this, "NoRequiredSafetyForZones"), - this, "StabilityZoneType", "ZoneTypeSafety", (IRepairer) this) - }; - } - } } return new ValidationResult[0]; } @@ -1466,37 +1368,6 @@ } /// - /// Determines whether [is pl line offset factor below shoulder crest valid]. - /// - /// - [Validate] - public ValidationResult[] IsPlLineOffsetFactorBelowShoulderCrestValid() - { - if (!IsDesign() && ArePlLineCreationExpertKnowledgeParametersNeeded() && UsePlLineOffsetFactorBelowShoulderCrest.HasValue && UsePlLineOffsetFactorBelowShoulderCrest.Value && - PlLineOffsetFactorBelowShoulderCrest.HasValue) - { - if (PlLineOffsetFactorBelowShoulderCrest.Value < DamGlobalConstants.PlLineOffsetFactorBelowShoulderCrestMinValue) - { - return new[] - { - new ValidationResult(ValidationResultType.Error, - LocalizationManager.GetTranslatedText(this, "PlLineOffsetFactorBelowShoulderCrestTooSmall"), - this, "PlLineOffsetFactorBelowShoulderCrest", "AssignMinValue", (IRepairer) this) - }; - } - if (PlLineOffsetFactorBelowShoulderCrest.Value > DamGlobalConstants.PlLineOffsetFactorBelowShoulderCrestMaxValue) - { - return new[] - { - new ValidationResult(ValidationResultType.Error, - LocalizationManager.GetTranslatedText(this, "PlLineOffsetFactorBelowShoulderCrestTooLarge"), - this, "PlLineOffsetFactorBelowShoulderCrest", "AssignMaxValue", (IRepairer) this) - }; - } - } - return new ValidationResult[0]; - } - /// /// Check if DikeEmbankmentMaterial is defined and is available as soil /// /// @@ -1694,62 +1565,6 @@ } /// - /// Gets or sets the head PL3. - /// - /// - /// The head PL3. - /// - [Unit(UnitType.Length)] - [Label("Head PL3")] - [Description("Head level for PL3")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(2, 9)] - [Clearable] - [XmlOldName("HeadPL3")] - public virtual double? HeadPl3 - { - get - { - return headPL3; - } - set - { - DataEventPublisher.BeforeChange(this, "HeadPl3"); - headPL3 = value; - DataEventPublisher.AfterChange(this, "HeadPl3"); - } - } - - /// - /// Gets or sets the head PL4. - /// - /// - /// The head PL4. - /// - [Unit(UnitType.Length)] - [Label("Head PL4")] - [Description("Head level for PL4")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(2, 10)] - [Clearable] - [XmlOldName("HeadPL4")] - public virtual double? HeadPl4 - { - get - { - return headPL4; - } - set - { - DataEventPublisher.BeforeChange(this, "HeadPl4"); - headPL4 = value; - DataEventPublisher.AfterChange(this, "HeadPl4"); - } - } - - /// /// Gets or sets the damping factor pl 3. /// /// @@ -1832,180 +1647,6 @@ } } - /// - /// Gets or sets the pl line offset below dike top at river. - /// - /// - /// The pl line offset below dike top at river. - /// - [Unit(UnitType.Length)] - [Label("PL1 below top dike (river)")] - [Description("PL1 below top dike (riverside)")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(3, 2)] - [XmlOldName("PLLineOffsetBelowDikeTopAtRiver")] - public virtual double PlLineOffsetBelowDikeTopAtRiver - { - get - { - return pLLineOffsetBelowDikeTopAtRiver; - } - set - { - DataEventPublisher.BeforeChange(this, "PlLineOffsetBelowDikeTopAtRiver"); - pLLineOffsetBelowDikeTopAtRiver = value; - DataEventPublisher.AfterChange(this, "PlLineOffsetBelowDikeTopAtRiver"); - } - } - - /// - /// Gets or sets the pl line offset below dike top at polder. - /// - /// - /// The pl line offset below dike top at polder. - /// - [Unit(UnitType.Length)] - [Label("PL1 below top dike (polder)")] - [Description("PL1 below top dike (polderside)")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(3, 3)] - [XmlOldName("PLLineOffsetBelowDikeTopAtPolder")] - public virtual double PlLineOffsetBelowDikeTopAtPolder - { - get - { - return pLLineOffsetBelowDikeTopAtPolder; - } - set - { - DataEventPublisher.BeforeChange(this, "PlLineOffsetBelowDikeTopAtPolder"); - pLLineOffsetBelowDikeTopAtPolder = value; - DataEventPublisher.AfterChange(this, "PlLineOffsetBelowDikeTopAtPolder"); - } - } - - /// - /// Gets or sets the pl line offset below shoulder base inside. - /// - /// - /// The pl line offset below shoulder base inside. - /// - [Unit(UnitType.Length)] - [Label("PL1 below shoulder base (polder)")] - [Description("PL1 below shoulder base (polderside)")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(3, 4)] - [XmlOldName("PLLineOffsetBelowShoulderBaseInside")] - public virtual double PlLineOffsetBelowShoulderBaseInside - { - get - { - return pLLineOffsetBelowShoulderBaseInside; - } - set - { - DataEventPublisher.BeforeChange(this, "PlLineOffsetBelowShoulderBaseInside"); - pLLineOffsetBelowShoulderBaseInside = value; - DataEventPublisher.AfterChange(this, "PlLineOffsetBelowShoulderBaseInside"); - } - } - - /// - /// Gets or sets the pl line offset below dike toe at polder. - /// - /// - /// The pl line offset below dike toe at polder. - /// - [Unit(UnitType.Length)] - [Label("PL1 below toe of dike (polder)")] - [Description("PL1 below toe of dike (polderside)")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(3, 5)] - [XmlOldName("PLLineOffsetBelowDikeToeAtPolder")] - public virtual double PlLineOffsetBelowDikeToeAtPolder - { - get - { - return pLLineOffsetBelowDikeToeAtPolder; - } - set - { - DataEventPublisher.BeforeChange(this, "PlLineOffsetBelowDikeToeAtPolder"); - pLLineOffsetBelowDikeToeAtPolder = value; - DataEventPublisher.AfterChange(this, "PlLineOffsetBelowDikeToeAtPolder"); - } - } - - /// - /// Gets or sets the use pl line offset below dike crest middle. - /// - /// - /// The use pl line offset below dike crest middle. - /// - [Unit(UnitType.None)] - [Category(WaterCategory)] - [Clearable] - [PropertyOrder(3, 10)] - public bool? UsePlLineOffsetBelowDikeCrestMiddle { get; set; } - - /// - /// Gets or sets the pl line offset below dike crest middle. - /// - /// - /// The pl line offset below dike crest middle. - /// - [Unit(UnitType.Length)] - [Format("F2")] - [Category(WaterCategory)] - [PropertyOrder(3, 11)] - public double? PlLineOffsetBelowDikeCrestMiddle - { - get { return plLineOffsetBelowDikeCrestMiddle; } - set - { - DataEventPublisher.BeforeChange(this, x => x.PlLineOffsetBelowDikeCrestMiddle); - plLineOffsetBelowDikeCrestMiddle = value; - DataEventPublisher.AfterChange(this, x => x.PlLineOffsetBelowDikeCrestMiddle); - } - } - - /// - /// Gets or sets the use pl line offset factor below shoulder crest. - /// - /// - /// The use pl line offset factor below shoulder crest. - /// - [Unit(UnitType.None)] - [Category(WaterCategory)] - [Clearable] - [PropertyOrder(3, 12)] - public bool? UsePlLineOffsetFactorBelowShoulderCrest { get; set; } - - /// - /// Gets or sets the pl line offset factor below shoulder crest. - /// - /// - /// The pl line offset factor below shoulder crest. - /// - [Unit(UnitType.Fractions)] - [Format("F2")] - [Category(WaterCategory)] - [PropertyOrder(3, 13)] - public double? PlLineOffsetFactorBelowShoulderCrest - { - get { return plLineOffsetFactorBelowShoulderCrest; } - set - { - DataEventPublisher.BeforeChange(this, x => x.PlLineOffsetFactorBelowShoulderCrest); - plLineOffsetFactorBelowShoulderCrest = value; - DataEventPublisher.AfterChange(this, x => x.PlLineOffsetFactorBelowShoulderCrest); - } - } - // /// Gets or sets the intrusion vertical water pressure. /// @@ -2048,69 +1689,6 @@ } } - [Unit(UnitType.Length)] - [Label("River level")] - [Description("Water level in river")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(2, 6)] - [Clearable] - public virtual double? RiverLevel - { - get - { - return riverLevel; - } - set - { - DataEventPublisher.BeforeChange(this, "RiverLevel"); - riverLevel = value; - DataEventPublisher.AfterChange(this, "RiverLevel"); - } - } - - [Unit(UnitType.Length)] - [Label("River level low")] - [Description("Water height low")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(2, 7)] - [Clearable] - public virtual double? RiverLevelLow - { - get - { - return riverLevelLow; - } - set - { - DataEventPublisher.BeforeChange(this, "RiverLevelLow"); - riverLevelLow = value; - DataEventPublisher.AfterChange(this, "RiverLevelLow"); - } - } - - [Unit(UnitType.Length)] - [Label("Dike table height")] - [Description("Dike table height")] - [Format("F3")] - [Category(WaterCategory)] - [PropertyOrder(2, 8)] - [Clearable] - public virtual double? DikeTableHeight - { - get - { - return dikeTableHeight; - } - set - { - DataEventPublisher.BeforeChange(this, "DikeTableHeight"); - dikeTableHeight = value; - DataEventPublisher.AfterChange(this, "DikeTableHeight"); - } - } - #endregion /// @@ -2156,45 +1734,13 @@ { nameValuePairs.Add(LocationParameterNames.HeadPL2, HeadPL2.Value.ToString(numberFormatInfo)); } - if (HeadPl3.HasValue) - { - nameValuePairs.Add(LocationParameterNames.HeadPL3, HeadPl3.Value.ToString(numberFormatInfo)); - } - if (HeadPl4.HasValue) - { - nameValuePairs.Add(LocationParameterNames.HeadPL4, HeadPl4.Value.ToString(numberFormatInfo)); - } nameValuePairs.Add(LocationParameterNames.XSoilGeometry2DOrigin, XSoilGeometry2DOrigin.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.DikeEmbankmentMaterial, DikeEmbankmentMaterial); nameValuePairs.Add(LocationParameterNames.ShoulderEmbankmentMaterial, ShoulderEmbankmentMaterial); nameValuePairs.Add(LocationParameterNames.DampingFactorPL3, DampingFactorPL3.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.DampingFactorPL4, DampingFactorPL4.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.PenetrationLength, PenetrationLength.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.PLLineCreationMethod, PLLineCreationMethod.ToString()); - nameValuePairs.Add(LocationParameterNames.PLLineOffsetBelowDikeTopAtRiver, PlLineOffsetBelowDikeTopAtRiver.ToString(numberFormatInfo)); - nameValuePairs.Add(LocationParameterNames.PLLineOffsetBelowDikeTopAtPolder, PlLineOffsetBelowDikeTopAtPolder.ToString(numberFormatInfo)); - nameValuePairs.Add(LocationParameterNames.PLLineOffsetBelowShoulderBaseInside, PlLineOffsetBelowShoulderBaseInside.ToString(numberFormatInfo)); - nameValuePairs.Add(LocationParameterNames.PLLineOffsetBelowDikeToeAtPolder, PlLineOffsetBelowDikeToeAtPolder.ToString(numberFormatInfo)); - if (PlLineOffsetBelowDikeCrestMiddle.HasValue) - { - nameValuePairs.Add(LocationParameterNames.PlLineOffsetBelowDikeCrestMiddle, - PlLineOffsetBelowDikeCrestMiddle.Value.ToString(numberFormatInfo)); - } - if (PlLineOffsetFactorBelowShoulderCrest.HasValue) - { - nameValuePairs.Add(LocationParameterNames.PlLineOffsetFactorBelowShoulderCrest, - PlLineOffsetFactorBelowShoulderCrest.Value.ToString(numberFormatInfo)); - } - if (UsePlLineOffsetBelowDikeCrestMiddle.HasValue) - { - nameValuePairs.Add(LocationParameterNames.UsePlLineOffsetBelowDikeCrestMiddle, - UsePlLineOffsetBelowDikeCrestMiddle.Value.ToString()); - } - if (UsePlLineOffsetFactorBelowShoulderCrest.HasValue) - { - nameValuePairs.Add(LocationParameterNames.UsePlLineOffsetFactorBelowShoulderCrest, - UsePlLineOffsetFactorBelowShoulderCrest.Value.ToString()); - } if (IntrusionVerticalWaterPressure.HasValue) { nameValuePairs.Add(LocationParameterNames.IntrusionVerticalWaterPressure, @@ -2207,26 +1753,6 @@ nameValuePairs.Add(LocationParameterNames.TL_DegreeOfConsolidation, TL_DegreeOfConsolidation.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.MinimalCircleDepth, MinimalCircleDepth.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.DistanceToEntryPoint, DistanceToEntryPoint.ToString(numberFormatInfo)); - if (ModelFactors.RequiredSafetyFactorStabilityInnerSlope != null) - { - nameValuePairs.Add(LocationParameterNames.RequiredSafetyFactorStabilityInnerSlope, ModelFactors.RequiredSafetyFactorStabilityInnerSlope.Value.ToString(numberFormatInfo)); - } - if (ModelFactors.RequiredSafetyFactorStabilityOuterSlope != null) - { - nameValuePairs.Add(LocationParameterNames.RequiredSafetyFactorStabilityOuterSlope, ModelFactors.RequiredSafetyFactorStabilityOuterSlope.Value.ToString(numberFormatInfo)); - } - if (ModelFactors.RequiredSafetyFactorPiping != null) - { - nameValuePairs.Add(LocationParameterNames.RequiredSafetyFactorPiping, ModelFactors.RequiredSafetyFactorPiping.Value.ToString(numberFormatInfo)); - } - if (ModelFactors.UpliftCriterionPiping != null) - { - nameValuePairs.Add(LocationParameterNames.UpliftCriterionPiping, ModelFactors.UpliftCriterionPiping.Value.ToString(numberFormatInfo)); - } - if (ModelFactors.UpliftCriterionStability != null) - { - nameValuePairs.Add(LocationParameterNames.UpliftCriterionStability, ModelFactors.UpliftCriterionStability.Value.ToString(numberFormatInfo)); - } nameValuePairs.Add(LocationParameterNames.StabilityZoneType, StabilityZoneType.ToString()); nameValuePairs.Add(LocationParameterNames.ForbiddenZoneFactor, ForbiddenZoneFactor.ToString(numberFormatInfo)); nameValuePairs.Add(LocationParameterNames.ZoneAreaRestSlopeCrestWidth, ZoneAreaRestSlopeCrestWidth.ToString(numberFormatInfo)); @@ -2255,18 +1781,6 @@ nameValuePairs.Add(LocationParameterNames.UseNewMinDistanceDikeToeStartDitch, UseNewMinDistanceDikeToeStartDitch.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewShoulderBaseSlope, UseNewShoulderBaseSlope.ToString()); nameValuePairs.Add(LocationParameterNames.UseNewShoulderTopSlope, UseNewShoulderTopSlope.ToString()); - if (DikeTableHeight.HasValue) - { - nameValuePairs.Add(LocationParameterNames.DikeTableHeight, DikeTableHeight.Value.ToString(numberFormatInfo)); - } - if (RiverLevel.HasValue) - { - nameValuePairs.Add(LocationParameterNames.RiverLevel, RiverLevel.Value.ToString(numberFormatInfo)); - } - if (RiverLevelLow.HasValue) - { - nameValuePairs.Add(LocationParameterNames.RiverLevelLow, RiverLevelLow.Value.ToString(numberFormatInfo)); - } return nameValuePairs; } @@ -2511,14 +2025,6 @@ { HeadPL2 = Convert.ToDouble(parameterValue, numberFormatInfo); } - if (parameterName.Equals(LocationParameterNames.HeadPL3)) - { - HeadPl3 = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.HeadPL4)) - { - HeadPl4 = Convert.ToDouble(parameterValue, numberFormatInfo); - } if (parameterName.Equals(LocationParameterNames.XSoilGeometry2DOrigin)) { XSoilGeometry2DOrigin = Convert.ToDouble(parameterValue, numberFormatInfo); @@ -2547,38 +2053,6 @@ { PLLineCreationMethod = (PLLineCreationMethod) Enum.Parse(typeof(PLLineCreationMethod), parameterValue); } - if (parameterName.Equals(LocationParameterNames.PLLineOffsetBelowDikeTopAtRiver)) - { - PlLineOffsetBelowDikeTopAtRiver = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.PLLineOffsetBelowDikeTopAtPolder)) - { - PlLineOffsetBelowDikeTopAtPolder = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.PLLineOffsetBelowShoulderBaseInside)) - { - PlLineOffsetBelowShoulderBaseInside = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.PLLineOffsetBelowDikeToeAtPolder)) - { - PlLineOffsetBelowDikeToeAtPolder = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.PlLineOffsetBelowDikeCrestMiddle)) - { - PlLineOffsetBelowDikeCrestMiddle = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.PlLineOffsetFactorBelowShoulderCrest)) - { - PlLineOffsetFactorBelowShoulderCrest = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.UsePlLineOffsetBelowDikeCrestMiddle)) - { - UsePlLineOffsetBelowDikeCrestMiddle = Convert.ToBoolean(parameterValue); - } - if (parameterName.Equals(LocationParameterNames.UsePlLineOffsetFactorBelowShoulderCrest)) - { - UsePlLineOffsetFactorBelowShoulderCrest = Convert.ToBoolean(parameterValue); - } if (parameterName.Equals(LocationParameterNames.IntrusionVerticalWaterPressure)) { IntrusionVerticalWaterPressure = @@ -2614,26 +2088,6 @@ { DistanceToEntryPoint = Convert.ToDouble(parameterValue, numberFormatInfo); } - if (parameterName.Equals(LocationParameterNames.RequiredSafetyFactorStabilityInnerSlope)) - { - ModelFactors.RequiredSafetyFactorStabilityInnerSlope = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.RequiredSafetyFactorStabilityOuterSlope)) - { - ModelFactors.RequiredSafetyFactorStabilityOuterSlope = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.RequiredSafetyFactorPiping)) - { - ModelFactors.RequiredSafetyFactorPiping = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.UpliftCriterionPiping)) - { - ModelFactors.UpliftCriterionPiping = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.UpliftCriterionStability)) - { - ModelFactors.UpliftCriterionStability = Convert.ToDouble(parameterValue, numberFormatInfo); - } if (parameterName.Equals(LocationParameterNames.StabilityZoneType)) { StabilityZoneType = (MStabZonesType) Enum.Parse(typeof(MStabZonesType), parameterValue); @@ -2741,18 +2195,6 @@ { UseNewShoulderTopSlope = Convert.ToBoolean(parameterValue, numberFormatInfo); } - if (parameterName.Equals(LocationParameterNames.DikeTableHeight)) - { - DikeTableHeight = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.RiverLevel)) - { - RiverLevel = Convert.ToDouble(parameterValue, numberFormatInfo); - } - if (parameterName.Equals(LocationParameterNames.RiverLevelLow)) - { - RiverLevelLow = Convert.ToDouble(parameterValue, numberFormatInfo); - } } #region IVisibleEnabled Members @@ -2857,30 +2299,6 @@ case "NewDepthDitch": case "NewSlopeAngleDitch": return isDesign && StabilityDesignMethod != StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption; - - // Next will are all parameters that are displayed by the scenarios tab - case "ModelFactorRequiredSafetyFactorPiping": - case "ModelFactorRequiredSafetyFactorStabilityInnerSlope": - case "ModelFactorRequiredSafetyFactorStabilityOuterSlope": - return false; // Probably obsolete, because it is defined in the scenario - case "PlLineOffsetBelowDikeToeAtPolder": - case "PlLineOffsetBelowDikeTopAtPolder": - case "PlLineOffsetBelowDikeTopAtRiver": - case "PlLineOffsetBelowShoulderBaseInside": - case "PlLineOffsetBelowDikeCrestMiddle": - case "PlLineOffsetFactorBelowShoulderCrest": - case "UsePlLineOffsetBelowDikeCrestMiddle": - case "UsePlLineOffsetFactorBelowShoulderCrest": - return !isDesign && arePlLineCreationExpertKnowledgeParametersNeeded; - case "UpliftCriterionStability": - case "UpliftCriterionPiping": - case "HeadPl3": - case "HeadPl4": - case "DikeTableHeight": - case "RiverLevel": - case "RiverLevelLow": - return !isDesign; - default: return true; } @@ -2969,14 +2387,6 @@ { NewDikeSlopeOutside = newDikeSlopeOutsideMinValue; } - if (id == "AssignMinValue" && property == "PlLineOffsetFactorBelowShoulderCrest") - { - PlLineOffsetFactorBelowShoulderCrest = DamGlobalConstants.PlLineOffsetFactorBelowShoulderCrestMinValue; - } - if (id == "AssignMaxValue" && property == "PlLineOffsetFactorBelowShoulderCrest") - { - PlLineOffsetFactorBelowShoulderCrest = DamGlobalConstants.PlLineOffsetFactorBelowShoulderCrestMaxValue; - } if (id == "AssignMinValue" && property == "PenetrationLength") { PenetrationLength = penetrationLenghtMinValue; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssembler.cs =================================================================== diff -u -r2089 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssembler.cs (.../DtoAssembler.cs) (revision 2089) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssembler.cs (.../DtoAssembler.cs) (revision 2529) @@ -193,7 +193,7 @@ public string ElementName { get; private set; } /// - /// Creates and materialized a data tranfer object (dto) from a domain object + /// Creates and materialized a data transfer object (dto) from a domain object /// /// The domain object /// An XElement instance @@ -217,7 +217,7 @@ } /// - /// Creates and materializes a domain object from a data tranfer object (dto) + /// Creates and materializes a domain object from a data transfer object (dto) /// /// The dto object /// The materialized domain object Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs =================================================================== diff -u -r2204 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs (.../LocationPropertyImporter.cs) (revision 2204) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs (.../LocationPropertyImporter.cs) (revision 2529) @@ -24,6 +24,7 @@ using System.Diagnostics; using System.IO; using System.Linq; +using Deltares.Dam.Data.CsvImporters; using Deltares.Maps; using Deltares.Standard; using NetTopologySuite.Geometries; @@ -44,22 +45,22 @@ // ReSharper restore ClassWithVirtualMembersNeverInherited.Global { private readonly IDictionary> filesToImportFrom; - private readonly PolygonAttributeImporter polygonAttributeImporter; - private readonly LineAttributeImporter lineAttributeImporter; + private readonly PolygonAttributeImporter polygonAttributeImporter; + private readonly LineAttributeImporter lineAttributeImporter; private List improperAttributeMessages = new List(); - private IEnumerable targets; + private IEnumerable targets; public LocationPropertyImporter() { this.filesToImportFrom = new Dictionary>(); - this.polygonAttributeImporter = new PolygonAttributeImporter + this.polygonAttributeImporter = new PolygonAttributeImporter { - XGetter = (t) => t.XRd, - YGetter = (t) => t.YRd + XGetter = (t) => t.GeoX.Value, + YGetter = (t) => t.GeoY.Value }; - this.lineAttributeImporter = new LineAttributeImporter(); + this.lineAttributeImporter = new LineAttributeImporter(); } public List ImproperAttributeMessages @@ -97,7 +98,7 @@ get { return this.polygonAttributeImporter.Errors.Concat(this.lineAttributeImporter.Errors); } } - public IEnumerable Targets + public IEnumerable Targets { set { this.targets = value; } } @@ -198,7 +199,7 @@ if (!IsValidString(dataFileName)) // not a valid file location? use the default file dataFileName = mapping.File; - Action action = mapping.Action; + Action action = mapping.Action; // Build a map to data (shape) files and attributes contained in the dbf file // if a file is already added to the map a new attribute will be added @@ -294,12 +295,12 @@ if (feature != null) { isPolygonTypeRepository = feature.Geometry is Polygon || feature.Geometry is MultiPolygon; - IAttributeImporter importer = isPolygonTypeRepository ? - this.polygonAttributeImporter as IAttributeImporter : - this.lineAttributeImporter as IAttributeImporter; + IAttributeImporter importer = isPolygonTypeRepository ? + this.polygonAttributeImporter as IAttributeImporter : + this.lineAttributeImporter as IAttributeImporter; importer.FileName = fileName; importer.AttributeRepository = attributeRepository; - importer.AttributeMappings = file.Value.OfType>(); + importer.AttributeMappings = file.Value.OfType>(); try { Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs =================================================================== diff -u -r2168 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (.../WaterBoardImporter.cs) (revision 2168) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (.../WaterBoardImporter.cs) (revision 2529) @@ -576,23 +576,12 @@ location.SurfaceLine2 = dike.SurfaceLines2.FirstOrDefault(s => s.Name == location.Name); } location.SoilList = dike.SoilList; - CheckModelFactorsForLocation(location); dike.Locations.Add(location); } dike.SortLocations(); - } /// - /// Checks the model factors for location. - /// - /// The location. - private static void CheckModelFactorsForLocation(Location location) - { - ModelParameters.AssignDefaultToNullValues(location.ModelFactors); - } - - /// /// Imports the model parameters. /// /// The dike ring identifier. Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs =================================================================== diff -u -r2512 -r2529 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs (.../CsvImporterLocations.cs) (revision 2512) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs (.../CsvImporterLocations.cs) (revision 2529) @@ -46,31 +46,30 @@ public string DikeRingId { get; set; } public double? GeoX { get; set; } public double? GeoY { get; set; } - public double? XSoilgeometry2DOrigin { get; set; } - public string Pl1Id { get; set; } - public double? Polderlevel { get; set; } + public double? XSoilGeometry2DOrigin { get; set; } + public double? PolderLevel { get; set; } public double? HeadPl2 { get; set; } public double? HeadPl3 { get; set; } public double? HeadPl4 { get; set; } - public string Ophoogmateriaaldijk { get; set; } - public string Ophoogmateriaalberm { get; set; } + public string DikeEmbankmentMaterial { get; set; } + public string ShoulderEmbankmentMaterial { get; set; } public double? PenetrationLength { get; set; } public double? TrafficLoad { get; set; } public double? TL_DegreeOfConsolidation { get; set; } public double? MinimalCircleDepth { get; set; } - public double? DempingsfactorPl3 { get; set; } - public double? DempingsfactorPl4 { get; set; } + public double? DampingFactorPl3 { get; set; } + public double? DampingFactorPl4 { get; set; } public PLLineCreationMethod? PLLineCreationMethod { get; set; } - public double? SafetyFactorPiping { get; set; } - public double? SafetyFactorStabilityInnerSlope { get; set; } - public double? SafetyFactorStabilityOuterSlope { get; set; } + public double? RequiredSafetyFactorPiping { get; set; } + public double? RequiredSafetyFactorStabilityInnerSlope { get; set; } + public double? RequiredSafetyFactorStabilityOuterSlope { get; set; } public double? UpliftCriterionPiping { get; set; } public double? UpliftCriterionStability { get; set; } public double? DistanceToEntryPoint { get; set; } - public double? PLLineOffsetBelowDikeTopAtRiver { get; set; } - public double? PLLineOffsetBelowDikeTopAtPolder { get; set; } - public double? PLLineOffsetBelowShoulderBaseInside { get; set; } - public double? PLLineOffsetBelowDikeToeAtPolder { get; set; } + public double? PlLineOffsetBelowDikeTopAtRiver { get; set; } + public double? PlLineOffsetBelowDikeTopAtPolder { get; set; } + public double? PlLineOffsetBelowShoulderBaseInside { get; set; } + public double? PlLineOffsetBelowDikeToeAtPolder { get; set; } public double? PlLineOffsetBelowDikeCrestMiddle { get; set; } public double? PlLineOffsetFactorBelowShoulderCrest { get; set; } public bool? UsePlLineOffsetBelowDikeCrestMiddle { get; set; } @@ -108,7 +107,7 @@ public double? NewDepthDitch { get; set; } public double? DikeTableHeight { get; set; } public double? RiverLevel { get; set; } - public double? RiverLevelLow { get; set; } + public double? RiverLevelLow { get; set; } } public CsvImporterLocations(string fileName) @@ -236,12 +235,12 @@ if (colIndexXSoilgeometry2DOrigin > -1) { colIndex = colIndexXSoilgeometry2DOrigin; - locationRecord.XSoilgeometry2DOrigin = Convert.ToDouble(csv[colIndexXSoilgeometry2DOrigin]); + locationRecord.XSoilGeometry2DOrigin = Convert.ToDouble(csv[colIndexXSoilgeometry2DOrigin]); } if (colIndexPolderlevel > -1) { colIndex = colIndexPolderlevel; - locationRecord.Polderlevel = Convert.ToDouble(csv[colIndexPolderlevel]); + locationRecord.PolderLevel = Convert.ToDouble(csv[colIndexPolderlevel]); } if (colIndexHeadPl2 > -1) { @@ -261,12 +260,12 @@ if (colIndexOphoogmateriaaldijk > -1) { colIndex = colIndexOphoogmateriaaldijk; - locationRecord.Ophoogmateriaaldijk = csv[colIndexOphoogmateriaaldijk]; + locationRecord.DikeEmbankmentMaterial = csv[colIndexOphoogmateriaaldijk]; } if (colIndexOphoogmateriaalberm > -1) { colIndex = colIndexOphoogmateriaalberm; - locationRecord.Ophoogmateriaalberm = csv[colIndexOphoogmateriaalberm]; + locationRecord.ShoulderEmbankmentMaterial = csv[colIndexOphoogmateriaalberm]; } if (colIndexPenetrationLength > -1) { @@ -291,12 +290,12 @@ if (colIndexDempingsfactorPl3 > -1) { colIndex = colIndexDempingsfactorPl3; - locationRecord.DempingsfactorPl3 = Convert.ToDouble(csv[colIndexDempingsfactorPl3]); + locationRecord.DampingFactorPl3 = Convert.ToDouble(csv[colIndexDempingsfactorPl3]); } if (colIndexDempingsfactorPl4 > -1) { colIndex = colIndexDempingsfactorPl4; - locationRecord.DempingsfactorPl4 = Convert.ToDouble(csv[colIndexDempingsfactorPl4]); + locationRecord.DampingFactorPl4 = Convert.ToDouble(csv[colIndexDempingsfactorPl4]); } if (colIndexPLLineCreationMethod > -1) { @@ -306,17 +305,17 @@ if (colIndexSafetyFactorPiping > -1) { colIndex = colIndexSafetyFactorPiping; - locationRecord.SafetyFactorPiping = Convert.ToDouble(csv[colIndexSafetyFactorPiping]); + locationRecord.RequiredSafetyFactorPiping = Convert.ToDouble(csv[colIndexSafetyFactorPiping]); } if (colIndexSafetyFactorStabilityInnerSlope > -1) { colIndex = colIndexSafetyFactorStabilityInnerSlope; - locationRecord.SafetyFactorStabilityInnerSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityInnerSlope]); + locationRecord.RequiredSafetyFactorStabilityInnerSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityInnerSlope]); } if (colIndexSafetyFactorStabilityOuterSlope > -1) { colIndex = colIndexSafetyFactorStabilityOuterSlope; - locationRecord.SafetyFactorStabilityOuterSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityOuterSlope]); + locationRecord.RequiredSafetyFactorStabilityOuterSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityOuterSlope]); } if (colIndexUpliftCriterionPiping > -1) { @@ -336,22 +335,22 @@ if (colIndexPLLineOffsetBelowDikeTopAtRiver > -1) { colIndex = colIndexPLLineOffsetBelowDikeTopAtRiver; - locationRecord.PLLineOffsetBelowDikeTopAtRiver = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeTopAtRiver]); + locationRecord.PlLineOffsetBelowDikeTopAtRiver = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeTopAtRiver]); } if (colIndexPLLineOffsetBelowDikeTopAtPolder > -1) { colIndex = colIndexPLLineOffsetBelowDikeTopAtPolder; - locationRecord.PLLineOffsetBelowDikeTopAtPolder = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeTopAtPolder]); + locationRecord.PlLineOffsetBelowDikeTopAtPolder = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeTopAtPolder]); } if (colIndexPLLineOffsetBelowShoulderBaseInside > -1) { colIndex = colIndexPLLineOffsetBelowShoulderBaseInside; - locationRecord.PLLineOffsetBelowShoulderBaseInside = Convert.ToDouble(csv[colIndexPLLineOffsetBelowShoulderBaseInside]); + locationRecord.PlLineOffsetBelowShoulderBaseInside = Convert.ToDouble(csv[colIndexPLLineOffsetBelowShoulderBaseInside]); } if (colIndexPLLineOffsetBelowDikeToeAtPolder > -1) { colIndex = colIndexPLLineOffsetBelowDikeToeAtPolder; - locationRecord.PLLineOffsetBelowDikeToeAtPolder = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeToeAtPolder]); + locationRecord.PlLineOffsetBelowDikeToeAtPolder = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeToeAtPolder]); } if (colIndexPlLineOffsetBelowDikeCrestMiddle > -1) { Index: DamClients/DamUI/trunk/src/Dam/Tests/TestHelper/FactoryForStabilityTests.cs =================================================================== diff -u -r2168 -r2529 --- DamClients/DamUI/trunk/src/Dam/Tests/TestHelper/FactoryForStabilityTests.cs (.../FactoryForStabilityTests.cs) (revision 2168) +++ DamClients/DamUI/trunk/src/Dam/Tests/TestHelper/FactoryForStabilityTests.cs (.../FactoryForStabilityTests.cs) (revision 2529) @@ -79,8 +79,6 @@ coordinateSystemConverter.ConvertGlobalXYZToLocalXZ(localSurfaceLine.Geometry); location.LocalXZSurfaceLine2 = localSurfaceLine; - location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope = 1; - return location; }