Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj
===================================================================
diff -u -r0a6fd2fa18908a63fc029833ea3735709ebd5829 -r7164a642dc83ca7a1fd78513cbff9da53c052602
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 0a6fd2fa18908a63fc029833ea3735709ebd5829)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 7164a642dc83ca7a1fd78513cbff9da53c052602)
@@ -56,6 +56,9 @@
+
+ Form
+
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructuresSelectionDialog.cs
===================================================================
diff -u
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructuresSelectionDialog.cs (revision 0)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructuresSelectionDialog.cs (revision 7164a642dc83ca7a1fd78513cbff9da53c052602)
@@ -0,0 +1,54 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets 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 System.Linq;
+using System.Windows.Forms;
+using Ringtoets.Common.Forms;
+using Ringtoets.Common.Forms.Views;
+using Ringtoets.HeightStructures.Data;
+using Ringtoets.HeightStructures.Forms.Properties;
+
+namespace Ringtoets.HeightStructures.Forms
+{
+ public class StructuresSelectionDialog : SelectionDialogBase
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The parent of the dialog.
+ /// The collection of to show in the dialog.
+ /// Thrown when any parameter is null.
+ public StructuresSelectionDialog(IWin32Window dialogParent, IEnumerable structures)
+ : base(dialogParent)
+ {
+ if (structures == null)
+ {
+ throw new ArgumentNullException("structures");
+ }
+
+ InitializeDataGridView(Resources.Structure_DisplayName);
+
+ SetDataSource(structures.Select(structure => new SelectableRow(structure, structure.Name)).ToArray());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs
===================================================================
diff -u -r6b9fda141298524c0910937dd090d82be420c52b -r7164a642dc83ca7a1fd78513cbff9da53c052602
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 6b9fda141298524c0910937dd090d82be420c52b)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 7164a642dc83ca7a1fd78513cbff9da53c052602)
@@ -25,7 +25,9 @@
using System.IO;
using System.Linq;
using System.Windows.Forms;
+using Core.Common.Base;
using Core.Common.Controls.TreeView;
+using Core.Common.Gui.ContextMenu;
using Core.Common.Gui.Forms.ProgressDialog;
using Core.Common.Gui.Plugin;
using Ringtoets.Common.Data;
@@ -36,10 +38,12 @@
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.TreeNodeInfos;
using Ringtoets.HeightStructures.Data;
+using Ringtoets.HeightStructures.Forms;
using Ringtoets.HeightStructures.Forms.PresentationObjects;
using Ringtoets.HeightStructures.Forms.PropertyClasses;
using Ringtoets.HeightStructures.Forms.Views;
using Ringtoets.HeightStructures.IO;
+using Ringtoets.HeightStructures.Plugin.Properties;
using Ringtoets.HeightStructures.Service;
using Ringtoets.HydraRing.IO;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
@@ -347,6 +351,12 @@
var builder = new RingtoetsContextMenuBuilder(Gui.Get(context, treeViewControl));
var isNestedGroup = parentData is HeightStructuresCalculationGroupContext;
+ if (!isNestedGroup)
+ {
+ builder.AddCustomItem(CreateGenerateWaveConditionsCalculationsItem(context))
+ .AddSeparator();
+ }
+
builder.AddCreateCalculationGroupItem(group)
.AddCreateCalculationItem(context, AddCalculation);
@@ -379,6 +389,55 @@
.Build();
}
+ private StrictContextMenuItem CreateGenerateWaveConditionsCalculationsItem(HeightStructuresCalculationGroupContext nodeData)
+ {
+ ObservableList heightStructures = nodeData.FailureMechanism.HeightStructures;
+ bool structuresAvailable = heightStructures.Any();
+
+ string stabilityStoneCoverWaveConditionsCalculationGroupContextToolTip = structuresAvailable
+ ? Resources.HeightStructuresPlugin_Generate_calculations_for_selected_strutures
+ : Resources.HeightStructuresPlugin_No_structures_to_generate_for;
+
+ return new StrictContextMenuItem(RingtoetsCommonFormsResources.CalculationsGroup_Generate_calculations,
+ stabilityStoneCoverWaveConditionsCalculationGroupContextToolTip,
+ RingtoetsCommonFormsResources.GenerateScenariosIcon,
+ (sender, args) => { ShowHeightStructuresSelectionDialog(nodeData); })
+ {
+ Enabled = structuresAvailable
+ };
+ }
+
+ private void ShowHeightStructuresSelectionDialog(HeightStructuresCalculationGroupContext nodeData)
+ {
+ using (var dialog = new StructuresSelectionDialog(Gui.MainWindow, nodeData.FailureMechanism.HeightStructures))
+ {
+ dialog.ShowDialog();
+
+ if (dialog.SelectedItems.Any())
+ {
+ GenerateHeightStructuresCalculations(dialog.SelectedItems, nodeData.WrappedData.Children);
+ nodeData.NotifyObservers();
+ }
+ }
+ }
+
+ private static void GenerateHeightStructuresCalculations(IEnumerable structures,
+ IList calculations)
+ {
+ foreach (var structure in structures)
+ {
+ var calculation = new HeightStructuresCalculation
+ {
+ Name = NamingHelper.GetUniqueName(calculations, structure.Name, c => c.Name),
+ InputParameters =
+ {
+ HeightStructure = structure
+ }
+ };
+ calculations.Add(calculation);
+ }
+ }
+
private static void CalculationGroupContextOnNodeRemoved(HeightStructuresCalculationGroupContext context, object parentNodeData)
{
var parentGroupContext = (HeightStructuresCalculationGroupContext) parentNodeData;
Fisheye: Tag e568165b751acf8d72cdf0d128f76d7792dadb56 refers to a dead (removed) revision in file `Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/Properties/Resources.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e568165b751acf8d72cdf0d128f76d7792dadb56 refers to a dead (removed) revision in file `Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/Properties/Resources.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/Ringtoets.HeightStructures.Plugin.csproj
===================================================================
diff -u -r423010168fe01b2373e9be55f047659911e670f5 -r7164a642dc83ca7a1fd78513cbff9da53c052602
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/Ringtoets.HeightStructures.Plugin.csproj (.../Ringtoets.HeightStructures.Plugin.csproj) (revision 423010168fe01b2373e9be55f047659911e670f5)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/Ringtoets.HeightStructures.Plugin.csproj (.../Ringtoets.HeightStructures.Plugin.csproj) (revision 7164a642dc83ca7a1fd78513cbff9da53c052602)
@@ -43,6 +43,11 @@
+
+ True
+ True
+ Resources.resx
+
@@ -126,6 +131,12 @@
Copying.licenseheader
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+