Fisheye: Tag 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/AssessmentSectionFromFileCommandHandler.cs
===================================================================
diff -u -r707e86ed42f964fde0eaeba837272f8e62521ba9 -r55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/AssessmentSectionFromFileCommandHandler.cs (.../AssessmentSectionFromFileCommandHandler.cs) (revision 707e86ed42f964fde0eaeba837272f8e62521ba9)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/AssessmentSectionFromFileCommandHandler.cs (.../AssessmentSectionFromFileCommandHandler.cs) (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -37,6 +37,7 @@
using Ringtoets.Common.IO.Exceptions;
using Ringtoets.Common.IO.ReferenceLines;
using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Forms.Dialogs;
using Ringtoets.Integration.Forms.Properties;
using IntegrationResources = Ringtoets.Integration.Data.Properties.Resources;
using BaseResources = Core.Common.Base.Properties.Resources;
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.Designer.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.Designer.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.Designer.cs (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -0,0 +1,135 @@
+// Copyright (C) Stichting Deltares 2017. 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.
+
+namespace Ringtoets.Integration.Forms.Dialogs
+{
+ partial class BackgroundMapDataSelectionDialog
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BackgroundMapDataSelectionDialog));
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
+ this.mapLayerLabel = new System.Windows.Forms.Label();
+ this.mapLayerComboBox = new System.Windows.Forms.ComboBox();
+ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.selectButton = new System.Windows.Forms.Button();
+ this.propertiesGroupBox = new System.Windows.Forms.GroupBox();
+ this.tableLayoutPanel1.SuspendLayout();
+ this.flowLayoutPanel2.SuspendLayout();
+ this.flowLayoutPanel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // tableLayoutPanel1
+ //
+ resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
+ this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 0);
+ this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 2);
+ this.tableLayoutPanel1.Controls.Add(this.propertiesGroupBox, 0, 1);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ //
+ // flowLayoutPanel2
+ //
+ resources.ApplyResources(this.flowLayoutPanel2, "flowLayoutPanel2");
+ this.flowLayoutPanel2.Controls.Add(this.mapLayerLabel);
+ this.flowLayoutPanel2.Controls.Add(this.mapLayerComboBox);
+ this.flowLayoutPanel2.Name = "flowLayoutPanel2";
+ //
+ // mapLayerLabel
+ //
+ resources.ApplyResources(this.mapLayerLabel, "mapLayerLabel");
+ this.mapLayerLabel.Name = "mapLayerLabel";
+ //
+ // mapLayerComboBox
+ //
+ this.mapLayerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.mapLayerComboBox.FormattingEnabled = true;
+ resources.ApplyResources(this.mapLayerComboBox, "mapLayerComboBox");
+ this.mapLayerComboBox.Name = "mapLayerComboBox";
+ this.mapLayerComboBox.Sorted = true;
+ this.mapLayerComboBox.SelectedIndexChanged += new System.EventHandler(this.MapLayerComboBox_OnSelectedIndexChanged);
+ //
+ // flowLayoutPanel1
+ //
+ resources.ApplyResources(this.flowLayoutPanel1, "flowLayoutPanel1");
+ this.flowLayoutPanel1.Controls.Add(this.cancelButton);
+ this.flowLayoutPanel1.Controls.Add(this.selectButton);
+ this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+ //
+ // cancelButton
+ //
+ this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ resources.ApplyResources(this.cancelButton, "cancelButton");
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ //
+ // selectButton
+ //
+ resources.ApplyResources(this.selectButton, "selectButton");
+ this.selectButton.Name = "selectButton";
+ this.selectButton.UseVisualStyleBackColor = true;
+ this.selectButton.Click += new System.EventHandler(this.OnSelectButtonClick);
+ //
+ // propertiesGroupBox
+ //
+ resources.ApplyResources(this.propertiesGroupBox, "propertiesGroupBox");
+ this.propertiesGroupBox.Name = "propertiesGroupBox";
+ this.propertiesGroupBox.TabStop = false;
+ //
+ // BackgroundMapDataSelectionDialog
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.tableLayoutPanel1);
+ this.Name = "BackgroundMapDataSelectionDialog";
+ this.tableLayoutPanel1.ResumeLayout(false);
+ this.tableLayoutPanel1.PerformLayout();
+ this.flowLayoutPanel2.ResumeLayout(false);
+ this.flowLayoutPanel2.PerformLayout();
+ this.flowLayoutPanel1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
+ private System.Windows.Forms.Button cancelButton;
+ private System.Windows.Forms.Button selectButton;
+ private System.Windows.Forms.GroupBox propertiesGroupBox;
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
+ private System.Windows.Forms.Label mapLayerLabel;
+ private System.Windows.Forms.ComboBox mapLayerComboBox;
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.cs (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -0,0 +1,174 @@
+// Copyright (C) Stichting Deltares 2017. 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 Core.Common.Controls.Dialogs;
+using Core.Components.BruTile.Forms;
+using Core.Components.Gis.Data;
+using Core.Components.Gis.Forms.Views;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.Dialogs
+{
+ ///
+ /// A dialog which allows the user to make a selection from a given set of background layers. Upon
+ /// closing of the dialog, the selected background layer can be obtained.
+ ///
+ public partial class BackgroundMapDataSelectionDialog : DialogBase
+ {
+ private readonly HashSet mapDatas;
+ private BackgroundMapDataSelectionControl currentBackgroundMapDataSelectionControl;
+ private bool mapLayerComboBoxUpdating;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The parent of the dialog.
+ /// The active map data or null if none is active.
+ /// Thrown when is null.
+ public BackgroundMapDataSelectionDialog(IWin32Window dialogParent, ImageBasedMapData mapData)
+ : base(dialogParent, RingtoetsCommonFormsResources.SelectionDialogIcon, 500, 350)
+ {
+ mapDatas = new HashSet
+ {
+ new WellKnownMapDataControl(mapData as WellKnownTileSourceMapData),
+ new WmtsLocationControl(mapData as WmtsMapData, new BruTileWmtsCapabilityFactory())
+ };
+
+ InitializeComponent();
+ InitializeButtons();
+
+ BackgroundMapDataSelectionControl controlToSelect = GetBackgroundMapDataControlToSelect(mapData);
+ PreSelectComboBox(controlToSelect);
+ }
+
+ ///
+ /// Gets the selected or null if none selected.
+ ///
+ public ImageBasedMapData SelectedMapData { get; private set; }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ components?.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private BackgroundMapDataSelectionControl GetBackgroundMapDataControlToSelect(ImageBasedMapData mapData)
+ {
+ if (mapData is WellKnownTileSourceMapData)
+ {
+ return mapDatas.OfType().Single();
+ }
+ if (mapData is WmtsMapData)
+ {
+ return mapDatas.OfType().Single();
+ }
+ return mapDatas.First();
+ }
+
+ private void UpdatePropertiesGroupBox(BackgroundMapDataSelectionControl newBackgroundMapDataSelectionControl)
+ {
+ if (currentBackgroundMapDataSelectionControl != null)
+ {
+ currentBackgroundMapDataSelectionControl.SelectedMapDataChanged -= OnSelectedMapDataSelectionChanged;
+ }
+
+ propertiesGroupBox.Controls.Clear();
+ propertiesGroupBox.Controls.Add(newBackgroundMapDataSelectionControl);
+ newBackgroundMapDataSelectionControl.Dock = DockStyle.Fill;
+ newBackgroundMapDataSelectionControl.SelectedMapDataChanged += OnSelectedMapDataSelectionChanged;
+
+ currentBackgroundMapDataSelectionControl = newBackgroundMapDataSelectionControl;
+ UpdateSelectButton();
+ }
+
+ #region ComboBox
+
+ private void PreSelectComboBox(BackgroundMapDataSelectionControl controlToSelect)
+ {
+ mapLayerComboBox.BeginUpdate();
+
+ mapLayerComboBoxUpdating = true;
+ mapLayerComboBox.DataSource = mapDatas.ToArray();
+ mapLayerComboBox.DisplayMember = nameof(BackgroundMapDataSelectionControl.DisplayName);
+ mapLayerComboBox.SelectedItem = null;
+ mapLayerComboBoxUpdating = false;
+
+ mapLayerComboBox.EndUpdate();
+
+ mapLayerComboBox.SelectedItem = controlToSelect;
+ currentBackgroundMapDataSelectionControl = controlToSelect;
+ }
+
+ #endregion
+
+ #region Buttons
+
+ private void InitializeButtons()
+ {
+ UpdateSelectButton();
+ }
+
+ private void UpdateSelectButton()
+ {
+ selectButton.Enabled = currentBackgroundMapDataSelectionControl?.SelectedMapData != null;
+ }
+
+ protected override Button GetCancelButton()
+ {
+ return cancelButton;
+ }
+
+ #endregion
+
+ #region Event handlers
+
+ private void OnSelectButtonClick(object sender, EventArgs e)
+ {
+ SelectedMapData = currentBackgroundMapDataSelectionControl.SelectedMapData;
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+
+ private void OnSelectedMapDataSelectionChanged(object sender, EventArgs e)
+ {
+ UpdateSelectButton();
+ }
+
+ private void MapLayerComboBox_OnSelectedIndexChanged(object sender, EventArgs eventArgs)
+ {
+ if (mapLayerComboBoxUpdating || mapLayerComboBox.SelectedIndex == -1)
+ {
+ return;
+ }
+
+ UpdatePropertiesGroupBox((BackgroundMapDataSelectionControl) mapLayerComboBox.SelectedItem);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.resx
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.resx (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/BackgroundMapDataSelectionDialog.resx (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -0,0 +1,357 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ 1
+
+
+ True
+
+
+ True
+
+
+
+ 3, 6
+
+
+
+ 3, 6, 3, 0
+
+
+ 78, 13
+
+
+ 0
+
+
+ Type kaartlaag
+
+
+ mapLayerLabel
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ flowLayoutPanel2
+
+
+ 0
+
+
+ 87, 3
+
+
+ 255, 21
+
+
+ 0
+
+
+ mapLayerComboBox
+
+
+ System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ flowLayoutPanel2
+
+
+ 1
+
+
+ Top
+
+
+ 3, 3
+
+
+ 728, 27
+
+
+ 0
+
+
+ flowLayoutPanel2
+
+
+ System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tableLayoutPanel1
+
+
+ 0
+
+
+ True
+
+
+ 650, 3
+
+
+ 75, 23
+
+
+ 1
+
+
+ Annuleren
+
+
+ cancelButton
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ flowLayoutPanel1
+
+
+ 0
+
+
+ 569, 3
+
+
+ 75, 23
+
+
+ 2
+
+
+ Selecteren
+
+
+ selectButton
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ flowLayoutPanel1
+
+
+ 1
+
+
+ Bottom
+
+
+ 3, 480
+
+
+ Yes
+
+
+ 728, 29
+
+
+ 0
+
+
+ flowLayoutPanel1
+
+
+ System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tableLayoutPanel1
+
+
+ 1
+
+
+ Fill
+
+
+ 3, 36
+
+
+ 728, 438
+
+
+ 1
+
+
+ Eigenschappen
+
+
+ propertiesGroupBox
+
+
+ System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tableLayoutPanel1
+
+
+ 2
+
+
+ Fill
+
+
+ 0, 0
+
+
+ 3
+
+
+ 734, 512
+
+
+ 0
+
+
+ tableLayoutPanel1
+
+
+ System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 0
+
+
+ <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="flowLayoutPanel2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="flowLayoutPanel1" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="propertiesGroupBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,Percent,100,AutoSize,0,Absolute,20,Absolute,20" /></TableLayoutSettings>
+
+
+ True
+
+
+ 6, 13
+
+
+ 734, 512
+
+
+ Selecteer achtergrondkaart
+
+
+ BackgroundMapDataSelectionDialog
+
+
+ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.Designer.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.Designer.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.Designer.cs (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -0,0 +1,160 @@
+// Copyright (C) Stichting Deltares 2017. 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.
+
+namespace Ringtoets.Integration.Forms.Dialogs
+{
+ partial class ReferenceLineMetaSelectionDialog
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReferenceLineMetaSelectionDialog));
+ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+ this.Cancel = new System.Windows.Forms.Button();
+ this.Ok = new System.Windows.Forms.Button();
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.LowLimitValueRadioButton = new System.Windows.Forms.RadioButton();
+ this.SignallingValueRadioButton = new System.Windows.Forms.RadioButton();
+ this.ReferenceLineMetaDataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl();
+ this.SelectAssessmentSectionLabel = new System.Windows.Forms.Label();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.flowLayoutPanel1.SuspendLayout();
+ this.tableLayoutPanel1.SuspendLayout();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // flowLayoutPanel1
+ //
+ resources.ApplyResources(this.flowLayoutPanel1, "flowLayoutPanel1");
+ this.flowLayoutPanel1.Controls.Add(this.Cancel);
+ this.flowLayoutPanel1.Controls.Add(this.Ok);
+ this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+ //
+ // Cancel
+ //
+ this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ resources.ApplyResources(this.Cancel, "Cancel");
+ this.Cancel.Name = "Cancel";
+ this.Cancel.UseVisualStyleBackColor = true;
+ this.Cancel.Click += new System.EventHandler(this.CancelButtonOnClick);
+ //
+ // Ok
+ //
+ this.Ok.DialogResult = System.Windows.Forms.DialogResult.OK;
+ resources.ApplyResources(this.Ok, "Ok");
+ this.Ok.Name = "Ok";
+ this.Ok.UseVisualStyleBackColor = true;
+ this.Ok.Click += new System.EventHandler(this.OkButtonOnClick);
+ //
+ // tableLayoutPanel1
+ //
+ resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
+ this.tableLayoutPanel1.Controls.Add(this.SelectAssessmentSectionLabel, 0, 0);
+ this.tableLayoutPanel1.Controls.Add(this.ReferenceLineMetaDataGridViewControl, 0, 1);
+ this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 2);
+ this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 3);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ //
+ // LowLimitValueRadioButton
+ //
+ resources.ApplyResources(this.LowLimitValueRadioButton, "LowLimitValueRadioButton");
+ this.LowLimitValueRadioButton.Name = "LowLimitValueRadioButton";
+ this.LowLimitValueRadioButton.UseVisualStyleBackColor = true;
+ //
+ // SignallingValueRadioButton
+ //
+ resources.ApplyResources(this.SignallingValueRadioButton, "SignallingValueRadioButton");
+ this.SignallingValueRadioButton.Checked = true;
+ this.SignallingValueRadioButton.Name = "SignallingValueRadioButton";
+ this.SignallingValueRadioButton.TabStop = true;
+ this.SignallingValueRadioButton.UseVisualStyleBackColor = true;
+ //
+ // ReferenceLineMetaDataGridViewControl
+ //
+ resources.ApplyResources(this.ReferenceLineMetaDataGridViewControl, "ReferenceLineMetaDataGridViewControl");
+ this.ReferenceLineMetaDataGridViewControl.MultiSelect = false;
+ this.ReferenceLineMetaDataGridViewControl.Name = "ReferenceLineMetaDataGridViewControl";
+ this.ReferenceLineMetaDataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ //
+ // SelectAssessmentSectionLabel
+ //
+ resources.ApplyResources(this.SelectAssessmentSectionLabel, "SelectAssessmentSectionLabel");
+ this.SelectAssessmentSectionLabel.Name = "SelectAssessmentSectionLabel";
+ //
+ // groupBox1
+ //
+ resources.ApplyResources(this.groupBox1, "groupBox1");
+ this.groupBox1.Controls.Add(this.SignallingValueRadioButton);
+ this.groupBox1.Controls.Add(this.LowLimitValueRadioButton);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.TabStop = false;
+ //
+ // ReferenceLineMetaSelectionDialog
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.tableLayoutPanel1);
+ this.Name = "ReferenceLineMetaSelectionDialog";
+ this.flowLayoutPanel1.ResumeLayout(false);
+ this.tableLayoutPanel1.ResumeLayout(false);
+ this.tableLayoutPanel1.PerformLayout();
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
+ private System.Windows.Forms.Button Ok;
+ private System.Windows.Forms.Button Cancel;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private Core.Common.Controls.DataGrid.DataGridViewControl ReferenceLineMetaDataGridViewControl;
+ private System.Windows.Forms.RadioButton LowLimitValueRadioButton;
+ private System.Windows.Forms.RadioButton SignallingValueRadioButton;
+ private System.Windows.Forms.Label SelectAssessmentSectionLabel;
+ private System.Windows.Forms.GroupBox groupBox1;
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.cs (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -0,0 +1,237 @@
+// Copyright (C) Stichting Deltares 2017. 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.Text.RegularExpressions;
+using System.Windows.Forms;
+using Core.Common.Controls.DataGrid;
+using Core.Common.Controls.Dialogs;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Integration.Forms.Properties;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.Dialogs
+{
+ ///
+ /// A dialog which allows the user to make a selection from a given set of . Upon
+ /// closing of the dialog, the selected can be obtained.
+ ///
+ public partial class ReferenceLineMetaSelectionDialog : DialogBase
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The parent of the dialog.
+ /// A list of the user can select.
+ /// Thrown when or
+ /// is null.
+ public ReferenceLineMetaSelectionDialog(IWin32Window dialogParent, IEnumerable referenceLineMetas)
+ : base(dialogParent, RingtoetsCommonFormsResources.SelectionDialogIcon, 372, 350)
+ {
+ if (referenceLineMetas == null)
+ {
+ throw new ArgumentNullException(nameof(referenceLineMetas));
+ }
+ InitializeComponent();
+ InitializeReferenceLineMetaDataGridViewControl(referenceLineMetas);
+ }
+
+ ///
+ /// Gets the from the selected row in the .
+ ///
+ public ReferenceLineMeta SelectedReferenceLineMeta { get; private set; }
+
+ ///
+ /// Gets the lower limit norm value from the selected row in the .
+ ///
+ public double SelectedLowerLimitNorm { get; private set; }
+
+ ///
+ /// Gets the signaling norm value from the selected row in the .
+ ///
+ public double SelectedSignalingNorm { get; private set; }
+
+ ///
+ /// Gets the norm type from the selected in the dialog.
+ ///
+ public NormType SelectedNormativeNorm { get; private set; }
+
+ protected override Button GetCancelButton()
+ {
+ return Cancel;
+ }
+
+ private void InitializeReferenceLineMetaDataGridViewControl(IEnumerable referenceLineMetas)
+ {
+ ReferenceLineMetaDataGridViewControl.AddTextBoxColumn("AssessmentSectionId", Resources.ReferenceLineMetaSelectionDialog_ColumnHeader_AssessmentSectionId);
+ ReferenceLineMetaDataGridViewControl.AddTextBoxColumn("SignalingValue", Resources.ReferenceLineMetaSelectionDialog_ColumnHeader_SignalingValue);
+ ReferenceLineMetaDataGridViewControl.AddTextBoxColumn("LowerLimitValue", Resources.ReferenceLineMetaSelectionDialog_ColumnHeader_LowerLimitValue);
+
+ IOrderedEnumerable dataSource = referenceLineMetas.Select(rlm => new ReferenceLineMetaSelectionRow(rlm)).OrderBy(row => row.AssessmentSectionId, new AssessmentSectionIdComparer());
+ ReferenceLineMetaDataGridViewControl.SetDataSource(dataSource.ToArray());
+ }
+
+ private void OkButtonOnClick(object sender, EventArgs e)
+ {
+ SetSelectionProperties();
+ Close();
+ }
+
+ private void SetSelectionProperties()
+ {
+ ReferenceLineMetaSelectionRow referenceLineMetaSelectionRow = GetSelectedReferenceLineMetaSelectionRow();
+ if (referenceLineMetaSelectionRow != null)
+ {
+ SelectedReferenceLineMeta = referenceLineMetaSelectionRow.ReferenceLineMeta;
+
+ SelectedNormativeNorm = SignallingValueRadioButton.Checked
+ ? NormType.Signaling
+ : NormType.LowerLimit;
+
+ double lowerLimitNormValue = GetNormValue(referenceLineMetaSelectionRow.LowerLimitValueReturnPeriod);
+
+ SelectedLowerLimitNorm = lowerLimitNormValue;
+ SelectedSignalingNorm = referenceLineMetaSelectionRow.SignalingReturnPeriod.HasValue
+ ? GetNormValue(referenceLineMetaSelectionRow.SignalingReturnPeriod.Value)
+ : lowerLimitNormValue;
+ }
+ }
+
+ private static double GetNormValue(int returnPeriod)
+ {
+ return 1.0 / returnPeriod;
+ }
+
+ private ReferenceLineMetaSelectionRow GetSelectedReferenceLineMetaSelectionRow()
+ {
+ DataGridViewRow selectedRow = ReferenceLineMetaDataGridViewControl.CurrentRow;
+ return (ReferenceLineMetaSelectionRow) selectedRow?.DataBoundItem;
+ }
+
+ private void CancelButtonOnClick(object sender, EventArgs e)
+ {
+ Close();
+ }
+
+ private class AssessmentSectionIdComparer : IComparer
+ {
+ public int Compare(string x, string y)
+ {
+ int idX;
+ string suffixX;
+ int subX;
+
+ int idY;
+ string suffixY;
+ int subY;
+
+ SplitAssessmentSectionId(x, out idX, out suffixX, out subX);
+ SplitAssessmentSectionId(y, out idY, out suffixY, out subY);
+
+ if (idX != idY)
+ {
+ return idX - idY;
+ }
+
+ if (string.IsNullOrEmpty(suffixX) != string.IsNullOrEmpty(suffixY))
+ {
+ return string.IsNullOrEmpty(suffixX) ? -1 : 1;
+ }
+ if (!string.IsNullOrEmpty(suffixX) && suffixX != suffixY)
+ {
+ return string.Compare(suffixX, suffixY, StringComparison.Ordinal);
+ }
+ return subX - subY;
+ }
+
+ private static void SplitAssessmentSectionId(string str, out int id, out string suffix, out int sub)
+ {
+ if (string.IsNullOrEmpty(str))
+ {
+ id = 0;
+ sub = 0;
+ suffix = string.Empty;
+ return;
+ }
+ string[] parts = str.Split('-');
+ string[] firstPart = Regex.Split(parts.First(), "([A-Za-z])");
+ if (firstPart.Length > 1)
+ {
+ int.TryParse(firstPart[0], out id);
+ suffix = firstPart[1];
+ }
+ else
+ {
+ int.TryParse(parts[0], out id);
+ suffix = string.Empty;
+ }
+
+ if (parts.Length == 2)
+ {
+ int.TryParse(parts[1], out sub);
+ }
+ else
+ {
+ sub = 0;
+ }
+ }
+ }
+
+ private class ReferenceLineMetaSelectionRow
+ {
+ public ReferenceLineMetaSelectionRow(ReferenceLineMeta referenceLineMeta)
+ {
+ AssessmentSectionId = referenceLineMeta.AssessmentSectionId;
+ ReferenceLineMeta = referenceLineMeta;
+
+ SignalingValue = GetNormValue(referenceLineMeta.SignalingValue);
+ if (SignalingValue != string.Empty)
+ {
+ SignalingReturnPeriod = referenceLineMeta.SignalingValue;
+ }
+
+ LowerLimitValue = GetNormValue(referenceLineMeta.LowerLimitValue);
+ if (LowerLimitValue != string.Empty)
+ {
+ LowerLimitValueReturnPeriod = referenceLineMeta.LowerLimitValue;
+ }
+ }
+
+ public string AssessmentSectionId { get; }
+ public string SignalingValue { get; }
+ public int? SignalingReturnPeriod { get; }
+ public string LowerLimitValue { get; }
+ public int LowerLimitValueReturnPeriod { get; }
+ public ReferenceLineMeta ReferenceLineMeta { get; }
+
+ private static string GetNormValue(int? returnPeriod)
+ {
+ return returnPeriod.HasValue && returnPeriod > 0
+ ? ProbabilityFormattingHelper.FormatFromReturnPeriod(returnPeriod.Value)
+ : string.Empty;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.resx
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.resx (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/ReferenceLineMetaSelectionDialog.resx (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -0,0 +1,393 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ True
+
+
+
+ 200, 3
+
+
+ 75, 23
+
+
+ 1
+
+
+ Annuleren
+
+
+ Cancel
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ flowLayoutPanel1
+
+
+ 0
+
+
+ 119, 3
+
+
+ 75, 23
+
+
+ 0
+
+
+ Toevoegen
+
+
+ Ok
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ flowLayoutPanel1
+
+
+ 1
+
+
+
+ Bottom
+
+
+ 3, 259
+
+
+ Yes
+
+
+ 278, 29
+
+
+ 0
+
+
+ flowLayoutPanel1
+
+
+ System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tableLayoutPanel1
+
+
+ 3
+
+
+ 1
+
+
+ True
+
+
+ 3, 15
+
+
+ 3, 15, 3, 3
+
+
+ 108, 13
+
+
+ 0
+
+
+ Selecteer een traject:
+
+
+ SelectAssessmentSectionLabel
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tableLayoutPanel1
+
+
+ 0
+
+
+ Top, Bottom, Left, Right
+
+
+ 3, 34
+
+
+ 278, 135
+
+
+ 2
+
+
+ ReferenceLineMetaDataGridViewControl
+
+
+ Core.Common.Controls.DataGrid.DataGridViewControl, Core.Common.Controls, Culture=neutral, PublicKeyToken=null
+
+
+ tableLayoutPanel1
+
+
+ 1
+
+
+ Top, Bottom, Left, Right
+
+
+ True
+
+
+ 6, 19
+
+
+ 117, 17
+
+
+ 2
+
+
+ Signaleringswaarde
+
+
+ SignallingValueRadioButton
+
+
+ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ groupBox1
+
+
+ 0
+
+
+ True
+
+
+ 6, 42
+
+
+ 80, 17
+
+
+ 3
+
+
+ Ondergrens
+
+
+ LowLimitValueRadioButton
+
+
+ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ groupBox1
+
+
+ 1
+
+
+ 3, 187
+
+
+ 3, 15, 3, 3
+
+
+ 278, 66
+
+
+ 4
+
+
+ Kies de norm van het dijktraject:
+
+
+ groupBox1
+
+
+ System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tableLayoutPanel1
+
+
+ 2
+
+
+ Fill
+
+
+ 0, 0
+
+
+ 3
+
+
+ 284, 291
+
+
+ 2
+
+
+ tableLayoutPanel1
+
+
+ System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 0
+
+
+ <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="SelectAssessmentSectionLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="ReferenceLineMetaDataGridViewControl" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="groupBox1" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="flowLayoutPanel1" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,Percent,100,AutoSize,0,AutoSize,0" /></TableLayoutSettings>
+
+
+ True
+
+
+ 6, 13
+
+
+ 284, 291
+
+
+ 240, 130
+
+
+ Stel een traject samen
+
+
+ ReferenceLineMetaSelectionDialog
+
+
+ Core.Common.Controls.Dialogs.DialogBase, Core.Common.Controls, Culture=neutral, PublicKeyToken=null
+
+
\ No newline at end of file
Fisheye: Tag 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/ReferenceLineMetaSelectionDialog.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/ReferenceLineMetaSelectionDialog.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/ReferenceLineMetaSelectionDialog.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -rdc5c060596974db6fc401c9abdbdfaea858132a2 -r55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision dc5c060596974db6fc401c9abdbdfaea858132a2)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -18,10 +18,10 @@
-
+
Form
-
+
BackgroundMapDataSelectionDialog.cs
@@ -61,10 +61,10 @@
-
+
Form
-
+
ReferenceLineMetaSelectionDialog.cs
@@ -280,15 +280,15 @@
-
+
BackgroundMapDataSelectionDialog.cs
PublicResXFileCodeGenerator
Designer
Resources.Designer.cs
-
+
ReferenceLineMetaSelectionDialog.cs
Designer
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -rcf5f7a2fbcaf236ba2d6edfc111d6f89eacbd05e -r55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision cf5f7a2fbcaf236ba2d6edfc111d6f89eacbd05e)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -78,8 +78,8 @@
using Ringtoets.Integration.Data.StandAlone;
using Ringtoets.Integration.Data.StandAlone.Input;
using Ringtoets.Integration.Data.StandAlone.SectionResults;
-using Ringtoets.Integration.Forms;
using Ringtoets.Integration.Forms.Commands;
+using Ringtoets.Integration.Forms.Dialogs;
using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
using Ringtoets.Integration.Forms.PropertyClasses;
Fisheye: Tag 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/BackgroundMapDataSelectionDialogTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Commands/AssessmentSectionFromFileCommandHandlerTest.cs
===================================================================
diff -u -r401ea38da560543cd91415c326b9463976b2e80a -r55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Commands/AssessmentSectionFromFileCommandHandlerTest.cs (.../AssessmentSectionFromFileCommandHandlerTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Commands/AssessmentSectionFromFileCommandHandlerTest.cs (.../AssessmentSectionFromFileCommandHandlerTest.cs) (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -41,6 +41,7 @@
using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Integration.Data;
using Ringtoets.Integration.Forms.Commands;
+using Ringtoets.Integration.Forms.Dialogs;
namespace Ringtoets.Integration.Forms.Test.Commands
{
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/BackgroundMapDataSelectionDialogTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/BackgroundMapDataSelectionDialogTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/BackgroundMapDataSelectionDialogTest.cs (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -0,0 +1,461 @@
+// Copyright (C) Stichting Deltares 2017. 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.Drawing;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Windows.Forms;
+using Core.Common.Controls.DataGrid;
+using Core.Common.Controls.Dialogs;
+using Core.Common.TestUtil;
+using Core.Common.Util.TestUtil.Settings;
+using Core.Components.BruTile.Configurations;
+using Core.Components.BruTile.TestUtil;
+using Core.Components.Gis.Data;
+using Core.Components.Gis.Forms.Views;
+using Core.Components.Gis.TestUtil;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Integration.Forms.Dialogs;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.Test.Dialogs
+{
+ [TestFixture]
+ public class BackgroundMapDataSelectionDialogTest : NUnitFormTest
+ {
+ private MockRepository mockRepository;
+ private ITileSourceFactory tileFactory;
+ private static readonly string testPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Forms);
+
+ public override void Setup()
+ {
+ mockRepository = new MockRepository();
+ tileFactory = mockRepository.StrictMock();
+ }
+
+ public override void TearDown()
+ {
+ mockRepository.VerifyAll();
+ base.TearDown();
+ }
+
+ [Test]
+ public void Constructor_MapDataNull_DefaultProperties()
+ {
+ // Setup
+ var dialogParent = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ string settingsDirectory = Path.Combine(testPath, "EmptyWmtsConnectionInfo");
+ using (new UseCustomSettingsHelper(new TestSettingsHelper
+ {
+ ApplicationLocalUserSettingsDirectory = settingsDirectory
+ }))
+ {
+ // Call
+ using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, null))
+ {
+ // Assert
+ Assert.IsInstanceOf(dialog);
+ Assert.AreEqual("Selecteer achtergrondkaart", dialog.Text);
+
+ Icon icon = BitmapToIcon(RingtoetsCommonFormsResources.SelectionDialogIcon);
+ Bitmap expectedImage = icon.ToBitmap();
+ Bitmap actualImage = dialog.Icon.ToBitmap();
+ TestHelper.AssertImagesAreEqual(expectedImage, actualImage);
+
+ AssertMapDataControls(dialog);
+ }
+ }
+ }
+
+ [Test]
+ public void MapDataConstructor_ParentNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ mockRepository.ReplayAll();
+ var imageBasedMapData = new TestImageBasedMapData("someMapData", true);
+
+ // Call
+ TestDelegate test = () => new BackgroundMapDataSelectionDialog(null, imageBasedMapData);
+
+ // Assert
+ string parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("dialogParent", parameter);
+ }
+
+ [Test]
+ public void MapDataConstructor_WithWmtsMapData_DefaultProperties()
+ {
+ // Setup
+ var dialogParent = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ WmtsMapData mapData = WmtsMapDataTestHelper.CreateDefaultPdokMapData();
+
+ using (new UseCustomTileSourceFactoryConfig(tileFactory))
+ {
+ // Call
+ using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, mapData))
+ {
+ // Assert
+ AssertMapDataControls(dialog);
+ }
+ }
+ }
+
+ [Test]
+ public void MapDataConstructor_WithWellKnownMapData_DefaultProperties()
+ {
+ // Setup
+ var dialogParent = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ var random = new Random(124);
+ var mapData = new WellKnownTileSourceMapData(random.NextEnumValue());
+
+ string settingsDirectory = Path.Combine(testPath, "EmptyWmtsConnectionInfo");
+ using (new UseCustomSettingsHelper(new TestSettingsHelper
+ {
+ ApplicationLocalUserSettingsDirectory = settingsDirectory
+ }))
+ using (new UseCustomTileSourceFactoryConfig(tileFactory))
+ {
+ // Call
+ using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, mapData))
+ {
+ // Assert
+ AssertMapDataControls(dialog);
+ }
+ }
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void ShowDialog_Always_DefaultProperties()
+ {
+ // Setup
+ mockRepository.ReplayAll();
+
+ string settingsDirectory = Path.Combine(testPath, "EmptyWmtsConnectionInfo");
+ using (new UseCustomSettingsHelper(new TestSettingsHelper
+ {
+ ApplicationLocalUserSettingsDirectory = settingsDirectory
+ }))
+ using (var dialogParent = new Form())
+ using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, null))
+ {
+ // Call
+ dialog.Show();
+
+ // Assert
+ var mapLayerLabel = new LabelTester("mapLayerLabel", dialog);
+ Assert.AreEqual("Type kaartlaag", mapLayerLabel.Text);
+
+ var mapLayers = (ComboBox) new ComboBoxTester("mapLayerComboBox", dialog).TheObject;
+ Assert.IsTrue(mapLayers.Enabled);
+
+ var groupBoxProperties = new ControlTester("propertiesGroupBox", dialog);
+ Assert.AreEqual("Eigenschappen", groupBoxProperties.Text);
+
+ var buttonSelect = (Button) new ButtonTester("selectButton", dialog).TheObject;
+ Assert.AreEqual("Selecteren", buttonSelect.Text);
+ Assert.IsTrue(buttonSelect.Enabled);
+
+ var buttonCancel = (Button) new ButtonTester("cancelButton", dialog).TheObject;
+ Assert.AreEqual("Annuleren", buttonCancel.Text);
+
+ Assert.AreEqual(500, dialog.MinimumSize.Width);
+ Assert.AreEqual(350, dialog.MinimumSize.Height);
+ }
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenValidDialog_WhenCancelPressed_ThenSelectedMapDataNull()
+ {
+ // Given
+ mockRepository.ReplayAll();
+ Button cancelButton = null;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ using (new FormTester(name))
+ {
+ var button = new ButtonTester("cancelButton", name);
+ cancelButton = (Button) button.TheObject;
+ button.Click();
+ }
+ };
+
+ string settingsDirectory = Path.Combine(testPath, "EmptyWmtsConnectionInfo");
+ using (new UseCustomSettingsHelper(new TestSettingsHelper
+ {
+ ApplicationLocalUserSettingsDirectory = settingsDirectory
+ }))
+ using (var dialogParent = new Form())
+ using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, null))
+ {
+ // When
+ DialogResult dialogResult = dialog.ShowDialog();
+
+ // Then
+ Assert.AreEqual(DialogResult.Cancel, dialogResult);
+ Assert.IsNull(dialog.SelectedMapData);
+ Assert.AreEqual(dialog.CancelButton, cancelButton);
+ }
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenValidDialog_WhenSelectPressed_ThenSelectedMapDataSet()
+ {
+ // Given
+ mockRepository.ReplayAll();
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ using (new FormTester(name))
+ {
+ var button = new ButtonTester("selectButton", name);
+ button.Click();
+ }
+ };
+
+ string settingsDirectory = Path.Combine(testPath, "EmptyWmtsConnectionInfo");
+ using (new UseCustomSettingsHelper(new TestSettingsHelper
+ {
+ ApplicationLocalUserSettingsDirectory = settingsDirectory
+ }))
+ using (var dialogParent = new Form())
+ using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, null))
+ {
+ // When
+ DialogResult dialogResult = dialog.ShowDialog();
+
+ // Then
+ Assert.AreEqual(DialogResult.OK, dialogResult);
+ Assert.IsNotNull(dialog.SelectedMapData);
+ }
+ }
+
+ [Test]
+ public void GivenValidDialogWithoutMapData_WhenBackgroundMapDataSelectionControlSwitchedBackAndForth_ThenSelectButtonAsExpected()
+ {
+ // Given
+ mockRepository.ReplayAll();
+
+ string settingsDirectory = Path.Combine(testPath, "EmptyWmtsConnectionInfo");
+ using (new UseCustomSettingsHelper(new TestSettingsHelper
+ {
+ ApplicationLocalUserSettingsDirectory = settingsDirectory
+ }))
+ using (new UseCustomTileSourceFactoryConfig(tileFactory))
+ using (var dialogParent = new Form())
+ using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, null))
+ {
+ dialog.Show();
+
+ var selectButton = (Button) new ButtonTester("selectButton", dialog).TheObject;
+ var comboBox = (ComboBox) new ComboBoxTester("mapLayerComboBox", dialog).TheObject;
+ var wellKnownMapDataControl = GetComboBoxItem(comboBox);
+ var wmtsLocationControl = GetComboBoxItem(comboBox);
+
+ // Precondition state
+ comboBox.SelectedItem = wmtsLocationControl;
+ DataGridViewControl wmtsDataGridViewControl = dialog.Controls.Find("dataGridViewControl", true).OfType().First();
+ Assert.IsNull(wmtsDataGridViewControl.CurrentRow);
+ Assert.IsFalse(selectButton.Enabled);
+
+ // When
+ comboBox.SelectedItem = wellKnownMapDataControl;
+ DataGridViewControl wellKnownDataGridViewControl = dialog.Controls.Find("dataGridViewControl", true).OfType().First();
+ DataGridViewRow currentRow = wellKnownDataGridViewControl.CurrentRow;
+ Assert.AreEqual(0, currentRow.Index);
+ Assert.IsTrue(selectButton.Enabled);
+
+ // Then
+ comboBox.SelectedItem = wmtsLocationControl;
+ Assert.IsNull(wmtsDataGridViewControl.CurrentRow);
+ Assert.IsFalse(selectButton.Enabled);
+ }
+ }
+
+ [Test]
+ public void GivenValidDialog_WhenControlSwitched_ThenDoesNotListenToEventOfOldControl()
+ {
+ // Given
+ WmtsMapData activeWmtsMapData = WmtsMapDataTestHelper.CreateDefaultPdokMapData();
+
+ var capabilities = new[]
+ {
+ new TestWmtsTileSource(WmtsMapDataTestHelper.CreateAlternativePdokMapData()),
+ new TestWmtsTileSource(activeWmtsMapData)
+ };
+
+ tileFactory.Expect(tf => tf.GetWmtsTileSources(activeWmtsMapData.SourceCapabilitiesUrl)).Return(capabilities);
+ mockRepository.ReplayAll();
+
+ var wmtsLocationControlSelectedMapDataChanged = 0;
+
+ string settingsDirectory = Path.Combine(testPath, "EmptyWmtsConnectionInfo");
+ using (new UseCustomSettingsHelper(new TestSettingsHelper
+ {
+ ApplicationLocalUserSettingsDirectory = settingsDirectory
+ }))
+ using (new UseCustomTileSourceFactoryConfig(tileFactory))
+ using (var dialogParent = new Form())
+ using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, activeWmtsMapData))
+ {
+ dialog.Show();
+
+ var comboBox = (ComboBox) new ComboBoxTester("mapLayerComboBox", dialog).TheObject;
+ var wellKnownMapDataControl = GetComboBoxItem(comboBox);
+ var wmtsLocationControl = GetComboBoxItem(comboBox);
+
+ comboBox.SelectedItem = wmtsLocationControl;
+
+ Button connectButton = dialog.Controls.Find("connectToButton", true).OfType
-
+
@@ -59,7 +59,7 @@
-
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs
===================================================================
diff -u -r6f33b44599df032ecae3342b0aacd606a9e87c1f -r55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs (.../BackgroundDataTreeNodeInfoTest.cs) (revision 6f33b44599df032ecae3342b0aacd606a9e87c1f)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs (.../BackgroundDataTreeNodeInfoTest.cs) (revision 55bc38bfa86e54bbd5ee3c9abaa1117e4d918b03)
@@ -44,7 +44,7 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Util.TypeConverters;
-using Ringtoets.Integration.Forms;
+using Ringtoets.Integration.Forms.Dialogs;
using Ringtoets.Integration.Forms.Properties;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;