Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -r86dd4f050890e7008836987b7560e2e76a7e0cd5 -r8b6d97341faa438655fd58d8bab819d9c7adb9de
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 86dd4f050890e7008836987b7560e2e76a7e0cd5)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8b6d97341faa438655fd58d8bab819d9c7adb9de)
@@ -427,6 +427,24 @@
}
///
+ /// Looks up a localized string similar to h.
+ ///
+ public static string MetaData_WaterLevelCalculation {
+ get {
+ return ResourceManager.GetString("MetaData_WaterLevelCalculation", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Hs.
+ ///
+ public static string MetaData_WaveHeight {
+ get {
+ return ResourceManager.GetString("MetaData_WaveHeight", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Na het importeren van een aangepaste ligging van de referentielijn zullen alle geïmporteerde en berekende gegevens van alle toetssporen worden gewist.
///
///Wilt u doorgaan?.
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx
===================================================================
diff -u -r86dd4f050890e7008836987b7560e2e76a7e0cd5 -r8b6d97341faa438655fd58d8bab819d9c7adb9de
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 86dd4f050890e7008836987b7560e2e76a7e0cd5)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 8b6d97341faa438655fd58d8bab819d9c7adb9de)
@@ -292,4 +292,10 @@
Weet u zeker dat u wilt doorgaan?
+
+ h
+
+
+ Hs
+
\ No newline at end of file
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs
===================================================================
diff -u -r297462ba9127f686dd41384d91ba79cba91c9363 -r8b6d97341faa438655fd58d8bab819d9c7adb9de
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 297462ba9127f686dd41384d91ba79cba91c9363)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 8b6d97341faa438655fd58d8bab819d9c7adb9de)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2021. All rights reserved.
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
//
// This file is part of Riskeer.
//
@@ -748,6 +748,11 @@
GetExportPath = () => ExportHelper.GetFilePath(GetInquiryHelper(), new FileFilterGenerator(Resources.AssemblyResult_file_filter_Extension,
RiskeerCommonFormsResources.AssemblyResult_DisplayName))
};
+
+ yield return CreateHydraulicBoundaryLocationCalculationsForTargetProbabilityExportInfo<
+ WaterLevelCalculationsForUserDefinedTargetProbabilityContext>(Resources.MetaData_WaterLevelCalculation);
+ yield return CreateHydraulicBoundaryLocationCalculationsForTargetProbabilityExportInfo<
+ WaveHeightCalculationsForUserDefinedTargetProbabilityContext>(Resources.MetaData_WaveHeight);
}
public override IEnumerable GetUpdateInfos()
@@ -1162,6 +1167,21 @@
};
}
+ private ExportInfo CreateHydraulicBoundaryLocationCalculationsForTargetProbabilityExportInfo(string metaDataHeader)
+ where T : HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilityContext
+ {
+ return new ExportInfo
+ {
+ Name = RiskeerCommonDataResources.HydraulicBoundaryConditions_DisplayName,
+ Extension = RiskeerCommonIOResources.Shape_file_filter_Extension,
+ CreateFileExporter = (context, filePath) => new HydraulicBoundaryLocationCalculationsExporter(
+ context.WrappedData.HydraulicBoundaryLocationCalculations, filePath, metaDataHeader),
+ IsEnabled = context => true,
+ GetExportPath = () => ExportHelper.GetFilePath(GetInquiryHelper(), new FileFilterGenerator(RiskeerCommonIOResources.Shape_file_filter_Extension,
+ RiskeerCommonIOResources.Shape_file_filter_Description))
+ };
+ }
+
private static ViewInfo, IObservableEnumerable, TView> CreateFailureMechanismResultViewInfo<
TFailureMechanism, TResult, TView, TResultRow, TAssemblyResultControl>(
Func, TView> createInstanceFunc)
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaterLevelCalculationsForUserDefinedTargetProbabilityContextExportInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaterLevelCalculationsForUserDefinedTargetProbabilityContextExportInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaterLevelCalculationsForUserDefinedTargetProbabilityContextExportInfoTest.cs (revision 8b6d97341faa438655fd58d8bab819d9c7adb9de)
@@ -0,0 +1,104 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Linq;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Integration.Data;
+using Riskeer.Integration.IO.Exporters;
+using CoreGuiResources = Core.Gui.Properties.Resources;
+
+namespace Riskeer.Integration.Plugin.Test.ExportInfos
+{
+ [TestFixture]
+ public class WaterLevelCalculationsForUserDefinedTargetProbabilityContextExportInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ // Call
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Assert
+ Assert.AreEqual("Hydraulische belastingen", info.Name);
+ Assert.AreEqual("shp", info.Extension);
+ Assert.IsNotNull(info.CreateFileExporter);
+ Assert.IsNotNull(info.IsEnabled);
+ Assert.AreEqual("Algemeen", info.Category);
+ TestHelper.AssertImagesAreEqual(CoreGuiResources.ExportIcon, info.Image);
+ Assert.IsNotNull(info.GetExportPath);
+ }
+ }
+
+ [Test]
+ public void CreateFileExporter_WithContext_ReturnFileExporter()
+ {
+ // Setup
+ var random = new Random(21);
+ var assessmentSection = new AssessmentSection(random.NextEnumValue());
+ var context = new WaterLevelCalculationsForUserDefinedTargetProbabilityContext(
+ new HydraulicBoundaryLocationCalculationsForTargetProbability(0.1), assessmentSection);
+
+ const string filePath = "test";
+
+ using (var plugin = new RiskeerPlugin())
+ {
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Call
+ IFileExporter fileExporter = info.CreateFileExporter(context, filePath);
+
+ // Assert
+ Assert.IsInstanceOf(fileExporter);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_Always_ReturnsTrue()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Call
+ bool isEnabled = info.IsEnabled(null);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+ }
+
+ private static ExportInfo GetExportInfo(RiskeerPlugin plugin)
+ {
+ return plugin.GetExportInfos().First(ei => ei.DataType == typeof(WaterLevelCalculationsForUserDefinedTargetProbabilityContext));
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaveHeightCalculationsForUserDefinedTargetProbabilityContextExportInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaveHeightCalculationsForUserDefinedTargetProbabilityContextExportInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaveHeightCalculationsForUserDefinedTargetProbabilityContextExportInfoTest.cs (revision 8b6d97341faa438655fd58d8bab819d9c7adb9de)
@@ -0,0 +1,104 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Linq;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Integration.Data;
+using Riskeer.Integration.IO.Exporters;
+using CoreGuiResources = Core.Gui.Properties.Resources;
+
+namespace Riskeer.Integration.Plugin.Test.ExportInfos
+{
+ [TestFixture]
+ public class WaveHeightCalculationsForUserDefinedTargetProbabilityContextExportInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ // Call
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Assert
+ Assert.AreEqual("Hydraulische belastingen", info.Name);
+ Assert.AreEqual("shp", info.Extension);
+ Assert.IsNotNull(info.CreateFileExporter);
+ Assert.IsNotNull(info.IsEnabled);
+ Assert.AreEqual("Algemeen", info.Category);
+ TestHelper.AssertImagesAreEqual(CoreGuiResources.ExportIcon, info.Image);
+ Assert.IsNotNull(info.GetExportPath);
+ }
+ }
+
+ [Test]
+ public void CreateFileExporter_WithContext_ReturnFileExporter()
+ {
+ // Setup
+ var random = new Random(21);
+ var assessmentSection = new AssessmentSection(random.NextEnumValue());
+ var context = new WaveHeightCalculationsForUserDefinedTargetProbabilityContext(
+ new HydraulicBoundaryLocationCalculationsForTargetProbability(0.1), assessmentSection);
+
+ const string filePath = "test";
+
+ using (var plugin = new RiskeerPlugin())
+ {
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Call
+ IFileExporter fileExporter = info.CreateFileExporter(context, filePath);
+
+ // Assert
+ Assert.IsInstanceOf(fileExporter);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_Always_ReturnsTrue()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Call
+ bool isEnabled = info.IsEnabled(null);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+ }
+
+ private static ExportInfo GetExportInfo(RiskeerPlugin plugin)
+ {
+ return plugin.GetExportInfos().First(ei => ei.DataType == typeof(WaveHeightCalculationsForUserDefinedTargetProbabilityContext));
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs
===================================================================
diff -u -r8c379b950333e45a56c901c937e705c8ac1e1c88 -r8b6d97341faa438655fd58d8bab819d9c7adb9de
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 8c379b950333e45a56c901c937e705c8ac1e1c88)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 8b6d97341faa438655fd58d8bab819d9c7adb9de)
@@ -378,10 +378,12 @@
ExportInfo[] exportInfos = plugin.GetExportInfos().ToArray();
// Assert
- Assert.AreEqual(3, exportInfos.Length);
+ Assert.AreEqual(5, exportInfos.Length);
Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(ReferenceLineContext)));
Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(HydraulicBoundaryDatabaseContext)));
Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(AssemblyResultsContext)));
+ Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(WaterLevelCalculationsForUserDefinedTargetProbabilityContext)));
+ Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(WaveHeightCalculationsForUserDefinedTargetProbabilityContext)));
}
}