Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/CsvImporters/CsvImporterSurfaceLines.cs =================================================================== diff -u --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/CsvImporters/CsvImporterSurfaceLines.cs (revision 0) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/CsvImporters/CsvImporterSurfaceLines.cs (revision 3102) @@ -0,0 +1,32 @@ +// Copyright (C) Stichting Deltares 2020. All rights reserved. +// +// This file is part of the LayerOnSlopeTool +// +// The LayerOnSlopeTool is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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 System.Text; +using System.Threading.Tasks; + +namespace Deltares.LayerOnSlopeTool.Data.CsvImporters +{ + public class CsvImporterSurfaceLines + { + } +} Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/Deltares.LayerOnSlopeTool.Data.csproj =================================================================== diff -u -r3089 -r3102 --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/Deltares.LayerOnSlopeTool.Data.csproj (.../Deltares.LayerOnSlopeTool.Data.csproj) (revision 3089) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/Deltares.LayerOnSlopeTool.Data.csproj (.../Deltares.LayerOnSlopeTool.Data.csproj) (revision 3102) @@ -44,14 +44,18 @@ + + + Copying.AGPL.licenseheader + \ No newline at end of file Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/SurfaceLine.cs =================================================================== diff -u -r3089 -r3102 --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/SurfaceLine.cs (.../SurfaceLine.cs) (revision 3089) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/SurfaceLine.cs (.../SurfaceLine.cs) (revision 3102) @@ -19,10 +19,49 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections.Generic; + namespace Deltares.LayerOnSlopeTool.Data { + /// + /// Defines the surface line + /// public class SurfaceLine { - + private readonly List surfaceLinePoints = new List(); + + /// + /// Gets the surface line points. + /// + /// + /// The surface line points. + /// + public List SurfaceLinePoints + { + get { return surfaceLinePoints; } + } + + /// + /// Gets the surface line point by location. + /// + /// The x. + /// The z. + /// + public SurfaceLinePoint GetSurfaceLinePointByLocation(double x, double z) + { + // Todo implement + return null; + } + + /// + /// Gets the type of the surface line point by. + /// + /// Type of the point. + /// + public SurfaceLinePoint GetSurfaceLinePointByType(CharacteristicPointType pointType) + { + // Todo implement + return null; + } } } \ No newline at end of file Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/CsvImporters/CsvImporterLocations.cs =================================================================== diff -u --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/CsvImporters/CsvImporterLocations.cs (revision 0) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/CsvImporters/CsvImporterLocations.cs (revision 3102) @@ -0,0 +1,544 @@ +// Copyright (C) Stichting Deltares 2020. All rights reserved. +// +// This file is part of the LayerOnSlopeTool +// +// The LayerOnSlopeTool is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.SqlServer.Server; + +namespace Deltares.LayerOnSlopeTool.Data.CsvImporters +{ + public class CsvImporterLocations + { + private List locationRecords = new List(); + private List errorMessages = new List(); + + /// + /// Record used for importing the items from the locations csv file. + /// + public class LocationRecord + { + /// + /// Gets or sets the location record identifier. + /// + /// + /// The location record identifier. + /// + public int LocationRecordId { get; set; } + + /// + /// Gets or sets the location identifier. + /// + /// + /// The location identifier. + /// + public string LocationId { get; set; } + + /// + /// Gets or sets the surface line identifier. + /// + /// + /// The surface line identifier. + /// + public string SurfaceLineId { get; set; } + + /// + /// Gets or sets the x soil geometry2 d origin. + /// This is the offset needed to combine with the surface line correctly when both do not line up. + /// + /// + /// The x soil geometry2 d origin. + /// + public double? XSoilGeometry2DOrigin { get; set; } + + /// + /// Gets or sets the dike embankment material. This is to be used as filling material for surface between the original 2D sti profile and the surface line. + /// + /// + /// The dike embankment material. + /// + public string DikeEmbankmentMaterial { get; set; } + + public string LayerMaterial { get; set; } + + public double LayerThickness { get; set; } + + + } + + public CsvImporterLocations(string fileName) + { + errorMessages.Clear(); + if (fileName == "") + { + throw new ArgumentException("De filenaam voor de locations csv is leeg."); + } + + if (!File.Exists(fileName)) + { + throw new ArgumentException(string.Format("De loacations csv file met naam {0} bestaat niet.", fileName)); + } + + + 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 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(); + // 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 (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]); + // } + // locationRecords.Add(locationRecord); + // } + // catch (Exception e) + // { + // var csvLocationError = String.Format("Tijdens het lezen van locatie { 0} in kolom { 1} uit de csv trad de volgende fout op: ", 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; } + } + } +} Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/SurfaceLinePoint.cs =================================================================== diff -u --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/SurfaceLinePoint.cs (revision 0) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Data/SurfaceLinePoint.cs (revision 3102) @@ -0,0 +1,120 @@ +// Copyright (C) Stichting Deltares 2020. All rights reserved. +// +// This file is part of the Dam Engine. +// +// The Dam Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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; + +namespace Deltares.LayerOnSlopeTool.Data +{ + + /// + /// Holds the possible point types. + /// + public enum CharacteristicPointType + { + None, + SurfaceLevelOutside = 1, // Maaiveld buitenwaarts + BottomRiverChannel = 2, // Bodem geul NODIG? + InsertRiverChannel = 3, // Insteek geul NODIG? + DikeToeAtRiver = 5, // Teen dijk buitenwaarts + ShoulderTopOutside = 6, // Kruin buitenberm + ShoulderBaseOutside = 7, // Insteek buitenberm + DikeTopAtRiver = 8, // Kruin buitentalud + DikeLine = 9, // referentielijn + TrafficLoadOutside = 10, // Verkeersbelasting kant buitenwaarts + TrafficLoadInside = 11, // Verkeersbelasting kant binnenwaarts + DikeTopAtPolder = 12, // Kruin binnentalud + ShoulderBaseInside = 13, // Insteek binnenberm + ShoulderTopInside = 14, // Kruin binnenberm + DikeToeAtPolder = 15, // Teen dijk binnenwaarts + DitchDikeSide = 16, // Insteek sloot dijkzijde + BottomDitchDikeSide = 17, // Slootbodem dijkzijde + BottomDitchPolderSide = 18, // Slootbodem polderzijde + DitchPolderSide = 19, // Insteek sloot polderzijde + SurfaceLevelInside = 25, // Maaiveld binnenwaarts + } + + /// + /// Defines the surface line point + /// + public class SurfaceLinePoint + { + /// + /// Gets or sets the x coordinate. + /// + /// + /// The x coordinate. + /// + public double XCoordinate { get; set; } + + /// + /// Gets or sets the z coordinate. + /// + /// + /// The z coordinate. + /// + public double ZCoordinate { get; set; } + + /// + /// Gets or sets the type of the point. + /// + /// + /// The type of the point. + /// + public CharacteristicPointType PointType { get; set; } + + /// + /// Determines whether the difference between the location of the given point and + /// this one are within the given precision. + /// + /// The other. + /// The precision. + /// + public bool LocationEquals(SurfaceLinePoint other, double precision = 0.001) + { + if (ReferenceEquals(other, null)) + { + return false; + } + if (ReferenceEquals(other, this)) + { + return true; + } + + return AlmostEquals(XCoordinate,other.XCoordinate, precision) && + AlmostEquals(ZCoordinate,other.ZCoordinate, precision); + } + + private bool AlmostEquals(double double1, double double2, double precision) + { + if (double.IsNaN(double1) && double.IsNaN(double2)) + { + return true; + } + + if (double.IsNaN(double1) || double.IsNaN(double2)) + { + return false; + } + + return (Math.Abs(double1 - double2) <= precision); + } + } +}