// Copyright (C) Stichting Deltares 2019. All rights reserved.
//
// This file is part of the application DAM - Clients Library.
//
// 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.IO;
using System.Linq;
using System.Threading;
using Deltares.Dam.Data.Importers;
using Deltares.Probabilistic;
using Deltares.Standard.IO;
using Deltares.Standard.Language;
using LumenWorks.Framework.IO.Csv;
namespace Deltares.Dam.Data.CsvImporters
{
public class CsvImporterLocations
{
private List locationRecords = new List();
private List errorMessages = new List();
public class LocationRecord
{
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 string Pl1Id { get; set; }
public double? Polderlevel { get; set; }
public double? HeadPl2 { get; set; }
public double? HeadPl3 { get; set; }
public double? HeadPl4 { get; set; }
public double? GrassQuality { get; set; }
public double? Direction { get; set; }
public string Ophoogmateriaaldijk { get; set; }
public string Ophoogmateriaalberm { get; set; }
public bool? UseOriginalPllineAssignments { 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 PLLineCreationMethod? PLLineCreationMethod { get; set; }
public double? LevelReductionInside { get; set; }
public double? LevelReductionOutside { get; set; }
public DistributionType? LayerHeightDistribution { get; set; }
public double? LayerHeightDeviation { get; set; }
public double? SafetyFactorPiping { get; set; }
public double? SafetyFactorStabilityInnerSlope { get; set; }
public double? SafetyFactorStabilityOuterSlope { 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 IntrusionVerticalWaterPressureType? IntrusionVerticalWaterPressure;
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? ZoneAreaRestSlopeCrestWidth { 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? WaterHeight { get; set; }
public double? WaterHeightLow { get; set; }
}
public CsvImporterLocations(string fileName)
{
errorMessages.Clear();
ThrowHelper.ThrowIfStringArgumentNullOrEmpty(fileName, StringResourceNames.CsvFileNotValid);
ThrowHelper.ThrowIfFileNotExist(fileName, StringResourceNames.CsvFileNotFound);
var 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)
{
var csvHeaderError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderError");
throw new CsvImporterSegmentsException(String.Format("{0} : {1}", 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 colIndexPl1Id = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.Pl1ColumnName);
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 colIndexGrassQuality = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.GrassQualityColumnName);
int colIndexDirection = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DirectionColumnName);
int colIndexOphoogmateriaaldijk = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DikeEmbankmentMaterialColumnName);
int colIndexOphoogmateriaalberm = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ShoulderEmbankmentMaterialColumnName);
int colIndexUseOriginalPllineAssignments = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseOriginalPlLineAssignmentsColumnName);
int colIndexPenetrationLength = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PenetrationLengthColumnName);
int colIndexTrafficLoad = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.TrafficLoadColumnName);
int colIndexTL_DegreeOfConsolidation = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.TL_DegreeOfConsolidationColumnName);
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 colIndexLevelReductionInside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.LevelReductionInsideColumnName);
int colIndexLevelReductionOutside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.LevelReductionOutsideColumnName);
int colIndexLayerHeightDistribution = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.LayerHeightDistributionColumnName);
int colIndexLayerHeightDeviation = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.LayerHeightDeviationColumnName);
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 colIndexZoneAreaRestSlopeCrestWidth = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ZoneAreaRestSlopeCrestWidthColumnName);
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 colIndexWaterHeight = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.WaterHeightColumnName);
int colIndexWaterHeightLow = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.WaterHeightLowColumnName);
var index = 1;
while (csv.ReadNextRecord())
{
var locationRecord = new LocationRecord();
var 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 (colIndexPl1Id > -1)
{
colIndex = colIndexPl1Id;
locationRecord.Pl1Id = csv[colIndexPl1Id];
}
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 (colIndexGrassQuality > -1)
{
colIndex = colIndexGrassQuality;
locationRecord.GrassQuality = Convert.ToDouble(csv[colIndexGrassQuality]);
}
if (colIndexDirection > -1)
{
colIndex = colIndexDirection;
locationRecord.Direction = Convert.ToDouble(csv[colIndexDirection]);
}
if (colIndexOphoogmateriaaldijk > -1)
{
colIndex = colIndexOphoogmateriaaldijk;
locationRecord.Ophoogmateriaaldijk = csv[colIndexOphoogmateriaaldijk];
}
if (colIndexOphoogmateriaalberm > -1)
{
colIndex = colIndexOphoogmateriaalberm;
locationRecord.Ophoogmateriaalberm = csv[colIndexOphoogmateriaalberm];
}
if (colIndexUseOriginalPllineAssignments > -1)
{
colIndex = colIndexUseOriginalPllineAssignments;
locationRecord.UseOriginalPllineAssignments = Convert.ToBoolean(csv[colIndexUseOriginalPllineAssignments]);
}
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.DempingsfactorPl3 = Convert.ToDouble(csv[colIndexDempingsfactorPl3]);
}
if (colIndexDempingsfactorPl4 > -1)
{
colIndex = colIndexDempingsfactorPl4;
locationRecord.DempingsfactorPl4 = Convert.ToDouble(csv[colIndexDempingsfactorPl4]);
}
if (colIndexPLLineCreationMethod > -1)
{
colIndex = colIndexPLLineCreationMethod;
locationRecord.PLLineCreationMethod = LocationImportHelper.ToPLLineCreationMethod(csv[colIndexPLLineCreationMethod]);
}
if (colIndexLevelReductionInside > -1)
{
colIndex = colIndexLevelReductionInside;
locationRecord.LevelReductionInside = Convert.ToDouble(csv[colIndexLevelReductionInside]);
}
if (colIndexLevelReductionOutside > -1)
{
colIndex =colIndexLevelReductionOutside;
locationRecord.LevelReductionOutside = Convert.ToDouble(csv[colIndexLevelReductionOutside]);
}
if (colIndexLayerHeightDistribution > -1)
{
colIndex = colIndexLayerHeightDistribution;
locationRecord.LayerHeightDistribution = LocationImportHelper.ToDistribution(csv[colIndexLayerHeightDistribution]);
}
if (colIndexLayerHeightDeviation > -1)
{
colIndex = colIndexLayerHeightDeviation;
locationRecord.LayerHeightDeviation = Convert.ToDouble(csv[colIndexLayerHeightDeviation]);
}
if (colIndexSafetyFactorPiping > -1)
{
colIndex = colIndexSafetyFactorPiping;
locationRecord.SafetyFactorPiping = Convert.ToDouble(csv[colIndexSafetyFactorPiping]);
}
if (colIndexSafetyFactorStabilityInnerSlope > -1)
{
colIndex = colIndexSafetyFactorStabilityInnerSlope;
locationRecord.SafetyFactorStabilityInnerSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityInnerSlope]);
}
if (colIndexSafetyFactorStabilityOuterSlope > -1)
{
colIndex = colIndexSafetyFactorStabilityOuterSlope;
locationRecord.SafetyFactorStabilityOuterSlope = 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 (colIndexZoneAreaRestSlopeCrestWidth > -1)
{
colIndex = colIndexZoneAreaRestSlopeCrestWidth;
locationRecord.ZoneAreaRestSlopeCrestWidth = Convert.ToDouble(csv[colIndexZoneAreaRestSlopeCrestWidth]);
}
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 (colIndexWaterHeight > -1)
{
colIndex = colIndexWaterHeight;
locationRecord.WaterHeight = Convert.ToDouble(csv[colIndexWaterHeight]);
}
if (colIndexWaterHeightLow > -1)
{
colIndex = colIndexWaterHeightLow;
locationRecord.WaterHeightLow = Convert.ToDouble(csv[colIndexWaterHeightLow]);
}
locationRecords.Add(locationRecord);
}
catch (Exception e)
{
var csvLocationError = String.Format(LocalizationManager.GetTranslatedText(this.GetType(), "csvLocationError"), locationRecord.LocationId, colIndex + 1);
errorMessages.Add(csvLocationError + e.Message);
}
}
}
}
finally
{
Thread.CurrentThread.CurrentCulture = oldcur;
}
}
public List ImportedItems
{
get { return locationRecords; }
}
public List ErrorMessages
{
get { return errorMessages; }
set { errorMessages = value; }
}
}
}