Index: Core/Components/src/Core.Components.Gis/Data/MapLineData.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Core/Components/src/Core.Components.Gis/Data/MapLineData.cs (.../MapLineData.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Components/src/Core.Components.Gis/Data/MapLineData.cs (.../MapLineData.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -21,6 +21,8 @@ using System; using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; using System.Linq; using Core.Components.Gis.Features; using Core.Components.Gis.Style; @@ -33,17 +35,36 @@ public class MapLineData : FeatureBasedMapData { /// - /// Creates a new instance of . + /// Creates a new instance of with default styling. /// /// The name of the . /// Thrown when is /// null or only whitespace. - public MapLineData(string name) : base(name) {} + public MapLineData(string name) + : this(name, new LineStyle(Color.Black, 2, DashStyle.Solid)) {} /// + /// Creates a new instance of with default styling. + /// + /// The name of the . + /// + /// Thrown when is + /// null or only whitespace. + /// Thrown when + /// is null. + public MapLineData(string name, LineStyle style) : base(name) + { + if (style == null) + { + throw new ArgumentNullException(nameof(style)); + } + Style = style; + } + + /// /// Gets or sets the style of the line. /// - public LineStyle Style { get; set; } + public LineStyle Style { get; } /// /// This method validates newly set features. Index: Core/Components/src/Core.Components.Gis/Data/MapPointData.cs =================================================================== diff -u -r87ac68e11e89dda424f6fe34e145ee901cdc4e5c -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Core/Components/src/Core.Components.Gis/Data/MapPointData.cs (.../MapPointData.cs) (revision 87ac68e11e89dda424f6fe34e145ee901cdc4e5c) +++ Core/Components/src/Core.Components.Gis/Data/MapPointData.cs (.../MapPointData.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -64,7 +64,7 @@ /// /// Gets or sets the style of the points. /// - public PointStyle Style { get; private set; } + public PointStyle Style { get; } /// /// This method validates newly set features. Index: Core/Components/test/Core.Components.DotSpatial.Test/Converter/MapLineDataConverterTest.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Core/Components/test/Core.Components.DotSpatial.Test/Converter/MapLineDataConverterTest.cs (.../MapLineDataConverterTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Components/test/Core.Components.DotSpatial.Test/Converter/MapLineDataConverterTest.cs (.../MapLineDataConverterTest.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -175,10 +175,7 @@ Color expectedColor = Color.FromKnownColor(color); var converter = new MapLineDataConverter(); var mapLineLayer = new MapLineLayer(); - var mapLineData = new MapLineData("test") - { - Style = new LineStyle(expectedColor, width, lineStyle) - }; + var mapLineData = new MapLineData("test", new LineStyle(expectedColor, width, lineStyle)); // Call converter.ConvertLayerProperties(mapLineData, mapLineLayer); Index: Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs (.../MapLineDataLayerTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs (.../MapLineDataLayerTest.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -55,7 +55,7 @@ public void Constructor_MapLineDataWithTestProperties_MapLineDataLayerCreatedAccordingly() { // Setup - var mapLineData = new MapLineData("Test name"); + var mapLineData = new MapLineData("Test name", new LineStyle(Color.AliceBlue, 2, DashStyle.DashDot)); SetMapLineDataTestProperties(mapLineData); @@ -73,7 +73,7 @@ public void Update_MapLineDataWithTestProperties_MapLineDataLayerUpdatedAccordingly() { // Setup - var mapLineData = new MapLineData("Test name"); + var mapLineData = new MapLineData("Test name", new LineStyle(Color.AliceBlue, 2, DashStyle.DashDot)); var mapLineDataLayer = new MapLineDataLayer(mapLineData); SetMapLineDataTestProperties(mapLineData); @@ -142,7 +142,6 @@ mapLineData.IsVisible = false; mapLineData.ShowLabels = true; mapLineData.SelectedMetaDataAttribute = "Name"; - mapLineData.Style = new LineStyle(Color.AliceBlue, 2, DashStyle.DashDot); mapLineData.Features = new[] { CreateTestMapFeature() @@ -156,7 +155,7 @@ Assert.IsTrue(mapLineDataLayer.ShowLabels); Assert.IsNotNull(mapLineDataLayer.LabelLayer); - Assert.AreEqual(string.Format("[{0}]", "2"), mapLineDataLayer.LabelLayer.Symbology.Categories[0].Expression); + Assert.AreEqual("[2]", mapLineDataLayer.LabelLayer.Symbology.Categories[0].Expression); var firstStroke = (CartographicStroke) mapLineDataLayer.Symbolizer.Strokes[0]; Assert.AreEqual(Color.AliceBlue, firstStroke.Color); @@ -176,8 +175,8 @@ Assert.IsNull(mapLineDataLayer.LabelLayer.Symbology.Categories[0].Expression); var firstStroke = (SimpleStroke) mapLineDataLayer.Symbolizer.Strokes[0]; - Assert.AreEqual(1.0, firstStroke.Width); - Assert.AreEqual(DashStyle.Solid, firstStroke.DashStyle); + Assert.AreEqual(2.0, firstStroke.Width); + Assert.AreEqual(DashStyle.DashDot, firstStroke.DashStyle); Assert.AreEqual(0, mapLineDataLayer.DataSet.Features.Count); } Index: Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs (.../MapLineDataTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs (.../MapLineDataTest.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -21,12 +21,15 @@ using System; using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; using System.Linq; using Core.Common.Base.Geometry; using Core.Common.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; +using Core.Components.Gis.Style; using NUnit.Framework; namespace Core.Components.Gis.Test.Data @@ -44,6 +47,9 @@ Assert.AreEqual("test data", data.Name); Assert.IsEmpty(data.Features); Assert.IsInstanceOf(data); + Assert.AreEqual(Color.Black, data.Style.Color); + Assert.AreEqual(2, data.Style.Width); + Assert.AreEqual(DashStyle.Solid, data.Style.Style); } [Test] @@ -61,6 +67,33 @@ } [Test] + public void Constructor_StyleNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => new MapLineData("test data", null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("style", exception.ParamName); + } + + [Test] + public void Constructor_WithStyle_ExpectedValues() + { + // Setup + var style = new LineStyle(Color.Red, 5, DashStyle.Dash); + + // Call + var data = new MapLineData("test data", style); + + // Assert + Assert.AreEqual("test data", data.Name); + Assert.IsEmpty(data.Features); + Assert.IsInstanceOf(data); + Assert.AreSame(style, data.Style); + } + + [Test] public void Features_SetValidNewValue_GetsNewValue() { // Setup Index: Core/Components/test/Core.Components.Gis.Test/Data/MapPointDataTest.cs =================================================================== diff -u -r9db03162dd78287d02807c92b35d7d967fac9c8a -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Core/Components/test/Core.Components.Gis.Test/Data/MapPointDataTest.cs (.../MapPointDataTest.cs) (revision 9db03162dd78287d02807c92b35d7d967fac9c8a) +++ Core/Components/test/Core.Components.Gis.Test/Data/MapPointDataTest.cs (.../MapPointDataTest.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -71,7 +71,7 @@ public void Constructor_StyleNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => new MapPointData("test", null); + TestDelegate test = () => new MapPointData("test data", null); // Assert var exception = Assert.Throws(test); Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsMapDataFactory.cs =================================================================== diff -u -r7fc5e21f72a83b37ad5e4daca553fca84fe140ab -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsMapDataFactory.cs (.../RingtoetsMapDataFactory.cs) (revision 7fc5e21f72a83b37ad5e4daca553fca84fe140ab) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsMapDataFactory.cs (.../RingtoetsMapDataFactory.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -50,9 +50,9 @@ /// The created . public static MapLineData CreateReferenceLineMapData() { - return new MapLineData(RingtoetsCommonDataResources.ReferenceLine_DisplayName) + return new MapLineData(RingtoetsCommonDataResources.ReferenceLine_DisplayName, + new LineStyle(Color.Red, thickLineWidth, DashStyle.Solid)) { - Style = new LineStyle(Color.Red, thickLineWidth, DashStyle.Solid), SelectedMetaDataAttribute = Resources.MetaData_Name }; } @@ -77,9 +77,9 @@ /// The created . public static MapLineData CreateFailureMechanismSectionsMapData() { - return new MapLineData(Resources.FailureMechanism_Sections_DisplayName) + return new MapLineData(Resources.FailureMechanism_Sections_DisplayName, + new LineStyle(Color.Khaki, thickLineWidth, DashStyle.Dot)) { - Style = new LineStyle(Color.Khaki, thickLineWidth, DashStyle.Dot), SelectedMetaDataAttribute = Resources.MetaData_Name }; } @@ -114,9 +114,9 @@ /// The created . public static MapLineData CreateDikeProfileMapData() { - return new MapLineData(Resources.DikeProfiles_DisplayName) + return new MapLineData(Resources.DikeProfiles_DisplayName, + new LineStyle(Color.SaddleBrown, thinLineWidth, DashStyle.Solid)) { - Style = new LineStyle(Color.SaddleBrown, thinLineWidth, DashStyle.Solid), SelectedMetaDataAttribute = Resources.MetaData_Name }; } @@ -127,9 +127,9 @@ /// The created . public static MapLineData CreateForeshoreProfileMapData() { - return new MapLineData(Resources.ForeshoreProfiles_DisplayName) + return new MapLineData(Resources.ForeshoreProfiles_DisplayName, + new LineStyle(Color.DarkOrange, thinLineWidth, DashStyle.Solid)) { - Style = new LineStyle(Color.DarkOrange, thinLineWidth, DashStyle.Solid), SelectedMetaDataAttribute = Resources.MetaData_Name }; } @@ -153,9 +153,9 @@ /// The created . public static MapLineData CreateCalculationsMapData() { - return new MapLineData(RingtoetsCommonDataResources.FailureMechanism_Calculations_DisplayName) + return new MapLineData(RingtoetsCommonDataResources.FailureMechanism_Calculations_DisplayName, + new LineStyle(Color.MediumPurple, thinLineWidth, DashStyle.Dash)) { - Style = new LineStyle(Color.MediumPurple, thinLineWidth, DashStyle.Dash), ShowLabels = true, SelectedMetaDataAttribute = Resources.MetaData_Name }; Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsMapDataFactory.cs =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsMapDataFactory.cs (.../MacroStabilityInwardsMapDataFactory.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsMapDataFactory.cs (.../MacroStabilityInwardsMapDataFactory.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -41,9 +41,9 @@ /// The created . public static MapLineData CreateSurfaceLinesMapData() { - return new MapLineData(DataResources.MacroStabilityInwardsSurfaceLineCollection_TypeDescriptor) + return new MapLineData(DataResources.MacroStabilityInwardsSurfaceLineCollection_TypeDescriptor, + new LineStyle(Color.DarkSeaGreen, 2, DashStyle.Solid)) { - Style = new LineStyle(Color.DarkSeaGreen, 2, DashStyle.Solid), SelectedMetaDataAttribute = RingtoetsCommonFormsResources.MetaData_Name }; } @@ -54,9 +54,9 @@ /// The created . public static MapLineData CreateStochasticSoilModelsMapData() { - return new MapLineData(DataResources.StochasticSoilModelCollection_TypeDescriptor) + return new MapLineData(DataResources.StochasticSoilModelCollection_TypeDescriptor, + new LineStyle(Color.FromArgb(70, Color.SaddleBrown), 5, DashStyle.Solid)) { - Style = new LineStyle(Color.FromArgb(70, Color.SaddleBrown), 5, DashStyle.Solid), SelectedMetaDataAttribute = RingtoetsCommonFormsResources.MetaData_Name }; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingMapDataFactory.cs =================================================================== diff -u -rf1f94637a6b45b394493bf16a078b317c02d329b -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingMapDataFactory.cs (.../PipingMapDataFactory.cs) (revision f1f94637a6b45b394493bf16a078b317c02d329b) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingMapDataFactory.cs (.../PipingMapDataFactory.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) @@ -41,9 +41,9 @@ /// The created . public static MapLineData CreateSurfaceLinesMapData() { - return new MapLineData(PipingDataResources.PipingSurfaceLineCollection_TypeDescriptor) + return new MapLineData(PipingDataResources.PipingSurfaceLineCollection_TypeDescriptor, + new LineStyle(Color.DarkSeaGreen, 2, DashStyle.Solid)) { - Style = new LineStyle(Color.DarkSeaGreen, 2, DashStyle.Solid), SelectedMetaDataAttribute = RingtoetsCommonFormsResources.MetaData_Name }; } @@ -54,9 +54,9 @@ /// The created . public static MapLineData CreateStochasticSoilModelsMapData() { - return new MapLineData(PipingDataResources.StochasticSoilModelCollection_TypeDescriptor) + return new MapLineData(PipingDataResources.StochasticSoilModelCollection_TypeDescriptor, + new LineStyle(Color.FromArgb(70, Color.SaddleBrown), 5, DashStyle.Solid)) { - Style = new LineStyle(Color.FromArgb(70, Color.SaddleBrown), 5, DashStyle.Solid), SelectedMetaDataAttribute = RingtoetsCommonFormsResources.MetaData_Name }; }