Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/FeatureBasedMapDataProperties.cs =================================================================== diff -u -r72c17e3476c4e8dc4fa1e61ce324093da2ec57ff -r238c6231af18aa67dfb68fa8a192ac310bc0403a --- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/FeatureBasedMapDataProperties.cs (.../FeatureBasedMapDataProperties.cs) (revision 72c17e3476c4e8dc4fa1e61ce324093da2ec57ff) +++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/FeatureBasedMapDataProperties.cs (.../FeatureBasedMapDataProperties.cs) (revision 238c6231af18aa67dfb68fa8a192ac310bc0403a) @@ -25,7 +25,6 @@ using System.Drawing.Design; using System.Linq; using Core.Common.Gui.Attributes; -using Core.Common.Gui.Converters; using Core.Common.Gui.PropertyBag; using Core.Common.Util.Attributes; using Core.Common.Util.Extensions; @@ -47,8 +46,6 @@ private const int showLabelsPropertyIndex = 3; private const int selectedMetaDataAttributePropertyIndex = 4; private const int styleTypePropertyIndex = 5; - private const int mapThemeAttributeNamePropertyIndex = 6; - private const int mapThemeCategoryPropertyIndex = 7; private readonly IEnumerable parents; /// @@ -138,47 +135,10 @@ { get { - if (data.MapTheme != null) - { - return Resources.FeatureBasedMapData_StyleType_Categories; - } - return Resources.FeatureBasedMapData_StyleType_Single_Symbol; } } - [PropertyOrder(mapThemeAttributeNamePropertyIndex)] - [DynamicVisible] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] - [ResourcesDisplayName(typeof(Resources), nameof(Resources.FeatureBasedMapdata_MapThemeAttributeName_DisplayName))] - [ResourcesDescription(typeof(Resources), nameof(Resources.FeatureBasedMapdata_MapThemeAttributeName_Description))] - public string MapThemeAttributeName - { - get - { - return data.MapTheme != null - ? data.MapTheme.AttributeName - : string.Empty; - } - } - - [PropertyOrder(mapThemeCategoryPropertyIndex)] - [DynamicVisible] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))] - [ResourcesDisplayName(typeof(Resources), nameof(Resources.FeatureBasedMapdata_Categories_DisplayName))] - [TypeConverter(typeof(ExpandableArrayConverter))] - public CategoryThemeProperties[] Categories - { - get - { - return data.MapTheme != null - ? data.MapTheme.CategoryThemes - .Select(theme => new CategoryThemeProperties(data.MapTheme.AttributeName, theme)) - .ToArray() - : new CategoryThemeProperties[0]; - } - } - [PropertyOrder(selectedMetaDataAttributePropertyIndex)] [DynamicVisible] [DynamicReadOnly] @@ -219,12 +179,6 @@ return data.ShowLabels; } - if (propertyName == nameof(MapThemeAttributeName) - || propertyName == nameof(Categories)) - { - return data.MapTheme != null; - } - return false; } Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/FeatureBasedMapDataPropertiesTest.cs =================================================================== diff -u -r72c17e3476c4e8dc4fa1e61ce324093da2ec57ff -r238c6231af18aa67dfb68fa8a192ac310bc0403a --- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/FeatureBasedMapDataPropertiesTest.cs (.../FeatureBasedMapDataPropertiesTest.cs) (revision 72c17e3476c4e8dc4fa1e61ce324093da2ec57ff) +++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/FeatureBasedMapDataPropertiesTest.cs (.../FeatureBasedMapDataPropertiesTest.cs) (revision 238c6231af18aa67dfb68fa8a192ac310bc0403a) @@ -24,15 +24,13 @@ using System.ComponentModel; using System.Linq; using Core.Common.Base; -using Core.Common.Gui.Converters; using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; using Core.Common.Util.Extensions; using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; using Core.Components.Gis.TestUtil; -using Core.Components.Gis.Theme; using Core.Plugins.Map.PropertyClasses; using Core.Plugins.Map.UITypeEditors; using NUnit.Framework; @@ -50,9 +48,6 @@ private const int selectedMetaDataAttributePropertyIndex = 4; private const int stylePropertyIndex = 5; - private const int mapThemeAttributeNamePropertyIndex = 5; - private const int mapThemeCategoriesPropertyIndex = 6; - [Test] public void Constructor_DataNull_ThrowsArgumentNullException() { @@ -88,9 +83,6 @@ Assert.IsInstanceOf>(properties); Assert.IsInstanceOf(properties); Assert.AreSame(data, properties.Data); - - TestHelper.AssertTypeConverter( - nameof(properties.Categories)); } [Test] @@ -111,46 +103,9 @@ Assert.AreEqual(data.MetaData, properties.GetAvailableMetaDataAttributes()); Assert.AreEqual("Enkel symbool", properties.StyleType); - Assert.IsEmpty(properties.MapThemeAttributeName); - CollectionAssert.IsEmpty(properties.Categories); } [Test] - public void Constructor_MapDataInstanceWithMapTheme_ReturnCorrectPropertyValues() - { - // Setup - var mapData = new TestFeatureBasedMapData - { - MapTheme = new MapTheme("Attribute", new[] - { - CategoryThemeTestFactory.CreateCategoryTheme() - }) - }; - - // Call - var properties = new TestFeatureBasedMapDataProperties(mapData, Enumerable.Empty()); - - // Assert - Assert.AreEqual(mapData.Name, properties.Name); - Assert.AreEqual("Test feature based map data", properties.Type); - Assert.AreEqual(mapData.IsVisible, properties.IsVisible); - Assert.AreEqual(mapData.ShowLabels, properties.ShowLabels); - Assert.IsEmpty(properties.SelectedMetaDataAttribute.MetaDataAttribute); - Assert.AreEqual(mapData.MetaData, properties.GetAvailableMetaDataAttributes()); - - Assert.AreEqual("Categorie", properties.StyleType); - Assert.AreEqual(mapData.MapTheme.AttributeName, properties.MapThemeAttributeName); - - IEnumerable categoryThemes = mapData.MapTheme.CategoryThemes; - Assert.AreEqual(categoryThemes.Count(), properties.Categories.Length); - - CategoryThemeProperties categoryThemeProperties = properties.Categories.First(); - CategoryTheme categoryTheme = categoryThemes.First(); - Assert.AreSame(categoryTheme, categoryThemeProperties.Data); - StringAssert.StartsWith(mapData.MapTheme.AttributeName, categoryThemeProperties.Criterion); - } - - [Test] public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup @@ -260,7 +215,7 @@ { new MapDataCollection("test 1"), new MapDataCollection("test 2"), - new MapDataCollection("test 3"), + new MapDataCollection("test 3") }; mapData.Attach(observer); @@ -270,7 +225,7 @@ // Call properties.IsVisible = false; - + // Assert Assert.IsFalse(properties.IsVisible); mocks.VerifyAll(); @@ -356,48 +311,6 @@ [Test] [TestCase(true)] [TestCase(false)] - public void MapThemeRelatedProperties_MapDataWithMapThemeConfiguration_PropertiesShouldBeVisible(bool hasMapTheme) - { - // Setup - var mapData = new TestFeatureBasedMapData - { - MapTheme = hasMapTheme - ? new MapTheme("Attribute", new[] - { - CategoryThemeTestFactory.CreateCategoryTheme() - }) - : null - }; - - // Call - var properties = new TestFeatureBasedMapDataProperties(mapData, Enumerable.Empty()); - - // Assert - // Assert - PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(hasMapTheme ? 7 : 5, dynamicProperties.Count); - - if (hasMapTheme) - { - PropertyDescriptor mapThemeAttributeNameProperty = dynamicProperties[mapThemeAttributeNamePropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(mapThemeAttributeNameProperty, - "Stijl", - "Op basis van", - "Toont de eigenschap op basis waarvan de kaartlaag is gecategoriseerd.", - true); - - PropertyDescriptor categoriesAttribute = dynamicProperties[mapThemeCategoriesPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoriesAttribute, - "Stijl", - "Categorieën", - string.Empty, - true); - } - } - - [Test] - [TestCase(true)] - [TestCase(false)] public void DynamicReadOnlyValidator_MapHasMetaData_ReturnsExpectedValuesForRelevantProperties(bool hasMetaData) { // Setup @@ -474,35 +387,6 @@ } [Test] - [TestCase(true)] - [TestCase(false)] - public void DynamicVisibleValidationMethod_MapDataWithMapTheme_ReturnsExpectedValuesForRelevantProperties(bool hasMapTheme) - { - // Setup - var mapData = new TestFeatureBasedMapData - { - MapTheme = hasMapTheme - ? new MapTheme("Attribute", new[] - { - CategoryThemeTestFactory.CreateCategoryTheme() - }) - : null - }; - - var properties = new TestFeatureBasedMapDataProperties(mapData, Enumerable.Empty()); - - // Call - bool isMapThemeAttributeNameVisible = properties.DynamicVisibleValidationMethod( - nameof(TestFeatureBasedMapDataProperties.MapThemeAttributeName)); - bool isMapThemeCategoriesVisible = properties.DynamicVisibleValidationMethod( - nameof(TestFeatureBasedMapDataProperties.Categories)); - - // Assert - Assert.AreEqual(hasMapTheme, isMapThemeAttributeNameVisible); - Assert.AreEqual(hasMapTheme, isMapThemeCategoriesVisible); - } - - [Test] public void DynamicVisibleValidationMethod_AnyOtherProperty_ReturnsTrue() { var mapData = new TestFeatureBasedMapData @@ -511,11 +395,7 @@ { new MapFeature(Enumerable.Empty()) }, - ShowLabels = true, - MapTheme = new MapTheme("Attribute", new[] - { - CategoryThemeTestFactory.CreateCategoryTheme() - }) + ShowLabels = true }; var properties = new TestFeatureBasedMapDataProperties(mapData, Enumerable.Empty());