Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs (.../MapLineDataConverter.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs (.../MapLineDataConverter.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -44,9 +44,7 @@ protected override IFeatureSymbolizer CreateSymbolizer(MapLineData mapData) { - return mapData.Style != null - ? new LineSymbolizer(mapData.Style.Color, mapData.Style.Color, mapData.Style.Width, mapData.Style.Style, LineCap.Round) - : new LineSymbolizer(); + return new LineSymbolizer(mapData.Style.Color, mapData.Style.Color, mapData.Style.Width, mapData.Style.DashStyle, LineCap.Round); } private static IBasicGeometry GetGeometry(MapFeature mapFeature) Index: Core/Components/src/Core.Components.Gis/Style/LineStyle.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Core/Components/src/Core.Components.Gis/Style/LineStyle.cs (.../LineStyle.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Components/src/Core.Components.Gis/Style/LineStyle.cs (.../LineStyle.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -34,27 +34,27 @@ /// /// The color of the line. /// The width of the line. - /// The of the line. - public LineStyle(Color color, int width, DashStyle style) + /// The of the line. + public LineStyle(Color color, int width, DashStyle dashStyle) { Color = color; Width = width; - Style = style; + DashStyle = dashStyle; } /// - /// Gets the line color. + /// Gets or sets the line color. /// - public Color Color { get; private set; } + public Color Color { get; set; } /// - /// Gets the line width. + /// Gets or sets the line width. /// - public int Width { get; private set; } + public int Width { get; set; } /// - /// Gets the line style. + /// Gets or sets the line style. /// - public DashStyle Style { get; private set; } + public DashStyle DashStyle { get; set; } } } \ No newline at end of file Index: Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs =================================================================== diff -u -r31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2 -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs (.../MapLineDataTest.cs) (revision 31fd11e38313a3c1ee9bb0aa28ce7cdc49f749b2) +++ Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs (.../MapLineDataTest.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -49,7 +49,7 @@ Assert.IsInstanceOf(data); Assert.AreEqual(Color.Black, data.Style.Color); Assert.AreEqual(2, data.Style.Width); - Assert.AreEqual(DashStyle.Solid, data.Style.Style); + Assert.AreEqual(DashStyle.Solid, data.Style.DashStyle); } [Test] Index: Core/Components/test/Core.Components.Gis.Test/Style/LineStyleTest.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Core/Components/test/Core.Components.Gis.Test/Style/LineStyleTest.cs (.../LineStyleTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Components/test/Core.Components.Gis.Test/Style/LineStyleTest.cs (.../LineStyleTest.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -43,7 +43,7 @@ // Assert Assert.AreEqual(color, lineStyle.Color); Assert.AreEqual(width, lineStyle.Width); - Assert.AreEqual(style, lineStyle.Style); + Assert.AreEqual(style, lineStyle.DashStyle); } } } \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs =================================================================== diff -u -rf428df0e20d75d31d35cc78141b326ca0e8bd699 -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f428df0e20d75d31d35cc78141b326ca0e8bd699) +++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -375,6 +375,42 @@ } /// + /// Looks up a localized string similar to De stijl van de lijnen waarmee deze kaartlaag wordt weergegeven.. + /// + public static string MapLineData_DashStyle_Description { + get { + return ResourceManager.GetString("MapLineData_DashStyle_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lijnstijl. + /// + public static string MapLineData_DashStyle_DisplayName { + get { + return ResourceManager.GetString("MapLineData_DashStyle_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De dikte van de lijnen waarmee deze kaartlaag wordt weergegeven.. + /// + public static string MapLineData_Width_Description { + get { + return ResourceManager.GetString("MapLineData_Width_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lijndikte. + /// + public static string MapLineData_Width_DisplayName { + get { + return ResourceManager.GetString("MapLineData_Width_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Shapebestand. /// public static string MapPlugin_GetImportInfos_MapDataCollection_filefilter_Description { Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx =================================================================== diff -u -rf428df0e20d75d31d35cc78141b326ca0e8bd699 -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision f428df0e20d75d31d35cc78141b326ca0e8bd699) +++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -304,4 +304,16 @@ Symbool + + De stijl van de lijnen waarmee deze kaartlaag wordt weergegeven. + + + Lijnstijl + + + De dikte van de lijnen waarmee deze kaartlaag wordt weergegeven. + + + Lijndikte + \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapLineDataProperties.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapLineDataProperties.cs (.../MapLineDataProperties.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapLineDataProperties.cs (.../MapLineDataProperties.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -19,8 +19,17 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Design; +using System.Drawing.Drawing2D; +using Core.Common.Gui.Attributes; +using Core.Common.Utils; +using Core.Common.Utils.Attributes; using Core.Components.Gis.Data; +using Core.Plugins.Map.Converters; using Core.Plugins.Map.Properties; +using Core.Plugins.Map.UITypeEditors; namespace Core.Plugins.Map.PropertyClasses { @@ -29,6 +38,62 @@ /// public class MapLineDataProperties : FeatureBasedMapDataProperties { + [PropertyOrder(5)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapData_Color_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MapData_Color_Description))] + [Editor(typeof(ColorEditor), typeof(UITypeEditor))] + [TypeConverter(typeof(MapColorConverter))] + public Color Color + { + get + { + return data.Style.Color; + } + set + { + data.Style.Color = value; + data.NotifyObservers(); + } + } + + [PropertyOrder(6)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapLineData_Width_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MapLineData_Width_Description))] + [Editor(typeof(ColorEditor), typeof(UITypeEditor))] + [TypeConverter(typeof(MapColorConverter))] + public int Width + { + get + { + return data.Style.Width; + } + set + { + data.Style.Width = value; + data.NotifyObservers(); + } + } + + [PropertyOrder(7)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapLineData_DashStyle_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MapLineData_DashStyle_Description))] + [TypeConverter(typeof(EnumTypeConverter))] + public DashStyle DashStyle + { + get + { + return data.Style.DashStyle; + } + set + { + data.Style.DashStyle = value; + data.NotifyObservers(); + } + } + public override string Type { get Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapLineDataPropertiesTest.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapLineDataPropertiesTest.cs (.../MapLineDataPropertiesTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapLineDataPropertiesTest.cs (.../MapLineDataPropertiesTest.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -19,15 +19,31 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using Core.Common.Base; +using Core.Common.TestUtil; +using Core.Common.Utils; using Core.Components.Gis.Data; +using Core.Components.Gis.Features; +using Core.Components.Gis.Geometries; +using Core.Components.Gis.Style; +using Core.Plugins.Map.Converters; using Core.Plugins.Map.PropertyClasses; using NUnit.Framework; +using Rhino.Mocks; namespace Core.Plugins.Map.Test.PropertyClasses { [TestFixture] public class MapLineDataPropertiesTest { + private const int colorPropertyIndex = 5; + private const int widthPropertyIndex = 6; + private const int lineStylePropertyIndex = 7; + [Test] public void Constructor_ExpectedValues() { @@ -39,5 +55,107 @@ Assert.IsNull(properties.Data); Assert.AreEqual("Lijnen", properties.Type); } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Setup + var mapLineData = new MapLineData("Test") + { + Features = new[] + { + new MapFeature(Enumerable.Empty()) + }, + ShowLabels = true + }; + + // Call + var properties = new MapLineDataProperties + { + Data = mapLineData + }; + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(8, dynamicProperties.Count); + + PropertyDescriptor colorProperty = dynamicProperties[colorPropertyIndex]; + Assert.IsInstanceOf(colorProperty.Converter); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(colorProperty, + "Stijl", + "Kleur", + "De kleur van de symbolen waarmee deze kaartlaag wordt weergegeven."); + + PropertyDescriptor strokeColorProperty = dynamicProperties[widthPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeColorProperty, + "Stijl", + "Lijndikte", + "De dikte van de lijnen waarmee deze kaartlaag wordt weergegeven."); + + PropertyDescriptor strokeThicknessProperty = dynamicProperties[lineStylePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeThicknessProperty, + "Stijl", + "Lijnstijl", + "De stijl van de lijnen waarmee deze kaartlaag wordt weergegeven."); + } + + [Test] + public void Data_SetNewMapLineDataInstance_ReturnCorrectPropertyValues() + { + // Setup + Color color = Color.Aqua; + const int width = 4; + const DashStyle dashStyle = DashStyle.DashDot; + + var mapLineData = new MapLineData("Test", new LineStyle(color, width, dashStyle)); + var properties = new MapLineDataProperties(); + + // Call + properties.Data = mapLineData; + + // Assert + Assert.AreEqual(mapLineData.ShowLabels, properties.ShowLabels); + Assert.AreEqual(string.Empty, properties.SelectedMetaDataAttribute.MetaDataAttribute); + Assert.AreEqual(mapLineData.MetaData, properties.GetAvailableMetaDataAttributes()); + + Assert.AreEqual(color, properties.Color); + Assert.AreEqual(width, properties.Width); + Assert.AreEqual(dashStyle, properties.DashStyle); + } + + [Test] + public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() + { + // Setup + const int numberOfChangedProperties = 3; + var mocks = new MockRepository(); + var observerMock = mocks.StrictMock(); + observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); + mocks.ReplayAll(); + + var mapLineData = new MapLineData("Test", new LineStyle(Color.AliceBlue, 3, DashStyle.Solid)); + + mapLineData.Attach(observerMock); + + var properties = new MapLineDataProperties + { + Data = mapLineData + }; + + Color newColor = Color.Blue; + const int newWidth = 6; + const DashStyle newDashStyle = DashStyle.DashDot; + + // Call + properties.Color = newColor; + properties.Width = newWidth; + properties.DashStyle = newDashStyle; + + // Assert + Assert.AreEqual(newColor, mapLineData.Style.Color); + Assert.AreEqual(newWidth, mapLineData.Style.Width); + Assert.AreEqual(newDashStyle, mapLineData.Style.DashStyle); + mocks.VerifyAll(); + } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsMapDataFactoryTest.cs =================================================================== diff -u -rf1f94637a6b45b394493bf16a078b317c02d329b -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsMapDataFactoryTest.cs (.../RingtoetsMapDataFactoryTest.cs) (revision f1f94637a6b45b394493bf16a078b317c02d329b) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsMapDataFactoryTest.cs (.../RingtoetsMapDataFactoryTest.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -150,7 +150,7 @@ { Assert.AreEqual(color, lineStyle.Color); Assert.AreEqual(width, lineStyle.Width); - Assert.AreEqual(style, lineStyle.Style); + Assert.AreEqual(style, lineStyle.DashStyle); } private static void AssertEqualStyle(PointStyle pointStyle, Color color, int width, PointSymbol symbol) Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsMapDataFactoryTest.cs =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsMapDataFactoryTest.cs (.../MacroStabilityInwardsMapDataFactoryTest.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsMapDataFactoryTest.cs (.../MacroStabilityInwardsMapDataFactoryTest.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -61,7 +61,7 @@ { Assert.AreEqual(color, lineStyle.Color); Assert.AreEqual(width, lineStyle.Width); - Assert.AreEqual(style, lineStyle.Style); + Assert.AreEqual(style, lineStyle.DashStyle); } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Factories/PipingMapDataFactoryTest.cs =================================================================== diff -u -r616d3ed2e3262894d16948262fa1b223d2bc806e -re8c1804f4a27a708313b7ba2512512b62ad2d3e6 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Factories/PipingMapDataFactoryTest.cs (.../PipingMapDataFactoryTest.cs) (revision 616d3ed2e3262894d16948262fa1b223d2bc806e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Factories/PipingMapDataFactoryTest.cs (.../PipingMapDataFactoryTest.cs) (revision e8c1804f4a27a708313b7ba2512512b62ad2d3e6) @@ -61,7 +61,7 @@ { Assert.AreEqual(color, lineStyle.Color); Assert.AreEqual(width, lineStyle.Width); - Assert.AreEqual(style, lineStyle.Style); + Assert.AreEqual(style, lineStyle.DashStyle); } } } \ No newline at end of file