// 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; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Xml.Serialization; using Deltares.Geographic; using Deltares.Geometry; using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; using Deltares.Standard.IO; using Deltares.Standard.IO.Xml; using Deltares.Standard.Units; using XmlSerializer = Deltares.Standard.IO.Xml.XmlSerializer; namespace Deltares.Dam.Data; /// /// Class for presenting Design results. /// /// /// /// public class CsvExportData : IVisibleEnabled, IGeographicPoint { private string profileName; private DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculationSpecification; private Scenario scenario; private SoilProfile1D soilProfile; private double? localPipingExitPointX; private double? pl3LocalLocationXMinUplift; private double? pl4LocalLocationXMinUplift; private string resultMessage = ""; private ResultEvaluation resultEvaluation = ResultEvaluation.NotEvaluated; private string notes = ""; // redesigned LOCAL surfaceline (initialized with original local surfaceline) private SurfaceLine2 redesignedSurfaceLine; // redesigned Global surfaceline in use for this result (either piping or stability) private SurfaceLine2 redesignedSurfaceLineGlobal; private CsvExportResultSlicesAndSoilProfileWithSurfaceLine resultSlicesAndSoilProfileWithSurfaceLine; private List resultSlices; private double? stabilityToeAtPolderX; private double? stabilityToeAtPolderZ; private double? stabilityShoulderHeight; private double? dikeLength; private double? dikeToeAtRiverXrd; private double? dikeToeAtRiverYrd; private double? dikeToeAtRiverZrd; private double? dikeTopAtRiverXrd; private double? dikeTopAtRiverYrd; private double? dikeTopAtRiverZrd; private double? dikeTopAtPolderXrd; private double? dikeTopAtPolderYrd; private double? dikeTopAtPolderZrd; private double? dikeToeAtPolderXrd; private double? dikeToeAtPolderYrd; private double? dikeToeAtPolderZrd; private double? pipingToeAtPolderX; private double? pipingToeAtPolderZ; private double? pipingShoulderHeight; private double? pl3LocationXMinUplift; private double? pl3LocationYMinUplift; private double? pl4LocationXMinUplift; private double? pl4LocationYMinUplift; private double? pipingEntryPointX; private double? pipingEntryPointY; private double? pipingExitPointX; private double? pipingExitPointY; private string FCalculationSubDir; /// /// Initializes a new instance of the class. /// public CsvExportData() { redesignedSurfaceLine = null; } /// /// Initializes a new instance of the class. /// /// Name of the location. /// Name of the scenario. public CsvExportData(string locationName, string scenarioName) { LocationName = locationName; ScenarioName = scenarioName; } /// /// Gets or sets the exception message. /// /// /// The exception message. /// public string ExceptionMessage { get; set; } /// /// Gets or sets the number of iterations (as used in the design calculation). /// /// /// The number of iterations. /// [ReadOnly(true)] public int NumberOfIterations { get; set; } /// /// Gets the result file. /// /// /// The result file. /// [Browsable(false)] public string ResultFile { get { if (!String.IsNullOrEmpty(BaseFileName)) { const string wmfExtension = ".wmf"; string fullBaseFilename = DamProject.ProjectWorkingPath; if (!string.IsNullOrEmpty(CalculationSubDir)) { fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); } fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; string fullFilename = fullBaseFilename + wmfExtension; if (!File.Exists(fullFilename)) { fullFilename = fullBaseFilename + "z1" + wmfExtension; } if (!File.Exists(fullFilename)) { fullFilename = fullBaseFilename + "z2" + wmfExtension; } return fullFilename; } return ""; } } /// /// Gets the piping result file. /// /// /// The piping result file. /// [Browsable(false)] public string PipingResultFile { get { if (!String.IsNullOrEmpty(BaseFileName)) { const string pipingResultFileExtension = ".prxml"; string fullFilename = DamProject.ProjectWorkingPath; if (string.IsNullOrEmpty(CalculationSubDir)) { CalculationSubDir = Path.Combine("Piping", PipingModel.ToString()); } fullFilename = Path.Combine(fullFilename, CalculationSubDir); fullFilename = fullFilename + Path.DirectorySeparatorChar + BaseFileName; fullFilename += pipingResultFileExtension; return fullFilename; } return ""; } } [PropertyOrder(1, 2)] [ReadOnly(true)] public AnalysisType AnalysisType // moet vanuit invoer komen { get; set; } [Browsable(false)] public DamFailureMechanismeCalculationSpecification DamFailureMechanismeCalculation // moet vanuit invoer komen { get { return damFailureMechanismeCalculationSpecification; } set { // Clone the specification to ensure a non-changeable version. damFailureMechanismeCalculationSpecification = value.Clone(); if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) { redesignedSurfaceLine = RedesignedSurfaceLine2; } } } [CsvExportColumn("DikeName", 2)] [Browsable(false)] public string DikeName { get; set; } [CsvExportColumn("Calculation", 3)] [Browsable(false)] public string Calculation { get { return damFailureMechanismeCalculationSpecification?.ToString() ?? ""; } } [CsvExportColumn("Scenario", 4)] [Browsable(false)] public string ScenarioName { get; set; } [CsvExportColumn("LocationName", 5)] [PropertyOrder(0, 1)] [ReadOnly(true)] public string LocationName { get; set; } [PropertyOrder(0, 2)] [ReadOnly(true)] public string ScenarioDefinitionName { get { return ScenarioName + " (" + (ScenarioIndex + 1) + " of " + LocationScenarioCount + ")"; } } /// /// The total number of scenarios of the location /// [Browsable(false)] public int LocationScenarioCount { get; set; } /// /// The index (starting with 0) of the scenario in the list of all scenarios of the location /// [Browsable(false)] public int ScenarioIndex { get; set; } [PropertyOrder(0, 3)] [ReadOnly(true)] public CalculationResult CalculationResult { get; set; } = CalculationResult.NoRun; [PropertyOrder(8, 1)] [ReadOnly(true)] public string ResultMessage { get { RemoveCarriageReturnsFromMessage(ref resultMessage); return resultMessage; } set { resultMessage = value; } } [CsvExportColumn("LocationScenarioId", 8)] [Browsable(false)] public string LocationScenarioId { get { return ScenarioName; } } [CsvExportColumn("RiverLevel", 9)] [PropertyOrder(2, 12)] [Format("F3")] [ReadOnly(true)] public double? RiverLevel { get { return scenario.RiverLevel; } } [CsvExportColumn("RiverLevelLow", 10)] [PropertyOrder(2, 13)] [Format("F3")] [ReadOnly(true)] public double? RiverLevelLow { get { return scenario.RiverLevelLow; } } [CsvExportColumn("DikeTableHeight", 11)] [PropertyOrder(2, 14)] [Format("F3")] [ReadOnly(true)] public double? DikeTableHeight { get { return scenario.DikeTableHeight; } } [CsvExportColumn("DikeTableHeight", 12)] [PropertyOrder(2, 15)] [Format("F3")] [ReadOnly(true)] public double? SlopeDampingPiezometricHeightPolderSide { get { return scenario.Location.SlopeDampingPiezometricHeightPolderSide; } } /// /// Gets the height of the current original dike (so not of the redesigned surfaceline). /// /// /// The height of the current dike. /// [CsvExportColumn("CurrentDikeHeight", 13)] [Browsable(false)] public double? CurrentDikeHeight { get { return scenario.Location.SurfaceLine2.GetDikeHeight(); } } /// /// Gets the current original dike toe at polder x (so not of the redesigned surfaceline). /// /// /// The current global dike toe at polder x. /// [CsvExportColumn("CurrentDikeToeAtPolderX", 14)] [Browsable(false)] public double? CurrentDikeToeAtPolderX { get { double? x = null; GeometryPoint point = scenario.Location.SurfaceLine2.GetDikeToeInward(); if (point != null) { x = point.X; } return x; } } /// /// Gets the current original dike toe at polder z (so not of the redesigned surfaceline). /// /// /// The current global dike toe at polder z. /// [CsvExportColumn("CurrentDikeToeAtPolderZ", 15)] [Browsable(false)] public double? CurrentDikeToeAtPolderZ { get { double? z = null; GeometryPoint point = scenario.Location.SurfaceLine2.GetDikeToeInward(); if (point != null) { z = point.Z; } return z; } } [CsvExportColumn("StabilityProfileName", 16)] [Browsable(false)] public string StabilityProfileName { get { return ProfileName; } } [CsvExportColumn("StabilityProfileProbability", 17)] [Format("F3")] [Unit(UnitType.Fractions)] [Browsable(false)] public double? StabilityProfileProbability { get { return GetSoilProfileProbability(FailureMechanismSystemType.StabilityInside); } } [CsvExportColumn("PipingProfileName", 18)] [Browsable(false)] public string PipingProfileName { get { return ProfileName; } } [CsvExportColumn("PipingProfileProbability", 19)] [Format("F3")] [Unit(UnitType.Fractions)] [Browsable(false)] public double? PipingProfileProbability { get { return GetSoilProfileProbability(FailureMechanismSystemType.Piping); } } /// /// Gets the length of the current original dike (so not of the redesigned surfaceline). /// /// /// The length of the current dike. /// [CsvExportColumn("CurrentDikeLength", 20)] [Browsable(false)] public double? CurrentDikeLength { get { return scenario.Location.SurfaceLine2.GetDikeLength(); } } [CsvExportColumn("StabilityToeAtPolderX", 21)] [Format("F3")] [Unit(UnitType.Length)] [Browsable(false)] public double? StabilityToeAtPolderX { get { GeometryPoint point = redesignedSurfaceLineGlobal?.GetDikeToeInward(); if (point != null) { stabilityToeAtPolderX = point.X; } return stabilityToeAtPolderX; } set => stabilityToeAtPolderX = value; } [CsvExportColumn("StabilityToeAtPolderZ", 22)] [Format("F3")] [Unit(UnitType.Length)] [Browsable(false)] public double? StabilityToeAtPolderZ { get { GeometryPoint point = redesignedSurfaceLineGlobal?.GetDikeToeInward(); if (point != null) { stabilityToeAtPolderZ = point.Z; } return stabilityToeAtPolderZ; } set => stabilityToeAtPolderZ = value; } [CsvExportColumn("StabilityShoulderHeight", 23)] [Format("F3")] [Unit(UnitType.Length)] [Browsable(false)] public double? StabilityShoulderHeight { get { GeometryPoint point = redesignedSurfaceLineGlobal?.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); if (point != null) { stabilityShoulderHeight = point.Z; } return stabilityShoulderHeight; } set => stabilityShoulderHeight = value; } [CsvExportColumn("StabilitySafetyFactor", 24)] [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [Browsable(false)] public double? StabilitySafetyFactor { get; set; } [CsvExportColumn("RequiredSafetyFactorStabilityInnerSlope", 26)] [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [Browsable(false)] public double? RequiredSafetyFactorStabilityInnerSlope { get { return scenario.RequiredSafetyFactorStabilityInnerSlope; } } [CsvExportColumn("RequiredSafetyFactorStabilityOuterSlope", 27)] [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [Browsable(false)] public double? RequiredSafetyFactorStabilityOuterSlope { get { return scenario.RequiredSafetyFactorStabilityOuterSlope; } } [CsvExportColumn("RequiredSafetyFactorPiping", 28)] [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [Browsable(false)] public double? RequiredSafetyFactorPiping { get { return scenario.RequiredSafetyFactorPiping; } } [CsvExportColumn("PipingToeAtPolderX", 29)] [Format("F3")] [Unit(UnitType.Length)] [Browsable(false)] public double? PipingToeAtPolderX { get { GeometryPoint point = redesignedSurfaceLineGlobal?.GetDikeToeInward(); if (point != null) { pipingToeAtPolderX = point.X; } return pipingToeAtPolderX; } set => pipingToeAtPolderX = value; } [CsvExportColumn("PipingToeAtPolderZ", 30)] [Format("F3")] [Unit(UnitType.Length)] [Browsable(false)] public double? PipingToeAtPolderZ { get { GeometryPoint point = redesignedSurfaceLineGlobal?.GetDikeToeInward(); if (point != null) { pipingToeAtPolderZ = point.Z; } return pipingToeAtPolderZ; } set => pipingToeAtPolderZ = value; } [CsvExportColumn("PipingShoulderHeight", 31)] [Format("F3")] [Unit(UnitType.Length)] [Browsable(false)] public double? PipingShoulderHeight { get { GeometryPoint point = redesignedSurfaceLineGlobal?.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); if (point != null) { pipingShoulderHeight = point.Z; } return pipingShoulderHeight; } set => pipingShoulderHeight = value; } [CsvExportColumn("DikeLength", 33)] [Format("F3")] [PropertyOrder(4, 1)] [Unit(UnitType.Length)] [ReadOnly(true)] public double? DikeLength { get { if (redesignedSurfaceLineGlobal != null) { dikeLength = redesignedSurfaceLineGlobal.GetDikeLength(); } return dikeLength; } set => dikeLength = value; } [CsvExportColumn("IsUplift", 52)] [PropertyOrder(1, 4)] [ReadOnly(true)] public bool? IsUplift { get; set; } [CsvExportColumn("Pl3MinUplift", 53)] [Format("F3")] [PropertyOrder(5, 1)] [Unit(UnitType.None)] [ReadOnly(true)] public double? Pl3MinUplift { get; set; } [CsvExportColumn("Pl3HeadAdjusted", 54)] [Format("F3")] [PropertyOrder(5, 2)] [Unit(UnitType.Length)] [ReadOnly(true)] public double? Pl3HeadAdjusted { get; set; } [CsvExportColumn("pl3LocalLocationXMinUplift", 55)] [Format("F3")] [PropertyOrder(5, 3)] [Unit(UnitType.Length)] [ReadOnly(true)] public double? Pl3LocalLocationXMinUplift { get { return pl3LocalLocationXMinUplift; } set { pl3LocalLocationXMinUplift = value; } } [CsvExportColumn("Pl3LocationXMinUplift", 56)] [Format("F3")] [PropertyOrder(5, 4)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? Pl3LocationXMinUplift { get { if (pl3LocalLocationXMinUplift == null) { return null; } if (redesignedSurfaceLineGlobal != null) { GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( new GeometryPoint(pl3LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); if (point != null) { pl3LocationXMinUplift = point.X; } } return pl3LocationXMinUplift; } set => pl3LocationXMinUplift = value; } [CsvExportColumn("Pl3LocationYMinUplift", 57)] [Format("F3")] [PropertyOrder(5, 5)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? Pl3LocationYMinUplift { get { if (pl3LocalLocationXMinUplift == null) { return null; } if (redesignedSurfaceLineGlobal != null) { GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( new GeometryPoint(pl3LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); if (point != null) { pl3LocationYMinUplift = point.Y; } } return pl3LocationYMinUplift; } set => pl3LocationYMinUplift = value; } [CsvExportColumn("Pl4MinUplift", 58)] [Format("F3")] [PropertyOrder(5, 6)] [Unit(UnitType.None)] [ReadOnly(true)] public double? Pl4MinUplift { get; set; } [CsvExportColumn("Pl4HeadAdjusted", 59)] [Format("F3")] [PropertyOrder(5, 7)] [Unit(UnitType.Length)] [ReadOnly(true)] public double? Pl4HeadAdjusted { get; set; } [CsvExportColumn("pl4LocalLocationXMinUplift", 60)] [Format("F3")] [PropertyOrder(5, 8)] [Unit(UnitType.Length)] [ReadOnly(true)] public double? Pl4LocalLocationXMinUplift { get { return pl4LocalLocationXMinUplift; } set { pl4LocalLocationXMinUplift = value; } } [CsvExportColumn("Pl4LocationXMinUplift", 61)] [Format("F3")] [PropertyOrder(5, 9)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? Pl4LocationXMinUplift { get { if (pl4LocalLocationXMinUplift == null) { return null; } if (redesignedSurfaceLineGlobal != null) { GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( new GeometryPoint(pl4LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); if (point != null) { pl4LocationXMinUplift = point.X; } } return pl4LocationXMinUplift; } set => pl4LocationXMinUplift = value; } [CsvExportColumn("Pl4LocationYMinUplift", 62)] [Format("F3")] [PropertyOrder(5, 10)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? Pl4LocationYMinUplift { get { if (pl4LocalLocationXMinUplift == null) { return null; } if (redesignedSurfaceLineGlobal != null) { GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( new GeometryPoint(pl4LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); if (point != null) { pl4LocationYMinUplift = point.Y; } } return pl4LocationYMinUplift; } set => pl4LocationYMinUplift = value; } [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [PropertyOrder(6, 11)] public double? UpliftFactor { get; set; } [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [PropertyOrder(6, 12)] [Browsable(false)] public double? HeaveFactor { get; set; } [CsvExportColumn("BlighPipingFactor", 63)] [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [Browsable(false)] public double? BlighPipingFactor { get; set; } [CsvExportColumn("BlighHCritical", 64)] [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [Browsable(false)] public double? BlighHCritical { get; set; } /// /// Gets or sets the wti2017 safety factor for backward erosion. /// /// /// The wti2017 safety factor. /// [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [CsvExportColumn("Wti2017BackwardErosionSafetyFactor", 71)] [PropertyOrder(7, 1)] public double? Wti2017BackwardErosionSafetyFactor { get; set; } /// /// Gets or sets the wti2017 safety factor for Uplift. /// /// /// The wti2017 safety factor for Uplift. /// [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [CsvExportColumn("Wti2017UpliftSafetyFactor", 72)] [PropertyOrder(7, 5)] public double? Wti2017UpliftSafetyFactor { get; set; } /// /// Gets or sets the wti2017 safety factor heave. /// /// /// The wti2017 safety factor heave. /// [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [CsvExportColumn("Wti2017HeaveSafetyFactor", 73)] [PropertyOrder(7, 8)] public double? Wti2017HeaveSafetyFactor { get; set; } /// /// Gets or sets the wti2017 safety factor overall (see MWDAM-1299). /// /// /// The wti2017 safety factor overall. /// [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [CsvExportColumn("Wti2017SafetyFactorOverall", 74)] [PropertyOrder(7, 11)] public double? Wti2017SafetyFactorOverall { get; set; } /// /// Gets or sets the wti2017 critical waterlevel for backward erosion. /// /// /// The wti2017 critical waterlevel backward erosion. /// [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [CsvExportColumn("Wti2017BackwardErosionHcritical", 75)] [PropertyOrder(7, 2)] public double? Wti2017BackwardErosionHcritical { get; set; } /// /// Gets or sets the wti2017 critical waterlevel for Uplift. /// /// /// The wti2017 hcritical uplift. /// [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [CsvExportColumn("Wti2017UpliftHcritical", 76)] [PropertyOrder(7, 6)] public double? Wti2017UpliftHcritical { get; set; } /// /// Gets or sets the wti2017 critical waterlevel for Heave. /// /// /// The wti2017 hcritical heave. /// [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [CsvExportColumn("Wti2017HeaveHcritical", 77)] [PropertyOrder(7, 9)] public double? Wti2017HeaveHcritical { get; set; } /// /// Gets or sets the wti2017 critical waterlevel overall (see MWDAM-1299). /// /// /// The wti2017 hcritical overall. /// [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [CsvExportColumn("Wti2017HcriticalOverall", 78)] [PropertyOrder(7, 12)] public double? Wti2017HcriticalOverall { get; set; } /// /// Gets or sets the wti2017 delta phi c be (backward erosion, critical head difference). /// /// /// The wti2017 delta phi c be. /// [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [CsvExportColumn("Wti2017BackwardErosionDeltaPhiC", 79)] [PropertyOrder(7, 3)] public double? Wti2017BackwardErosionDeltaPhiC { get; set; } /// /// Gets or sets the wti2017 delta phi c be (backward erosion, reduced head difference). /// /// /// The wti2017 delta phi c be. /// [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [CsvExportColumn("Wti2017BackwardErosionDeltaPhiReduced", 80)] [PropertyOrder(7, 4)] public double? Wti2017BackwardErosionDeltaPhiReduced { get; set; } /// /// Gets or sets the wti2017 delta phi cu (Uplift, critical head difference). /// /// /// The wti2017 delta phi cu. /// [Format("F3")] [Unit(UnitType.Length)] [ReadOnly(true)] [CsvExportColumn("Wti2017UpliftDeltaPhiC", 81)] [PropertyOrder(7, 7)] public double? Wti2017UpliftDeltaPhiC { get; set; } /// /// Gets or sets the wti2017 gradient (vertical outflow gradient for Heave). /// /// /// The wti2017 gradient. /// [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [CsvExportColumn("Wti2017Gradient", 82)] [PropertyOrder(7, 10)] public double? Wti2017Gradient { get; set; } /// /// Gets or sets the effective stress (at exit point, as calculated with Wti EffectiveThicknessCalculator). /// /// /// The effective stress. /// [Format("F3")] [Unit(UnitType.Pressure)] [ReadOnly(true)] [CsvExportColumn("Wti2017EffectiveStress", 83)] [PropertyOrder(7, 13)] public double? Wti2017EffectiveStress { get; set; } /// /// Gets or sets the wti2017 c creep (Creep coefficient). /// /// /// The wti2017 c creep. /// [Format("F3")] [Unit(UnitType.None)] [ReadOnly(true)] [CsvExportColumn("Wti2017CCreep", 84)] [PropertyOrder(7, 14)] public double? Wti2017CCreep { get; set; } [CsvExportColumn("DikeToeAtRiverXrd", 85)] [Browsable(false)] public double? DikeToeAtRiverXrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; } return dikeToeAtRiverXrd; } set => dikeToeAtRiverXrd = value; } [CsvExportColumn("DikeToeAtRiverYrd", 86)] [Browsable(false)] public double? DikeToeAtRiverYrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Y; } return dikeToeAtRiverYrd; } set => dikeToeAtRiverYrd = value; } [CsvExportColumn("DikeToeAtRiverZrd", 87)] [Browsable(false)] public double? DikeToeAtRiverZrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Z; } return dikeToeAtRiverZrd; } set => dikeToeAtRiverZrd = value; } [CsvExportColumn("DikeTopAtRiverXrd", 88)] [Browsable(false)] public double? DikeTopAtRiverXrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; } return dikeTopAtRiverXrd; } set => dikeTopAtRiverXrd = value; } [CsvExportColumn("DikeTopAtRiverYrd", 89)] [Browsable(false)] public double? DikeTopAtRiverYrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Y; } return dikeTopAtRiverYrd; } set => dikeTopAtRiverYrd = value; } [CsvExportColumn("DikeTopAtRiverZrd", 90)] [Browsable(false)] public double? DikeTopAtRiverZrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z; } return dikeTopAtRiverZrd; } set => dikeTopAtRiverZrd = value; } [CsvExportColumn("DikeTopAtPolderXrd", 91)] [Browsable(false)] public double? DikeTopAtPolderXrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; } return dikeTopAtPolderXrd; } set => dikeTopAtPolderXrd = value; } [CsvExportColumn("DikeTopAtPolderYrd", 92)] [Browsable(false)] public double? DikeTopAtPolderYrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Y; } return dikeTopAtPolderYrd; } set => dikeTopAtPolderYrd = value; } [CsvExportColumn("DikeTopAtPolderZrd", 93)] [Browsable(false)] public double? DikeTopAtPolderZrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; } return dikeTopAtPolderZrd; } set => dikeTopAtPolderZrd = value; } [CsvExportColumn("DikeToeAtPolderXrd", 94)] [Browsable(false)] public double? DikeToeAtPolderXrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; } return dikeToeAtPolderXrd; } set => dikeToeAtPolderXrd = value; } [CsvExportColumn("DikeToeAtPolderYrd", 95)] [Browsable(false)] public double? DikeToeAtPolderYrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Y; } return dikeToeAtPolderYrd; } set => dikeToeAtPolderYrd = value; } [CsvExportColumn("DikeToeAtPolderZrd", 96)] [Browsable(false)] public double? DikeToeAtPolderZrd { get { if (redesignedSurfaceLineGlobal != null) { return redesignedSurfaceLineGlobal.CharacteristicPoints .GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; } return dikeToeAtPolderZrd; } set => dikeToeAtPolderZrd = value; } [CsvExportColumn("ActiveCenterPointX", 97)] [Format("F3")] [ReadOnly(true)] [Browsable(false)] public double? ActiveCenterPointX { get; set; } [CsvExportColumn("ActiveCenterPointZ", 98)] [Format("F3")] [ReadOnly(true)] [Browsable(false)] public double? ActiveCenterPointZ { get; set; } [CsvExportColumn("ActiveCenterPointRadius", 99)] [Format("F3")] [ReadOnly(true)] [Browsable(false)] public double? ActiveCenterPointRadius { get; set; } [CsvExportColumn("PassiveCenterPointX", 100)] [Format("F3")] [ReadOnly(true)] [Browsable(false)] public double? PassiveCenterPointX { get; set; } [CsvExportColumn("PassiveCenterPointZ", 101)] [Format("F3")] [ReadOnly(true)] [Browsable(false)] public double? PassiveCenterPointZ { get; set; } [CsvExportColumn("PassiveCenterPointRadius", 102)] [Format("F3")] [ReadOnly(true)] [Browsable(false)] public double? PassiveCenterPointRadius { get; set; } [Browsable(false)] public Scenario Scenario { get { return scenario; } set { scenario = value; if (scenario != null) { ScenarioName = scenario.LocationScenarioID; LocationName = scenario.Location.Name; X = scenario.Location.XRd; Y = scenario.Location.YRd; } } } [Browsable(false)] [XmlIgnore] public SoilProfile1D SoilProfile { get { if (soilProfile != null) { return soilProfile; } FailureMechanismSystemType failureMechanismSystemType = damFailureMechanismeCalculationSpecification.FailureMechanismSystemType; var fileName = ""; if (failureMechanismSystemType == FailureMechanismSystemType.Piping && File.Exists(PipingResultFile)) { fileName = PipingResultFile; } else if ((failureMechanismSystemType == FailureMechanismSystemType.StabilityInside || failureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && File.Exists(GetDesignResultFile())) { fileName = GetDesignResultFile(); } if (fileName != string.Empty) { if (resultSlicesAndSoilProfileWithSurfaceLine == null) { resultSlicesAndSoilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(fileName); } soilProfile = resultSlicesAndSoilProfileWithSurfaceLine.SoilProfile; } return soilProfile; } set { soilProfile = value; } } [Browsable(false)] public string SoilGeometry2DName { get; set; } /// /// Gets or sets the redesigned surface line2. /// /// /// The redesigned surface line2. /// [Browsable(false)] [XmlIgnore] public SurfaceLine2 RedesignedSurfaceLine2 { get { if (redesignedSurfaceLine != null) { return redesignedSurfaceLine; } FailureMechanismSystemType failureMechanismSystemType = damFailureMechanismeCalculationSpecification.FailureMechanismSystemType; var fileName = ""; if (failureMechanismSystemType == FailureMechanismSystemType.Piping && File.Exists(PipingResultFile)) { fileName = PipingResultFile; } else if ((failureMechanismSystemType == FailureMechanismSystemType.StabilityInside || failureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && File.Exists(GetDesignResultFile())) { fileName = GetDesignResultFile(); } if (fileName != string.Empty) { if (resultSlicesAndSoilProfileWithSurfaceLine == null) { resultSlicesAndSoilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(fileName); } redesignedSurfaceLine = resultSlicesAndSoilProfileWithSurfaceLine.SurfaceLine; // Also determine and set the correct global version in order to retrieve dependent properties redesignedSurfaceLineGlobal = CreateRedesignedSurfaceLineGlobal(); } return redesignedSurfaceLine; } set { redesignedSurfaceLine = value; // Also determine and set the correct global version in order to retrieve dependent properties redesignedSurfaceLineGlobal = CreateRedesignedSurfaceLineGlobal(); } } [Browsable(false)] [XmlIgnore] public List ResultSlices { get { FailureMechanismSystemType failureMechanismSystemType = damFailureMechanismeCalculationSpecification.FailureMechanismSystemType; var fileName = ""; if ((failureMechanismSystemType == FailureMechanismSystemType.StabilityInside || failureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && File.Exists(GetDesignResultFile())) { fileName = GetDesignResultFile(); } if (fileName != string.Empty) { if (resultSlicesAndSoilProfileWithSurfaceLine == null) { resultSlicesAndSoilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(fileName); } if (resultSlices == null) { resultSlices = resultSlicesAndSoilProfileWithSurfaceLine.ResultSlices; } } return resultSlices; } set => resultSlices = value; } [PropertyOrder(2, 1)] [XmlIgnore] [ReadOnly(true)] public string ProfileName { get { if (scenario != null) { profileName = GetSoilProfileName(); } return profileName; } set { profileName = value; } } [Format("F3")] [PropertyOrder(2, 2)] [Unit(UnitType.Fractions)] [ReadOnly(true)] [XmlIgnore] public double? ProfileProbability { get { double? res = null; switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) { case FailureMechanismSystemType.StabilityOutside: case FailureMechanismSystemType.StabilityInside: res = StabilityProfileProbability; break; case FailureMechanismSystemType.Piping: res = PipingProfileProbability; break; } return res; } } [Unit(UnitType.None)] [PropertyOrder(2, 3)] [ReadOnly(true)] public StabilityModelType? StabilityModel { get; set; } [Unit(UnitType.None)] [Format("F3")] [PropertyOrder(2, 4)] [ReadOnly(true)] [XmlIgnore] public double? SafetyFactor { get { double? res = null; switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) { case FailureMechanismSystemType.StabilityOutside: case FailureMechanismSystemType.StabilityInside: res = StabilitySafetyFactor; break; case FailureMechanismSystemType.Piping: res = PipingFactor; break; } return res; } } [Format("F3")] [PropertyOrder(2, 10)] [Unit(UnitType.None)] [ReadOnly(true)] [XmlIgnore] public double? RequiredSafetyFactor { get { double? res = null; switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) { case FailureMechanismSystemType.StabilityOutside: res = RequiredSafetyFactorStabilityOuterSlope; break; case FailureMechanismSystemType.StabilityInside: res = RequiredSafetyFactorStabilityInnerSlope; break; case FailureMechanismSystemType.Piping: res = RequiredSafetyFactorPiping; break; } return res; } } [Format("F3")] [PropertyOrder(2, 5)] [Unit(UnitType.Length)] [XmlIgnore] [ReadOnly(true)] public double? ShoulderHeight { get { double? res = null; switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) { case FailureMechanismSystemType.StabilityInside: res = StabilityShoulderHeight; break; case FailureMechanismSystemType.Piping: res = PipingShoulderHeight; break; } return res; } } [Format("F3")] [PropertyOrder(2, 7)] [Unit(UnitType.Length)] [XmlIgnore] [ReadOnly(true)] public double? ToeAtPolderX { get { double? res = null; switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) { case FailureMechanismSystemType.StabilityInside: res = StabilityToeAtPolderX; break; case FailureMechanismSystemType.Piping: res = PipingToeAtPolderX; break; } return res; } } [Format("F3")] [PropertyOrder(2, 8)] [Unit(UnitType.Length)] [XmlIgnore] [ReadOnly(true)] public double? ToeAtPolderZ { get { double? res = null; switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) { case FailureMechanismSystemType.StabilityInside: res = StabilityToeAtPolderZ; break; case FailureMechanismSystemType.Piping: res = PipingToeAtPolderZ; break; } return res; } } [PropertyOrder(6, 1)] [Unit(UnitType.None)] [ReadOnly(true)] [XmlIgnore] public PipingModelType? PipingModel { get { if (damFailureMechanismeCalculationSpecification != null && damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) { return damFailureMechanismeCalculationSpecification.PipingModelType; } return null; } } [Format("F3")] [PropertyOrder(6, 2)] [Unit(UnitType.None)] [ReadOnly(true)] [XmlIgnore] public double? PipingFactor { get { double? res = null; if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) { switch (damFailureMechanismeCalculationSpecification.PipingModelType) { case PipingModelType.Bligh: res = BlighPipingFactor; break; case PipingModelType.Wti2017: res = Wti2017SafetyFactorOverall; break; } } return res; } } [Format("F3")] [PropertyOrder(6, 3)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? LocalPipingEntryPointX { get { GeometryPoint point = null; if (RedesignedSurfaceLine2 != null) { point = redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); } if (point != null && scenario != null) { return point.X - scenario.Location.DistanceToEntryPoint; } if (point != null) { return point.X; } return null; } } [Format("F3")] [PropertyOrder(6, 4)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? PipingEntryPointX { get { if (LocalPipingEntryPointX == null) { return null; } if (redesignedSurfaceLineGlobal != null) { GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( new GeometryPoint(LocalPipingEntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); if (point != null) { pipingEntryPointX = point.X; } } return pipingEntryPointX; } set => pipingEntryPointX = value; } [Format("F3")] [PropertyOrder(6, 5)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? PipingEntryPointY { get { if (LocalPipingEntryPointX == null) { return null; } if (redesignedSurfaceLineGlobal != null) { GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( new GeometryPoint(LocalPipingEntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); if (point != null) { pipingEntryPointY = point.Y; } } return pipingEntryPointY; } set => pipingEntryPointY = value; } [Format("F3")] [PropertyOrder(6, 6)] [Unit(UnitType.Length)] [ReadOnly(true)] public double? LocalPipingExitPointX { get { return localPipingExitPointX; } set { localPipingExitPointX = value; } } [Format("F3")] [PropertyOrder(6, 7)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? PipingExitPointX { get { if (localPipingExitPointX == null) { return null; } if (redesignedSurfaceLineGlobal != null) { GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( new GeometryPoint(localPipingExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); if (point != null) { pipingExitPointX = point.X; } } return pipingExitPointX; } set => pipingExitPointX = value; } [Format("F3")] [PropertyOrder(6, 8)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? PipingExitPointY { get { if (localPipingExitPointX == null) { return null; } if (redesignedSurfaceLineGlobal != null) { GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( new GeometryPoint(localPipingExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); if (point != null) { pipingExitPointY = point.Y; } } return pipingExitPointY; } set => pipingExitPointY = value; } [Format("F3")] [PropertyOrder(6, 9)] [Unit(UnitType.Length)] [ReadOnly(true)] public double? SeepageLength { get { if (scenario != null) { return localPipingExitPointX - LocalPipingEntryPointX; } return localPipingExitPointX - LocalPipingEntryPointX; } } [Format("F3")] [PropertyOrder(6, 10)] [Unit(UnitType.Length)] [ReadOnly(true)] [XmlIgnore] public double? HCritical { get { double? res = null; if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) { switch (damFailureMechanismeCalculationSpecification.PipingModelType) { case PipingModelType.Bligh: res = BlighHCritical; break; case PipingModelType.Wti2017: res = Wti2017HcriticalOverall; break; } } return res; } } [Browsable(false)] public string BaseFileName { get; set; } [Browsable(false)] public string CalculationSubDir { get { if (string.IsNullOrEmpty(FCalculationSubDir)) { FCalculationSubDir = PipingModel.ToString(); } return FCalculationSubDir; } set { FCalculationSubDir = value; } } public ResultEvaluation ResultEvaluation { get { return resultEvaluation; } set { DataEventPublisher.BeforeChange(this, "ResultEvaluation"); resultEvaluation = value; DataEventPublisher.AfterChange(this, "ResultEvaluation"); } } [Description("Use this area to explain the valuation and for any further remarks")] public string Notes { get { return notes; } set { DataEventPublisher.BeforeChange(this, "Notes"); notes = value; DataEventPublisher.AfterChange(this, "Notes"); } } [CsvExportColumn("X", 6)] [Format("F3")] [PropertyOrder(1, 0)] [Unit(UnitType.Length)] [XmlIgnore] [ReadOnly(true)] public double X { get; set; } [CsvExportColumn("Y", 7)] [Format("F3")] [PropertyOrder(1, 1)] [Unit(UnitType.Length)] [XmlIgnore] [ReadOnly(true)] public double Y { get; set; } /// /// Gets the resulting surface line file. /// /// /// The design result file. /// [Browsable(false)] public string GetDesignResultFile() { if (string.IsNullOrEmpty(BaseFileName) || string.IsNullOrEmpty(CalculationSubDir)) { return ""; } const string surfacelineResultFileExtension = ".rsxml"; string fullFilename = DamProject.ProjectWorkingPath; fullFilename = Path.Combine(fullFilename, CalculationSubDir); fullFilename = fullFilename + Path.DirectorySeparatorChar + BaseFileName; fullFilename += surfacelineResultFileExtension; return fullFilename; } /// /// Creates a new instance based on /// with global coordinates instead of local coordinates. /// [Browsable(false)] public SurfaceLine2 CreateRedesignedSurfaceLineGlobal() { SurfaceLine2 localRedesignedSurfaceLineGlobal = null; if (redesignedSurfaceLine != null) { SurfaceLine2 originalSurfaceLine = scenario.Location.SurfaceLine2; if (originalSurfaceLine != null) { var coordinateSystemConverter = new CoordinateSystemConverter(); coordinateSystemConverter.DefineGlobalXYZBasedOnLine(originalSurfaceLine.Geometry); localRedesignedSurfaceLineGlobal = redesignedSurfaceLine.FullDeepClone(); coordinateSystemConverter.ConvertLocalXZToGlobalXYZ(localRedesignedSurfaceLineGlobal.Geometry); } } return localRedesignedSurfaceLineGlobal; } /// /// Creates the results file for surface line and profile. /// public void CreateResultsFileForSurfaceLineAndProfile(string fileName) { var fileInfo = new FileInfo(fileName); string fullPath = fileInfo.DirectoryName; if (!Directory.Exists(fullPath)) { Directory.CreateDirectory(fullPath); } var csvExportSoilProfileWithSurfaceLine = new CsvExportResultSlicesAndSoilProfileWithSurfaceLine { SoilProfile = soilProfile, SurfaceLine = redesignedSurfaceLine, ResultSlices = resultSlices }; var xmlSerializer = new XmlSerializer(); xmlSerializer.Serialize(csvExportSoilProfileWithSurfaceLine, fileName); } /// /// Opens the calculation file. /// public void OpenCalculationFile() { if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType is FailureMechanismSystemType.StabilityInside or FailureMechanismSystemType.StabilityOutside) { if (File.Exists(InputFile)) { string copyFile = Path.GetDirectoryName(InputFile) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(InputFile) + " (copy)" + Path.GetExtension(InputFile); File.Copy(InputFile, copyFile, true); var process = new Process { StartInfo = new ProcessStartInfo(copyFile) { UseShellExecute = true, WindowStyle = ProcessWindowStyle.Normal } }; try { process.Start(); } catch (Exception) { ExceptionMessage = $"The file {InputFile} could not be opened with D-Stability. Make sure D-Stability is installed and that files with the extension {Path.GetExtension(InputFile)} are associated with D-Stability."; DataEventPublisher.AfterChange(this, "ExceptionMessage"); } } else { ExceptionMessage = $"The file {InputFile} is not available."; DataEventPublisher.AfterChange(this, "ExceptionMessage"); } } else { if (File.Exists(PipingResultFile)) { string copyFile = Path.GetTempPath() + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(PipingResultFile) + " (copy)" + Path.GetExtension(PipingResultFile); File.Copy(PipingResultFile, copyFile, true); Process.Start(copyFile); } } } public bool IsEnabled(string property) { return true; } public bool IsVisible(string property) { if (damFailureMechanismeCalculationSpecification == null) { return false; } switch (property) { case "StabilityModel": return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside || damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside; case "PipingModel": return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping; case "PipingFactor": return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping; case "HCritical": return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping; case "OpenCalculationFile": return (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside || damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside); default: return true; } } /// /// Removes the carriage returns from message. /// /// The message. internal static void RemoveCarriageReturnsFromMessage(ref string message) { // remove carriage return at the end message = message.TrimEnd('\r', '\n'); // replace other carriage returns by a space message = message.Replace("\r\n", " "); } /// /// Gets the input file. /// /// /// The input file. /// [Browsable(false)] private string InputFile { get { if (!String.IsNullOrEmpty(BaseFileName)) { const string fileExtension = ".stix"; const string suffix = "_result"; string fullBaseFilename = DamProject.ProjectWorkingPath; if (CalculationSubDir != "") { fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); } fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName + suffix; string fullFilename = fullBaseFilename + fileExtension; return fullFilename; } return ""; } } /// /// Determines the global point coordinates based on global surface line. /// /// The local point. /// The global surface line. /// private GeometryPoint DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine(GeometryPoint localPoint, SurfaceLine2 globalSurfaceLine) { var coordinateSystemConverter = new CoordinateSystemConverter(); coordinateSystemConverter.DefineGlobalXYZBasedOnLine(globalSurfaceLine.Geometry); coordinateSystemConverter.ConvertLocalXZToGlobalXYZ(localPoint); return localPoint; } private double? GetSoilProfileProbability(FailureMechanismSystemType? failureMechanismType) { if (SoilProfile != null) { return scenario.Location.GetSoilProfileProbability(soilProfile, failureMechanismType); } return scenario.Location.GetSoilGeometry2DProbability(SoilGeometry2DName, failureMechanismType); } private CsvExportResultSlicesAndSoilProfileWithSurfaceLine ReadSoilProfileWithSurfaceLineFromFile(string resultFile) { CsvExportResultSlicesAndSoilProfileWithSurfaceLine localResultSlicesAndSoilProfileWithSurfaceLine = null; DataEventPublisher.InvokeWithoutPublishingEvents(() => { var xmlDeSerializer = new XmlDeserializer(); var classFactory = new DefaultClassFactory(); localResultSlicesAndSoilProfileWithSurfaceLine = (CsvExportResultSlicesAndSoilProfileWithSurfaceLine) xmlDeSerializer.XmlDeserialize(resultFile, typeof(CsvExportResultSlicesAndSoilProfileWithSurfaceLine), classFactory); }); return localResultSlicesAndSoilProfileWithSurfaceLine; } private string GetSoilProfileName() { var soilprofilename = ""; if (soilProfile != null) { soilprofilename = soilProfile.Name; } else { if (!String.IsNullOrEmpty(SoilGeometry2DName)) { soilprofilename = SoilGeometry2DName; } } return soilprofilename; } /// /// Copies the result file. /// /// The extension. private void CopyResultFile(string extension) { string copyResFile = Path.GetDirectoryName(InputFile) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(InputFile) + " (copy)" + extension; string resFile = Path.ChangeExtension(InputFile, extension); if (resFile != null) { File.Copy(resFile, copyResFile, true); } } }