Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Importers/StabilityPointStructuresImporter.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Importers/StabilityPointStructuresImporter.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Importers/StabilityPointStructuresImporter.cs (revision 5bbbdab924d1cc6c4959ac892903120acdbc82fb)
@@ -0,0 +1,214 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Common.IO.Structures;
+using Ringtoets.StabilityPointStructures.Data;
+
+namespace Ringtoets.StabilityPointStructures.IO.Importers
+{
+ ///
+ /// Imports point shapefiles containing stability point structure locations and csv files containing stability point structure schematizations.
+ ///
+ public class StabilityPointStructuresImporter : StructuresImporter>
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The point structure structures to import on.
+ /// The reference line used to check if the
+ /// objects found in the file are intersecting it.
+ /// The path to the file to import from.
+ /// Thrown when ,
+ /// , or is null.
+ public StabilityPointStructuresImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath)
+ : base(importTarget, referenceLine, filePath) {}
+
+ protected override void CreateSpecificStructures(ICollection structureLocations,
+ Dictionary> groupedStructureParameterRows)
+ {
+ IEnumerable importedStabilityPointStructures = CreateStabilityPointStructures(structureLocations.ToList(), groupedStructureParameterRows);
+
+ foreach (StabilityPointStructure stabilityPointStructure in importedStabilityPointStructures)
+ {
+ ImportTarget.Add(stabilityPointStructure);
+ }
+ }
+
+ private IEnumerable CreateStabilityPointStructures(IList structureLocations,
+ Dictionary> groupedStructureParameterRows)
+ {
+ var stabilityPointStructures = new List();
+ foreach (StructureLocation structureLocation in structureLocations)
+ {
+ string id = structureLocation.Id;
+
+ List structureParameterRows = groupedStructureParameterRows.ContainsKey(id)
+ ? groupedStructureParameterRows[id]
+ : new List();
+
+ ValidationResult parameterRowsValidationResult = StructuresParameterRowsValidator.ValidateStabilityPointStructuresParameters(structureParameterRows);
+ if (!parameterRowsValidationResult.IsValid)
+ {
+ LogValidationErrorForStructure(structureLocation.Name, structureLocation.Id, parameterRowsValidationResult.ErrorMessages);
+ continue;
+ }
+
+ StabilityPointStructure stabilityPointStructure = CreateStabilityPointStructure(structureLocation, structureParameterRows);
+ stabilityPointStructures.Add(stabilityPointStructure);
+ }
+ return stabilityPointStructures;
+ }
+
+ private StabilityPointStructure CreateStabilityPointStructure(StructureLocation structureLocation, List structureParameterRows)
+ {
+ Dictionary rowData = structureParameterRows.ToDictionary(row => row.ParameterId, row => row, StringComparer.OrdinalIgnoreCase);
+
+ string structureName = structureLocation.Name;
+ return new StabilityPointStructure(
+ new StabilityPointStructure.ConstructionProperties
+ {
+ Name = structureName, Id = structureLocation.Id, Location = structureLocation.Point,
+ StructureNormalOrientation = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword1].NumericalValue,
+ StorageStructureArea =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword2].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword2], structureName)
+ },
+ AllowedLevelIncreaseStorage =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword3].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword3], structureName)
+ },
+ WidthFlowApertures =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword4].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword4], structureName)
+ },
+ InsideWaterLevel =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword5].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword5], structureName)
+ },
+ ThresholdHeightOpenWeir =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword6].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword6], structureName)
+ },
+ CriticalOvertoppingDischarge =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword7].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword7], structureName)
+ },
+ FlowWidthAtBottomProtection =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword8].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword8], structureName)
+ },
+ ConstructiveStrengthLinearLoadModel =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword9].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword9], structureName)
+ },
+ ConstructiveStrengthQuadraticLoadModel =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword10].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword10], structureName)
+ },
+ BankWidth =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword11].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword11], structureName)
+ },
+ InsideWaterLevelFailureConstruction =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword12].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword12], structureName)
+ },
+ EvaluationLevel = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword13].NumericalValue,
+ LevelCrestStructure =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword14].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword14], structureName)
+ },
+ VerticalDistance = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword15].NumericalValue,
+ FailureProbabilityRepairClosure = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword16].NumericalValue,
+ FailureCollisionEnergy =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword17].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword17], structureName)
+ },
+ ShipMass =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword18].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword18], structureName)
+ },
+ ShipVelocity =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword19].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword19], structureName)
+ },
+ LevellingCount = (int) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword20].NumericalValue,
+ ProbabilityCollisionSecondaryStructure = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword21].NumericalValue,
+ FlowVelocityStructureClosable =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword22].NumericalValue,
+ },
+ StabilityLinearLoadModel =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword23].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword23], structureName)
+ },
+ StabilityQuadraticLoadModel =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword24].NumericalValue,
+ CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword24], structureName)
+ },
+ AreaFlowApertures =
+ {
+ Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword25].NumericalValue,
+ StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword25], structureName)
+ },
+ InflowModelType = GetStabilityPointStructureInflowModelType(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword26])
+ });
+ }
+
+ private static StabilityPointStructureInflowModelType GetStabilityPointStructureInflowModelType(StructuresParameterRow structureParameterRow)
+ {
+ string keywordValue = structureParameterRow.AlphanumericValue.ToLower();
+ switch (keywordValue)
+ {
+ case StructureFilesKeywords.InflowModelTypeLowSill:
+ return StabilityPointStructureInflowModelType.LowSill;
+ case StructureFilesKeywords.InflowModelTypeFloodedCulvert:
+ return StabilityPointStructureInflowModelType.FloodedCulvert;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -r5bbbdab924d1cc6c4959ac892903120acdbc82fb
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj (.../Ringtoets.StabilityPointStructures.IO.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj (.../Ringtoets.StabilityPointStructures.IO.csproj) (revision 5bbbdab924d1cc6c4959ac892903120acdbc82fb)
@@ -44,7 +44,7 @@
Properties\GlobalAssembly.cs
-
+
@@ -74,6 +74,7 @@
False
+