// 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.Collections.Generic; using System.Drawing; using System.Linq; using Core.Common.Base.Data; using Core.Common.Controls.DataGrid; using Ringtoets.Piping.Forms.Properties; using Ringtoets.Piping.Primitives; namespace Ringtoets.MacroStabilityInwards.Forms.Views { /// /// This class defines a table in which properties of instances /// are shown as rows. /// public class PipingSoilLayerTable : DataGridViewControl { /// /// Creates a new instance of . /// public PipingSoilLayerTable() { AddColumns(); } /// /// Sets the given for which the properties /// are shown in the table. /// /// The collection of layers to show. public void SetData(IEnumerable layers) { SetDataSource(layers?.Select(l => new FormattedPipingSoilLayerRow(l)).ToArray()); } private void AddColumns() { AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.MaterialName), Resources.PipingSoilLayerTable_ColumnHeader_MaterialName, true); AddColorColumn(nameof(FormattedPipingSoilLayerRow.Color), Resources.PipingSoilLayerTable_ColumnHeader_Color); AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.Top), Resources.PipingSoilLayerTable_ColumnHeader_Top, true); AddCheckBoxColumn(nameof(FormattedPipingSoilLayerRow.IsAquifer), Resources.PipingSoilLayerTable_ColumnHeader_IsAquifer, true); AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.PermeabilityMean), Resources.PipingSoilLayerTable_ColumnHeader_PermeabilityMean, true); AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.PermeabilityCoefficientOfVariation), Resources.PipingSoilLayerTable_ColumnHeader_PermeabilityCoefficientOfVariation, true); AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.DiameterD70Mean), Resources.PipingSoilLayerTable_ColumnHeader_DiameterD70Mean, true); AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.DiameterD70CoefficientOfVariation), Resources.PipingSoilLayerTable_ColumnHeader_DiameterD70CoefficientOfVariation, true); AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.BelowPhreaticLevelMean), Resources.PipingSoilLayerTable_ColumnHeader_BelowPhreaticLevelMean, true); AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.BelowPhreaticLevelDeviation), Resources.PipingSoilLayerTable_ColumnHeader_BelowPhreaticLevelDeviation, true); AddTextBoxColumn(nameof(FormattedPipingSoilLayerRow.BelowPhreaticLevelShift), Resources.PipingSoilLayerTable_ColumnHeader_BelowPhreaticLevelShift, true); } private class FormattedPipingSoilLayerRow { public FormattedPipingSoilLayerRow(PipingSoilLayer layer) { MaterialName = layer.MaterialName; Color = layer.Color; Top = new RoundedDouble(2, layer.Top); IsAquifer = layer.IsAquifer; PermeabilityMean = new RoundedDouble(6, layer.PermeabilityMean); PermeabilityCoefficientOfVariation = new RoundedDouble(6, layer.PermeabilityCoefficientOfVariation); DiameterD70Mean = new RoundedDouble(6, layer.DiameterD70Mean); DiameterD70CoefficientOfVariation = new RoundedDouble(6, layer.DiameterD70CoefficientOfVariation); BelowPhreaticLevelMean = new RoundedDouble(2, layer.BelowPhreaticLevelMean); BelowPhreaticLevelDeviation = new RoundedDouble(2, layer.BelowPhreaticLevelDeviation); BelowPhreaticLevelShift = new RoundedDouble(2, layer.BelowPhreaticLevelShift); } /// /// Gets the top level of the . /// public RoundedDouble Top { get; } /// /// Gets a value indicating whether or not the is an aquifer. /// public bool IsAquifer { get; } /// /// Gets the mean of the distrubtion for the volumic weight of the below the phreatic level. /// [kN/m³] /// public RoundedDouble BelowPhreaticLevelMean { get; } /// /// Gets the deviation of the distrubtion for the volumic weight of the below the phreatic level. /// [kN/m³] /// public RoundedDouble BelowPhreaticLevelDeviation { get; } /// /// Gets the shift of the distrubtion for the volumic weight of the below the phreatic level. /// [kN/m³] /// public RoundedDouble BelowPhreaticLevelShift { get; } /// /// Gets the mean of the distribution for the mean diameter of small scale tests applied to different kinds of sand, /// on which the formula of Sellmeijer has been fit. /// [m] /// public RoundedDouble DiameterD70Mean { get; } /// /// Gets the coefficient of variation of the distribution for the mean diameter of small scale tests applied to different kinds of sand, /// on which the formula of Sellmeijer has been fit. /// [m] /// public RoundedDouble DiameterD70CoefficientOfVariation { get; } /// /// Gets the mean of the distribution for the the Darcy-speed with which water flows through the aquifer layer. /// [m/s] /// public RoundedDouble PermeabilityMean { get; } /// /// Gets the coefficient of variation of the distribution for the Darcy-speed with which water flows through the aquifer layer. /// [m/s] /// public RoundedDouble PermeabilityCoefficientOfVariation { get; } /// /// Gets the name of the material that was assigned to the . /// public string MaterialName { get; } /// /// Gets the that was used to represent the . /// public Color Color { get; } } } }