Index: DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSoilProfileWithSurfaceLine.cs =================================================================== diff -u --- DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSoilProfileWithSurfaceLine.cs (revision 0) +++ DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSoilProfileWithSurfaceLine.cs (revision 3571) @@ -0,0 +1,50 @@ +// Copyright (C) Stichting Deltares 2022. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. +using System; +using SoilProfile = Deltares.Geotechnics.Soils.SoilProfile; +using SurfaceLine2 = Deltares.Geotechnics.SurfaceLines.SurfaceLine2; + +namespace Deltares.Dam.Data +{ + /// + /// Helper class to be able to (de-)serialize the 1D profile together with its belonging surface line + /// + [Serializable] + public class CsvExportSoilProfileWithSurfaceLine + { + /// + /// Gets or sets the soil profile. + /// + /// + /// The soil profile. + /// + public SoilProfile SoilProfile { get; set; } + + /// + /// Gets or sets the surface line. + /// + /// + /// The surface line. + /// + public SurfaceLine2 SurfaceLine { get; set; } + + } +} Index: DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj =================================================================== diff -u -r2715 -r3571 --- DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 2715) +++ DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 3571) @@ -171,6 +171,7 @@ + Index: DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs =================================================================== diff -u -r2715 -r3571 --- DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 2715) +++ DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 3571) @@ -29,9 +29,14 @@ using Deltares.Standard.EventPublisher; using Deltares.Standard.Units; using System; -using Deltares.Geotechnics.Soils; +using Deltares.DamEngine.Data.Geotechnics; using Deltares.Geotechnics.SurfaceLines; using Deltares.Standard.Attributes; +using Deltares.Standard.IO; +using Deltares.Standard.IO.Xml; +using CharacteristicPointType = Deltares.Geotechnics.SurfaceLines.CharacteristicPointType; +using SoilProfile1D = Deltares.Geotechnics.Soils.SoilProfile1D; +using SurfaceLine2 = Deltares.Geotechnics.SurfaceLines.SurfaceLine2; namespace Deltares.Dam.Data { @@ -114,7 +119,7 @@ public CsvExportData() { - // this contructor is needed for the UI table eventhough is seems not to be referenced. + // this constructor is needed for the UI table even though is seems not to be referenced. } /// @@ -239,21 +244,24 @@ /// The piping result file. /// [Browsable(false)] - private string PipingResultFile + public string PipingResultFile { // Path of piping is not based on the working dir but on assembly (Assembly.GetExecutingAssembly().Location) get { if (!String.IsNullOrEmpty(BaseFileName)) { - const string txtExtension = ".txt"; - string fullBaseFilename = DamProject.ProjectWorkingPath; - if (CalculationSubDir != "") + const string txtExtension = ".prxml"; + string fullFilename = calculationSubDir; + if (calculationSubDir == "") { - fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); + fullFilename = DamProject.ProjectWorkingPath; + fullFilename = Path.Combine(fullFilename, "Piping"); + fullFilename = Path.Combine(fullFilename, PipingModel.ToString()); + calculationSubDir = fullFilename; } - fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; - string fullFilename = fullBaseFilename + txtExtension; + fullFilename = fullFilename + Path.DirectorySeparatorChar + BaseFileName; + fullFilename = fullFilename + txtExtension; return fullFilename; } return ""; @@ -1821,7 +1829,10 @@ [Browsable(false)] public SurfaceLine2 RedesignedSurfaceLine2 { - get { return redesignedSurfaceLine; } + get + { + return redesignedSurfaceLine; + } set { redesignedSurfaceLine = value; @@ -1831,7 +1842,6 @@ } [PropertyOrder(2, 1)] - [XmlIgnore] [ReadOnly(true)] public string ProfileName { @@ -1863,6 +1873,10 @@ soilprofilename = soilGeometry2DName; } } + if (soilprofilename == "") + { + soilprofilename = profileName; + } return soilprofilename; } @@ -2295,6 +2309,25 @@ return exeName; } + public void CreatePipingResultsFileForSurfaceLineAndProfile(CsvExportData desResult) + { + if (!Directory.Exists(CalculationSubDir)) + { + Directory.CreateDirectory(CalculationSubDir); + } + else + { + //Directory. moet de directory altijd deleted worden? Of werkt dit zo? + } + + var soilProfileWithSurfaceLine = new CsvExportSoilProfileWithSurfaceLine + { + SoilProfile = soilProfile, SurfaceLine = redesignedSurfaceLine + }; + var xmlSerializer = new Deltares.Standard.IO.Xml.XmlSerializer(); + xmlSerializer.Serialize(soilProfileWithSurfaceLine, PipingResultFile); + } + /// /// Opens the calculation file. /// Index: DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs =================================================================== diff -u -r2715 -r3571 --- DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs (.../FillDamUiFromXmlOutput.cs) (revision 2715) +++ DamClients/DamUI/branches/DamUI 19.1/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs (.../FillDamUiFromXmlOutput.cs) (revision 3571) @@ -20,14 +20,13 @@ // All rights reserved. using System.Collections.Generic; -using System.Linq; +using System.IO; using Deltares.DamEngine.Io.XmlOutput; using Deltares.Geometry; using Deltares.Geotechnics.GeotechnicalGeometry; using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; using Deltares.Standard.EventPublisher; -using Deltares.Standard.Extensions; using SurfaceLine = Deltares.DamEngine.Io.XmlOutput.SurfaceLine; namespace Deltares.Dam.Data.DamEngineIo @@ -65,16 +64,18 @@ for (int i = 0; i < output.Results.CalculationMessages.Length; i++) { var validationResult = output.Results.CalculationMessages[i]; - var logMessage = new Deltares.Standard.Logging.LogMessage(); - logMessage.MessageType = ConversionHelper.ConvertToMessageType(validationResult.MessageType); - logMessage.Subject = null; - logMessage.Message = validationResult.Message1; + var logMessage = new Standard.Logging.LogMessage + { + MessageType = ConversionHelper.ConvertToMessageType(validationResult.MessageType), + Subject = null, + Message = validationResult.Message1 + }; damProjectData.CalculationMessages.Add(logMessage); } } // Transfer output time series - if (output.Results.OperationalOutputTimeSeries != null) + if (output != null && output.Results != null && output.Results.OperationalOutputTimeSeries != null) { damProjectData.OutputTimeSerieCollection = new TimeSerieCollection(); TransferOutputTimeSeries(output.Results.OperationalOutputTimeSeries, damProjectData.OutputTimeSerieCollection); @@ -222,6 +223,19 @@ desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; } + + if (string.IsNullOrEmpty(desResult.CalculationSubDir)) + { + var calculationSubDir = DamProject.ProjectMapWorkingPath; + calculationSubDir = Path.Combine(calculationSubDir, "Piping"); + calculationSubDir = Path.Combine(calculationSubDir, desResult.PipingModel.ToString()); + desResult.CalculationSubDir = calculationSubDir; + } + if (string.IsNullOrEmpty(desResult.BaseFileName)) + { + desResult.BaseFileName = designResult.LocationName + designResult.ProfileName + designResult.ScenarioName; + } + desResult.CreatePipingResultsFileForSurfaceLineAndProfile(desResult); } private static Scenario GetScenarioByName(DamProjectData damProjectData, string locationName, string scenarioName)