// Copyright (C) Stichting Deltares 2025. 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.Globalization; using Deltares.Geometry; 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; } // 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 string SurfaceLevelOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideY, 3)] public string SurfaceLevelOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideZ, 4)] public string SurfaceLevelOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverX, 5)] public string DikeToeAtRiverX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverY, 6)] public string DikeToeAtRiverY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverZ, 7)] public string DikeToeAtRiverZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideX, 8)] public string ShoulderTopOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideY, 9)] public string ShoulderTopOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideZ, 10)] public string ShoulderTopOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideX, 11)] public string ShoulderBaseOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideY, 12)] public string ShoulderBaseOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideZ, 13)] public string ShoulderBaseOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverX, 14)] public string DikeTopAtRiverX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverY, 15)] public string DikeTopAtRiverY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverZ, 16)] public string DikeTopAtRiverZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideX, 17)] public string TrafficLoadOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideY, 18)] public string TrafficLoadOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideZ, 19)] public string TrafficLoadOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideX, 20)] public string TrafficLoadInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideY, 21)] public string TrafficLoadInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideZ, 22)] public string TrafficLoadInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderX, 23)] public string DikeTopAtPolderX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderY, 24)] public string DikeTopAtPolderY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderZ, 25)] public string DikeTopAtPolderZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideX, 26)] public string ShoulderBaseInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideY, 27)] public string ShoulderBaseInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideZ, 28)] public string ShoulderBaseInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideX, 29)] public string ShoulderTopInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideY, 30)] public string ShoulderTopInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideZ, 31)] public string ShoulderTopInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderX, 32)] public string DikeToeAtPolderX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderY, 33)] public string DikeToeAtPolderY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderZ, 34)] public string DikeToeAtPolderZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideX, 35)] public string DitchDikeSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideY, 36)] public string DitchDikeSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideZ, 37)] public string DitchDikeSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideX, 38)] public string BottomDitchDikeSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideY, 39)] public string BottomDitchDikeSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideZ, 40)] public string BottomDitchDikeSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideX, 41)] public string BottomDitchPolderSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideY, 42)] public string BottomDitchPolderSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideZ, 43)] public string BottomDitchPolderSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideX, 44)] public string DitchPolderSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideY, 45)] public string DitchPolderSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideZ, 46)] public string DitchPolderSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideX, 47)] public string SurfaceLevelInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideY, 48)] public string SurfaceLevelInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideZ, 49)] public string SurfaceLevelInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } string GetXfromPoint(SurfaceLine2 line, CharacteristicPointType type) { GeometryPoint point = line.CharacteristicPoints.GetGeometryPoint(type); double result = -1.0; if (point != null) { result = point.X; } return result.ToString("F3", CultureInfo.InvariantCulture); } string GetYfromPoint(SurfaceLine2 line, CharacteristicPointType type) { GeometryPoint point = line.CharacteristicPoints.GetGeometryPoint(type); double result = -1.0; if (point != null) { result = point.Y; } return result.ToString("F3", CultureInfo.InvariantCulture); } string GetZfromPoint(SurfaceLine2 line, CharacteristicPointType type) { GeometryPoint point = line.CharacteristicPoints.GetGeometryPoint(type); double result = -1.0; if (point != null) { result = point.Z; } return result.ToString("F3", CultureInfo.InvariantCulture); } }