Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -rf428df0e20d75d31d35cc78141b326ca0e8bd699 --- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f428df0e20d75d31d35cc78141b326ca0e8bd699) @@ -119,6 +119,15 @@ } /// + /// Looks up a localized string similar to Stijl. + /// + public static string Categories_Styling { + get { + return ResourceManager.GetString("Categories_Styling", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Toont de eigenschap op basis waarvan labels worden weergegeven op deze kaartlaag.. /// public static string FeatureBasedMapdata_SelectedMetaDataAttribute_Description { @@ -219,6 +228,24 @@ } /// + /// Looks up a localized string similar to De kleur van de symbolen waarmee deze kaartlaag wordt weergegeven.. + /// + public static string MapData_Color_Description { + get { + return ResourceManager.GetString("MapData_Color_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kleur. + /// + public static string MapData_Color_DisplayName { + get { + return ResourceManager.GetString("MapData_Color_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Geeft aan of deze kaartlaag wordt weergegeven.. /// public static string MapData_IsVisible_Description { @@ -376,6 +403,78 @@ } /// + /// Looks up a localized string similar to De grootte van de symbolen waarmee deze kaartlaag wordt weergegeven.. + /// + public static string MapPointData_Size_Description { + get { + return ResourceManager.GetString("MapPointData_Size_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Grootte. + /// + public static string MapPointData_Size_DisplayName { + get { + return ResourceManager.GetString("MapPointData_Size_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De kleur van de lijn van de symbolen waarmee deze kaartlaag wordt weergegeven.. + /// + public static string MapPointData_StrokeColor_Description { + get { + return ResourceManager.GetString("MapPointData_StrokeColor_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lijnkleur. + /// + public static string MapPointData_StrokeColor_DisplayName { + get { + return ResourceManager.GetString("MapPointData_StrokeColor_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De dikte van de lijn van de symbolen waarmee deze kaartlaag wordt weergegeven.. + /// + public static string MapPointData_StrokeThickness_Description { + get { + return ResourceManager.GetString("MapPointData_StrokeThickness_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lijndikte. + /// + public static string MapPointData_StrokeThickness_DisplayName { + get { + return ResourceManager.GetString("MapPointData_StrokeThickness_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Het symbool waarmee deze kaartlaag wordt weergegeven.. + /// + public static string MapPointData_Symbol_Description { + get { + return ResourceManager.GetString("MapPointData_Symbol_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Symbool. + /// + public static string MapPointData_Symbol_Displayname { + get { + return ResourceManager.GetString("MapPointData_Symbol_Displayname", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap MapPointIcon { Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx =================================================================== diff -u -r392383a267a69010698aef6948b1e53c6a889bae -rf428df0e20d75d31d35cc78141b326ca0e8bd699 --- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision 392383a267a69010698aef6948b1e53c6a889bae) +++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision f428df0e20d75d31d35cc78141b326ca0e8bd699) @@ -271,4 +271,37 @@ Om het zoomniveau aan te passen moet de kaartlaag elementen bevatten. + + Stijl + + + De kleur van de symbolen waarmee deze kaartlaag wordt weergegeven. + + + Kleur + + + De grootte van de symbolen waarmee deze kaartlaag wordt weergegeven. + + + Grootte + + + De kleur van de lijn van de symbolen waarmee deze kaartlaag wordt weergegeven. + + + Lijnkleur + + + De dikte van de lijn van de symbolen waarmee deze kaartlaag wordt weergegeven. + + + Lijndikte + + + Het symbool waarmee deze kaartlaag wordt weergegeven. + + + Symbool + \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -rf428df0e20d75d31d35cc78141b326ca0e8bd699 --- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs (.../MapPointDataProperties.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs (.../MapPointDataProperties.cs) (revision f428df0e20d75d31d35cc78141b326ca0e8bd699) @@ -19,6 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Core.Common.Gui.Attributes; +using Core.Common.Utils.Attributes; using Core.Components.Gis.Data; using Core.Plugins.Map.Properties; @@ -29,6 +31,64 @@ /// public class MapPointDataProperties : 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))] + public string Color + { + get + { + return data.Style?.Color.ToString() ?? string.Empty; + } + } + + [PropertyOrder(6)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapPointData_StrokeColor_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MapPointData_StrokeColor_Description))] + public string StrokeColor + { + get + { + return data.Style?.Color.ToString() ?? string.Empty; + } + } + [PropertyOrder(7)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapPointData_StrokeThickness_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MapPointData_StrokeThickness_Description))] + public double StrokeThickness + { + get + { + return data.Style?.Size ?? 0; + } + } + [PropertyOrder(8)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapPointData_Size_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MapPointData_Size_Description))] + public double Size + { + get + { + return data.Style?.Size ?? 0; + } + } + + [PropertyOrder(9)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapPointData_Symbol_Displayname))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MapPointData_Symbol_Description))] + public string Symbol + { + get + { + return data.Style?.Symbol.ToString() ?? string.Empty; + } + } + public override string Type { get Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -rf428df0e20d75d31d35cc78141b326ca0e8bd699 --- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs (.../MapPointDataPropertiesTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs (.../MapPointDataPropertiesTest.cs) (revision f428df0e20d75d31d35cc78141b326ca0e8bd699) @@ -19,7 +19,14 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.ComponentModel; +using System.Drawing; +using System.Linq; +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 Core.Plugins.Map.PropertyClasses; using NUnit.Framework; @@ -28,6 +35,12 @@ [TestFixture] public class MapPointDataPropertiesTest { + private const int colorPropertyIndex = 5; + private const int strokeColorPropertyIndex = 6; + private const int strokeThicknessPropertyIndex = 7; + private const int sizePropertyIndex = 8; + private const int symbolPropertyIndex = 9; + [Test] public void Constructor_ExpectedValues() { @@ -39,5 +52,115 @@ Assert.IsNull(properties.Data); Assert.AreEqual("Punten", properties.Type); } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Setup + var mapPointData = new MapPointData("Test") + { + Features = new[] + { + new MapFeature(Enumerable.Empty()) + }, + ShowLabels = true + }; + + // Call + var properties = new MapPointDataProperties + { + Data = mapPointData + }; + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(10, dynamicProperties.Count); + + PropertyDescriptor colorProperty = dynamicProperties[colorPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(colorProperty, + "Stijl", + "Kleur", + "De kleur van de symbolen waarmee deze kaartlaag wordt weergegeven.", + true); + + PropertyDescriptor strokeColorProperty = dynamicProperties[strokeColorPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeColorProperty, + "Stijl", + "Lijnkleur", + "De kleur van de lijn van de symbolen waarmee deze kaartlaag wordt weergegeven.", + true); + + PropertyDescriptor strokeThicknessProperty = dynamicProperties[strokeThicknessPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeThicknessProperty, + "Stijl", + "Lijndikte", + "De dikte van de lijn van de symbolen waarmee deze kaartlaag wordt weergegeven.", + true); + + PropertyDescriptor sizeProperty = dynamicProperties[sizePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(sizeProperty, + "Stijl", + "Grootte", + "De grootte van de symbolen waarmee deze kaartlaag wordt weergegeven.", + true); + + PropertyDescriptor symbolProperty = dynamicProperties[symbolPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(symbolProperty, + "Stijl", + "Symbool", + "Het symbool waarmee deze kaartlaag wordt weergegeven.", + true); + } + + [Test] + public void Data_SetNewMapPointDataInstanceWithStyle_ReturnCorrectPropertyValues() + { + // Setup + Color color = Color.Aqua; + const int size = 4; + const PointSymbol symbol = PointSymbol.Circle; + + var mapPointData = new MapPointData("Test") + { + Style = new PointStyle(color, size, symbol) + }; + var properties = new MapPointDataProperties(); + + // Call + properties.Data = mapPointData; + + // Assert + Assert.AreEqual(mapPointData.ShowLabels, properties.ShowLabels); + Assert.AreEqual(string.Empty, properties.SelectedMetaDataAttribute.MetaDataAttribute); + Assert.AreEqual(mapPointData.MetaData, properties.GetAvailableMetaDataAttributes()); + + Assert.AreEqual(color.ToString(), properties.Color); + Assert.AreEqual(color.ToString(), properties.StrokeColor); + Assert.AreEqual(size, properties.StrokeThickness); + Assert.AreEqual(size, properties.Size); + Assert.AreEqual(symbol.ToString(), properties.Symbol); + } + + [Test] + public void Data_SetNewMapPointDataInstanceWithoutStyle_ReturnCorrectPropertyValues() + { + // Setup + var mapPointData = new MapPointData("Test"); + var properties = new MapPointDataProperties(); + + // Call + properties.Data = mapPointData; + + // Assert + Assert.AreEqual(mapPointData.ShowLabels, properties.ShowLabels); + Assert.AreEqual(string.Empty, properties.SelectedMetaDataAttribute.MetaDataAttribute); + Assert.AreEqual(mapPointData.MetaData, properties.GetAvailableMetaDataAttributes()); + + Assert.AreEqual(string.Empty, properties.Color); + Assert.AreEqual(string.Empty, properties.StrokeColor); + Assert.AreEqual(0, properties.StrokeThickness); + Assert.AreEqual(0, properties.Size); + Assert.AreEqual(string.Empty, properties.Symbol); + } } } \ No newline at end of file