Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundMapDataContainerCreateExtensions.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundMapDataContainerCreateExtensions.cs (.../BackgroundMapDataContainerCreateExtensions.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundMapDataContainerCreateExtensions.cs (.../BackgroundMapDataContainerCreateExtensions.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Core.Common.Utils.Extensions; +using Core.Components.Gis; using Core.Components.Gis.Data; using Ringtoets.Common.Data; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs =================================================================== diff -u -r0fbb881c5c82f540f01772234b3c1faadfab07f9 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 0fbb881c5c82f540f01772234b3c1faadfab07f9) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,6 +24,8 @@ using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Serializers; using Core.Common.Base.Geometry; +using Core.Components.Gis; +using Core.Components.Gis.Data; using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/BackgroundMapDataEntityReadExtensions.cs =================================================================== diff -u -r0fbb881c5c82f540f01772234b3c1faadfab07f9 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/BackgroundMapDataEntityReadExtensions.cs (.../BackgroundMapDataEntityReadExtensions.cs) (revision 0fbb881c5c82f540f01772234b3c1faadfab07f9) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/BackgroundMapDataEntityReadExtensions.cs (.../BackgroundMapDataEntityReadExtensions.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Core.Common.Base.Data; +using Core.Components.Gis; using Core.Components.Gis.Data; using Ringtoets.Common.Data; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/BackgroundMapDataContainerCreateExtensionsTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/BackgroundMapDataContainerCreateExtensionsTest.cs (.../BackgroundMapDataContainerCreateExtensionsTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/BackgroundMapDataContainerCreateExtensionsTest.cs (.../BackgroundMapDataContainerCreateExtensionsTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -23,6 +23,7 @@ using Application.Ringtoets.Storage.Create; using Application.Ringtoets.Storage.DbContext; using Core.Common.Base.Data; +using Core.Components.Gis; using Core.Components.Gis.Data; using NUnit.Framework; using Ringtoets.Common.Data; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -34,6 +34,7 @@ using Core.Common.Gui.Forms.MainWindow; using Core.Common.Gui.Settings; using Core.Common.TestUtil; +using Core.Components.Gis; using Core.Components.Gis.Data; using NUnit.Framework; using Ringtoets.ClosingStructures.Data; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -r425a1030cf1f383e0a8f5cbd712c52c5cc2d3369 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 425a1030cf1f383e0a8f5cbd712c52c5cc2d3369) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -28,6 +28,7 @@ using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Common.TestUtil; +using Core.Components.Gis; using Core.Components.Gis.Data; using NUnit.Framework; using Ringtoets.Common.Data; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/BackgroundMapDataEntityReadExtensionsTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/BackgroundMapDataEntityReadExtensionsTest.cs (.../BackgroundMapDataEntityReadExtensionsTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/BackgroundMapDataEntityReadExtensionsTest.cs (.../BackgroundMapDataEntityReadExtensionsTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; +using Core.Components.Gis; using Core.Components.Gis.Data; using NUnit.Framework; using Ringtoets.Common.Data; Index: Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs =================================================================== diff -u -raeb0c6618ebf88db04e417b47693c704c7151181 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (.../MapControl.cs) (revision aeb0c6618ebf88db04e417b47693c704c7151181) +++ Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (.../MapControl.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -29,6 +29,7 @@ using Core.Components.DotSpatial.Layer.BruTile; using Core.Components.DotSpatial.Layer.BruTile.Configurations; using Core.Components.DotSpatial.MapFunctions; +using Core.Components.Gis; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using DotSpatial.Controls; @@ -57,7 +58,8 @@ private RdNewMouseCoordinatesMapExtension mouseCoordinatesMapExtension; private MapDataCollection data; - private WmtsMapData backgroundMapData; + private BackgroundMapDataContainer backgroundMapData; + private WmtsMapData mapData; /// /// Creates a new instance of . @@ -101,7 +103,7 @@ } } - public WmtsMapData BackgroundMapData + public BackgroundMapDataContainer BackgroundMapData { get { @@ -115,8 +117,9 @@ } backgroundMapData = value; + mapData = (WmtsMapData)backgroundMapData?.MapData; - backGroundMapDataObserver.Observable = value; + backGroundMapDataObserver.Observable = mapData; if (HasMapData) { @@ -187,7 +190,7 @@ { get { - return backgroundMapData != null || data != null; + return mapData != null || data != null; } } @@ -204,8 +207,8 @@ } else { - backgroundLayerStatus.BackgroundLayer.IsVisible = backgroundMapData.IsVisible; - backgroundLayerStatus.BackgroundLayer.Transparency = Convert.ToSingle(backgroundMapData.Transparency); + backgroundLayerStatus.BackgroundLayer.IsVisible = mapData.IsVisible; + backgroundLayerStatus.BackgroundLayer.Transparency = Convert.ToSingle(mapData.Transparency); } } else @@ -216,12 +219,12 @@ private bool HasBackgroundMapDataConfigurationChanged() { - return !backgroundLayerStatus.HasSameConfiguration(BackgroundMapData); + return !backgroundLayerStatus.HasSameConfiguration(mapData); } private void InsertBackgroundLayer() { - if (backgroundMapData.IsConfigured) + if (mapData.IsConfigured) { InitializeBackgroundLayer(); @@ -244,15 +247,15 @@ { try { - WmtsLayerConfiguration configuration = WmtsLayerConfiguration.CreateInitializedConfiguration(backgroundMapData.SourceCapabilitiesUrl, - backgroundMapData.SelectedCapabilityIdentifier, - backgroundMapData.PreferredFormat); + WmtsLayerConfiguration configuration = WmtsLayerConfiguration.CreateInitializedConfiguration(mapData.SourceCapabilitiesUrl, + mapData.SelectedCapabilityIdentifier, + mapData.PreferredFormat); var backgroundLayer = new BruTileLayer(configuration) { - IsVisible = backgroundMapData.IsVisible, - Transparency = Convert.ToSingle(backgroundMapData.Transparency) + IsVisible = mapData.IsVisible, + Transparency = Convert.ToSingle(mapData.Transparency) }; - backgroundLayerStatus.SuccessfullyInitializedLayer(backgroundLayer, backgroundMapData); + backgroundLayerStatus.SuccessfullyInitializedLayer(backgroundLayer, mapData); return true; } catch (Exception e) when (e is CannotFindTileSourceException || e is CannotReceiveTilesException) @@ -405,7 +408,7 @@ private void DrawInitialMapData() { - if (BackgroundMapData != null && BackgroundMapData.IsConfigured) + if (mapData != null && mapData.IsConfigured) { if (InitializeBackgroundLayer()) { Index: Core/Components/src/Core.Components.Gis.Forms/IMapControl.cs =================================================================== diff -u -r16bd8076863c03907abeee60b16704aba1bdb1a0 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Core/Components/src/Core.Components.Gis.Forms/IMapControl.cs (.../IMapControl.cs) (revision 16bd8076863c03907abeee60b16704aba1bdb1a0) +++ Core/Components/src/Core.Components.Gis.Forms/IMapControl.cs (.../IMapControl.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -52,7 +52,7 @@ /// /// Gets or sets the data to show in the background of the . /// - WmtsMapData BackgroundMapData { get; set; } + BackgroundMapDataContainer BackgroundMapData { get; set; } /// /// Zooms to a level so that all visible layers are in view. Index: Core/Components/src/Core.Components.Gis/BackgroundMapDataContainer.cs =================================================================== diff -u --- Core/Components/src/Core.Components.Gis/BackgroundMapDataContainer.cs (revision 0) +++ Core/Components/src/Core.Components.Gis/BackgroundMapDataContainer.cs (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -0,0 +1,109 @@ +// 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; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Components.Gis.Data; + +namespace Core.Components.Gis +{ + /// + /// Holds a to serve as the background map-data and allows + /// preconfiguration of properties. + /// + public class BackgroundMapDataContainer : Observable + { + private readonly ImageBasedMapDataConfigurationHolder configuration = new ImageBasedMapDataConfigurationHolder(); + private ImageBasedMapData mapData; + + /// + /// The background . + /// + public ImageBasedMapData MapData + { + get + { + return mapData; + } + set + { + mapData = value; + if (mapData != null) + { + mapData.IsVisible = IsVisible; + mapData.Transparency = Transparency; + } + } + } + + /// + /// Gets or sets a value indicating whether the is visible. + /// + public bool IsVisible + { + get + { + return configuration.IsVisible; + } + set + { + configuration.IsVisible = value; + if (mapData != null) + { + mapData.IsVisible = value; + } + } + } + + /// + /// Gets or sets the transparency of . + /// + /// Thrown when setting a new value + /// that is not in the range [0.0, 1.0]. + public RoundedDouble Transparency + { + get + { + return configuration.Transparency; + } + set + { + configuration.Transparency = value; + if (mapData != null) + { + mapData.Transparency = value; + } + } + } + + public override void NotifyObservers() + { + base.NotifyObservers(); + mapData?.NotifyObservers(); + } + + private class ImageBasedMapDataConfigurationHolder : ImageBasedMapData + { + public ImageBasedMapDataConfigurationHolder() : base("c") {} + } + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj =================================================================== diff -u -r25b9b0e94d71419d3a2f2f92c810f81e1b90a628 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj (.../Core.Components.Gis.csproj) (revision 25b9b0e94d71419d3a2f2f92c810f81e1b90a628) +++ Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj (.../Core.Components.Gis.csproj) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -40,6 +40,7 @@ Properties\GlobalAssembly.cs + Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs =================================================================== diff -u -rb1574f00ac2a6242a94659b08de22f8b9ee97120 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (.../MapControlTest.cs) (revision b1574f00ac2a6242a94659b08de22f8b9ee97120) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (.../MapControlTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -34,6 +34,7 @@ using Core.Components.DotSpatial.Layer.BruTile.Configurations; using Core.Components.DotSpatial.MapFunctions; using Core.Components.DotSpatial.TestUtil; +using Core.Components.Gis; using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.Forms; @@ -104,14 +105,19 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); - backgroundMapData.IsVisible = isVisible; - backgroundMapData.Transparency = (RoundedDouble) 0.25; + var mapDataContainer = new BackgroundMapDataContainer + { + IsVisible = isVisible, + Transparency = (RoundedDouble) 0.25, + MapData = backgroundMapData + }; + using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) { // When - map.BackgroundMapData = backgroundMapData; + map.BackgroundMapData = mapDataContainer; // Then var mapView = map.Controls.OfType().First(); @@ -134,6 +140,10 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var container = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(problematicFactory)) using (var map = new MapControl()) @@ -142,7 +152,7 @@ var originalProjection = mapView.Projection; // When - Action call = () => map.BackgroundMapData = backgroundMapData; + Action call = () => map.BackgroundMapData = container; // Then const string expectedMessage = "Verbinden met WMTS is mislukt waardoor geen kaartgegevens ingeladen kunnen worden. De achtergrondkaart kan nu niet getoond worden."; @@ -161,14 +171,19 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; + using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) { var mapView = map.Controls.OfType().First(); var originalProjection = mapView.Projection; // When - Action call = () => map.BackgroundMapData = backgroundMapData; + Action call = () => map.BackgroundMapData = mapDataContainer; // Then const string expectedMessage = "Configuratie van kaartgegevens hulpbestanden is mislukt. De achtergrondkaart kan nu niet getoond worden."; @@ -190,12 +205,16 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(problematicFactory)) using (var map = new MapControl()) { // Precondition - Action setAndCauseFailingInitialization = () => map.BackgroundMapData = backgroundMapData; + Action setAndCauseFailingInitialization = () => map.BackgroundMapData = mapDataContainer; const string expectedMessage = "Verbinden met WMTS is mislukt waardoor geen kaartgegevens ingeladen kunnen worden. De achtergrondkaart kan nu niet getoond worden."; TestHelper.AssertLogMessageIsGenerated(setAndCauseFailingInitialization, expectedMessage, 1); @@ -220,13 +239,18 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; + using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) { DoWhileTileCacheRootLocked(() => { // Precondition - Action setAndCauseCacheInitializationFailure = () => map.BackgroundMapData = backgroundMapData; + Action setAndCauseCacheInitializationFailure = () => map.BackgroundMapData = mapDataContainer; const string expectedMessage = "Configuratie van kaartgegevens hulpbestanden is mislukt. De achtergrondkaart kan nu niet getoond worden."; TestHelper.AssertLogMessageIsGenerated(setAndCauseCacheInitializationFailure, expectedMessage, 1); }); @@ -253,6 +277,10 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(problematicFactory)) using (var map = new MapControl()) @@ -261,7 +289,7 @@ var originalProjection = mapView.Projection; // Precondition - Action setAndCauseFailToInitializeLayer = () => map.BackgroundMapData = backgroundMapData; + Action setAndCauseFailToInitializeLayer = () => map.BackgroundMapData = mapDataContainer; const string expectedMessage = "Verbinden met WMTS is mislukt waardoor geen kaartgegevens ingeladen kunnen worden. De achtergrondkaart kan nu niet getoond worden."; TestHelper.AssertLogMessageIsGenerated(setAndCauseFailToInitializeLayer, expectedMessage, 1); @@ -284,14 +312,19 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; + using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) { var mapView = map.Controls.OfType().First(); var originalProjection = mapView.Projection; // Precondition - Action setAndCauseCacheInitializationFailure = () => map.BackgroundMapData = backgroundMapData; + Action setAndCauseCacheInitializationFailure = () => map.BackgroundMapData = mapDataContainer; const string expectedMessage = "Configuratie van kaartgegevens hulpbestanden is mislukt. De achtergrondkaart kan nu niet getoond worden."; TestHelper.AssertLogMessageIsGenerated(setAndCauseCacheInitializationFailure, expectedMessage, 1); @@ -318,9 +351,13 @@ ProjectionInfo originalProjection = mapView.Projection; WmtsMapData backgroundMapData = WmtsMapData.CreateUnconnectedMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; // When - map.BackgroundMapData = backgroundMapData; + map.BackgroundMapData = mapDataContainer; // Then Assert.AreEqual(0, mapView.Layers.Count); @@ -334,8 +371,12 @@ { // Given WmtsMapData originalBackGroundMapData = WmtsMapData.CreateDefaultPdokMapData(); - originalBackGroundMapData.IsVisible = true; - originalBackGroundMapData.Transparency = (RoundedDouble) 0.25; + var mapDataContainer = new BackgroundMapDataContainer + { + IsVisible = true, + Transparency = (RoundedDouble)0.25, + MapData = originalBackGroundMapData + }; using (new UseCustomTileSourceFactoryConfig(originalBackGroundMapData)) using (var map = new MapControl()) @@ -344,7 +385,7 @@ var mapView = map.Controls.OfType().First(); ProjectionInfo originalProjection = mapView.Projection; - map.BackgroundMapData = originalBackGroundMapData; + map.BackgroundMapData = mapDataContainer; // Precondition Assert.AreEqual(1, mapView.Layers.Count); @@ -355,7 +396,11 @@ // When var newBackGroundMapData = WmtsMapData.CreateUnconnectedMapData(); - map.BackgroundMapData = newBackGroundMapData; + var newMapDataContainer = new BackgroundMapDataContainer + { + MapData = newBackGroundMapData + }; + map.BackgroundMapData = newMapDataContainer; // Then Assert.AreEqual(0, mapView.Layers.Count); @@ -368,25 +413,33 @@ { // Given var newBackGroundMapData = WmtsMapData.CreateDefaultPdokMapData(); - newBackGroundMapData.IsVisible = true; - newBackGroundMapData.Transparency = (RoundedDouble) 0.75; + var newMapDataContainer = new BackgroundMapDataContainer + { + IsVisible = true, + Transparency = (RoundedDouble) 0.75, + MapData = newBackGroundMapData + }; using (new UseCustomTileSourceFactoryConfig(newBackGroundMapData)) using (var map = new MapControl()) { WmtsMapData originalBackGroundMapData = WmtsMapData.CreateUnconnectedMapData(); + var originalMapDataContainer = new BackgroundMapDataContainer + { + MapData = originalBackGroundMapData + }; var mapView = map.Controls.OfType().First(); ProjectionInfo originalProjection = mapView.Projection; - map.BackgroundMapData = originalBackGroundMapData; + map.BackgroundMapData = originalMapDataContainer; // Precondition Assert.AreEqual(0, mapView.Layers.Count); Assert.IsTrue(originalProjection.Equals(mapView.Projection)); // When - map.BackgroundMapData = newBackGroundMapData; + map.BackgroundMapData = newMapDataContainer; // Then Assert.AreEqual(1, mapView.Layers.Count); @@ -402,13 +455,17 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); - backgroundMapData.IsVisible = true; - backgroundMapData.Transparency = (RoundedDouble) 0.25; + var mapDataContainer = new BackgroundMapDataContainer + { + IsVisible = true, + Transparency = (RoundedDouble) 0.25, + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl { - BackgroundMapData = backgroundMapData + BackgroundMapData = mapDataContainer }) { var mapView = map.Controls.OfType().First(); @@ -435,11 +492,15 @@ // Given var newBackgroundMapData = WmtsMapData.CreateAlternativePdokMapData(); var startingBackgroundMapData = WmtsMapData.CreateUnconnectedMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = startingBackgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(newBackgroundMapData)) using (var map = new MapControl { - BackgroundMapData = startingBackgroundMapData + BackgroundMapData = mapDataContainer }) { var mapView = map.Controls.OfType().First(); @@ -496,11 +557,15 @@ { // Given var startingBackgroundMapData = WmtsMapData.CreateAlternativePdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = startingBackgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(startingBackgroundMapData)) using (var map = new MapControl { - BackgroundMapData = startingBackgroundMapData + BackgroundMapData = mapDataContainer }) { var mapView = map.Controls.OfType().First(); @@ -559,6 +624,10 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateAlternativePdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) @@ -590,7 +659,7 @@ Assert.AreEqual(2.2, pointFeatureLayer.FeatureSet.Features[0].BasicGeometry.Coordinates[0].Y); // When - map.BackgroundMapData = backgroundMapData; + map.BackgroundMapData = mapDataContainer; // Then Assert.AreEqual(2, mapView.Layers.Count); @@ -609,6 +678,10 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateUnconnectedMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) @@ -640,7 +713,7 @@ Assert.AreEqual(2.2, pointFeatureLayer.FeatureSet.Features[0].BasicGeometry.Coordinates[0].Y); // When - map.BackgroundMapData = backgroundMapData; + map.BackgroundMapData = mapDataContainer; // Then Assert.AreEqual(1, mapView.Layers.Count); @@ -656,6 +729,10 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) @@ -678,7 +755,7 @@ } }); map.Data = mapDataCollection; - map.BackgroundMapData = backgroundMapData; + map.BackgroundMapData = mapDataContainer; // Precondition var mapView = map.Controls.OfType().First(); @@ -691,9 +768,13 @@ // When var differentBackgroundMapData = WmtsMapData.CreateAlternativePdokMapData(); + var differentMapDataContainer = new BackgroundMapDataContainer + { + MapData = differentBackgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(differentBackgroundMapData)) { - map.BackgroundMapData = differentBackgroundMapData; + map.BackgroundMapData = differentMapDataContainer; // Then Assert.AreEqual(2, mapView.Layers.Count); @@ -713,6 +794,10 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateAlternativePdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) @@ -735,7 +820,7 @@ } }); map.Data = mapDataCollection; - map.BackgroundMapData = backgroundMapData; + map.BackgroundMapData = mapDataContainer; // Precondition var mapView = map.Controls.OfType().First(); @@ -750,9 +835,13 @@ // When var differentBackgroundMapData = WmtsMapData.CreateUnconnectedMapData(); + var differentMapDataContainer = new BackgroundMapDataContainer + { + MapData = differentBackgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(differentBackgroundMapData)) { - map.BackgroundMapData = differentBackgroundMapData; + map.BackgroundMapData = differentMapDataContainer; // Then Assert.AreEqual(1, mapView.Layers.Count); @@ -821,11 +910,15 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateAlternativePdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl { - BackgroundMapData = backgroundMapData + BackgroundMapData = mapDataContainer }) { var mapPointData = new MapPointData("Points") @@ -885,6 +978,10 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(problematicFactory)) using (var map = new MapControl()) @@ -914,7 +1011,7 @@ // When Action call = () => { - map.BackgroundMapData = backgroundMapData; + map.BackgroundMapData = mapDataContainer; map.Data = mapDataCollection; }; @@ -938,6 +1035,10 @@ { // Given WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl()) @@ -967,7 +1068,7 @@ // When Action call = () => { - map.BackgroundMapData = backgroundMapData; + map.BackgroundMapData = mapDataContainer; map.Data = mapDataCollection; }; @@ -1180,11 +1281,15 @@ { // Given var backgroundMapData = WmtsMapData.CreateAlternativePdokMapData(); + var mapDataContainer = new BackgroundMapDataContainer + { + MapData = backgroundMapData + }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var map = new MapControl { - BackgroundMapData = backgroundMapData + BackgroundMapData = mapDataContainer }) { var mapView = map.Controls.OfType().First(); @@ -2036,6 +2141,11 @@ string expectedTileCachePath = Path.Combine(BruTileSettings.PersistentCacheDirectoryRoot, "wmts"); string backupTileCachePath = expectedTileCachePath + "_bak"; + if (Directory.Exists(backupTileCachePath)) + { + Directory.Delete(backupTileCachePath, true); + } + if (Directory.Exists(expectedTileCachePath)) { Directory.Move(expectedTileCachePath, backupTileCachePath); Index: Core/Components/test/Core.Components.Gis.Test/BackgroundMapDataContainerTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.Gis.Test/BackgroundMapDataContainerTest.cs (revision 0) +++ Core/Components/test/Core.Components.Gis.Test/BackgroundMapDataContainerTest.cs (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -0,0 +1,214 @@ +// 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; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.TestUtil; +using Core.Components.Gis.Data; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Core.Components.Gis.Test +{ + [TestFixture] + public class BackgroundMapDataContainerTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var container = new BackgroundMapDataContainer(); + + // Assert + Assert.IsInstanceOf(container); + + Assert.IsNull(container.MapData); + Assert.IsTrue(container.IsVisible); + Assert.AreEqual(2, container.Transparency.NumberOfDecimalPlaces); + Assert.AreEqual(0, container.Transparency.Value); + } + + [Test] + [TestCase(0)] + [TestCase(0.8)] + [TestCase(1)] + public void Transparency_ValidValues_ReturnNewlySetValue(double newValue) + { + // Setup + var container = new BackgroundMapDataContainer(); + + // Call + container.Transparency = (RoundedDouble) newValue; + + // Assert + Assert.AreEqual(newValue, container.Transparency); + } + + [Test] + public void Transparency_WithMapData_MapDataTransparencyUpdated() + { + // Setup + var imageBasedMapData = new ImageBasedMapDataStub(); + + var container = new BackgroundMapDataContainer(); + container.MapData = imageBasedMapData; + + // Call + container.Transparency = (RoundedDouble) 0.5; + + // Assert + Assert.AreEqual(container.Transparency, imageBasedMapData.Transparency); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(-123.56)] + [TestCase(0.0 - 1e-2)] + [TestCase(1.0 + 1e-2)] + [TestCase(456.876)] + [TestCase(double.NaN)] + public void Transparency_SetInvalidValue_ThrowArgumentOutOfRangeException(double invalidTransparency) + { + // Setup + var container = new BackgroundMapDataContainer(); + + // Call + TestDelegate call = () => container.Transparency = (RoundedDouble) invalidTransparency; + + // Assert + var message = "De transparantie moet in het bereik [0,00, 1,00] liggen."; + string paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message).ParamName; + Assert.AreEqual("value", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void IsVisible_SetNewValue_GetNewlySetValue(bool newValue) + { + // Setup + var container = new BackgroundMapDataContainer(); + + // Call + container.IsVisible = newValue; + + // Assert + Assert.AreEqual(newValue, container.IsVisible); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void IsVisible_WithMapData_MapDataIsVisibleUpdated(bool isVisible) + { + // Setup + var imageBasedMapData = new ImageBasedMapDataStub(); + + var container = new BackgroundMapDataContainer + { + MapData = imageBasedMapData + }; + + // Call + container.IsVisible = isVisible; + + // Assert + Assert.AreEqual(container.IsVisible, imageBasedMapData.IsVisible); + } + + [Test] + [TestCase(true, 0.5)] + [TestCase(false, 0.8)] + public void MapData_SetNewValue_GetNewValueAndInitializePreconfiguration(bool isVisible, double transparency) + { + // Setup + var imageBasedMapData = new ImageBasedMapDataStub(); + + var container = new BackgroundMapDataContainer + { + IsVisible = isVisible, + Transparency = (RoundedDouble) transparency + }; + + // Call + container.MapData = imageBasedMapData; + + // Assert + Assert.AreEqual(container.Transparency, imageBasedMapData.Transparency); + Assert.AreEqual(container.IsVisible, imageBasedMapData.IsVisible); + Assert.AreSame(imageBasedMapData, container.MapData); + } + + [Test] + public void NotifyObservers_WithMapData_NotifyObserversOfMapDataAndContainer() + { + // Setup + var mocks = new MockRepository(); + var mapDataObserver = mocks.StrictMock(); + mapDataObserver.Expect(o => o.UpdateObserver()); + + var containerObserver = mocks.StrictMock(); + containerObserver.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var imageBasedMapData = new ImageBasedMapDataStub(); + imageBasedMapData.Attach(mapDataObserver); + + var container = new BackgroundMapDataContainer + { + MapData = imageBasedMapData + }; + container.Attach(containerObserver); + + // Call + container.NotifyObservers(); + + // Assert + mocks.VerifyAll(); // 'imageBasedMapData' and 'container' should have it's observers notified. + } + + + [Test] + public void NotifyObservers_NoMapData_NotifyObserversOfContainer() + { + // Setup + var mocks = new MockRepository(); + var containerObserver = mocks.StrictMock(); + containerObserver.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var container = new BackgroundMapDataContainer(); + container.Attach(containerObserver); + + // Call + container.NotifyObservers(); + + // Assert + mocks.VerifyAll(); // 'container' should have it's observers notified. + } + + private class ImageBasedMapDataStub : ImageBasedMapData + { + public ImageBasedMapDataStub() : base("A") {} + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj =================================================================== diff -u -r4b32064801ece7ab70357a2a942e21f113abc679 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj (.../Core.Components.Gis.Test.csproj) (revision 4b32064801ece7ab70357a2a942e21f113abc679) +++ Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj (.../Core.Components.Gis.Test.csproj) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -38,6 +38,10 @@ ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll True + + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll + True + @@ -46,6 +50,7 @@ Properties\GlobalAssembly.cs + Index: Core/Components/test/Core.Components.Gis.Test/packages.config =================================================================== diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Core/Components/test/Core.Components.Gis.Test/packages.config (.../packages.config) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2) +++ Core/Components/test/Core.Components.Gis.Test/packages.config (.../packages.config) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -23,4 +23,5 @@ --> + \ No newline at end of file Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismView.cs (.../ClosingStructuresFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismView.cs (.../ClosingStructuresFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -149,7 +149,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs (.../ClosingStructuresFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs (.../ClosingStructuresFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,7 +24,6 @@ using System.Windows.Forms; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using Core.Components.Gis.Geometries; @@ -106,17 +105,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new ClosingStructuresFailureMechanismView()) { var failureMechanismContext = new ClosingStructuresFailureMechanismContext( @@ -126,7 +116,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs (.../IAssessmentSection.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs (.../IAssessmentSection.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -21,6 +21,7 @@ using System.Collections.Generic; using Core.Common.Base; +using Core.Components.Gis; using Core.Components.Gis.Data; using Ringtoets.Common.Data.Contribution; using Ringtoets.Common.Data.FailureMechanism; Fisheye: Tag 31012b85637f7fcf6b28f498fc996edcda2eb505 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/BackgroundMapDataContainer.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -r9f3f7c10efcf38e5b49973744e52307ddda3c0f7 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 9f3f7c10efcf38e5b49973744e52307ddda3c0f7) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -42,7 +42,6 @@ - Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismView.cs (.../FailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismView.cs (.../FailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -116,7 +116,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Fisheye: Tag 31012b85637f7fcf6b28f498fc996edcda2eb505 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/BackgroundMapDataContainerTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -r9f3f7c10efcf38e5b49973744e52307ddda3c0f7 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 9f3f7c10efcf38e5b49973744e52307ddda3c0f7) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -57,7 +57,6 @@ - Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs (.../ObservableTestAssessmentSectionStub.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs (.../ObservableTestAssessmentSectionStub.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Linq; using Core.Common.Base; +using Core.Components.Gis; using Core.Components.Gis.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Contribution; Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs (.../FailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs (.../FailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,7 +24,6 @@ using System.Windows.Forms; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; @@ -97,17 +96,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new FailureMechanismView()) { var failureMechanism = new TestFailureMechanism(); @@ -117,7 +107,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismView.cs (.../DuneErosionFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismView.cs (.../DuneErosionFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -106,7 +106,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismViewTest.cs (.../DuneErosionFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismViewTest.cs (.../DuneErosionFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -118,17 +118,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new DuneErosionFailureMechanismView()) { var failureMechanismContext = new DuneErosionFailureMechanismContext(new DuneErosionFailureMechanism(), assessmentSection); @@ -137,7 +128,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismView.cs (.../GrassCoverErosionInwardsFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismView.cs (.../GrassCoverErosionInwardsFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -144,7 +144,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,7 +24,6 @@ using System.Windows.Forms; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; @@ -118,17 +117,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new GrassCoverErosionInwardsFailureMechanismView()) { var failureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(new GrassCoverErosionInwardsFailureMechanism(), assessmentSection); @@ -137,7 +127,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs (.../GrassCoverErosionOutwardsFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs (.../GrassCoverErosionOutwardsFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -134,7 +134,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,7 +24,6 @@ using System.Windows.Forms; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; @@ -116,17 +115,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new GrassCoverErosionOutwardsFailureMechanismView()) { var failureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext( @@ -136,7 +126,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismView.cs (.../HeightStructuresFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismView.cs (.../HeightStructuresFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -150,7 +150,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs (.../HeightStructuresFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs (.../HeightStructuresFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,11 +24,9 @@ using System.Windows.Forms; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; @@ -122,17 +120,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new HeightStructuresFailureMechanismView()) { var failureMechanismContext = new HeightStructuresFailureMechanismContext( @@ -142,7 +131,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } @@ -218,10 +207,10 @@ var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] - { - new Point2D(1.0, 2.0), - new Point2D(2.0, 1.0) - }); + { + new Point2D(1.0, 2.0), + new Point2D(2.0, 1.0) + }); var assessmentSection = new ObservableTestAssessmentSectionStub { @@ -259,15 +248,15 @@ failureMechanism.AddSection(new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2))); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.CalculationsGroup.Children.Add(calculationA); failureMechanism.CalculationsGroup.Children.Add(calculationB); @@ -491,10 +480,10 @@ // Call failureMechanism.AddSection(new FailureMechanismSection(string.Empty, new[] - { - new Point2D(1, 2), - new Point2D(1, 2) - })); + { + new Point2D(1, 2), + new Point2D(1, 2) + })); failureMechanism.NotifyObservers(); // Assert @@ -516,10 +505,10 @@ var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, new ObservableTestAssessmentSectionStub()); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); view.Data = failureMechanismContext; @@ -530,10 +519,10 @@ // Call failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.ForeshoreProfiles.NotifyObservers(); // Assert @@ -802,10 +791,10 @@ newAssessmentSection.ReferenceLine = new ReferenceLine(); newAssessmentSection.ReferenceLine.SetGeometry(new[] - { - new Point2D(2, 4), - new Point2D(3, 4) - }); + { + new Point2D(2, 4), + new Point2D(3, 4) + }); var oldHeightStructuresFailureMechanismContext = new HeightStructuresFailureMechanismContext(new HeightStructuresFailureMechanism(), oldAssessmentSection); var newHeightStructuresFailureMechanismContext = new HeightStructuresFailureMechanismContext(new HeightStructuresFailureMechanism(), newAssessmentSection); @@ -860,10 +849,10 @@ StructuresCalculation calculation = calculationsArray[index]; CollectionAssert.AreEquivalent(new[] - { - calculation.InputParameters.Structure.Location, - calculation.InputParameters.HydraulicBoundaryLocation.Location - }, geometries[0].PointCollections.First()); + { + calculation.InputParameters.Structure.Location, + calculation.InputParameters.HydraulicBoundaryLocation.Location + }, geometries[0].PointCollections.First()); } Assert.AreEqual("Berekeningen", mapData.Name); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -23,6 +23,7 @@ using System.ComponentModel; using Core.Common.Base; using Core.Common.Base.Geometry; +using Core.Components.Gis; using Core.Components.Gis.Data; using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data; @@ -88,7 +89,7 @@ DuneErosion = new DuneErosionFailureMechanism(); TechnicalInnovation = new TechnicalInnovationFailureMechanism(); - const double norm = 1.0/30000; + const double norm = 1.0 / 30000; const int otherContribution = 30; FailureMechanismContribution = new FailureMechanismContribution(GetContributingFailureMechanisms(), otherContribution, Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -92,7 +92,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.BackgroundMapData.MapData; + Map.BackgroundMapData = data.BackgroundMapData; } } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (.../AssessmentSectionViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (.../AssessmentSectionViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -23,7 +23,6 @@ using System.Linq; using System.Windows.Forms; using Core.Common.Base.Geometry; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; @@ -104,24 +103,15 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new AssessmentSectionView()) { // Call view.Data = assessmentSection; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs (.../PipingFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs (.../PipingFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -147,7 +147,7 @@ SetMapDataFeatures(); - Map.BackgroundMapData = (WmtsMapData) data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; Map.Data = mapDataCollection; } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs =================================================================== diff -u -r425a1030cf1f383e0a8f5cbd712c52c5cc2d3369 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs (.../PipingFailureMechanismViewTest.cs) (revision 425a1030cf1f383e0a8f5cbd712c52c5cc2d3369) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs (.../PipingFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -23,15 +23,13 @@ using System.Collections.ObjectModel; using System.Linq; using System.Windows.Forms; -using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -149,16 +147,8 @@ public void Data_EmptyPipingFailureMechanismContext_NoMapDataSet() { // Setup - var backgroundMapData = WmtsMapData.CreateUnconnectedMapData(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); - var assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - using (var view = new PipingFailureMechanismView()) { var failureMechanismContext = new PipingFailureMechanismContext( @@ -170,26 +160,17 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } [Test] public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { - WmtsMapData backgroundMapData = WmtsMapData.CreateAlternativePdokMapData(); - var mocks = new MockRepository(); - var assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; + var assessmentSection = new ObservableTestAssessmentSectionStub(); // Setup - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new PipingFailureMechanismView()) { var failureMechanismContext = new PipingFailureMechanismContext(new PipingFailureMechanism(), assessmentSection); @@ -198,7 +179,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } mocks.VerifyAll(); } Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs (.../StabilityPointStructuresFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs (.../StabilityPointStructuresFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -149,7 +149,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs (.../StabilityPointStructuresFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs (.../StabilityPointStructuresFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,7 +24,6 @@ using System.Windows.Forms; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; @@ -121,17 +120,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new StabilityPointStructuresFailureMechanismView()) { var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext( @@ -141,7 +131,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverFailureMechanismView.cs (.../StabilityStoneCoverFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverFailureMechanismView.cs (.../StabilityStoneCoverFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -142,7 +142,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs (.../StabilityStoneCoverFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs (.../StabilityStoneCoverFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,7 +24,6 @@ using System.Windows.Forms; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; @@ -117,17 +116,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new StabilityStoneCoverFailureMechanismView()) { var failureMechanismContext = new StabilityStoneCoverFailureMechanismContext( @@ -137,7 +127,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } } Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismView.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismView.cs (.../WaveImpactAsphaltCoverFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismView.cs (.../WaveImpactAsphaltCoverFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -142,7 +142,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; + Map.BackgroundMapData = data.Parent.BackgroundMapData; } } } Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs =================================================================== diff -u -r3014d0ced22c45300938639e7958ea0850485240 -r31012b85637f7fcf6b28f498fc996edcda2eb505 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismViewTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) @@ -24,7 +24,6 @@ using System.Windows.Forms; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; -using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; @@ -117,17 +116,8 @@ public void Data_AssessmentSectionWithBackgroundMapData_BackgroundMapDataSet() { // Setup - WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); + IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub(); - IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub - { - BackgroundMapData = - { - MapData = backgroundMapData - } - }; - - using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new WaveImpactAsphaltCoverFailureMechanismView()) { var failureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext( @@ -137,7 +127,7 @@ view.Data = failureMechanismContext; // Assert - Assert.AreSame(backgroundMapData, view.Map.BackgroundMapData); + Assert.AreSame(assessmentSection.BackgroundMapData, view.Map.BackgroundMapData); } }