// 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 Lesser 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser 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 System.Drawing; using System.Drawing.Drawing2D; using Core.Components.Charting.Data; using Core.Components.Charting.Styles; using OxyPlot; namespace Core.Components.OxyPlot.Converter { /// /// Helper methods related to instances. /// public static class ChartDataHelper { /// /// Converts to . /// /// The to convert. /// The converted . /// Thrown when /// cannot be converted. public static LineStyle Convert(DashStyle dashStyle) { var lineStyle = LineStyle.Solid; switch (dashStyle) { case DashStyle.Solid: break; case DashStyle.Dash: lineStyle = LineStyle.Dash; break; case DashStyle.Dot: lineStyle = LineStyle.Dot; break; case DashStyle.DashDot: lineStyle = LineStyle.DashDot; break; case DashStyle.DashDotDot: lineStyle = LineStyle.DashDotDot; break; default: throw new InvalidEnumArgumentException("dashStyle", (int) dashStyle, typeof(DashStyle)); } return lineStyle; } /// /// Converts to . /// /// The to convert. /// The converted . /// Thrown when /// cannot be converted. public static MarkerType Convert(ChartPointSymbol symbol) { MarkerType markerType; switch (symbol) { case ChartPointSymbol.None: markerType = MarkerType.None; break; case ChartPointSymbol.Circle: markerType = MarkerType.Circle; break; case ChartPointSymbol.Square: markerType = MarkerType.Square; break; case ChartPointSymbol.Diamond: markerType = MarkerType.Diamond; break; case ChartPointSymbol.Triangle: markerType = MarkerType.Triangle; break; default: throw new InvalidEnumArgumentException("symbol", (int) symbol, typeof(ChartPointSymbol)); } return markerType; } /// /// Converts to . /// /// The to convert. /// The converted . public static OxyColor Convert(Color color) { return OxyColor.FromArgb(color.A, color.R, color.G, color.B); } } }