Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs =================================================================== diff -u -r4377 -r4384 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 4377) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 4384) @@ -212,27 +212,23 @@ /// The design result file. /// [Browsable(false)] - public string DesignResultFile + public string GetDesignResultFile() { - get + if (!string.IsNullOrEmpty(BaseFileName)) { - if (!string.IsNullOrEmpty(BaseFileName)) + const string surfacelineResultFileExtension = ".rsxml"; + string fullFilename = DamProject.ProjectWorkingPath; + if (string.IsNullOrEmpty(CalculationSubDir)) { - const string surfacelineResultFileExtension = ".rsxml"; - string fullFilename = DamProject.ProjectWorkingPath; - if (string.IsNullOrEmpty(CalculationSubDir)) - { - throw new NullReferenceException(nameof(CalculationSubDir) + " is null."); - } - - fullFilename = Path.Combine(fullFilename, CalculationSubDir); - fullFilename = fullFilename + Path.DirectorySeparatorChar + BaseFileName; - fullFilename += surfacelineResultFileExtension; - return fullFilename; + throw new ArgumentNullException(nameof(CalculationSubDir)); } - return ""; + fullFilename = Path.Combine(fullFilename, CalculationSubDir); + fullFilename = fullFilename + Path.DirectorySeparatorChar + BaseFileName; + fullFilename += surfacelineResultFileExtension; + return fullFilename; } + return ""; } [PropertyOrder(1, 2)] @@ -1348,9 +1344,9 @@ fileName = PipingResultFile; } else if ((failureMechanismSystemType == FailureMechanismSystemType.StabilityInside || failureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && - File.Exists(DesignResultFile)) + File.Exists(GetDesignResultFile())) { - fileName = DesignResultFile; + fileName = GetDesignResultFile(); } if (fileName != string.Empty) @@ -1398,9 +1394,9 @@ fileName = PipingResultFile; } else if ((failureMechanismSystemType == FailureMechanismSystemType.StabilityInside || failureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && - File.Exists(DesignResultFile)) + File.Exists(GetDesignResultFile())) { - fileName = DesignResultFile; + fileName = GetDesignResultFile(); } if (fileName != string.Empty) @@ -1434,9 +1430,9 @@ FailureMechanismSystemType failureMechanismSystemType = damFailureMechanismeCalculationSpecification.FailureMechanismSystemType; var fileName = ""; if ((failureMechanismSystemType == FailureMechanismSystemType.StabilityInside || failureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && - File.Exists(DesignResultFile)) + File.Exists(GetDesignResultFile())) { - fileName = DesignResultFile; + fileName = GetDesignResultFile(); } if (fileName != string.Empty) Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillDamUiFromXmlOutputTests.cs =================================================================== diff -u -r4236 -r4384 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillDamUiFromXmlOutputTests.cs (.../FillDamUiFromXmlOutputTests.cs) (revision 4236) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillDamUiFromXmlOutputTests.cs (.../FillDamUiFromXmlOutputTests.cs) (revision 4384) @@ -157,7 +157,8 @@ Assert.AreEqual(0.0, combinedDamProjectData.DesignCalculations[0].Pl3MinUplift); Assert.AreEqual(0.0, combinedDamProjectData.DesignCalculations[0].Pl3LocationYMinUplift); Assert.AreEqual(0, combinedDamProjectData.DesignCalculations[0].NumberOfIterations); - StringAssert.Contains(combinedDamProjectData.DesignCalculations[0].BaseFileName + ".rsxml", combinedDamProjectData.DesignCalculations[0].DesignResultFile); + StringAssert.Contains(combinedDamProjectData.DesignCalculations[0].BaseFileName + ".rsxml", + combinedDamProjectData.DesignCalculations[0].GetDesignResultFile()); Assert.AreNotEqual(null, combinedDamProjectData.DesignCalculations[1].ProfileName); Assert.AreNotEqual("", combinedDamProjectData.DesignCalculations[1].ProfileName); @@ -170,7 +171,8 @@ Assert.AreEqual(0.7, combinedDamProjectData.DesignCalculations[1].Pl3MinUplift); Assert.AreEqual(0.0, combinedDamProjectData.DesignCalculations[1].Pl3LocationYMinUplift); Assert.AreEqual(1, combinedDamProjectData.DesignCalculations[1].NumberOfIterations); - StringAssert.Contains(combinedDamProjectData.DesignCalculations[1].BaseFileName + ".rsxml", combinedDamProjectData.DesignCalculations[1].DesignResultFile); + StringAssert.Contains(combinedDamProjectData.DesignCalculations[1].BaseFileName + ".rsxml", + combinedDamProjectData.DesignCalculations[1].GetDesignResultFile()); DamXmlSerialization.SaveOutputAsXmlFile(inputFilename, output); output = DamXmlSerialization.LoadOutputFromXmlFile(inputFilename); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs =================================================================== diff -u -r4377 -r4384 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs (.../FillDamUiFromXmlOutput.cs) (revision 4377) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs (.../FillDamUiFromXmlOutput.cs) (revision 4384) @@ -416,21 +416,7 @@ if (designResult.StabilityDesignResults.UpliftSituation != null) { - DamEngine.Io.XmlOutput.UpliftSituation uplift = designResult.StabilityDesignResults.UpliftSituation; - desResult.IsUplift = uplift.IsUplift; - if (desResult.IsUplift.Value) - { - desResult.Pl3MinUplift = uplift.Pl3MinUplift; - desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted; - desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift; - desResult.Pl4MinUplift = uplift.Pl4MinUplift; - desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; - desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; - } - else - { - ResetUpliftValues(desResult); - } + CreateDesignUpliftSituationResults(designResult, desResult); } else { @@ -439,78 +425,102 @@ if (designResult.StabilityDesignResults.SlipCircleDefinition != null) { - switch (designResult.StabilityDesignResults.StabilityModelType) - { - case DesignResultStabilityDesignResultsStabilityModelType.Bishop: - var singleSlipCircleDefinition = (SlidingCircleMinimumSafetyCurveType) designResult.StabilityDesignResults.SlipCircleDefinition; - if (singleSlipCircleDefinition.Center != null) - { - desResult.ActiveCenterPointX = singleSlipCircleDefinition.Center.X; - desResult.ActiveCenterPointZ = singleSlipCircleDefinition.Center.Z; - desResult.ActiveCenterPointRadius = singleSlipCircleDefinition.Radius; - } - - break; - case DesignResultStabilityDesignResultsStabilityModelType.UpliftVan: - var dualSlipCircleDefinition = (DualSlidingCircleMinimumSafetyCurveType) designResult.StabilityDesignResults.SlipCircleDefinition; - if (dualSlipCircleDefinition.ActiveCircleCenter != null) - { - desResult.ActiveCenterPointX = dualSlipCircleDefinition.ActiveCircleCenter.X; - desResult.ActiveCenterPointZ = dualSlipCircleDefinition.ActiveCircleCenter.Z; - desResult.ActiveCenterPointRadius = dualSlipCircleDefinition.ActiveCircleRadius; - } - - if (dualSlipCircleDefinition.PassiveCircleCenter != null) - { - desResult.PassiveCenterPointX = dualSlipCircleDefinition.PassiveCircleCenter.X; - desResult.PassiveCenterPointZ = dualSlipCircleDefinition.PassiveCircleCenter.Z; - desResult.PassiveCenterPointRadius = dualSlipCircleDefinition.PassiveCircleRadius; - } - - break; - } - - if (designResult.StabilityDesignResults.StabilityModelType == - DesignResultStabilityDesignResultsStabilityModelType.Bishop || - designResult.StabilityDesignResults.StabilityModelType == - DesignResultStabilityDesignResultsStabilityModelType.UpliftVan) - { - if (designResult.StabilityDesignResults.SlipCircleDefinition.Slices != null) - { - desResult.ResultSlices = new List(); - foreach (MinimumSafetyCurveBaseTypeSlice slice in designResult.StabilityDesignResults.SlipCircleDefinition.Slices) - { - var resultSlice = new StabilityResultSlice - { - TopLeftPoint = new Point2D(slice.TopLeftPoint.X, slice.TopLeftPoint.Z), - TopRightPoint = new Point2D(slice.TopRightPoint.X, slice.TopRightPoint.Z), - BottomLeftPoint = new Point2D(slice.BottomLeftPoint.X, slice.BottomLeftPoint.Z), - BottomRightPoint = new Point2D(slice.BottomRightPoint.X, slice.BottomRightPoint.Z) - }; - desResult.ResultSlices.Add(resultSlice); - } - } - } + CreateSlipPlaneDefinitionResults(designResult, desResult); } if (string.IsNullOrEmpty(desResult.CalculationSubDir) && (desResult.CalculationResult != CalculationResult.RunFailed) && (desResult.CalculationResult != CalculationResult.UnexpectedError)) { - throw new NullReferenceException(nameof(desResult.CalculationSubDir) + " is null"); + throw new ArgumentNullException(nameof(desResult.CalculationSubDir)); } if (string.IsNullOrEmpty(desResult.BaseFileName)) { - throw new NullReferenceException(nameof(desResult.BaseFileName) + " is null"); + throw new ArgumentNullException(nameof(desResult.BaseFileName)); } if ((desResult.CalculationResult != CalculationResult.RunFailed) && (desResult.CalculationResult != CalculationResult.UnexpectedError)) { - desResult.CreateResultsFileForSurfaceLineAndProfile(desResult.DesignResultFile); + desResult.CreateResultsFileForSurfaceLineAndProfile(desResult.GetDesignResultFile()); } } + private static void CreateSlipPlaneDefinitionResults(DesignResult designResult, CsvExportData desResult) + { + switch (designResult.StabilityDesignResults.StabilityModelType) + { + case DesignResultStabilityDesignResultsStabilityModelType.Bishop: + var singleSlipCircleDefinition = (SlidingCircleMinimumSafetyCurveType) designResult.StabilityDesignResults.SlipCircleDefinition; + if (singleSlipCircleDefinition.Center != null) + { + desResult.ActiveCenterPointX = singleSlipCircleDefinition.Center.X; + desResult.ActiveCenterPointZ = singleSlipCircleDefinition.Center.Z; + desResult.ActiveCenterPointRadius = singleSlipCircleDefinition.Radius; + } + + break; + case DesignResultStabilityDesignResultsStabilityModelType.UpliftVan: + var dualSlipCircleDefinition = (DualSlidingCircleMinimumSafetyCurveType) designResult.StabilityDesignResults.SlipCircleDefinition; + if (dualSlipCircleDefinition.ActiveCircleCenter != null) + { + desResult.ActiveCenterPointX = dualSlipCircleDefinition.ActiveCircleCenter.X; + desResult.ActiveCenterPointZ = dualSlipCircleDefinition.ActiveCircleCenter.Z; + desResult.ActiveCenterPointRadius = dualSlipCircleDefinition.ActiveCircleRadius; + } + + if (dualSlipCircleDefinition.PassiveCircleCenter != null) + { + desResult.PassiveCenterPointX = dualSlipCircleDefinition.PassiveCircleCenter.X; + desResult.PassiveCenterPointZ = dualSlipCircleDefinition.PassiveCircleCenter.Z; + desResult.PassiveCenterPointRadius = dualSlipCircleDefinition.PassiveCircleRadius; + } + + break; + } + + if (designResult.StabilityDesignResults.StabilityModelType == + DesignResultStabilityDesignResultsStabilityModelType.Bishop || + designResult.StabilityDesignResults.StabilityModelType == + DesignResultStabilityDesignResultsStabilityModelType.UpliftVan) + { + if (designResult.StabilityDesignResults.SlipCircleDefinition.Slices != null) + { + desResult.ResultSlices = new List(); + foreach (MinimumSafetyCurveBaseTypeSlice slice in designResult.StabilityDesignResults.SlipCircleDefinition.Slices) + { + var resultSlice = new StabilityResultSlice + { + TopLeftPoint = new Point2D(slice.TopLeftPoint.X, slice.TopLeftPoint.Z), + TopRightPoint = new Point2D(slice.TopRightPoint.X, slice.TopRightPoint.Z), + BottomLeftPoint = new Point2D(slice.BottomLeftPoint.X, slice.BottomLeftPoint.Z), + BottomRightPoint = new Point2D(slice.BottomRightPoint.X, slice.BottomRightPoint.Z) + }; + desResult.ResultSlices.Add(resultSlice); + } + } + } + } + + private static void CreateDesignUpliftSituationResults(DesignResult designResult, CsvExportData desResult) + { + DamEngine.Io.XmlOutput.UpliftSituation uplift = designResult.StabilityDesignResults.UpliftSituation; + desResult.IsUplift = uplift.IsUplift; + if (desResult.IsUplift.Value) + { + desResult.Pl3MinUplift = uplift.Pl3MinUplift; + desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted; + desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift; + desResult.Pl4MinUplift = uplift.Pl4MinUplift; + desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; + desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; + } + else + { + ResetUpliftValues(desResult); + } + } + private static void ResetUpliftValues(CsvExportData desResult) { desResult.Pl3MinUplift = null;