Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs =================================================================== diff -u -r3818 -r3846 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 3818) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 3846) @@ -113,7 +113,8 @@ // redesigned Global surfaceline in use for this result (either piping or stability) private SurfaceLine2 redesignedSurfaceLineGlobal; - private CsvExportSoilProfileWithSurfaceLine soilProfileWithSurfaceLine; + private CsvExportResultSlicesAndSoilProfileWithSurfaceLine resultSlicesAndSoilProfileWithSurfaceLine; + private List resultSlices; private double? stabilityToeAtPolderX; private double? stabilityToeAtPolderZ; @@ -1705,11 +1706,11 @@ if (fileName != string.Empty) { - if (soilProfileWithSurfaceLine == null) + if (resultSlicesAndSoilProfileWithSurfaceLine == null) { - soilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(fileName); + resultSlicesAndSoilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(fileName); } - soilProfile = soilProfileWithSurfaceLine.SoilProfile; + soilProfile = resultSlicesAndSoilProfileWithSurfaceLine.SoilProfile; } return soilProfile; } @@ -1748,18 +1749,18 @@ return localRedesignedSurfaceLineGlobal; } - private CsvExportSoilProfileWithSurfaceLine ReadSoilProfileWithSurfaceLineFromFile(string resultFile) + private CsvExportResultSlicesAndSoilProfileWithSurfaceLine ReadSoilProfileWithSurfaceLineFromFile(string resultFile) { - CsvExportSoilProfileWithSurfaceLine localSoilProfileWithSurfaceLine = null; + CsvExportResultSlicesAndSoilProfileWithSurfaceLine localResultSlicesAndSoilProfileWithSurfaceLine = null; DataEventPublisher.InvokeWithoutPublishingEvents(() => { var xmlDeSerializer = new Deltares.Standard.IO.Xml.XmlDeserializer(); var classFactory = new DefaultClassFactory(); - localSoilProfileWithSurfaceLine = - (CsvExportSoilProfileWithSurfaceLine)xmlDeSerializer.XmlDeserialize(resultFile, - typeof(CsvExportSoilProfileWithSurfaceLine), classFactory); + localResultSlicesAndSoilProfileWithSurfaceLine = + (CsvExportResultSlicesAndSoilProfileWithSurfaceLine)xmlDeSerializer.XmlDeserialize(resultFile, + typeof(CsvExportResultSlicesAndSoilProfileWithSurfaceLine), classFactory); }); - return localSoilProfileWithSurfaceLine; + return localResultSlicesAndSoilProfileWithSurfaceLine; } /// @@ -1791,11 +1792,11 @@ if (fileName != string.Empty) { - if (soilProfileWithSurfaceLine == null) + if (resultSlicesAndSoilProfileWithSurfaceLine == null) { - soilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(fileName); + resultSlicesAndSoilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(fileName); } - redesignedSurfaceLine = soilProfileWithSurfaceLine.SurfaceLine; + redesignedSurfaceLine = resultSlicesAndSoilProfileWithSurfaceLine.SurfaceLine; // Also determine and set the correct global version in order to retrieve dependent properties redesignedSurfaceLineGlobal = CreateRedesignedSurfaceLineGlobal(); } @@ -1811,8 +1812,34 @@ [Browsable(false)] [XmlIgnore] - public List ResultSlices { get; set; } + public List ResultSlices + { + get + { + var failureMechanismSystemType = damFailureMechanismeCalculationSpecification.FailureMechanismSystemType; + var fileName = ""; + if ((failureMechanismSystemType == FailureMechanismSystemType.StabilityInside || failureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && + File.Exists(DesignResultFile)) + { + fileName = DesignResultFile; + } + 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)] @@ -2305,10 +2332,11 @@ Directory.CreateDirectory(fullPath); } - var csvExportSoilProfileWithSurfaceLine = new CsvExportSoilProfileWithSurfaceLine + var csvExportSoilProfileWithSurfaceLine = new CsvExportResultSlicesAndSoilProfileWithSurfaceLine { SoilProfile = soilProfile, - SurfaceLine = redesignedSurfaceLine + SurfaceLine = redesignedSurfaceLine, + ResultSlices = resultSlices }; var xmlSerializer = new Deltares.Standard.IO.Xml.XmlSerializer(); xmlSerializer.Serialize(csvExportSoilProfileWithSurfaceLine, fileName); Index: DamClients/DamUI/trunk/src/Dam/Forms/DamSpatialEditorDecorator.cs =================================================================== diff -u -r3558 -r3846 --- DamClients/DamUI/trunk/src/Dam/Forms/DamSpatialEditorDecorator.cs (.../DamSpatialEditorDecorator.cs) (revision 3558) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamSpatialEditorDecorator.cs (.../DamSpatialEditorDecorator.cs) (revision 3846) @@ -358,6 +358,17 @@ // Show soil layer and surface line. CurrentSoilProfile = locationJob.Location.GetSoilSurfaceProfile(FailureMechanismType, index, out probability); GeometryProbabilities = locationJob.Location.GetGeometryProbabilities(FailureMechanismType); + if (csvExportData != null && (csvExportData.StabilityProfileName != CurrentSoilProfile.SoilProfile.Name)) + { + for (int i = 0; i < GeometryProbabilitiesCount; i++) + { + if (GeometryProbabilities[i].SoilGeometryName == csvExportData.StabilityProfileName) + { + CurrentSoilProfile = locationJob.Location.GetSoilSurfaceProfile(FailureMechanismType, i, out probability); + } + } + } + DrawSoilProfile(); DrawSoilProfileCurves(); @@ -590,7 +601,7 @@ if (locationJob != null && CurrentSoilProfile != null) { csvExportData = locationJob.GetDesignResultByProfileScenarioAndCalculationName(CurrentSoilProfile.SoilProfile.Name, - "1", "UpliftVan"); + "1", LocationJob.CurrentCalculation); } } } Fisheye: Tag 3846 refers to a dead (removed) revision in file `DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSoilProfileWithSurfaceLine.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportResultSlicesAndSoilProfileWithSurfaceLine.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportResultSlicesAndSoilProfileWithSurfaceLine.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportResultSlicesAndSoilProfileWithSurfaceLine.cs (revision 3846) @@ -0,0 +1,80 @@ +// 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 System.Collections.Generic; +using Deltares.Geotechnics.Soils; +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 CsvExportResultSlicesAndSoilProfileWithSurfaceLine + { + private List resultSlices = new List(); + + /// + /// Gets or sets the soil profile. + /// + /// + /// The soil profile. + /// + public SoilProfile1D SoilProfile + { + get; + set; + } + + /// + /// Gets or sets the surface line. + /// + /// + /// The surface line. + /// + public SurfaceLine2 SurfaceLine + { + get; + set; + } + + /// + /// Gets or sets the results slices. + /// + /// + /// The result slices. + /// + public List ResultSlices + { + get + { + return resultSlices; + } + set + { + resultSlices.Clear(); + resultSlices = value; + } + } + + } +} Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StabilityResultSlice.cs =================================================================== diff -u -r3526 -r3846 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StabilityResultSlice.cs (.../StabilityResultSlice.cs) (revision 3526) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StabilityResultSlice.cs (.../StabilityResultSlice.cs) (revision 3846) @@ -20,33 +20,51 @@ // All rights reserved. using Deltares.Mathematics; +using System; namespace Deltares.Dam.Data { /// /// Class to hold all result values per slice (stability calculations) /// + [Serializable] public class StabilityResultSlice { /// /// The top left point /// - public Point2D TopLeftPoint; + public Point2D TopLeftPoint + { + get; + set; + } /// /// The top right point /// - public Point2D TopRightPoint; + public Point2D TopRightPoint + { + get; + set; + } /// /// The bottom left point /// - public Point2D BottomLeftPoint; + public Point2D BottomLeftPoint + { + get; + set; + } /// /// The bottom right point /// - public Point2D BottomRightPoint; + public Point2D BottomRightPoint + { + get; + set; + } } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj =================================================================== diff -u -r3842 -r3846 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 3842) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 3846) @@ -166,7 +166,7 @@ - + Index: DamClients/DamUI/trunk/src/Dam/Forms/SlipCircleDrawingObject.cs =================================================================== diff -u -r3451 -r3846 --- DamClients/DamUI/trunk/src/Dam/Forms/SlipCircleDrawingObject.cs (.../SlipCircleDrawingObject.cs) (revision 3451) +++ DamClients/DamUI/trunk/src/Dam/Forms/SlipCircleDrawingObject.cs (.../SlipCircleDrawingObject.cs) (revision 3846) @@ -77,6 +77,66 @@ DrawingSupport.Pen3D(System.Drawing.Drawing2D.DashStyle.Solid, 3, Color); + DrawSlices(info); + + Point3D activeCenterPoint; + + var topLeftPoint = new Point3D() + { + X = slipcircle.StabilityResultSlice[0].BottomLeftPoint.X, + Y = 0, + Z = slipcircle.StabilityResultSlice[0].BottomLeftPoint.Y + }; + GetScaled3DPoint(info.Projection, topLeftPoint, ref topLeftPoint); + + int sliceIndex = slipcircle.StabilityResultSlice.Count - 1; + var topRightPointSlice = new Point3D() + { + X = slipcircle.StabilityResultSlice[sliceIndex].TopRightPoint.X, + Y = 0, + Z = slipcircle.StabilityResultSlice[sliceIndex].TopRightPoint.Y + }; + GetScaled3DPoint(info.Projection, topRightPointSlice, ref topRightPointSlice); + + if (slipcircle.ActiveCenterPoint != null) + { + activeCenterPoint = new Point3D() + { + X = slipcircle.ActiveCenterPoint.X, + Y = 0, + Z = slipcircle.ActiveCenterPoint.Y + }; + GetScaled3DPoint(info.Projection, activeCenterPoint, ref activeCenterPoint); + DrawingSupport.Cross_Symbol3D(activeCenterPoint.X, activeCenterPoint.Z, 10); + + DrawingSupport.Pen3D(System.Drawing.Drawing2D.DashStyle.Solid, 1, Color); + + DrawingSupport.Line3D(topLeftPoint, activeCenterPoint); + + if (slipcircle.PassiveCenterPoint != null) + { + var passiveCenterPoint = new Point3D() + { + X = slipcircle.PassiveCenterPoint.X, + Y = 0, + Z = slipcircle.PassiveCenterPoint.Y + }; + GetScaled3DPoint(info.Projection, passiveCenterPoint, ref passiveCenterPoint); + DrawingSupport.Cross_Symbol3D(passiveCenterPoint.X, passiveCenterPoint.Z, 10); + + DrawingSupport.Pen3D(System.Drawing.Drawing2D.DashStyle.Solid, 1, Color); + DrawingSupport.Line3D(topRightPointSlice, passiveCenterPoint); + } + else + { + DrawingSupport.Pen3D(System.Drawing.Drawing2D.DashStyle.Solid, 1, Color); + DrawingSupport.Line3D(topRightPointSlice, activeCenterPoint); + } + } + } + + private void DrawSlices(GraphicsInfo info) + { for (int i = 0; i < slipcircle.StabilityResultSlice.Count; i++) { var stabilityResultSlice = slipcircle.StabilityResultSlice[i]; @@ -118,55 +178,6 @@ DrawingSupport.Line3D(topRightPoint, topLeftPoint); DrawingSupport.Line3D(topLeftPoint, bottomLeftPoint); } - - if (slipcircle.ActiveCenterPoint != null) - { - var activeCenterPoint = new Point3D() - { - X = slipcircle.ActiveCenterPoint.X, - Y = 0, - Z = slipcircle.ActiveCenterPoint.Y - }; - - GetScaled3DPoint(info.Projection, activeCenterPoint, ref activeCenterPoint); - DrawingSupport.Cross_Symbol3D(activeCenterPoint.X, activeCenterPoint.Z, 10); - - DrawingSupport.Pen3D(System.Drawing.Drawing2D.DashStyle.Solid, 1, Color); - var topLeftPoint = new Point3D() - { - X = slipcircle.StabilityResultSlice[0].BottomLeftPoint.X, - Y = 0, - Z = slipcircle.StabilityResultSlice[0].BottomLeftPoint.Y - }; - - GetScaled3DPoint(info.Projection, topLeftPoint, ref topLeftPoint); - DrawingSupport.Line3D(topLeftPoint, activeCenterPoint); - } - - if (slipcircle.PassiveCenterPoint != null) - { - var passiveCenterPoint = new Point3D() - { - X = slipcircle.PassiveCenterPoint.X, - Y = 0, - Z = slipcircle.PassiveCenterPoint.Y - }; - - GetScaled3DPoint(info.Projection, passiveCenterPoint, ref passiveCenterPoint); - DrawingSupport.Cross_Symbol3D(passiveCenterPoint.X, passiveCenterPoint.Z, 10); - - int sliceIndex = slipcircle.StabilityResultSlice.Count - 1; - DrawingSupport.Pen3D(System.Drawing.Drawing2D.DashStyle.Solid, 1, Color); - var topRightPoint = new Point3D() - { - X = slipcircle.StabilityResultSlice[sliceIndex].TopRightPoint.X, - Y = 0, - Z = slipcircle.StabilityResultSlice[sliceIndex].TopRightPoint.Y - }; - - GetScaled3DPoint(info.Projection, topRightPoint, ref topRightPoint); - DrawingSupport.Line3D(topRightPoint, passiveCenterPoint); - } } } }