// Copyright (C) Stichting Deltares 2018. 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 Deltares.Geotechnics.SurfaceLines; namespace Deltares.Dam.Data { public class CsvExportCharacteristicPoints { private readonly SurfaceLine2 surfaceLine; private readonly CsvExportSurfaceLineIdentifiers csvExportSurfaceLineIdentifiers; public CsvExportCharacteristicPoints(CsvExportSurfaceLineIdentifiers csvExportSurfaceLineIdentifiers, SurfaceLine2 surfaceLine) { this.surfaceLine = surfaceLine; this.csvExportSurfaceLineIdentifiers = csvExportSurfaceLineIdentifiers; } double GetXfromPoint(SurfaceLine2 line, CharacteristicPointType type) { var point = line.CharacteristicPoints.GetGeometryPoint(type); if (point == null) { return -1.0; } else { return point.X; } } double GetYfromPoint(SurfaceLine2 line, CharacteristicPointType type) { var point = line.CharacteristicPoints.GetGeometryPoint(type); if (point == null) { return -1.0; } else { return point.Y; } } double GetZfromPoint(SurfaceLine2 line, CharacteristicPointType type) { var point = line.CharacteristicPoints.GetGeometryPoint(type); if (point == null) { return -1.0; } else { return point.Z; } } // The following 5 properties are identifiers and should be the first columns. // Use negative identifers to add them as the first columns [CsvExportColumn(CharacteristicPointCsvIdentifiers.LocationId, -4)] public string LocationId { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.LocationId; } } [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderSoilProfileId, -3)] public string SoilProfileId { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.SoilProfileId; } } [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderScenario, -2)] public string Scenario { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.Scenario; } } [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderCalculationMechanism, -1)] public string CalculationMechanism { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.CalculationMechanism; } } [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderCalculationModel, 0)] public string CalculationModel { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.CalculationModel; } } // The following properties are the real surfaceline characteristic points data [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideX, 2)] public double SurfaceLevelOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideY, 3)] public double SurfaceLevelOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideZ, 4)] public double SurfaceLevelOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverX, 5)] public double DikeToeAtRiverX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverY, 6)] public double DikeToeAtRiverY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverZ, 7)] public double DikeToeAtRiverZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideX, 8)] public double ShoulderTopOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideY, 9)] public double ShoulderTopOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideZ, 10)] public double ShoulderTopOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideX, 11)] public double ShoulderBaseOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideY, 12)] public double ShoulderBaseOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideZ, 13)] public double ShoulderBaseOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverX, 14)] public double DikeTopAtRiverX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverY, 15)] public double DikeTopAtRiverY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverZ, 16)] public double DikeTopAtRiverZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideX, 17)] public double TrafficLoadOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideY, 18)] public double TrafficLoadOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideZ, 19)] public double TrafficLoadOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideX, 20)] public double TrafficLoadInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideY, 21)] public double TrafficLoadInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideZ, 22)] public double TrafficLoadInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderX, 23)] public double DikeTopAtPolderX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderY, 24)] public double DikeTopAtPolderY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderZ, 25)] public double DikeTopAtPolderZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideX, 26)] public double ShoulderBaseInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideY, 27)] public double ShoulderBaseInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideZ, 28)] public double ShoulderBaseInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideX, 29)] public double ShoulderTopInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideY, 30)] public double ShoulderTopInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideZ, 31)] public double ShoulderTopInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderX, 32)] public double DikeToeAtPolderX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderY, 33)] public double DikeToeAtPolderY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderZ, 34)] public double DikeToeAtPolderZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideX, 35)] public double DitchDikeSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideY, 36)] public double DitchDikeSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideZ, 37)] public double DitchDikeSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideX, 38)] public double BottomDitchDikeSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideY, 39)] public double BottomDitchDikeSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideZ, 40)] public double BottomDitchDikeSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideX, 41)] public double BottomDitchPolderSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideY, 42)] public double BottomDitchPolderSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideZ, 43)] public double BottomDitchPolderSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideX, 44)] public double DitchPolderSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideY, 45)] public double DitchPolderSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideZ, 46)] public double DitchPolderSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideX, 47)] public double SurfaceLevelInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideY, 48)] public double SurfaceLevelInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideZ, 49)] public double SurfaceLevelInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint1X, 50)] public double NonWaterRetainingObjectPoint1X { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint1); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint1Y, 51)] public double NonWaterRetainingObjectPoint1Y { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint1); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint1Z, 52)] public double NonWaterRetainingObjectPoint1Z { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint1); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint2X, 53)] public double NonWaterRetainingObjectPoint2X { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint2); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint2Y, 54)] public double NonWaterRetainingObjectPoint2Y { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint2); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint2Z, 55)] public double NonWaterRetainingObjectPoint2Z { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint2); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint3X, 56)] public double NonWaterRetainingObjectPoint3X { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint3); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint3Y, 57)] public double NonWaterRetainingObjectPoint3Y { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint3); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint3Z, 58)] public double NonWaterRetainingObjectPoint3Z { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint3); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint4X, 59)] public double NonWaterRetainingObjectPoint4X { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint4); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint4Y, 60)] public double NonWaterRetainingObjectPoint4Y { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint4); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.NonWaterRetainingObjectPoint4Z, 61)] public double NonWaterRetainingObjectPoint4Z { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.NonWaterRetainingObjectPoint4); } } } }