// 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.Drawing.Drawing2D; using Core.Components.Charting.Data; using Core.Components.Charting.Styles; using Ringtoets.Common.Forms.Factories; using Ringtoets.Revetment.Data; using Ringtoets.Revetment.Forms.Properties; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.Revetment.Forms.Factories { /// /// Factory for creating based on information used as /// wave conditions input. /// internal static class WaveConditionsChartDataFactory { /// /// Create with default styling for lower boundary revetment. /// /// The color of the . /// The created . public static ChartLineData CreateLowerRevetmentBoundaryChartData(Color lineColor) { return new ChartLineData(Resources.WaveConditionsChartDataFactory_LowerBoundaryRevetment_DisplayName) { Style = GetRevetmentBoundaryStyle(lineColor) }; } /// /// Create with default styling for upper boundary revetment. /// /// The color of the . /// The created . public static ChartLineData CreateUpperRevetmentBoundaryChartData(Color lineColor) { return new ChartLineData(Resources.WaveConditionsChartDataFactory_UpperBoundaryRevetment_DisplayName) { Style = GetRevetmentBoundaryStyle(lineColor) }; } /// /// Create with default styling for revetment. /// /// The color of the . /// The created . public static ChartLineData CreateRevetmentChartData(Color lineColor) { return new ChartLineData(Resources.WaveConditionsChartDataFactory_Revetment_DisplayName) { Style = GetRevetmentBoundaryStyle(lineColor) }; } /// /// Create with default styling for revetment. /// /// The color of the . /// The created . public static ChartLineData CreateRevetmentBaseChartData(Color lineColor) { return new ChartLineData(Resources.WaveConditionsChartDataFactory_Revetment_DisplayName) { Style = new ChartLineStyle(lineColor, 2, DashStyle.Dash) }; } /// /// Create with default styling for lower boundary water levels. /// /// The created . public static ChartLineData CreateLowerWaterLevelsBoundaryChartdata() { return new ChartLineData(Resources.WaveConditionsChartDataFactory_LowerBoundaryWaterLevels_DisplayName) { Style = GetWaterLevelBoundaryStyle() }; } /// /// Create with default styling for upper boundary water levels. /// /// The created . public static ChartLineData CreateUpperWaterLevelsBoundaryChartdata() { return new ChartLineData(Resources.WaveConditionsChartDataFactory_UpperBoundaryWaterLevelsDisplayName) { Style = GetWaterLevelBoundaryStyle() }; } /// /// Create with default styling for design water level. /// /// The name of the . /// The created . /// Thrown when /// is null. public static ChartLineData CreateDesignWaterLevelChartdata(string chartDataName) { if (chartDataName == null) { throw new ArgumentNullException(nameof(chartDataName)); } return new ChartLineData(chartDataName) { Style = new ChartLineStyle(Color.Red, 2, DashStyle.Solid) }; } /// /// Create with default styling for water levels. /// /// The created . public static ChartMultipleLineData CreateWaterLevelsChartData() { return new ChartMultipleLineData("Waterstanden") { Style = new ChartLineStyle(Color.Blue, 2, DashStyle.Dash) }; } /// /// Updates the name of based on . /// /// The to update the name for. /// The used for obtaining the name. /// A default name is set (the same as in ) when: /// /// is null; /// the foreshore profile in is null; /// the foreshore profile should not be used. /// /// public static void UpdateForeshoreGeometryChartDataName(ChartLineData chartData, WaveConditionsInput input) { chartData.Name = input?.ForeshoreProfile != null && input.UseForeshore ? string.Format(RingtoetsCommonFormsResources.ChartDataFactory_Create_DataIdentifier_0_DataTypeDisplayName_1_, input.ForeshoreProfile.Name, RingtoetsCommonFormsResources.Foreshore_DisplayName) : RingtoetsCommonFormsResources.Foreshore_DisplayName; } private static ChartLineStyle GetRevetmentBoundaryStyle(Color lineColor) { return new ChartLineStyle(lineColor, 2, DashStyle.Solid); } private static ChartLineStyle GetWaterLevelBoundaryStyle() { return new ChartLineStyle(Color.Blue, 2, DashStyle.Solid); } } }