Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -r129bee0491f9f29f4cd10662d812d1b541502129 -rffdaea5b476af6072fa570ad76cd7649b5490fac
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 129bee0491f9f29f4cd10662d812d1b541502129)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ffdaea5b476af6072fa570ad76cd7649b5490fac)
@@ -506,5 +506,23 @@
"tions_assigned_to_calculations_output_will_be_cleared_confirm", resourceCulture);
}
}
+
+ ///
+ /// Looks up a localized string similar to zip archief.
+ ///
+ public static string Zip_file_filter_Description {
+ get {
+ return ResourceManager.GetString("Zip_file_filter_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to zip.
+ ///
+ public static string Zip_file_filter_Extension {
+ get {
+ return ResourceManager.GetString("Zip_file_filter_Extension", resourceCulture);
+ }
+ }
}
}
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx
===================================================================
diff -u -r129bee0491f9f29f4cd10662d812d1b541502129 -rffdaea5b476af6072fa570ad76cd7649b5490fac
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 129bee0491f9f29f4cd10662d812d1b541502129)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision ffdaea5b476af6072fa570ad76cd7649b5490fac)
@@ -292,4 +292,10 @@
Weet u zeker dat u wilt doorgaan?
+
+ zip
+
+
+ zip archief
+
\ No newline at end of file
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs
===================================================================
diff -u -rb98ca78eaa45c4d5dc6703ae97deb81349d7536a -rffdaea5b476af6072fa570ad76cd7649b5490fac
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision b98ca78eaa45c4d5dc6703ae97deb81349d7536a)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision ffdaea5b476af6072fa570ad76cd7649b5490fac)
@@ -768,6 +768,39 @@
GetExportPath = () => ExportHelper.GetFilePath(GetInquiryHelper(), new FileFilterGenerator(RiskeerCommonIOResources.Shape_file_filter_Extension,
RiskeerCommonIOResources.Shape_file_filter_Description))
};
+
+ yield return new ExportInfo
+ {
+ Name = context => RiskeerCommonFormsResources.WaterLevelCalculationsForNormTargetProbabilities_DisplayName,
+ Extension = Resources.Zip_file_filter_Extension,
+ CreateFileExporter = (context, filePath) => new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter(
+ new[]
+ {
+ new Tuple, double>(
+ context.AssessmentSection.WaterLevelCalculationsForLowerLimitNorm,
+ context.AssessmentSection.FailureMechanismContribution.LowerLimitNorm),
+ new Tuple, double>(
+ context.AssessmentSection.WaterLevelCalculationsForSignalingNorm,
+ context.AssessmentSection.FailureMechanismContribution.SignalingNorm)
+ }, HydraulicBoundaryLocationCalculationsType.WaterLevel, filePath),
+ IsEnabled = context => true,
+ GetExportPath = () => ExportHelper.GetFilePath(GetInquiryHelper(), new FileFilterGenerator(Resources.Zip_file_filter_Extension,
+ Resources.Zip_file_filter_Description))
+ };
+
+ yield return CreateHydraulicBoundaryLocationCalculationsForTargetProbabilityGroupExportInfo
+ (
+ RiskeerCommonFormsResources.WaterLevelCalculationsForUserDefinedTargetProbabilities_DisplayName,
+ HydraulicBoundaryLocationCalculationsType.WaterLevel,
+ context => context.WrappedData.Select(tp => new Tuple, double>(
+ tp.HydraulicBoundaryLocationCalculations, tp.TargetProbability)));
+
+ yield return CreateHydraulicBoundaryLocationCalculationsForTargetProbabilityGroupExportInfo
+ (
+ RiskeerCommonFormsResources.WaveHeightCalculationsForUserDefinedTargetProbabilities_DisplayName,
+ HydraulicBoundaryLocationCalculationsType.WaveHeight,
+ context => context.WrappedData.Select(tp => new Tuple, double>(
+ tp.HydraulicBoundaryLocationCalculations, tp.TargetProbability)));
}
public override IEnumerable GetUpdateInfos()
@@ -1198,6 +1231,24 @@
};
}
+ private ExportInfo CreateHydraulicBoundaryLocationCalculationsForTargetProbabilityGroupExportInfo(
+ string displayName, HydraulicBoundaryLocationCalculationsType calculationsType,
+ Func, double>>> locationCalculationsForTargetProbabilities)
+ where T : HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext
+ {
+ return new ExportInfo
+ {
+ Name = context => displayName,
+ Extension = Resources.Zip_file_filter_Extension,
+ CreateFileExporter = (context, filePath) => new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter(
+ locationCalculationsForTargetProbabilities(context), calculationsType, filePath),
+ IsEnabled = context => true,
+ GetExportPath = () => ExportHelper.GetFilePath(GetInquiryHelper(), new FileFilterGenerator(Resources.Zip_file_filter_Extension,
+ Resources.Zip_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/WaterLevelCalculationsForNormTargetProbabilitiesGroupContextExportInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaterLevelCalculationsForNormTargetProbabilitiesGroupContextExportInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaterLevelCalculationsForNormTargetProbabilitiesGroupContextExportInfoTest.cs (revision ffdaea5b476af6072fa570ad76cd7649b5490fac)
@@ -0,0 +1,119 @@
+// 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.Linq;
+using Core.Common.Base;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Common.Data.TestUtil;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Integration.IO.Exporters;
+using CoreGuiResources = Core.Gui.Properties.Resources;
+
+namespace Riskeer.Integration.Plugin.Test.ExportInfos
+{
+ [TestFixture]
+ public class WaterLevelCalculationsForNormTargetProbabilitiesGroupContextExportInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ // Call
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Assert
+ Assert.IsNotNull(info.Name);
+ Assert.AreEqual("zip", 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 Name_Always_ReturnsName()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Call
+ string name = info.Name(null);
+
+ // Assert
+ Assert.AreEqual("Waterstanden bij norm", name);
+ }
+ }
+
+ [Test]
+ public void CreateFileExporter_WithContext_ReturnFileExporter()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSectionStub();
+
+ var context = new WaterLevelCalculationsForNormTargetProbabilitiesGroupContext(
+ new ObservableList(), 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(WaterLevelCalculationsForNormTargetProbabilitiesGroupContext));
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextExportInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextExportInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextExportInfoTest.cs (revision ffdaea5b476af6072fa570ad76cd7649b5490fac)
@@ -0,0 +1,124 @@
+// 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.Linq;
+using Core.Common.Base;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Integration.IO.Exporters;
+using CoreGuiResources = Core.Gui.Properties.Resources;
+
+namespace Riskeer.Integration.Plugin.Test.ExportInfos
+{
+ [TestFixture]
+ public class WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextExportInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ // Call
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Assert
+ Assert.IsNotNull(info.Name);
+ Assert.AreEqual("zip", 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 Name_Always_ReturnsName()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Call
+ string name = info.Name(null);
+
+ // Assert
+ Assert.AreEqual("Waterstanden bij doelkans", name);
+ }
+ }
+
+ [Test]
+ public void CreateFileExporter_WithContext_ReturnFileExporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext(
+ new ObservableList(), 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);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [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(WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext));
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextExportInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextExportInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ExportInfos/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextExportInfoTest.cs (revision ffdaea5b476af6072fa570ad76cd7649b5490fac)
@@ -0,0 +1,124 @@
+// 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.Linq;
+using Core.Common.Base;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Integration.IO.Exporters;
+using CoreGuiResources = Core.Gui.Properties.Resources;
+
+namespace Riskeer.Integration.Plugin.Test.ExportInfos
+{
+ [TestFixture]
+ public class WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextExportInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ // Call
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Assert
+ Assert.IsNotNull(info.Name);
+ Assert.AreEqual("zip", 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 Name_Always_ReturnsName()
+ {
+ // Setup
+ using (var plugin = new RiskeerPlugin())
+ {
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Call
+ string name = info.Name(null);
+
+ // Assert
+ Assert.AreEqual("Golfhoogten bij doelkans", name);
+ }
+ }
+
+ [Test]
+ public void CreateFileExporter_WithContext_ReturnFileExporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext(
+ new ObservableList(), 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);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [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(WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext));
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs
===================================================================
diff -u -rb98ca78eaa45c4d5dc6703ae97deb81349d7536a -rffdaea5b476af6072fa570ad76cd7649b5490fac
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision b98ca78eaa45c4d5dc6703ae97deb81349d7536a)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision ffdaea5b476af6072fa570ad76cd7649b5490fac)
@@ -378,13 +378,16 @@
ExportInfo[] exportInfos = plugin.GetExportInfos().ToArray();
// Assert
- Assert.AreEqual(6, exportInfos.Length);
+ Assert.AreEqual(9, 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)));
Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(WaterLevelCalculationsForNormTargetProbabilityContext)));
+ Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(WaterLevelCalculationsForNormTargetProbabilitiesGroupContext)));
+ Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext)));
+ Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext)));
}
}