Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/AssemblyMapDataFactory.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/AssemblyMapDataFactory.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/AssemblyMapDataFactory.cs (revision 3ce39c8b32628a3bc38da1c792806dec69139019) @@ -0,0 +1,147 @@ +// Copyright (C) Stichting Deltares 2018. 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.Drawing; +using Core.Common.Util; +using Core.Components.Gis.Data; +using Core.Components.Gis.Style; +using Core.Components.Gis.Theme; +using Ringtoets.AssemblyTool.Forms; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.Factories +{ + /// + /// Factory for creating instances for assembly data. + /// + public static class AssemblyMapDataFactory + { + private const int lineWidth = 2; + private const LineDashStyle lineDashStyle = LineDashStyle.Solid; + + /// + /// Creates a for assembly results. + /// + /// The created . + public static MapDataCollection CreateAssemblyMapDataCollection() + { + return new MapDataCollection(Resources.AssemblyMapDataFactory_AssemblyMapDataCollection); + } + + /// + /// Creates a with default styling for a simple assembly. + /// + /// The created . + public static MapLineData CreateSimpleAssemblyMapData() + { + return new MapLineData(Resources.AssemblyMapDataFactory_SimpleAssemblyMapData, + new LineStyle + { + Width = lineWidth, + DashStyle = lineDashStyle + }) + { + SelectedMetaDataAttribute = Resources.AssemblyCategory_Group_DisplayName, + IsVisible = false, + MapTheme = CreateMapTheme() + }; + } + + /// + /// Creates a with default styling for a detailed assembly. + /// + /// The created . + public static MapLineData CreateDetailedAssemblyMapData() + { + return new MapLineData(Resources.AssemblyMapDataFactory_DetailedAssemblyMapData, + new LineStyle + { + Width = lineWidth, + DashStyle = lineDashStyle + }) + { + SelectedMetaDataAttribute = Resources.AssemblyCategory_Group_DisplayName, + IsVisible = false, + MapTheme = CreateMapTheme() + }; + } + + /// + /// Creates a with default styling for a tailor made assembly. + /// + /// The created . + public static MapLineData CreateTailorMadeAssemblyMapData() + { + return new MapLineData(Resources.AssemblyMapDataFactory_TailorMadeAssemblyMapData, + new LineStyle + { + Width = lineWidth, + DashStyle = lineDashStyle + }) + { + SelectedMetaDataAttribute = Resources.AssemblyCategory_Group_DisplayName, + IsVisible = false, + MapTheme = CreateMapTheme() + }; + } + + /// + /// Creates a with default styling for a combined assembly. + /// + /// The created . + public static MapLineData CreateCombinedAssemblyMapData() + { + return new MapLineData(Resources.AssemblyMapDataFactory_CombinedAssemblyMapData, + new LineStyle + { + Width = lineWidth, + DashStyle = lineDashStyle + }) + { + SelectedMetaDataAttribute = Resources.AssemblyCategory_Group_DisplayName, + IsVisible = true, + MapTheme = CreateMapTheme() + }; + } + + private static MapTheme CreateMapTheme() + { + return new MapTheme(Resources.AssemblyCategory_Group_DisplayName, new[] + { + new CategoryTheme(Color.FromArgb(255, 0, 255, 0), CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.Iv)), + new CategoryTheme(Color.FromArgb(255, 118, 147, 60), CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.IIv)), + new CategoryTheme(Color.FromArgb(255, 255, 255, 0), CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.IIIv)), + new CategoryTheme(Color.FromArgb(255, 204, 192, 218), CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.IVv)), + new CategoryTheme(Color.FromArgb(255, 255, 153, 0), CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.Vv)), + new CategoryTheme(Color.FromArgb(255, 255, 0, 0), CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.VIv)), + new CategoryTheme(Color.FromArgb(255, 255, 255, 255), CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.VIIv)), + new CategoryTheme(Color.HotPink, CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.NotApplicable)), + new CategoryTheme(Color.FromArgb(0, 0, 0, 0), CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup.None)) + }); + } + + private static ValueCriterion CreateCriterion(DisplayFailureMechanismSectionAssemblyCategoryGroup category) + { + return new ValueCriterion(ValueCriterionOperator.EqualValue, + new EnumDisplayWrapper(category).DisplayName); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/AssemblyMapDataFactoryTest.cs =================================================================== diff -u -rb9d48f272caaffb9d0ee553ddf12d1d3af8966c2 -r3ce39c8b32628a3bc38da1c792806dec69139019 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/AssemblyMapDataFactoryTest.cs (.../AssemblyMapDataFactoryTest.cs) (revision b9d48f272caaffb9d0ee553ddf12d1d3af8966c2) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/AssemblyMapDataFactoryTest.cs (.../AssemblyMapDataFactoryTest.cs) (revision 3ce39c8b32628a3bc38da1c792806dec69139019) @@ -32,9 +32,6 @@ [TestFixture] public class AssemblyMapDataFactoryTest { - private const int lineWidth = 2; - private const LineDashStyle lineDashStyle = LineDashStyle.Solid; - [Test] public void CreateAssemblyMapDataCollection_ReturnsEmptyMapDataCollection() { @@ -92,7 +89,7 @@ Assert.AreEqual(expectedName, actualMapLineData.Name); Assert.AreEqual(expectedVisibility, actualMapLineData.IsVisible); Assert.AreEqual("Categorie", actualMapLineData.SelectedMetaDataAttribute); - AssertEqualStyle(actualMapLineData.Style, Color.Empty, lineWidth, lineDashStyle); + AssertEqualStyle(actualMapLineData.Style, Color.Empty, 2, LineDashStyle.Solid); AssertMapTheme(actualMapLineData.MapTheme); }