Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs =================================================================== diff -u -rcbb68632c994ef71c5fd4a2b3a8749a207553679 -rd16986d8086bbf899b59cd2db438f9522d5dd290 --- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision cbb68632c994ef71c5fd4a2b3a8749a207553679) +++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d16986d8086bbf899b59cd2db438f9522d5dd290) @@ -22,7 +22,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -101,6 +101,15 @@ } /// + /// Looks up a localized string similar to Label. + /// + public static string Categories_Label { + get { + return ResourceManager.GetString("Categories_Label", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kaart. /// public static string General_Map { @@ -120,7 +129,7 @@ } /// - /// Looks up a localized string similar to Naam van de kaartlaag.. + /// Looks up a localized string similar to De naam van de kaartlaag.. /// public static string MapData_Name_Description { get { @@ -138,6 +147,24 @@ } /// + /// Looks up a localized string similar to Geeft aan of op deze kaartlaag labels moeten worden weergegeven.. + /// + public static string MapData_ShowLabels_Description { + get { + return ResourceManager.GetString("MapData_ShowLabels_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Weergeven. + /// + public static string MapData_ShowLabels_DisplayName { + get { + return ResourceManager.GetString("MapData_ShowLabels_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap MapIcon { Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx =================================================================== diff -u -rcbb68632c994ef71c5fd4a2b3a8749a207553679 -rd16986d8086bbf899b59cd2db438f9522d5dd290 --- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision cbb68632c994ef71c5fd4a2b3a8749a207553679) +++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision d16986d8086bbf899b59cd2db438f9522d5dd290) @@ -215,9 +215,18 @@ Algemeen - Naam van de kaartlaag. + De naam van de kaartlaag. Naam + + Label + + + Geeft aan of op deze kaartlaag labels moeten worden weergegeven. + + + Weergeven + \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs =================================================================== diff -u -rcbb68632c994ef71c5fd4a2b3a8749a207553679 -rd16986d8086bbf899b59cd2db438f9522d5dd290 --- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs (.../MapPointDataProperties.cs) (revision cbb68632c994ef71c5fd4a2b3a8749a207553679) +++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs (.../MapPointDataProperties.cs) (revision d16986d8086bbf899b59cd2db438f9522d5dd290) @@ -32,7 +32,8 @@ /// public class MapPointDataProperties : ObjectProperties { - private const int namePropertyIndex = 1; + private const int namePropertyIndex = 0; + private const int showLabelsPropertyIndex = 1; [PropertyOrder(namePropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_General")] @@ -45,5 +46,22 @@ return data.Name; } } + + [PropertyOrder(showLabelsPropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_Label")] + [ResourcesDisplayName(typeof(Resources), "MapData_ShowLabels_DisplayName")] + [ResourcesDescription(typeof(Resources), "MapData_ShowLabels_Description")] + public bool ShowLabels + { + get + { + return data.ShowLabels; + } + set + { + data.ShowLabels = value; + data.NotifyObservers(); + } + } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj =================================================================== diff -u -r2d5e2d09b0cb1a7f48e1b0a067d332347c89d4a8 -rd16986d8086bbf899b59cd2db438f9522d5dd290 --- Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj (.../Core.Plugins.Map.Test.csproj) (revision 2d5e2d09b0cb1a7f48e1b0a067d332347c89d4a8) +++ Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj (.../Core.Plugins.Map.Test.csproj) (revision d16986d8086bbf899b59cd2db438f9522d5dd290) @@ -77,6 +77,7 @@ + Component Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs =================================================================== diff -u --- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs (revision 0) +++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs (revision d16986d8086bbf899b59cd2db438f9522d5dd290) @@ -0,0 +1,127 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using Core.Components.Gis.Data; +using Core.Plugins.Map.PropertyClasses; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Core.Plugins.Map.Test.PropertyClasses +{ + [TestFixture] + public class MapPointDataPropertiesTest + { + private const int namePropertyIndex = 0; + private const int showLabelsPropertyIndex = 1; + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var properties = new MapPointDataProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void Data_SetNewMapPointDataInstance_ReturnCorrectPropertyValues() + { + // Setup + MapPointData mapPointData = new MapPointData("Test"); + var properties = new MapPointDataProperties(); + + // Call + properties.Data = mapPointData; + + // Assert + Assert.AreEqual(mapPointData.Name, properties.Name); + Assert.AreEqual(mapPointData.ShowLabels, properties.ShowLabels); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Setup + MapPointData mapPointData = new MapPointData("Test"); + + // Call + var properties = new MapPointDataProperties + { + Data = mapPointData + }; + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(2, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + const string labelCategory = "Label"; + + PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "De naam van de kaartlaag.", + true); + + PropertyDescriptor showlabelsProperty = dynamicProperties[showLabelsPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(showlabelsProperty, + labelCategory, + "Weergeven", + "Geeft aan of op deze kaartlaag labels moeten worden weergegeven."); + } + + [Test] + public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() + { + // Setup + var mocks = new MockRepository(); + var observerMock = mocks.StrictMock(); + observerMock.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + MapPointData mapPointData = new MapPointData("Test") + { + ShowLabels = true + }; + + mapPointData.Attach(observerMock); + + var properties = new MapPointDataProperties + { + Data = mapPointData + }; + + // Call + properties.ShowLabels = false; + + // Assert + Assert.AreEqual(properties.ShowLabels, mapPointData.ShowLabels); + mocks.VerifyAll(); + } + } +} \ No newline at end of file