// Copyright (C) Stichting Deltares 2023. All rights reserved. // // This file is part of the application DAM - UI. // // DAM - UI 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.Globalization; using System.IO; using System.Linq; using System.Threading; using Deltares.Dam.Data.Importers; using Deltares.Standard.IO; using Deltares.Standard.Language; using LumenWorks.Framework.IO.Csv; namespace Deltares.Dam.Data.CsvImporters; public class CsvImporterLocations { public CsvImporterLocations(string fileName) { ErrorMessages.Clear(); ThrowHelper.ThrowIfStringArgumentNullOrEmpty(fileName, StringResourceNames.CsvFileNotValid); ThrowHelper.ThrowIfFileNotExist(fileName, StringResourceNames.CsvFileNotFound); CultureInfo oldcur = Thread.CurrentThread.CurrentCulture; try { Thread.CurrentThread.CurrentCulture = CsvReaderUtilities.DetermineCultureForFile(fileName); using (var csv = new CsvReader(new StreamReader(fileName), true, ';')) { string[] headers = CsvImporterHelper.GetFieldHeaders(this, csv); if (headers.Count() < 3) { string csvHeaderError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderError"); throw new CsvImporterSegmentsException($"{fileName} : {csvHeaderError}"); } int colIndexLocationId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.LocationColumnName); int colIndexSurfacelineId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SurfaceLineColumnName); int colIndexSegmentId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SegmentColumnName); int colIndexDikeRingId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DikeRingColumnName); int colIndexGeoX = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.XValueColumnName); int colIndexGeoY = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.YValueColumnName); int colIndexXSoilgeometry2DOrigin = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.XSoilGeometry2DOriginColumnName); int colIndexPolderlevel = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PolderLevelColumnName); int colIndexHeadPl2 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl2ColumnName); int colIndexHeadPl3 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl3ColumnName); int colIndexHeadPl4 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl4ColumnName); int colIndexOphoogmateriaaldijk = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DikeEmbankmentMaterialColumnName); int colIndexOphoogmateriaalberm = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ShoulderEmbankmentMaterialColumnName); int colIndexPenetrationLength = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PenetrationLengthColumnName); int colIndexTrafficLoad = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.TrafficLoadColumnName); int colIndexTL_DegreeOfConsolidation = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.TlDegreeOfConsolidationColumnName); int colIndexMinimalCircleDepth = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.MinimalCircleDepthColumnName); int colIndexDempingsfactorPl3 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DampingFactorPl3ColumnName); int colIndexDempingsfactorPl4 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DampingFactorPl4ColumnName); int colIndexPLLineCreationMethod = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineCreationMethodColumnName); int colIndexSafetyFactorPiping = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RequiredSafetyFactorPipingColumnName); int colIndexSafetyFactorStabilityInnerSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RequiredSafetyFactorStabilityInnerSlopeColumnName); int colIndexSafetyFactorStabilityOuterSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RequiredSafetyFactorStabilityOuterSlopeColumnName); int colIndexUpliftCriterionPiping = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UpliftCriterionPipingColumnName); int colIndexUpliftCriterionStability = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UpliftCriterionStabilityColumnName); int colIndexDistanceToEntryPoint = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DistanceToEntryPointColumnName); int colIndexPLLineOffsetBelowDikeTopAtRiver = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeTopAtRiverColumnName); int colIndexPLLineOffsetBelowDikeTopAtPolder = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeTopAtPolderColumnName); int colIndexPLLineOffsetBelowShoulderBaseInside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowShoulderBaseInsideColumnName); int colIndexPLLineOffsetBelowDikeToeAtPolder = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeToeAtPolderColumnName); int colIndexPlLineOffsetBelowDikeCrestMiddle = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeCrestMiddleColumnName); int colIndexPlLineOffsetFactorBelowShoulderCrest = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetFactorBelowShoulderCrestColumnName); int colIndexUsePlLineOffsetBelowDikeCrestMiddle = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UsePlLineOffsetBelowDikeCrestMiddleColumnName); int colIndexUsePlLineOffsetFactorBelowShoulderCrest = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UsePlLineOffsetFactorBelowShoulderCrestColumnName); int colIndexIntrusionVerticalWaterPressure = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.IntrusionVerticalWaterPressureColumnName); int colIndexStabilityShoulderGrowSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.StabilityShoulderGrowSlopeColumnName); int colIndexStabilityShoulderGrowDeltaX = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.StabilityShoulderGrowDeltaXColumnName); int colIndexStabilitySlopeAdaptionDeltaX = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.StabilitySlopeAdaptionDeltaXColumnName); int colIndexSlopeDampingPiezometricHeightPolderSide = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SlopeDampingPiezometricHeightPolderSideColumnName); int colIndexStabilityDesignMethod = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.StabilityDesignMethodColumnName); int colIndexStabilityZoneType = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ZoneTypeColumnName); int colIndexForbiddenZoneFactor = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ForbiddenZoneFactorColumnName); int colIndexSlopeAdaptionStartCotangent = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SlopeAdaptionStartCotangentColumnName); int colIndexSlopeAdaptionEndCotangent = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SlopeAdaptionEndCotangentColumnName); int colIndexSlopeAdaptionStepCotangent = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SlopeAdaptionStepCotangentColumnName); int colIndexNewDikeTopWidth = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewDikeTopWidthColumnName); int colIndexUseNewDikeTopWidth = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewDikeTopWidthColumnName); int colIndexNewDikeSlopeInside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewDikeSlopeInsideColumnName); int colIndexUseNewDikeSlopeInside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewDikeSlopeInsideColumnName); int colIndexNewDikeSlopeOutside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewDikeSlopeOutsideColumnName); int colIndexUseNewDikeSlopeOutside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewDikeSlopeOutsideColumnName); int colIndexNewShoulderTopSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewShoulderTopSlopeColumnName); int colIndexUseNewShoulderTopSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewShoulderTopSlopeColumnName); int colIndexNewShoulderBaseSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewShoulderBaseSlopeColumnName); int colIndexUseNewShoulderBaseSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewShoulderBaseSlopeColumnName); int colIndexNewMaxHeightShoulderAsFraction = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewMaxHeightShoulderAsFractionColumnName); int colIndexUseNewMaxHeightShoulderAsFraction = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewMaxHeightShoulderAsFractionColumnName); int colIndexNewMinDistanceDikeToeStartDitch = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewMinDistanceDikeToeStartDitchColumnName); int colIndexUseNewMinDistanceDikeToeStartDitch = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewMinDistanceDikeToeStartDitchColumnName); int colIndexUseNewDitchDefinition = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewDitchDefinitionColumnName); int colIndexNewWidthDitchBottom = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewWidthDitchBottomColumnName); int colIndexNewSlopeAngleDitch = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewSlopeAngleDitchColumnName); int colIndexNewDepthDitch = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewDepthDitchColumnName); int colIndexDikeTableHeight = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DikeTableHeightColumnName); int colIndexRiverLevel = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RiverLevelColumnName); int colIndexRiverLevelLow = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RiverLevelLowColumnName); var index = 1; while (csv.ReadNextRecord()) { var locationRecord = new LocationRecord(); int colIndex = -1; // Keep track of column for error message try { locationRecord.LocationRecordId = index++; /* * Required columns */ locationRecord.LocationId = csv[colIndexLocationId]; locationRecord.SurfaceLineId = csv[colIndexSurfacelineId]; locationRecord.SegmentId = csv[colIndexSegmentId]; /* * Optional columns */ if (colIndexDikeRingId > -1) { colIndex = colIndexDikeRingId; locationRecord.DikeRingId = csv[colIndexDikeRingId]; } if (colIndexGeoX > -1) { colIndex = colIndexGeoX; locationRecord.GeoX = Convert.ToDouble(csv[colIndexGeoX]); } if (colIndexGeoY > -1) { colIndex = colIndexGeoY; locationRecord.GeoY = Convert.ToDouble(csv[colIndexGeoY]); } if (colIndexXSoilgeometry2DOrigin > -1) { colIndex = colIndexXSoilgeometry2DOrigin; locationRecord.XSoilGeometry2DOrigin = Convert.ToDouble(csv[colIndexXSoilgeometry2DOrigin]); } if (colIndexPolderlevel > -1) { colIndex = colIndexPolderlevel; locationRecord.PolderLevel = Convert.ToDouble(csv[colIndexPolderlevel]); } if (colIndexHeadPl2 > -1) { colIndex = colIndexHeadPl2; locationRecord.HeadPl2 = Convert.ToDouble(csv[colIndexHeadPl2]); } if (colIndexHeadPl3 > -1) { colIndex = colIndexHeadPl3; locationRecord.HeadPl3 = Convert.ToDouble(csv[colIndexHeadPl3]); } if (colIndexHeadPl4 > -1) { colIndex = colIndexHeadPl4; locationRecord.HeadPl4 = Convert.ToDouble(csv[colIndexHeadPl4]); } if (colIndexOphoogmateriaaldijk > -1) { colIndex = colIndexOphoogmateriaaldijk; locationRecord.DikeEmbankmentMaterial = csv[colIndexOphoogmateriaaldijk]; } if (colIndexOphoogmateriaalberm > -1) { colIndex = colIndexOphoogmateriaalberm; locationRecord.ShoulderEmbankmentMaterial = csv[colIndexOphoogmateriaalberm]; } if (colIndexPenetrationLength > -1) { colIndex = colIndexPenetrationLength; locationRecord.PenetrationLength = Convert.ToDouble(csv[colIndexPenetrationLength]); } if (colIndexTrafficLoad > -1) { colIndex = colIndexTrafficLoad; locationRecord.TrafficLoad = Convert.ToDouble(csv[colIndexTrafficLoad]); } if (colIndexTL_DegreeOfConsolidation > -1) { colIndex = colIndexTL_DegreeOfConsolidation; locationRecord.TL_DegreeOfConsolidation = Convert.ToDouble(csv[colIndexTL_DegreeOfConsolidation]); } if (colIndexMinimalCircleDepth > -1) { colIndex = colIndexMinimalCircleDepth; locationRecord.MinimalCircleDepth = Convert.ToDouble(csv[colIndexMinimalCircleDepth]); } if (colIndexDempingsfactorPl3 > -1) { colIndex = colIndexDempingsfactorPl3; locationRecord.DampingFactorPl3 = Convert.ToDouble(csv[colIndexDempingsfactorPl3]); } if (colIndexDempingsfactorPl4 > -1) { colIndex = colIndexDempingsfactorPl4; locationRecord.DampingFactorPl4 = Convert.ToDouble(csv[colIndexDempingsfactorPl4]); } if (colIndexPLLineCreationMethod > -1) { colIndex = colIndexPLLineCreationMethod; locationRecord.PLLineCreationMethod = LocationImportHelper.ToPLLineCreationMethod(csv[colIndexPLLineCreationMethod]); } if (colIndexSafetyFactorPiping > -1) { colIndex = colIndexSafetyFactorPiping; locationRecord.RequiredSafetyFactorPiping = Convert.ToDouble(csv[colIndexSafetyFactorPiping]); } if (colIndexSafetyFactorStabilityInnerSlope > -1) { colIndex = colIndexSafetyFactorStabilityInnerSlope; locationRecord.RequiredSafetyFactorStabilityInnerSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityInnerSlope]); } if (colIndexSafetyFactorStabilityOuterSlope > -1) { colIndex = colIndexSafetyFactorStabilityOuterSlope; locationRecord.RequiredSafetyFactorStabilityOuterSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityOuterSlope]); } if (colIndexUpliftCriterionPiping > -1) { colIndex = colIndexUpliftCriterionPiping; locationRecord.UpliftCriterionPiping = Convert.ToDouble(csv[colIndexUpliftCriterionPiping]); } if (colIndexUpliftCriterionStability > -1) { colIndex = colIndexUpliftCriterionStability; locationRecord.UpliftCriterionStability = Convert.ToDouble(csv[colIndexUpliftCriterionStability]); } if (colIndexDistanceToEntryPoint > -1) { colIndex = colIndexDistanceToEntryPoint; locationRecord.DistanceToEntryPoint = Convert.ToDouble(csv[colIndexDistanceToEntryPoint]); } if (colIndexPLLineOffsetBelowDikeTopAtRiver > -1) { colIndex = colIndexPLLineOffsetBelowDikeTopAtRiver; locationRecord.PlLineOffsetBelowDikeTopAtRiver = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeTopAtRiver]); } if (colIndexPLLineOffsetBelowDikeTopAtPolder > -1) { colIndex = colIndexPLLineOffsetBelowDikeTopAtPolder; locationRecord.PlLineOffsetBelowDikeTopAtPolder = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeTopAtPolder]); } if (colIndexPLLineOffsetBelowShoulderBaseInside > -1) { colIndex = colIndexPLLineOffsetBelowShoulderBaseInside; locationRecord.PlLineOffsetBelowShoulderBaseInside = Convert.ToDouble(csv[colIndexPLLineOffsetBelowShoulderBaseInside]); } if (colIndexPLLineOffsetBelowDikeToeAtPolder > -1) { colIndex = colIndexPLLineOffsetBelowDikeToeAtPolder; locationRecord.PlLineOffsetBelowDikeToeAtPolder = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeToeAtPolder]); } if (colIndexPlLineOffsetBelowDikeCrestMiddle > -1) { colIndex = colIndexPlLineOffsetBelowDikeCrestMiddle; locationRecord.PlLineOffsetBelowDikeCrestMiddle = Convert.ToDouble(csv[colIndex]); } if (colIndexPlLineOffsetFactorBelowShoulderCrest > -1) { colIndex = colIndexPlLineOffsetFactorBelowShoulderCrest; locationRecord.PlLineOffsetFactorBelowShoulderCrest = Convert.ToDouble(csv[colIndex]); } if (colIndexUsePlLineOffsetBelowDikeCrestMiddle > -1) { colIndex = colIndexUsePlLineOffsetBelowDikeCrestMiddle; locationRecord.UsePlLineOffsetBelowDikeCrestMiddle = Convert.ToBoolean(csv[colIndex]); } if (colIndexUsePlLineOffsetFactorBelowShoulderCrest > -1) { colIndex = colIndexUsePlLineOffsetFactorBelowShoulderCrest; locationRecord.UsePlLineOffsetFactorBelowShoulderCrest = Convert.ToBoolean(csv[colIndex]); } if (colIndexIntrusionVerticalWaterPressure > -1) { colIndex = colIndexIntrusionVerticalWaterPressure; locationRecord.IntrusionVerticalWaterPressure = LocationImportHelper.ToIntrusionVerticalWaterPressure(csv[colIndex]); } if (colIndexStabilityShoulderGrowSlope > -1) { colIndex = colIndexStabilityShoulderGrowSlope; locationRecord.StabilityShoulderGrowSlope = Convert.ToDouble(csv[colIndexStabilityShoulderGrowSlope]); } if (colIndexStabilityShoulderGrowDeltaX > -1) { colIndex = colIndexStabilityShoulderGrowDeltaX; locationRecord.StabilityShoulderGrowDeltaX = Convert.ToDouble(csv[colIndexStabilityShoulderGrowDeltaX]); } if (colIndexStabilitySlopeAdaptionDeltaX > -1) { colIndex = colIndexStabilitySlopeAdaptionDeltaX; locationRecord.StabilitySlopeAdaptionDeltaX = Convert.ToDouble(csv[colIndexStabilitySlopeAdaptionDeltaX]); } if (colIndexStabilityDesignMethod > -1) { colIndex = colIndexStabilityDesignMethod; locationRecord.StabilityDesignMethod = LocationImportHelper.ToStabilityDesignMethod(csv[colIndexStabilityDesignMethod]); } if (colIndexStabilityZoneType > -1) { colIndex = colIndexStabilityZoneType; locationRecord.StabilityZoneType = LocationImportHelper.ToMStabZonesTypeMethod(csv[colIndexStabilityZoneType]); } if (colIndexForbiddenZoneFactor > -1) { colIndex = colIndexForbiddenZoneFactor; locationRecord.ForbiddenZoneFactor = Convert.ToDouble(csv[colIndexForbiddenZoneFactor]); } if (colIndexSlopeAdaptionStartCotangent > -1) { colIndex = colIndexSlopeAdaptionStartCotangent; locationRecord.SlopeAdaptionStartCotangent = Convert.ToDouble(csv[colIndexSlopeAdaptionStartCotangent]); } if (colIndexSlopeAdaptionEndCotangent > -1) { colIndex = colIndexSlopeAdaptionEndCotangent; locationRecord.SlopeAdaptionEndCotangent = Convert.ToDouble(csv[colIndexSlopeAdaptionEndCotangent]); } if (colIndexSlopeAdaptionStepCotangent > -1) { colIndex = colIndexSlopeAdaptionStepCotangent; locationRecord.SlopeAdaptionStepCotangent = Convert.ToDouble(csv[colIndexSlopeAdaptionStepCotangent]); } if (colIndexSlopeDampingPiezometricHeightPolderSide > -1) { colIndex = colIndexSlopeDampingPiezometricHeightPolderSide; locationRecord.SlopeDampingPiezometricHeightPolderSide = Convert.ToDouble(csv[colIndexSlopeDampingPiezometricHeightPolderSide]); } if (colIndexNewDikeTopWidth > -1) { colIndex = colIndexNewDikeTopWidth; locationRecord.NewDikeTopWidth = Convert.ToDouble(csv[colIndexNewDikeTopWidth]); } if (colIndexNewDikeSlopeInside > -1) { colIndex = colIndexNewDikeSlopeInside; locationRecord.NewDikeSlopeInside = Convert.ToDouble(csv[colIndexNewDikeSlopeInside]); } if (colIndexNewDikeSlopeOutside > -1) { colIndex = colIndexNewDikeSlopeOutside; locationRecord.NewDikeSlopeOutside = Convert.ToDouble(csv[colIndexNewDikeSlopeOutside]); } if (colIndexNewShoulderTopSlope > -1) { colIndex = colIndexNewShoulderTopSlope; locationRecord.NewShoulderTopSlope = Convert.ToDouble(csv[colIndexNewShoulderTopSlope]); } if (colIndexNewShoulderBaseSlope > -1) { colIndex = colIndexNewShoulderBaseSlope; locationRecord.NewShoulderBaseSlope = Convert.ToDouble(csv[colIndexNewShoulderBaseSlope]); } if (colIndexNewMaxHeightShoulderAsFraction > -1) { colIndex = colIndexNewMaxHeightShoulderAsFraction; locationRecord.NewMaxHeightShoulderAsFraction = Convert.ToDouble(csv[colIndexNewMaxHeightShoulderAsFraction]); } if (colIndexNewMinDistanceDikeToeStartDitch > -1) { colIndex = colIndexNewMinDistanceDikeToeStartDitch; locationRecord.NewMinDistanceDikeToeStartDitch = Convert.ToDouble(csv[colIndexNewMinDistanceDikeToeStartDitch]); } if (colIndexNewWidthDitchBottom > -1) { colIndex = colIndexNewWidthDitchBottom; locationRecord.NewWidthDitchBottom = Convert.ToDouble(csv[colIndexNewWidthDitchBottom]); } if (colIndexNewSlopeAngleDitch > -1) { colIndex = colIndexNewSlopeAngleDitch; locationRecord.NewSlopeAngleDitch = Convert.ToDouble(csv[colIndexNewSlopeAngleDitch]); } if (colIndexNewDepthDitch > -1) { colIndex = colIndexNewDepthDitch; locationRecord.NewDepthDitch = Convert.ToDouble(csv[colIndexNewDepthDitch]); } if (colIndexUseNewDikeTopWidth > -1) { colIndex = colIndexUseNewDikeTopWidth; locationRecord.UseNewDikeTopWidth = Convert.ToBoolean(csv[colIndexUseNewDikeTopWidth]); } if (colIndexUseNewDikeSlopeInside > -1) { colIndex = colIndexUseNewDikeSlopeInside; locationRecord.UseNewDikeSlopeInside = Convert.ToBoolean(csv[colIndexUseNewDikeSlopeInside]); } if (colIndexUseNewDikeSlopeOutside > -1) { colIndex = colIndexUseNewDikeSlopeOutside; locationRecord.UseNewDikeSlopeOutside = Convert.ToBoolean(csv[colIndexUseNewDikeSlopeOutside]); } if (colIndexUseNewShoulderTopSlope > -1) { colIndex = colIndexUseNewShoulderTopSlope; locationRecord.UseNewShoulderTopSlope = Convert.ToBoolean(csv[colIndexUseNewShoulderTopSlope]); } if (colIndexUseNewShoulderBaseSlope > -1) { colIndex = colIndexUseNewShoulderBaseSlope; locationRecord.UseNewShoulderBaseSlope = Convert.ToBoolean(csv[colIndexUseNewShoulderBaseSlope]); } if (colIndexUseNewMaxHeightShoulderAsFraction > -1) { colIndex = colIndexUseNewMaxHeightShoulderAsFraction; locationRecord.UseNewMaxHeightShoulderAsFraction = Convert.ToBoolean(csv[colIndexUseNewMaxHeightShoulderAsFraction]); } if (colIndexUseNewMinDistanceDikeToeStartDitch > -1) { colIndex = colIndexUseNewMinDistanceDikeToeStartDitch; locationRecord.UseNewMinDistanceDikeToeStartDitch = Convert.ToBoolean(csv[colIndexUseNewMinDistanceDikeToeStartDitch]); } if (colIndexUseNewDitchDefinition > -1) { colIndex = colIndexUseNewDitchDefinition; locationRecord.UseNewDitchDefinition = Convert.ToBoolean(csv[colIndexUseNewDitchDefinition]); } if (colIndexDikeTableHeight > -1) { colIndex = colIndexDikeTableHeight; locationRecord.DikeTableHeight = Convert.ToDouble(csv[colIndexDikeTableHeight]); } if (colIndexRiverLevel > -1) { colIndex = colIndexRiverLevel; locationRecord.RiverLevel = Convert.ToDouble(csv[colIndexRiverLevel]); } if (colIndexRiverLevelLow > -1) { colIndex = colIndexRiverLevelLow; locationRecord.RiverLevelLow = Convert.ToDouble(csv[colIndexRiverLevelLow]); } ImportedItems.Add(locationRecord); } catch (Exception e) { string csvLocationError = String.Format(LocalizationManager.GetTranslatedText(GetType(), "csvLocationError"), locationRecord.LocationId, colIndex + 1); ErrorMessages.Add(csvLocationError + e.Message); } } } } finally { Thread.CurrentThread.CurrentCulture = oldcur; } } public List ImportedItems { get; } = new List(); public List ErrorMessages { get; set; } = new List(); public class LocationRecord { public IntrusionVerticalWaterPressureType? IntrusionVerticalWaterPressure; public int LocationRecordId { get; set; } public string LocationId { get; set; } public string SurfaceLineId { get; set; } public string SegmentId { get; set; } public string DikeRingId { get; set; } public double? GeoX { get; set; } public double? GeoY { 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 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? DampingFactorPl3 { get; set; } public double? DampingFactorPl4 { get; set; } public PLLineCreationMethod? PLLineCreationMethod { 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? PlLineOffsetBelowDikeCrestMiddle { get; set; } public double? PlLineOffsetFactorBelowShoulderCrest { get; set; } public bool? UsePlLineOffsetBelowDikeCrestMiddle { get; set; } public bool? UsePlLineOffsetFactorBelowShoulderCrest { get; set; } public double? StabilityShoulderGrowSlope { get; set; } public double? StabilityShoulderGrowDeltaX { get; set; } public double? StabilitySlopeAdaptionDeltaX { get; set; } public double? SlopeDampingPiezometricHeightPolderSide { get; set; } public StabilityDesignMethod? StabilityDesignMethod { get; set; } public MStabZonesType? StabilityZoneType { get; set; } public double? ForbiddenZoneFactor { get; set; } public double? SlopeAdaptionStartCotangent { get; set; } public double? SlopeAdaptionEndCotangent { get; set; } public double? SlopeAdaptionStepCotangent { get; set; } public double? NewDikeTopWidth { get; set; } public bool? UseNewDikeTopWidth { get; set; } public double? NewDikeSlopeInside { get; set; } public bool? UseNewDikeSlopeInside { get; set; } public double? NewDikeSlopeOutside { get; set; } public bool? UseNewDikeSlopeOutside { get; set; } public double? NewShoulderTopSlope { get; set; } public bool? UseNewShoulderTopSlope { get; set; } public double? NewShoulderBaseSlope { get; set; } public bool? UseNewShoulderBaseSlope { get; set; } public double? NewMaxHeightShoulderAsFraction { get; set; } public bool? UseNewMaxHeightShoulderAsFraction { get; set; } public double? NewMinDistanceDikeToeStartDitch { get; set; } public bool? UseNewMinDistanceDikeToeStartDitch { get; set; } public bool? UseNewDitchDefinition { get; set; } public double? NewWidthDitchBottom { get; set; } public double? NewSlopeAngleDitch { get; set; } public double? NewDepthDitch { get; set; } public double? DikeTableHeight { get; set; } public double? RiverLevel { get; set; } public double? RiverLevelLow { get; set; } } }