Fisheye: Tag 84afb606e58d67c6342c4f11bf66b042e49f52d6 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/CalculateDesignWaterLevelCommandHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/HydraulicBoundaryLocationCalculationCommandHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/HydraulicBoundaryLocationCalculationCommandHandler.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/HydraulicBoundaryLocationCalculationCommandHandler.cs (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -0,0 +1,94 @@ +// 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 Core.Common.Base.Service; +using Core.Common.Gui.Forms.ProgressDialog; +using log4net; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HydraRing.Data; +using Ringtoets.HydraRing.IO; +using Ringtoets.Integration.Forms.Properties; +using Ringtoets.Integration.Service; + +namespace Ringtoets.Integration.Forms.Commands +{ + /// + /// This class is responsible for calculating the + /// and . + /// + public class HydraulicBoundaryLocationCalculationCommandHandler : IHydraulicBoundaryLocationCalculationCommandHandler + { + private static readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryLocationCalculationCommandHandler)); + private readonly IWin32Window viewParent; + private readonly IAssessmentSection assessmentSection; + + /// + /// Initializes a new instance of the class. + /// + /// The parent of the view. + /// The assessment section. + public HydraulicBoundaryLocationCalculationCommandHandler(IWin32Window viewParent, IAssessmentSection assessmentSection) + { + if (viewParent == null) + { + throw new ArgumentNullException("viewParent"); + } + if (assessmentSection == null) + { + throw new ArgumentNullException("assessmentSection"); + } + this.viewParent = viewParent; + this.assessmentSection = assessmentSection; + } + + public void CalculateDesignWaterLevels(IEnumerable locations) + { + var activities = locations.Select(hbl => new DesignWaterLevelCalculationActivity(assessmentSection, hbl)).ToArray(); + RunActivities(activities); + } + + public void CalculateWaveHeights(IEnumerable locations) + { + var activities = locations.Select(hbl => new WaveHeightCalculationActivity(assessmentSection, hbl)).ToArray(); + RunActivities(activities); + } + + private void RunActivities(IList activities) where TActivity : Activity + { + var hrdFile = assessmentSection.HydraulicBoundaryDatabase.FilePath; + var validationProblem = HydraulicDatabaseHelper.ValidatePathForCalculation(hrdFile); + if (string.IsNullOrEmpty(validationProblem)) + { + ActivityProgressDialogRunner.Run(viewParent, activities); + + assessmentSection.HydraulicBoundaryDatabase.NotifyObservers(); + } + else + { + log.ErrorFormat(Resources.CalculateHydraulicBoundaryLocation_ContextMenuStrip_Start_calculation_failed_0_, validationProblem); + } + } + } +} \ No newline at end of file Fisheye: Tag 84afb606e58d67c6342c4f11bf66b042e49f52d6 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/ICalculateDesignWaterLevelCommandHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/IHydraulicBoundaryLocationCalculationCommandHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/IHydraulicBoundaryLocationCalculationCommandHandler.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/IHydraulicBoundaryLocationCalculationCommandHandler.cs (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -0,0 +1,47 @@ +// 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.Collections.Generic; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Integration.Forms.Commands +{ + /// + /// Interface for and + /// calculations. + /// + public interface IHydraulicBoundaryLocationCalculationCommandHandler + { + /// + /// Performs the calculation for all . + /// + /// The objects to calculate + /// the for. + void CalculateDesignWaterLevels(IEnumerable locations); + + /// + /// Performs the calculation for all . + /// + /// The objects to calculate + /// the for. + void CalculateWaveHeights(IEnumerable locations); + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r6de162f9e652176605480f16f131ae9a14fbe05f -r84afb606e58d67c6342c4f11bf66b042e49f52d6 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6de162f9e652176605480f16f131ae9a14fbe05f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -1,4 +1,25 @@ -//------------------------------------------------------------------------------ +// 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. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -295,15 +316,6 @@ } /// - /// Looks up a localized string similar to Berekenen. - /// - public static string DesignWaterLevelLocationContextRow_Calculate { - get { - return ResourceManager.GetString("DesignWaterLevelLocationContextRow_Calculate", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Toetspeilen. /// public static string DesignWaterLevelLocationsContext_DisplayName { @@ -552,6 +564,15 @@ } /// + /// Looks up a localized string similar to Berekenen. + /// + public static string HydraulicBoundaryLocationsView_Calculate { + get { + return ResourceManager.GetString("HydraulicBoundaryLocationsView_Calculate", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap Map { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -r6de162f9e652176605480f16f131ae9a14fbe05f -r84afb606e58d67c6342c4f11bf66b042e49f52d6 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6de162f9e652176605480f16f131ae9a14fbe05f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -318,7 +318,7 @@ Convergentie status van de golfhoogte berekening. - + Berekenen Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r8767bf4def15fc3152bab00df2e7ca1c76e64b18 -r84afb606e58d67c6342c4f11bf66b042e49f52d6 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 8767bf4def15fc3152bab00df2e7ca1c76e64b18) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -48,9 +48,9 @@ - + - + @@ -101,6 +101,7 @@ DesignWaterLevelLocationsView.cs + @@ -162,6 +163,13 @@ UserControl + + + UserControl + + + WaveHeightLocationsView.cs + @@ -273,6 +281,9 @@ DesignWaterLevelLocationsView.cs Designer + + WaveHeightLocationsView.cs + Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationContextRow.cs =================================================================== diff -u -r5bdb5ecc12d8c8e7ef49b63f0a40dfbdd2532d54 -r84afb606e58d67c6342c4f11bf66b042e49f52d6 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationContextRow.cs (.../DesignWaterLevelLocationContextRow.cs) (revision 5bdb5ecc12d8c8e7ef49b63f0a40dfbdd2532d54) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationContextRow.cs (.../DesignWaterLevelLocationContextRow.cs) (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -22,93 +22,35 @@ using System; using System.ComponentModel; using Core.Common.Base.Data; -using Core.Common.Base.Geometry; using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Forms.PresentationObjects; namespace Ringtoets.Integration.Forms.Views { /// /// This class represents a row of . /// - internal class DesignWaterLevelLocationContextRow + internal class DesignWaterLevelLocationContextRow : HydraulicBoundaryLocationContextRow { - private readonly DesignWaterLevelLocationContext designWaterLevelLocationContext; - /// /// Creates a new instance of . /// - /// The for this row. - /// Thrown when is null. - internal DesignWaterLevelLocationContextRow(DesignWaterLevelLocationContext designWaterLevelLocationContext) - { - if (designWaterLevelLocationContext == null) - { - throw new ArgumentNullException("designWaterLevelLocationContext"); - } + /// The for this row. + /// Thrown when is null. + internal DesignWaterLevelLocationContextRow(DesignWaterLevelLocationContext hydraulicBoundaryLocationContext) + : base(hydraulicBoundaryLocationContext) {} - this.designWaterLevelLocationContext = designWaterLevelLocationContext; - } - /// - /// Gets or sets whether the is set to be calculated. + /// Gets the . /// - public bool ToCalculate { get; set; } - - /// - /// Gets the . - /// - public string Name - { - get - { - return designWaterLevelLocationContext.HydraulicBoundaryLocation.Name; - } - } - - /// - /// Gets the . - /// - public long Id - { - get - { - return designWaterLevelLocationContext.HydraulicBoundaryLocation.Id; - } - } - - /// - /// Gets the . - /// - public Point2D Location - { - get - { - return designWaterLevelLocationContext.HydraulicBoundaryLocation.Location; - } - } - - /// - /// Gets the . - /// [TypeConverter(typeof(NoValueRoundedDoubleConverter))] public RoundedDouble DesignWaterLevel { get { - return new RoundedDouble(2, designWaterLevelLocationContext.HydraulicBoundaryLocation.DesignWaterLevel); + return HydraulicBoundaryLocationContext.HydraulicBoundaryLocation.DesignWaterLevel; } } - - /// - /// Gets the . - /// - public DesignWaterLevelLocationContext DesignWaterLevelLocationContext - { - get - { - return designWaterLevelLocationContext; - } - } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs =================================================================== diff -u -r8351a9c0ff58140e8b0e5e65f7790e210f6d648a -r84afb606e58d67c6342c4f11bf66b042e49f52d6 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 8351a9c0ff58140e8b0e5e65f7790e210f6d648a) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -64,9 +64,9 @@ public IApplicationSelection ApplicationSelection { get; set; } /// - /// Gets or sets the . + /// Gets or sets the . /// - public ICalculateDesignWaterLevelCommandHandler CalculationCommandHandler { get; set; } + public IHydraulicBoundaryLocationCalculationCommandHandler CalculationCommandHandler { get; set; } public object Data { @@ -114,7 +114,7 @@ dataGridViewControl.AddCellClickHandler(DataGridViewOnCellClick); dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName(row => row.ToCalculate), - Resources.DesignWaterLevelLocationContextRow_Calculate); + Resources.HydraulicBoundaryLocationsView_Calculate); dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Name), Resources.HydraulicBoundaryDatabase_Locations_Name_DisplayName); dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Id), @@ -143,9 +143,9 @@ return dataGridViewControl.Rows.Cast().Select(row => (DesignWaterLevelLocationContextRow) row.DataBoundItem); } - private IEnumerable GetSelectedDesignWaterLevelLocationContext() + private IEnumerable GetSelectedHydraulicBoundaryLocationContext() { - return GetDesignWaterLevelLocationContextRows().Where(r => r.ToCalculate).Select(r => r.DesignWaterLevelLocationContext.HydraulicBoundaryLocation); + return GetDesignWaterLevelLocationContextRows().Where(r => r.ToCalculate).Select(r => r.HydraulicBoundaryLocationContext.HydraulicBoundaryLocation); } #region Event handling @@ -184,7 +184,7 @@ : null; return designWaterLevelRow != null - ? designWaterLevelRow.DesignWaterLevelLocationContext + ? designWaterLevelRow.HydraulicBoundaryLocationContext : null; } @@ -206,7 +206,7 @@ { return; } - var locations = GetSelectedDesignWaterLevelLocationContext(); + var locations = GetSelectedHydraulicBoundaryLocationContext(); CalculationCommandHandler.CalculateDesignWaterLevels(locations); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationContextRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationContextRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationContextRow.cs (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -0,0 +1,100 @@ +// 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 Core.Common.Base.Geometry; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Views +{ + /// + /// This class represents a row of . + /// + internal abstract class HydraulicBoundaryLocationContextRow + { + private readonly HydraulicBoundaryLocationContext hydraulicBoundaryLocationContext; + + /// + /// Creates a new instance of . + /// + /// The for this row. + /// Thrown when is null. + internal HydraulicBoundaryLocationContextRow(HydraulicBoundaryLocationContext hydraulicBoundaryLocationContext) + { + if (hydraulicBoundaryLocationContext == null) + { + throw new ArgumentNullException("hydraulicBoundaryLocationContext"); + } + + this.hydraulicBoundaryLocationContext = hydraulicBoundaryLocationContext; + } + + /// + /// Gets or sets whether the is set to be calculated. + /// + public bool ToCalculate { get; set; } + + /// + /// Gets the . + /// + public string Name + { + get + { + return hydraulicBoundaryLocationContext.HydraulicBoundaryLocation.Name; + } + } + + /// + /// Gets the . + /// + public long Id + { + get + { + return hydraulicBoundaryLocationContext.HydraulicBoundaryLocation.Id; + } + } + + /// + /// Gets the . + /// + public Point2D Location + { + get + { + return hydraulicBoundaryLocationContext.HydraulicBoundaryLocation.Location; + } + } + + /// + /// Gets the . + /// + public HydraulicBoundaryLocationContext HydraulicBoundaryLocationContext + { + get + { + return hydraulicBoundaryLocationContext; + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationContextRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationContextRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationContextRow.cs (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -0,0 +1,56 @@ +// 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.ComponentModel; +using Core.Common.Base.Data; +using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Views +{ + /// + /// This class represents a row of . + /// + internal class WaveHeightLocationContextRow : HydraulicBoundaryLocationContextRow + { + /// + /// Creates a new instance of . + /// + /// The for this row. + /// Thrown when is null. + internal WaveHeightLocationContextRow(WaveHeightLocationContext hydraulicBoundaryLocationContext) + : base(hydraulicBoundaryLocationContext) {} + + /// + /// Gets the . + /// + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble WaveHeight + { + get + { + return HydraulicBoundaryLocationContext.HydraulicBoundaryLocation.WaveHeight; + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.Designer.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.Designer.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.Designer.cs (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -0,0 +1,142 @@ +// 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. + +namespace Ringtoets.Integration.Forms.Views +{ + partial class WaveHeightLocationsView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl(); + this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.ButtonGroupBox = new System.Windows.Forms.GroupBox(); + this.CalculateForSelectedButton = new System.Windows.Forms.Button(); + this.DeselectAllButton = new System.Windows.Forms.Button(); + this.SelectAllButton = new System.Windows.Forms.Button(); + this.tableLayoutPanel.SuspendLayout(); + this.ButtonGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // dataGridViewControl + // + this.dataGridViewControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridViewControl.Location = new System.Drawing.Point(3, 3); + this.dataGridViewControl.MultiSelect = true; + this.dataGridViewControl.Name = "dataGridViewControl"; + this.dataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect; + this.dataGridViewControl.Size = new System.Drawing.Size(529, 264); + this.dataGridViewControl.TabIndex = 0; + // + // tableLayoutPanel + // + this.tableLayoutPanel.ColumnCount = 1; + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel.Controls.Add(this.dataGridViewControl, 0, 0); + this.tableLayoutPanel.Controls.Add(this.ButtonGroupBox, 0, 1); + this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel.Name = "tableLayoutPanel"; + this.tableLayoutPanel.RowCount = 2; + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel.Size = new System.Drawing.Size(535, 329); + this.tableLayoutPanel.TabIndex = 2; + // + // ButtonGroupBox + // + this.ButtonGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.ButtonGroupBox.Controls.Add(this.CalculateForSelectedButton); + this.ButtonGroupBox.Controls.Add(this.DeselectAllButton); + this.ButtonGroupBox.Controls.Add(this.SelectAllButton); + this.ButtonGroupBox.Location = new System.Drawing.Point(3, 275); + this.ButtonGroupBox.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); + this.ButtonGroupBox.Name = "ButtonGroupBox"; + this.ButtonGroupBox.Size = new System.Drawing.Size(529, 51); + this.ButtonGroupBox.TabIndex = 1; + this.ButtonGroupBox.TabStop = false; + this.ButtonGroupBox.Text = "Toetspeilen berekenen"; + // + // CalculateForSelectedButton + // + this.CalculateForSelectedButton.Location = new System.Drawing.Point(227, 19); + this.CalculateForSelectedButton.Name = "CalculateForSelectedButton"; + this.CalculateForSelectedButton.Size = new System.Drawing.Size(207, 23); + this.CalculateForSelectedButton.TabIndex = 2; + this.CalculateForSelectedButton.Text = "Bereken voor geselecteerde locaties"; + this.CalculateForSelectedButton.UseVisualStyleBackColor = true; + this.CalculateForSelectedButton.Click += new System.EventHandler(this.CalculateForSelectedButton_Click); + // + // DeselectAllButton + // + this.DeselectAllButton.Location = new System.Drawing.Point(110, 19); + this.DeselectAllButton.Name = "DeselectAllButton"; + this.DeselectAllButton.Size = new System.Drawing.Size(111, 23); + this.DeselectAllButton.TabIndex = 1; + this.DeselectAllButton.Text = "Deselecteer alles"; + this.DeselectAllButton.UseVisualStyleBackColor = true; + this.DeselectAllButton.Click += new System.EventHandler(this.DeselectAllButton_Click); + // + // SelectAllButton + // + this.SelectAllButton.Location = new System.Drawing.Point(6, 19); + this.SelectAllButton.Name = "SelectAllButton"; + this.SelectAllButton.Size = new System.Drawing.Size(98, 23); + this.SelectAllButton.TabIndex = 0; + this.SelectAllButton.Text = "Selecteer alles"; + this.SelectAllButton.UseVisualStyleBackColor = true; + this.SelectAllButton.Click += new System.EventHandler(this.SelectAllButton_Click); + // + // WaveHeightLocationsView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanel); + this.Name = "WaveHeightLocationsView"; + this.Size = new System.Drawing.Size(535, 329); + this.tableLayoutPanel.ResumeLayout(false); + this.ButtonGroupBox.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private Core.Common.Controls.DataGrid.DataGridViewControl dataGridViewControl; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; + private System.Windows.Forms.GroupBox ButtonGroupBox; + private System.Windows.Forms.Button CalculateForSelectedButton; + private System.Windows.Forms.Button DeselectAllButton; + private System.Windows.Forms.Button SelectAllButton; + } +} Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -0,0 +1,215 @@ +// 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 Core.Common.Base; +using Core.Common.Controls.Views; +using Core.Common.Gui.Selection; +using Core.Common.Utils.Extensions; +using Core.Common.Utils.Reflection; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.Commands; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.Properties; + +namespace Ringtoets.Integration.Forms.Views +{ + /// + /// View for the with . + /// + public partial class WaveHeightLocationsView : UserControl, ISelectionProvider + { + private readonly Observer assessmentSectionObserver; + private readonly Observer hydraulicBoundaryDatabaseObserver; + private IAssessmentSection assessmentSection; + private bool updatingDataSource; + + /// + /// Creates a new instance of . + /// + public WaveHeightLocationsView() + { + InitializeComponent(); + InitializeDataGridView(); + + assessmentSectionObserver = new Observer(UpdateDataGridViewDataSource); + hydraulicBoundaryDatabaseObserver = new Observer(() => dataGridViewControl.RefreshDataGridView()); + } + + /// + /// Gets or sets the . + /// + public IApplicationSelection ApplicationSelection { get; set; } + + /// + /// Gets or sets the . + /// + public IHydraulicBoundaryLocationCalculationCommandHandler CalculationCommandHandler { get; set; } + + public object Data + { + get + { + return assessmentSection; + } + set + { + assessmentSection = value as IAssessmentSection; + + UpdateDataGridViewDataSource(); + assessmentSectionObserver.Observable = assessmentSection; + } + } + + public object Selection + { + get + { + return CreateSelectedItemFromCurrentRow(); + } + } + + protected override void Dispose(bool disposing) + { + assessmentSectionObserver.Dispose(); + hydraulicBoundaryDatabaseObserver.Dispose(); + + if (disposing && (components != null)) + { + components.Dispose(); + } + + base.Dispose(disposing); + } + + private void SetHydraulicBoundaryDatabaseObserver() + { + hydraulicBoundaryDatabaseObserver.Observable = assessmentSection != null ? assessmentSection.HydraulicBoundaryDatabase : null; + } + + private void InitializeDataGridView() + { + dataGridViewControl.AddCellClickHandler(DataGridViewOnCellClick); + + dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName(row => row.ToCalculate), + Resources.HydraulicBoundaryLocationsView_Calculate); + dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Name), + Resources.HydraulicBoundaryDatabase_Locations_Name_DisplayName); + dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Id), + Resources.HydraulicBoundaryDatabase_Locations_Id_DisplayName); + dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Location), + Resources.HydraulicBoundaryDatabase_Locations_Coordinates_DisplayName); + dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.WaveHeight), + Resources.HydraulicBoundaryDatabase_Locations_WaveHeight_DisplayName); + } + + private void UpdateDataGridViewDataSource() + { + SetHydraulicBoundaryDatabaseObserver(); + + updatingDataSource = true; + dataGridViewControl.SetDataSource(assessmentSection != null && assessmentSection.HydraulicBoundaryDatabase != null + ? assessmentSection.HydraulicBoundaryDatabase.Locations.Select( + hl => new WaveHeightLocationContextRow( + new WaveHeightLocationContext(assessmentSection.HydraulicBoundaryDatabase, hl))).ToArray() + : null); + updatingDataSource = false; + } + + private IEnumerable GetWaveHeightLocationContextRows() + { + return dataGridViewControl.Rows.Cast().Select(row => (WaveHeightLocationContextRow) row.DataBoundItem); + } + + private IEnumerable GetSelectedHydraulicBoundaryLocationContext() + { + return GetWaveHeightLocationContextRows().Where(r => r.ToCalculate).Select(r => r.HydraulicBoundaryLocationContext.HydraulicBoundaryLocation); + } + + #region Event handling + + private void DataGridViewOnCellClick(object sender, DataGridViewCellEventArgs e) + { + if (updatingDataSource) + { + return; + } + + UpdateApplicationSelection(); + } + + private void UpdateApplicationSelection() + { + if (ApplicationSelection == null) + { + return; + } + + HydraulicBoundaryLocationContext selection = CreateSelectedItemFromCurrentRow(); + if ((ApplicationSelection.Selection == null && selection != null) || + (ApplicationSelection.Selection != null && !ReferenceEquals(selection, ApplicationSelection.Selection))) + { + ApplicationSelection.Selection = selection; + } + } + + private HydraulicBoundaryLocationContext CreateSelectedItemFromCurrentRow() + { + var currentRow = dataGridViewControl.CurrentRow; + + var waterLevelRow = currentRow != null + ? (WaveHeightLocationContextRow) currentRow.DataBoundItem + : null; + + return waterLevelRow != null + ? waterLevelRow.HydraulicBoundaryLocationContext + : null; + } + + private void SelectAllButton_Click(object sender, EventArgs e) + { + GetWaveHeightLocationContextRows().ForEachElementDo(row => row.ToCalculate = true); + dataGridViewControl.RefreshDataGridView(); + } + + private void DeselectAllButton_Click(object sender, EventArgs e) + { + GetWaveHeightLocationContextRows().ForEachElementDo(row => row.ToCalculate = false); + dataGridViewControl.RefreshDataGridView(); + } + + private void CalculateForSelectedButton_Click(object sender, EventArgs e) + { + if (CalculationCommandHandler == null) + { + return; + } + var locations = GetSelectedHydraulicBoundaryLocationContext(); + CalculationCommandHandler.CalculateWaveHeights(locations); + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.resx =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.resx (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.resx (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/packages.config =================================================================== diff -u -rfea3ed82dfb6dfcad535eef16efcbaa9c01564ed -r84afb606e58d67c6342c4f11bf66b042e49f52d6 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/packages.config (.../packages.config) (revision fea3ed82dfb6dfcad535eef16efcbaa9c01564ed) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/packages.config (.../packages.config) (revision 84afb606e58d67c6342c4f11bf66b042e49f52d6) @@ -1,4 +1,5 @@  +