Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs =================================================================== diff -u -rf28e5c177128224ea84257a3f29677f38b51f33f -r0e8c9f3912451d121375b590426837a3e6683dc5 --- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs (.../StructuresImporter.cs) (revision f28e5c177128224ea84257a3f29677f38b51f33f) +++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs (.../StructuresImporter.cs) (revision 0e8c9f3912451d121375b590426837a3e6683dc5) @@ -52,6 +52,7 @@ { private readonly ReferenceLine referenceLine; private readonly IImporterMessageProvider messageProvider; + private readonly IStructureUpdateStrategy structureUpdateStrategy; private IEnumerable updatedInstances; /// @@ -85,6 +86,7 @@ this.referenceLine = referenceLine; this.messageProvider = messageProvider; + this.structureUpdateStrategy = structureUpdateStrategy; } protected override bool OnImport() @@ -137,17 +139,6 @@ base.DoPostImportUpdates(); } - /// - /// Create structure objects from location and geometry data and use this to update the current data model. - /// - /// The read structure locations. - /// The read structure parameters, grouped by location identifier. - /// Collection of all objects that were changed due to the update. - /// Thrown when the validation of the structure fails. - /// Thrown when updating the structures failed. - protected abstract IEnumerable UpdateWithCreatedStructures(ICollection structureLocations, - Dictionary> groupedStructureParameterRows); - protected RoundedDouble GetStandardDeviation(StructuresParameterRow structuresParameterRow, string structureName) { if (structuresParameterRow.VarianceType == VarianceType.CoefficientOfVariation) @@ -198,6 +189,9 @@ } } + protected abstract IEnumerable CreateStructures(IEnumerable structureLocations, + IDictionary> groupedStructureParameterRows); + private string GetStructureDataCsvFilePath() { return Path.ChangeExtension(FilePath, ".csv"); @@ -372,5 +366,21 @@ { return Math2D.ConvertLinePointsToLineSegments(linePoints); } + + /// + /// Updates the import target with the imported structures. + /// + /// The read structure locations. + /// The read structure properties. + /// An with affected items. + /// Thrown when applying the strategy failed. + private IEnumerable UpdateWithCreatedStructures(IEnumerable structureLocations, + IDictionary> groupedStructureParameterRows) + { + return structureUpdateStrategy.UpdateStructuresWithImportedData(ImportTarget, + CreateStructures(structureLocations.ToList(), + groupedStructureParameterRows), + FilePath); + } } } \ No newline at end of file