Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rf9a16a153b6927605db8dd393120c6610dbbd0b3 -rb9d48f272caaffb9d0ee553ddf12d1d3af8966c2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f9a16a153b6927605db8dd393120c6610dbbd0b3) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b9d48f272caaffb9d0ee553ddf12d1d3af8966c2) @@ -137,6 +137,51 @@ } /// + /// Looks up a localized string similar to Toetsoordeel. + /// + public static string AssemblyMapDataFactory_AssemblyMapDataCollection { + get { + return ResourceManager.GetString("AssemblyMapDataFactory_AssemblyMapDataCollection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gecombineerd toetsoordeel. + /// + public static string AssemblyMapDataFactory_CombinedAssemblyMapData { + get { + return ResourceManager.GetString("AssemblyMapDataFactory_CombinedAssemblyMapData", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Toetsoordeel gedetailleerde toets. + /// + public static string AssemblyMapDataFactory_DetailedAssemblyMapData { + get { + return ResourceManager.GetString("AssemblyMapDataFactory_DetailedAssemblyMapData", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Toetsoordeel eenvoudige toets. + /// + public static string AssemblyMapDataFactory_SimpleAssemblyMapData { + get { + return ResourceManager.GetString("AssemblyMapDataFactory_SimpleAssemblyMapData", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Toetsoordeel toets op maat. + /// + public static string AssemblyMapDataFactory_TailorMadeAssemblyMapData { + get { + return ResourceManager.GetString("AssemblyMapDataFactory_TailorMadeAssemblyMapData", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Waterstand met een overschrijdingsfrequentie gelijk aan de norm van het dijktraject.. /// public static string AssessmentLevel_Description { @@ -2563,6 +2608,15 @@ } /// + /// Looks up a localized string similar to Faalkans. + /// + public static string MetaData_Probability { + get { + return ResourceManager.GetString("MetaData_Probability", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Er zijn geen kunstwerken beschikbaar om berekeningen voor te genereren.. /// public static string No_Structures_to_generate_Calculations_for { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r0ba26254d3aabf039be808c6c498abbda463d673 -rb9d48f272caaffb9d0ee553ddf12d1d3af8966c2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0ba26254d3aabf039be808c6c498abbda463d673) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision b9d48f272caaffb9d0ee553ddf12d1d3af8966c2) @@ -1491,4 +1491,22 @@ berekende kans [-] + + Toetsoordeel + + + Toetsoordeel eenvoudige toets + + + Toetsoordeel gedetailleerde toets + + + Toetsoordeel toets op maat + + + Gecombineerd toetsoordeel + + + Faalkans + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r4b48a3e7866946bb18c5bfe15b04bd51183fd335 -rb9d48f272caaffb9d0ee553ddf12d1d3af8966c2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 4b48a3e7866946bb18c5bfe15b04bd51183fd335) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision b9d48f272caaffb9d0ee553ddf12d1d3af8966c2) @@ -45,6 +45,7 @@ UserControl + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/AssemblyMapDataFactoryTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/AssemblyMapDataFactoryTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/AssemblyMapDataFactoryTest.cs (revision b9d48f272caaffb9d0ee553ddf12d1d3af8966c2) @@ -0,0 +1,128 @@ +// 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 System.Linq; +using Core.Components.Gis.Data; +using Core.Components.Gis.Style; +using Core.Components.Gis.Theme; +using NUnit.Framework; +using Ringtoets.Common.Forms.Factories; + +namespace Ringtoets.Common.Forms.Test.Factories +{ + [TestFixture] + public class AssemblyMapDataFactoryTest + { + private const int lineWidth = 2; + private const LineDashStyle lineDashStyle = LineDashStyle.Solid; + + [Test] + public void CreateAssemblyMapDataCollection_ReturnsEmptyMapDataCollection() + { + // Call + MapDataCollection data = AssemblyMapDataFactory.CreateAssemblyMapDataCollection(); + + // Assert + CollectionAssert.IsEmpty(data.Collection); + Assert.AreEqual("Toetsoordeel", data.Name); + } + + [Test] + public void CreateFailureMechanismSectionsMapData_ReturnsEmptyMapLineDataWithExpectedStyling() + { + // Call + MapLineData data = AssemblyMapDataFactory.CreateSimpleAssemblyMapData(); + + // Assert + AssertAssemblyMapLineData("Toetsoordeel eenvoudige toets", false, data); + } + + [Test] + public void CreateDetailedAssemblyMapData_ReturnsEmptyMapLineDataWithExpectedStyling() + { + // Call + MapLineData data = AssemblyMapDataFactory.CreateDetailedAssemblyMapData(); + + // Assert + AssertAssemblyMapLineData("Toetsoordeel gedetailleerde toets", false, data); + } + + [Test] + public void CreateTailorMadeAssemblyMapData_ReturnsEmptyMapLineDataWithExpectedStyling() + { + // Call + MapLineData data = AssemblyMapDataFactory.CreateTailorMadeAssemblyMapData(); + + // Assert + AssertAssemblyMapLineData("Toetsoordeel toets op maat", false, data); + } + + [Test] + public void CreateCombinedAssemblyMapData_ReturnsEmptyMapLineDataWithExpectedStyling() + { + // Call + MapLineData data = AssemblyMapDataFactory.CreateCombinedAssemblyMapData(); + + // Assert + AssertAssemblyMapLineData("Gecombineerd toetsoordeel", true, data); + } + + private static void AssertAssemblyMapLineData(string expectedName, bool expectedVisibility, MapLineData actualMapLineData) + { + CollectionAssert.IsEmpty(actualMapLineData.Features); + Assert.AreEqual(expectedName, actualMapLineData.Name); + Assert.AreEqual(expectedVisibility, actualMapLineData.IsVisible); + Assert.AreEqual("Categorie", actualMapLineData.SelectedMetaDataAttribute); + AssertEqualStyle(actualMapLineData.Style, Color.Empty, lineWidth, lineDashStyle); + AssertMapTheme(actualMapLineData.MapTheme); + } + + private static void AssertEqualStyle(LineStyle lineStyle, Color color, int width, LineDashStyle style) + { + Assert.AreEqual(color, lineStyle.Color); + Assert.AreEqual(width, lineStyle.Width); + Assert.AreEqual(style, lineStyle.DashStyle); + } + + private static void AssertMapTheme(MapTheme theme) + { + Assert.AreEqual("Categorie", theme.AttributeName); + Assert.AreEqual(9, theme.CategoryThemes.Count()); + AssertCategoryTheme("Iv", Color.FromArgb(255, 0, 255, 0), theme.CategoryThemes.First()); + AssertCategoryTheme("IIv", Color.FromArgb(255, 118, 147, 60), theme.CategoryThemes.ElementAt(1)); + AssertCategoryTheme("IIIv", Color.FromArgb(255, 255, 255, 0), theme.CategoryThemes.ElementAt(2)); + AssertCategoryTheme("IVv", Color.FromArgb(255, 204, 192, 218), theme.CategoryThemes.ElementAt(3)); + AssertCategoryTheme("Vv", Color.FromArgb(255, 255, 153, 0), theme.CategoryThemes.ElementAt(4)); + AssertCategoryTheme("VIv", Color.FromArgb(255, 255, 0, 0), theme.CategoryThemes.ElementAt(5)); + AssertCategoryTheme("VIIv", Color.FromArgb(255, 255, 255, 255), theme.CategoryThemes.ElementAt(6)); + AssertCategoryTheme("-", Color.HotPink, theme.CategoryThemes.ElementAt(7)); + AssertCategoryTheme(string.Empty, Color.FromArgb(0, 0, 0, 0), theme.CategoryThemes.ElementAt(8)); + } + + private static void AssertCategoryTheme(string expectedValue, Color expectedColor, CategoryTheme categoryTheme) + { + Assert.AreEqual(expectedColor, categoryTheme.Color); + Assert.AreEqual(expectedValue, categoryTheme.Criterion.Value); + Assert.AreEqual(ValueCriterionOperator.EqualValue, categoryTheme.Criterion.ValueOperator); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r6e293220ef3a2d80047bfc95a7b979c3946ce3fa -rb9d48f272caaffb9d0ee553ddf12d1d3af8966c2 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 6e293220ef3a2d80047bfc95a7b979c3946ce3fa) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision b9d48f272caaffb9d0ee553ddf12d1d3af8966c2) @@ -56,6 +56,7 @@ + Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingAssemblyMapDataFeaturesFactory.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingAssemblyMapDataFeaturesFactory.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingAssemblyMapDataFeaturesFactory.cs (revision b9d48f272caaffb9d0ee553ddf12d1d3af8966c2) @@ -0,0 +1,104 @@ +// 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; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Util; +using Core.Components.Gis.Features; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.AssemblyTool.Forms; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Exceptions; +using Ringtoets.Common.Forms.Factories; +using Ringtoets.Piping.Data; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Piping.Forms.Factories +{ + /// + /// Factory for creating collections of for assembly results. + /// + public static class PipingAssemblyMapDataFeaturesFactory + { + /// + /// Creates features for the simple assembly results in . + /// + /// The to create the features for. + /// A collection of . + /// Thrown when a could not be created. + public static IEnumerable CreateSimpleAssemblyFeatures(PipingFailureMechanism failureMechanism) + { + return CreateAssemblyFeatures(failureMechanism, + PipingFailureMechanismAssemblyFactory.AssembleSimpleAssessment).ToArray(); + } + + /// + /// Creates features for the detailed assembly results in . + /// + /// The to create the features for. + /// The the belongs to. + /// A collection of . + /// Thrown when a could not be created. + public static IEnumerable CreateDetailedAssemblyFeatures(PipingFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + { + return CreateAssemblyFeatures(failureMechanism, + sectionResult => PipingFailureMechanismAssemblyFactory.AssembleDetailedAssessment(sectionResult, + failureMechanism.Calculations.Cast(), + failureMechanism, + assessmentSection)).ToArray(); + } + + /// + /// Creates features for the tailor made assembly results in . + /// + /// The to create the features for. + /// The the belongs to. + /// A collection of . + /// Thrown when a could not be created. + public static IEnumerable CreateTailorMadeAssemblyFeatures(PipingFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + { + return CreateAssemblyFeatures(failureMechanism, + sectionResult => PipingFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(sectionResult, + failureMechanism, + assessmentSection)).ToArray(); + } + + private static IEnumerable CreateAssemblyFeatures(PipingFailureMechanism failureMechanism, + Func getAssemblyFunc) + { + for (var i = 0; i < failureMechanism.SectionResults.Count(); i++) + { + PipingFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.ElementAt(i); + MapFeature feature = RingtoetsMapDataFeaturesFactory.CreateSingleLineMapFeature(sectionResult.Section.Points); + FailureMechanismSectionAssembly assemblyResult = getAssemblyFunc(sectionResult); + + feature.MetaData[RingtoetsCommonFormsResources.AssemblyCategory_Group_DisplayName] = + new EnumDisplayWrapper( + DisplayFailureMechanismSectionAssemblyCategoryGroupConverter.Convert(assemblyResult.Group)).DisplayName; + + feature.MetaData[RingtoetsCommonFormsResources.MetaData_Probability] = assemblyResult.Probability; + + yield return feature; + } + } + } +} \ No newline at end of file