Index: Core/Plugins/src/Core.Plugins.Map/Core.Plugins.Map.csproj
===================================================================
diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -reb86c18d67960b58fb41105bd161b743134aeb87
--- Core/Plugins/src/Core.Plugins.Map/Core.Plugins.Map.csproj (.../Core.Plugins.Map.csproj) (revision ac96d7c315129af851634ed5a4a6800b59ede718)
+++ Core/Plugins/src/Core.Plugins.Map/Core.Plugins.Map.csproj (.../Core.Plugins.Map.csproj) (revision eb86c18d67960b58fb41105bd161b743134aeb87)
@@ -39,6 +39,7 @@
True
Resources.resx
+
Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs
===================================================================
diff -u -r5c6072174d8047b062655d56d523d74c5e740039 -reb86c18d67960b58fb41105bd161b743134aeb87
--- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5c6072174d8047b062655d56d523d74c5e740039)
+++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision eb86c18d67960b58fb41105bd161b743134aeb87)
@@ -128,6 +128,53 @@
}
///
+ /// Looks up a localized string similar to De kleur waarmee deze categorie wordt weergegeven..
+ ///
+ public static string CategoryThemeProperties_Color_Description {
+ get {
+ return ResourceManager.GetString("CategoryThemeProperties_Color_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Het criterium van deze categorie..
+ ///
+ public static string CategoryThemeProperties_Criterion_Description {
+ get {
+ return ResourceManager.GetString("CategoryThemeProperties_Criterion_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Criterium.
+ ///
+ public static string CategoryThemeProperties_Criterion_DisplayName {
+ get {
+ return ResourceManager.GetString("CategoryThemeProperties_Criterion_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} = {1}.
+ ///
+ public static string CategoryThemeProperties_Criterion_ValueCriterionOperatorEqualValue_AttributeName_0_Value_1_ {
+ get {
+ return ResourceManager.GetString("CategoryThemeProperties_Criterion_ValueCriterionOperatorEqualValue_AttributeName_" +
+ "0_Value_1_", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} ≠ {1}.
+ ///
+ public static string CategoryThemeProperties_Criterion_ValueCriterionOperatorUnequalValue_AttributeName_0_Value_1_ {
+ get {
+ return ResourceManager.GetString("CategoryThemeProperties_Criterion_ValueCriterionOperatorUnequalValue_AttributeNam" +
+ "e_0_Value_1_", 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 {
Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx
===================================================================
diff -u -r5c6072174d8047b062655d56d523d74c5e740039 -reb86c18d67960b58fb41105bd161b743134aeb87
--- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision 5c6072174d8047b062655d56d523d74c5e740039)
+++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision eb86c18d67960b58fb41105bd161b743134aeb87)
@@ -325,4 +325,19 @@
De dikte van de lijn van de vlakken waarmee deze kaartlaag wordt weergegeven.
+
+ De kleur waarmee deze categorie wordt weergegeven.
+
+
+ Het criterium van deze categorie.
+
+
+ Criterium
+
+
+ {0} = {1}
+
+
+ {0} ≠ {1}
+
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/CategoryThemeProperties.cs
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/CategoryThemeProperties.cs (revision 0)
+++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/CategoryThemeProperties.cs (revision eb86c18d67960b58fb41105bd161b743134aeb87)
@@ -0,0 +1,108 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Util.Attributes;
+using Core.Components.Gis.Theme;
+using Core.Plugins.Map.Properties;
+
+namespace Core.Plugins.Map.PropertyClasses
+{
+ ///
+ /// ViewModel of for properties panel.
+ ///
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class CategoryThemeProperties : ObjectProperties
+ {
+ private readonly string attributeName;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The name of the attribute on which
+ /// is based on.
+ /// The theme to create the property info panel for.
+ /// Thrown when any parameter is null.
+ public CategoryThemeProperties(string attributeName, CategoryTheme categoryTheme)
+ {
+ if (attributeName == null)
+ {
+ throw new ArgumentNullException(nameof(attributeName));
+ }
+
+ if (categoryTheme == null)
+ {
+ throw new ArgumentNullException(nameof(categoryTheme));
+ }
+
+ this.attributeName = attributeName;
+ data = categoryTheme;
+ }
+
+ [PropertyOrder(1)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CategoryThemeProperties_Criterion_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CategoryThemeProperties_Criterion_Description))]
+ [TypeConverter(typeof(ColorTypeConverter))]
+ public string Criterion
+ {
+ get
+ {
+ switch (data.Criterion.ValueOperator)
+ {
+ case ValueCriterionOperator.EqualValue:
+ return string.Format(Resources.CategoryThemeProperties_Criterion_ValueCriterionOperatorEqualValue_AttributeName_0_Value_1_,
+ attributeName,
+ data.Criterion.Value);
+ case ValueCriterionOperator.UnequalValue:
+ return string.Format(Resources.CategoryThemeProperties_Criterion_ValueCriterionOperatorUnequalValue_AttributeName_0_Value_1_,
+ attributeName,
+ data.Criterion.Value);
+ default:
+ throw new NotSupportedException();
+ }
+ }
+ }
+
+ [PropertyOrder(2)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Styling))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapData_Color_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CategoryThemeProperties_Color_Description))]
+ [TypeConverter(typeof(ColorTypeConverter))]
+ public Color Color
+ {
+ get
+ {
+ return data.Color;
+ }
+ }
+
+ public override string ToString()
+ {
+ return string.Empty;
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj
===================================================================
diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -reb86c18d67960b58fb41105bd161b743134aeb87
--- Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj (.../Core.Plugins.Map.Test.csproj) (revision ac96d7c315129af851634ed5a4a6800b59ede718)
+++ Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj (.../Core.Plugins.Map.Test.csproj) (revision eb86c18d67960b58fb41105bd161b743134aeb87)
@@ -58,6 +58,7 @@
+
@@ -120,6 +121,10 @@
{318ba582-88c9-4816-a54a-a7e431461de3}
Core.Components.Gis
+
+ {F0FB401A-3494-4237-9E6D-02CDF77912A8}
+ Core.Components.Gis.TestUtil
+
{610e0a9c-1997-4c43-a10e-39d4c66ada93}
Core.Plugins.Map
Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/CategoryThemePropertiesTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/CategoryThemePropertiesTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/CategoryThemePropertiesTest.cs (revision eb86c18d67960b58fb41105bd161b743134aeb87)
@@ -0,0 +1,148 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using Core.Components.Gis.TestUtil;
+using Core.Components.Gis.Theme;
+using Core.Plugins.Map.PropertyClasses;
+using NUnit.Framework;
+
+namespace Core.Plugins.Map.Test.PropertyClasses
+{
+ [TestFixture]
+ public class CategoryThemePropertiesTest
+ {
+ private const int criterionPropertyIndex = 0;
+ private const int colorPropertyIndex = 1;
+
+ [Test]
+ public void Constructor_AttributeNameNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new CategoryThemeProperties(null, CategoryThemeTestFactory.CreateCategoryTheme());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("attributeName", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_CategoryThemeNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new CategoryThemeProperties(string.Empty, null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("categoryTheme", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ CategoryTheme theme = CategoryThemeTestFactory.CreateCategoryTheme();
+
+ // Call
+ var properties = new CategoryThemeProperties(string.Empty, theme);
+
+ // Assert
+ Assert.AreSame(theme, properties.Data);
+ Assert.IsInstanceOf>(properties);
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ CategoryTheme theme = CategoryThemeTestFactory.CreateCategoryTheme();
+
+ // Call
+ var properties = new CategoryThemeProperties(string.Empty, theme);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(2, dynamicProperties.Count);
+
+ const string themeCategory = "Stijl";
+ PropertyDescriptor criterionProperty = dynamicProperties[criterionPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(criterionProperty,
+ themeCategory,
+ "Criterium",
+ "Het criterium van deze categorie.",
+ true);
+
+ PropertyDescriptor colorProperty = dynamicProperties[colorPropertyIndex];
+ Assert.IsInstanceOf(colorProperty.Converter);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(colorProperty,
+ themeCategory,
+ "Kleur",
+ "De kleur waarmee deze categorie wordt weergegeven.",
+ true);
+ }
+
+ [Test]
+ [TestCase(ValueCriterionOperator.EqualValue, "{0} = {1}")]
+ [TestCase(ValueCriterionOperator.UnequalValue, "{0} ≠ {1}")]
+ public void Constructor_Always_ReturnExpectedValues(ValueCriterionOperator valueOperator,
+ string formatExpression)
+ {
+ // Setup
+ const string attributeName = "AttributeName";
+
+ var random = new Random(21);
+ double value = random.NextDouble();
+
+ Color color = Color.FromKnownColor(random.NextEnumValue());
+ var criterion = new ValueCriterion(valueOperator, value);
+ var theme = new CategoryTheme(color, criterion);
+
+ // Call
+ var properties = new CategoryThemeProperties(attributeName, theme);
+
+ // Assert
+ string expectedValue = string.Format(formatExpression, attributeName, value);
+ Assert.AreEqual(expectedValue, properties.Criterion);
+
+ Assert.AreEqual(color, properties.Color);
+ }
+
+ [Test]
+ public void ToString_Always_ReturnsEmptyString()
+ {
+ // Setup
+ CategoryTheme theme = CategoryThemeTestFactory.CreateCategoryTheme();
+
+ var properties = new CategoryThemeProperties(string.Empty, theme);
+
+ // Call
+ string toString = properties.ToString();
+
+ // Assert
+ Assert.IsEmpty(toString);
+ }
+ }
+}
\ No newline at end of file