Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r7cb0a6f62cfa5564125168a4d9b3c270b7b91523 -r0bf0b88b0ee95f604d7ef5242670371d0da71c38 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7cb0a6f62cfa5564125168a4d9b3c270b7b91523) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0bf0b88b0ee95f604d7ef5242670371d0da71c38) @@ -22,7 +22,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -215,6 +215,78 @@ } /// + /// Looks up a localized string similar to Geeft aan of de geselecteerde achtergrondlaag in alle kaarten wordt weergegeven.. + /// + public static string BackgroundMapDataContextProperties_IsVisible_Description { + get { + return ResourceManager.GetString("BackgroundMapDataContextProperties_IsVisible_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Achtergrondlaag tonen. + /// + public static string BackgroundMapDataContextProperties_IsVisible_DisplayName { + get { + return ResourceManager.GetString("BackgroundMapDataContextProperties_IsVisible_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Naam van de achtergrond kaartlaag.. + /// + public static string BackgroundMapDataContextProperties_Name_Description { + get { + return ResourceManager.GetString("BackgroundMapDataContextProperties_Name_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Naam van de kaartlaag. + /// + public static string BackgroundMapDataContextProperties_Name_DisplayName { + get { + return ResourceManager.GetString("BackgroundMapDataContextProperties_Name_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Transparantie waarmee de achtergrondlaag wordt weergegeven.. + /// + public static string BackgroundMapDataContextProperties_Transparency_Description { + get { + return ResourceManager.GetString("BackgroundMapDataContextProperties_Transparency_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Transparantie. + /// + public static string BackgroundMapDataContextProperties_Transparency_DisplayName { + get { + return ResourceManager.GetString("BackgroundMapDataContextProperties_Transparency_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Volledige URL naar de wms of wmts service die als achtergrond kaartlaag gebruikt wordt.. + /// + public static string BackgroundMapDataContextProperties_Url_Description { + get { + return ResourceManager.GetString("BackgroundMapDataContextProperties_Url_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to URL naar de wms / wmts service. + /// + public static string BackgroundMapDataContextProperties_Url_DisplayName { + get { + return ResourceManager.GetString("BackgroundMapDataContextProperties_Url_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Naam van de berekening.. /// public static string Calculation_Name_Description { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -r7cb0a6f62cfa5564125168a4d9b3c270b7b91523 -r0bf0b88b0ee95f604d7ef5242670371d0da71c38 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 7cb0a6f62cfa5564125168a4d9b3c270b7b91523) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0bf0b88b0ee95f604d7ef5242670371d0da71c38) @@ -297,4 +297,28 @@ Trajecttype: {0} + + Geeft aan of de geselecteerde achtergrondlaag in alle kaarten wordt weergegeven. + + + Achtergrondlaag tonen + + + Naam van de achtergrond kaartlaag. + + + Naam van de kaartlaag + + + Transparantie waarmee de achtergrondlaag wordt weergegeven. + + + Transparantie + + + Volledige URL naar de wms of wmts service die als achtergrond kaartlaag gebruikt wordt. + + + URL naar de wms / wmts service + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/BackgroundMapDataContextProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/BackgroundMapDataContextProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/BackgroundMapDataContextProperties.cs (revision 0bf0b88b0ee95f604d7ef5242670371d0da71c38) @@ -0,0 +1,90 @@ +// 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 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.Properties; +using RingtoetsCommonForms = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.PropertyClasses +{ + /// + /// ViewModel of the for properties panel. + /// + public class BackgroundMapDataContextProperties : ObjectProperties + { + [ResourcesCategory(typeof(RingtoetsCommonForms), nameof(RingtoetsCommonForms.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.BackgroundMapDataContextProperties_Name_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.BackgroundMapDataContextProperties_Name_Description))] + public string Name + { + get + { + return data.WrappedData.Name; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonForms), nameof(RingtoetsCommonForms.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.BackgroundMapDataContextProperties_Url_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.BackgroundMapDataContextProperties_Url_Description))] + public string Url + { + get + { + return data.WrappedData.SourceCapabilitiesUrl; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonForms), nameof(RingtoetsCommonForms.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.BackgroundMapDataContextProperties_Transparency_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.BackgroundMapDataContextProperties_Transparency_Description))] + public RoundedDouble Transparency + { + get + { + return data.WrappedData.Transparency; + } + set + { + data.WrappedData.Transparency = value.ToPrecision(data.WrappedData.Transparency.NumberOfDecimalPlaces); + data.WrappedData.NotifyObservers(); + } + } + + [ResourcesCategory(typeof(RingtoetsCommonForms), nameof(RingtoetsCommonForms.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.BackgroundMapDataContextProperties_IsVisible_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.BackgroundMapDataContextProperties_IsVisible_Description))] + public bool IsVisible + { + get + { + return data.WrappedData.IsVisible; + } + set + { + data.WrappedData.IsVisible = value; + data.WrappedData.NotifyObservers(); + } + } + } +} Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r7cc1fd960a912443ccc3c6995eccb5673d1d8d22 -r0bf0b88b0ee95f604d7ef5242670371d0da71c38 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 7cc1fd960a912443ccc3c6995eccb5673d1d8d22) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 0bf0b88b0ee95f604d7ef5242670371d0da71c38) @@ -55,6 +55,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/BackgroundMapDataContextPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/BackgroundMapDataContextPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/BackgroundMapDataContextPropertiesTest.cs (revision 0bf0b88b0ee95f604d7ef5242670371d0da71c38) @@ -0,0 +1,147 @@ +// 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 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using Core.Components.Gis.Data; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses +{ + [TestFixture] + public class BackgroundMapDataContextPropertiesTest + { + private const int requiredNamePropertyIndex = 0; + private const int requiredUrlPropertyIndex = 1; + private const int requiredTransparencyPropertyIndex = 2; + private const int requiredVisibilityPropertyIndex = 3; + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + WmtsMapData mapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContext = new BackgroundMapDataContext(mapData); + + // Call + var properties = new BackgroundMapDataContextProperties + { + Data = mapDataContext + }; + + // Assert + Assert.IsInstanceOf>(properties); + + Assert.AreSame(mapDataContext, properties.Data); + + Assert.AreEqual(mapData.Name, properties.Name); + Assert.AreEqual(mapData.SourceCapabilitiesUrl, properties.Url); + + Assert.AreEqual(2, properties.Transparency.NumberOfDecimalPlaces); + Assert.AreEqual(mapData.Transparency, properties.Transparency); + Assert.AreEqual(mapData.IsVisible, properties.IsVisible); + } + + [Test] + public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() + { + // Setup + var mockRepository = new MockRepository(); + var observer = mockRepository.StrictMock(); + const int numberOfChangedProperties = 2; + observer.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); + mockRepository.ReplayAll(); + + var random = new Random(21); + var newTransparency = (RoundedDouble)random.NextDouble(); + var newVisibility = random.NextBoolean(); + + WmtsMapData mapData = WmtsMapData.CreateDefaultPdokMapData(); + mapData.Attach(observer); + + var properties = new BackgroundMapDataContextProperties + { + Data = new BackgroundMapDataContext(mapData) + }; + + // Call + properties.IsVisible = newVisibility; + properties.Transparency = newTransparency; + + // Assert + Assert.AreEqual(newTransparency, properties.Transparency, properties.Transparency.GetAccuracy()); + Assert.AreEqual(newVisibility, properties.IsVisible); + + mockRepository.VerifyAll(); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Setup + WmtsMapData mapData = WmtsMapData.CreateDefaultPdokMapData(); + + // Call + var properties = new BackgroundMapDataContextProperties + { + Data = new BackgroundMapDataContext(mapData) + }; + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(4, dynamicProperties.Count); + + PropertyDescriptor nameProperty = dynamicProperties[requiredNamePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + "Algemeen", + "Naam van de kaartlaag", + "Naam van de achtergrond kaartlaag.", + true); + + PropertyDescriptor urlProperty = dynamicProperties[requiredUrlPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(urlProperty, + "Algemeen", + "URL naar de wms / wmts service", + "Volledige URL naar de wms of wmts service die als achtergrond kaartlaag gebruikt wordt.", + true); + + PropertyDescriptor transparencyPropertyIndex = dynamicProperties[requiredTransparencyPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(transparencyPropertyIndex, + "Algemeen", + "Transparantie", + "Transparantie waarmee de achtergrondlaag wordt weergegeven."); + + PropertyDescriptor visibilityProperty = dynamicProperties[requiredVisibilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(visibilityProperty, + "Algemeen", + "Achtergrondlaag tonen", + "Geeft aan of de geselecteerde achtergrondlaag in alle kaarten wordt weergegeven."); + } + } +} Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -r0bf0b88b0ee95f604d7ef5242670371d0da71c38 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 0bf0b88b0ee95f604d7ef5242670371d0da71c38) @@ -67,6 +67,7 @@ +