Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs =================================================================== diff -u -r1ccc416d4657e14b11e02131ebdc34720a25e16f -rb10bbf87b67aadd7c647938226b57be19afb4b46 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision 1ccc416d4657e14b11e02131ebdc34720a25e16f) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision b10bbf87b67aadd7c647938226b57be19afb4b46) @@ -47,64 +47,6 @@ } /// - /// Create for a based on its color. - /// - /// The index of the in for which to create . - /// The which contains the . - /// The created . - /// Thrown when is null. - /// Thrown when is outside the allowable range of values ([0, number_of_soil_layers>). - public static ChartMultipleAreaData CreateSoilLayerChartData(int soilLayerIndex, MacroStabilityInwardsSoilProfile soilProfile) - { - if (soilProfile == null) - { - throw new ArgumentNullException(nameof(soilProfile)); - } - - if (soilLayerIndex < 0 || soilLayerIndex >= soilProfile.Layers.Count()) - { - throw new ArgumentOutOfRangeException(nameof(soilLayerIndex)); - } - - MacroStabilityInwardsSoilLayer soilLayer = soilProfile.Layers.ElementAt(soilLayerIndex); - - return new ChartMultipleAreaData($"{soilLayerIndex + 1} {soilLayer.MaterialName}", - new ChartAreaStyle - { - FillColor = soilLayer.Color, - StrokeColor = Color.Black, - StrokeThickness = 1 - }); - } - - /// - /// 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. - public static void UpdateSurfaceLineChartDataName(ChartLineData chartData, RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine) - { - chartData.Name = surfaceLine != null - ? surfaceLine.Name - : Resources.RingtoetsMacroStabilityInwardsSurfaceLine_DisplayName; - } - - /// - /// 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. - public static void UpdateSoilProfileChartDataName(ChartDataCollection chartData, MacroStabilityInwardsSoilProfile soilProfile) - { - chartData.Name = soilProfile != null - ? soilProfile.Name - : Resources.StochasticSoilProfileProperties_DisplayName; - } - - /// /// Create with default styling for a characteristic point /// of type ditch dike side. /// @@ -195,6 +137,129 @@ ChartPointSymbol.Diamond)); } + /// + /// Create with default styling for a characteristic point + /// of type traffic load outside. + /// + /// The created . + public static ChartPointData CreateTrafficLoadOutsideChartData() + { + return new ChartPointData(RingtoetsCommonDataResources.CharacteristicPoint_TrafficLoadOutside, + GetCharacteristicPointStyle(Color.SlateGray, + Color.Transparent, + ChartPointSymbol.Diamond)); + } + + /// + /// Create with default styling for a characteristic point + /// of type bottom ditch dike side. + /// + /// The created . + public static ChartPointData CreateBottomDitchDikeSideChartData() + { + return new ChartPointData(RingtoetsCommonDataResources.CharacteristicPoint_BottomDitchDikeSide, + GetCharacteristicPointStyle(Color.DarkSeaGreen, + Color.Transparent, + ChartPointSymbol.Circle)); + } + + /// + /// Create with default styling for a characteristic point + /// of type bottom ditch polder side. + /// + /// The created . + public static ChartPointData CreateBottomDitchPolderSideChartData() + { + return new ChartPointData(RingtoetsCommonDataResources.CharacteristicPoint_BottomDitchPolderSide, + GetCharacteristicPointStyle(Color.Teal, + Color.Transparent, + ChartPointSymbol.Circle)); + } + + /// + /// Create with default styling for a characteristic point + /// of type dike toe at polder. + /// + /// The created . + public static ChartPointData CreateDikeToeAtPolderChartData() + { + return new ChartPointData(RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder, + GetCharacteristicPointStyle(Color.LightGray, + Color.Black, + ChartPointSymbol.Square)); + } + + /// + /// Create with default styling for a characteristic point + /// of type dike toe at river. + /// + /// The created . + public static ChartPointData CreateDikeToeAtRiverChartData() + { + return new ChartPointData(RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver, + GetCharacteristicPointStyle(Color.DarkGray, + Color.Black, + ChartPointSymbol.Square)); + } + + /// + /// Create for a based on its color. + /// + /// The index of the in for which to create . + /// The which contains the . + /// The created . + /// Thrown when is null. + /// Thrown when is outside the allowable range of values ([0, number_of_soil_layers>). + public static ChartMultipleAreaData CreateSoilLayerChartData(int soilLayerIndex, MacroStabilityInwardsSoilProfile soilProfile) + { + if (soilProfile == null) + { + throw new ArgumentNullException(nameof(soilProfile)); + } + + if (soilLayerIndex < 0 || soilLayerIndex >= soilProfile.Layers.Count()) + { + throw new ArgumentOutOfRangeException(nameof(soilLayerIndex)); + } + + MacroStabilityInwardsSoilLayer soilLayer = soilProfile.Layers.ElementAt(soilLayerIndex); + + return new ChartMultipleAreaData($"{soilLayerIndex + 1} {soilLayer.MaterialName}", + new ChartAreaStyle + { + FillColor = soilLayer.Color, + StrokeColor = Color.Black, + StrokeThickness = 1 + }); + } + + /// + /// 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. + public static void UpdateSurfaceLineChartDataName(ChartLineData chartData, RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine) + { + chartData.Name = surfaceLine != null + ? surfaceLine.Name + : Resources.RingtoetsMacroStabilityInwardsSurfaceLine_DisplayName; + } + + /// + /// 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. + public static void UpdateSoilProfileChartDataName(ChartDataCollection chartData, MacroStabilityInwardsSoilProfile soilProfile) + { + chartData.Name = soilProfile != null + ? soilProfile.Name + : Resources.StochasticSoilProfileProperties_DisplayName; + } + private static ChartPointStyle GetCharacteristicPointStyle(Color fillColor, Color strokeColor, ChartPointSymbol symbol) { return new ChartPointStyle Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs =================================================================== diff -u -r1ccc416d4657e14b11e02131ebdc34720a25e16f -rb10bbf87b67aadd7c647938226b57be19afb4b46 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs (.../MacroStabilityInwardsChartDataFactoryTest.cs) (revision 1ccc416d4657e14b11e02131ebdc34720a25e16f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs (.../MacroStabilityInwardsChartDataFactoryTest.cs) (revision b10bbf87b67aadd7c647938226b57be19afb4b46) @@ -131,6 +131,66 @@ } [Test] + public void CreateTrafficLoadOutsideChartData_ReturnsChartPointDataWithDefaultStyling() + { + // Call + ChartPointData data = MacroStabilityInwardsChartDataFactory.CreateTrafficLoadOutsideChartData(); + + // Assert + Assert.IsFalse(data.HasData); + Assert.AreEqual("Verkeersbelasting kant buitenwaarts", data.Name); + AssertEqualStyle(data.Style, Color.SlateGray, 8, Color.Transparent, 0, ChartPointSymbol.Diamond); + } + + [Test] + public void CreateBottomDitchDikeSideChartData_ReturnsChartPointDataWithDefaultStyling() + { + // Call + ChartPointData data = MacroStabilityInwardsChartDataFactory.CreateBottomDitchDikeSideChartData(); + + // Assert + Assert.IsFalse(data.HasData); + Assert.AreEqual("Slootbodem dijkzijde", data.Name); + AssertEqualStyle(data.Style, Color.DarkSeaGreen, 8, Color.Transparent, 0, ChartPointSymbol.Circle); + } + + [Test] + public void CreateBottomDitchPolderSideChartData_ReturnsChartPointDataWithDefaultStyling() + { + // Call + ChartPointData data = MacroStabilityInwardsChartDataFactory.CreateBottomDitchPolderSideChartData(); + + // Assert + Assert.IsFalse(data.HasData); + Assert.AreEqual("Slootbodem polderzijde", data.Name); + AssertEqualStyle(data.Style, Color.Teal, 8, Color.Transparent, 0, ChartPointSymbol.Circle); + } + + [Test] + public void CreateDikeToeAtPolderChartData_ReturnsChartPointDataWithDefaultStyling() + { + // Call + ChartPointData data = MacroStabilityInwardsChartDataFactory.CreateDikeToeAtPolderChartData(); + + // Assert + Assert.IsFalse(data.HasData); + Assert.AreEqual("Teen dijk binnenwaarts", data.Name); + AssertEqualStyle(data.Style, Color.LightGray, 8, Color.Black, 1, ChartPointSymbol.Square); + } + + [Test] + public void CreateDikeToeAtRiverChartData_ReturnsChartPointDataWithDefaultStyling() + { + // Call + ChartPointData data = MacroStabilityInwardsChartDataFactory.CreateDikeToeAtRiverChartData(); + + // Assert + Assert.IsFalse(data.HasData); + Assert.AreEqual("Teen dijk buitenwaarts", data.Name); + AssertEqualStyle(data.Style, Color.DarkGray, 8, Color.Black, 1, ChartPointSymbol.Square); + } + + [Test] public void CreateSoilLayerChartData_SoilProfileNull_ThrowsArgumentNullException() { // Call