Index: Core/Common/src/Core.Common.Gui/Commands/ViewCommandHandler.cs =================================================================== diff -u -rb743d495d10779d51c8f75b7cb04b5babb4b226f -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Core/Common/src/Core.Common.Gui/Commands/ViewCommandHandler.cs (.../ViewCommandHandler.cs) (revision b743d495d10779d51c8f75b7cb04b5babb4b226f) +++ Core/Common/src/Core.Common.Gui/Commands/ViewCommandHandler.cs (.../ViewCommandHandler.cs) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -75,8 +75,15 @@ return; } - foreach (var data in guiPluginsHost.GetAllDataWithViewDefinitionsRecursively(dataObject)) + var objectsToRemoveViewsFor = new List { + dataObject + }; + + objectsToRemoveViewsFor.AddRange(guiPluginsHost.GetAllDataWithViewDefinitionsRecursively(dataObject).Cast()); + + foreach (var data in objectsToRemoveViewsFor) + { documentViewController.DocumentViewsResolver.CloseAllViewsFor(data); RemoveViewsAndData(toolViewController.ToolWindowViews.Where(v => v.Data == data).ToArray()); } Index: Core/Common/test/Core.Common.Gui.Test/Commands/ViewCommandHandlerTest.cs =================================================================== diff -u -ref1c61d94f2aec3b4ff32fcf03253d7ad386c8e5 -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Core/Common/test/Core.Common.Gui.Test/Commands/ViewCommandHandlerTest.cs (.../ViewCommandHandlerTest.cs) (revision ef1c61d94f2aec3b4ff32fcf03253d7ad386c8e5) +++ Core/Common/test/Core.Common.Gui.Test/Commands/ViewCommandHandlerTest.cs (.../ViewCommandHandlerTest.cs) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -206,7 +206,6 @@ var guiPluginsHost = mocks.Stub(); guiPluginsHost.Expect(g => g.GetAllDataWithViewDefinitionsRecursively(data)).Return(new[] { - data, childData }); var documentViewController = mocks.Stub(); Index: Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs (.../BaseChart.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs (.../BaseChart.cs) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -19,8 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System.Collections.Generic; -using System.Collections.ObjectModel; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; @@ -37,7 +35,6 @@ /// public sealed class BaseChart : Control, IObserver, IChart { - private readonly ICollection observers = new Collection(); private readonly SeriesFactory seriesFactory = new SeriesFactory(); private ChartData data; Fisheye: Tag 56ff0f1d920928ea93ba1a739936bca2df327391 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Data/Map/AssessmentSectionMapData.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj =================================================================== diff -u -racbd08302b69fc06e5cade26def0dea4d35e3b92 -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj (.../Ringtoets.Integration.Data.csproj) (revision acbd08302b69fc06e5cade26def0dea4d35e3b92) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj (.../Ringtoets.Integration.Data.csproj) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -46,7 +46,6 @@ - Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -rde09e649989e2c4f858632345841f7b9971debe3 -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision de09e649989e2c4f858632345841f7b9971debe3) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -53,6 +53,12 @@ + + UserControl + + + AssessmentSectionView.cs + UserControl @@ -91,6 +97,18 @@ Core.Common.Version False + + {5A91174A-FB95-4C9D-9CA5-81C0B8D4361A} + Core.Components.DotSpatial.Forms + + + {318BA582-88C9-4816-A54A-A7E431461DE3} + Core.Components.Gis + + + {610E0A9C-1997-4C43-A10E-39D4C66ADA93} + Core.Plugins.DotSpatial + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.Designer.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.Designer.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.Designer.cs (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -0,0 +1,37 @@ +namespace Ringtoets.Integration.Forms.Views +{ + partial class AssessmentSectionView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -0,0 +1,75 @@ +// 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.Windows.Forms; +using Core.Components.DotSpatial.Forms; +using Core.Components.Gis; +using Core.Plugins.DotSpatial.Forms; +using Ringtoets.Integration.Data; + +namespace Ringtoets.Integration.Forms.Views +{ + /// + /// This class represents a simple view with a map, to which data can be added. + /// + public partial class AssessmentSectionView : UserControl, IMapView + { + private readonly BaseMap map; + private AssessmentSectionBase data; + + /// + /// Creates a new instance of . + /// + public AssessmentSectionView() + { + map = new BaseMap + { + Dock = DockStyle.Fill + }; + Controls.Add(map); + } + + public object Data + { + get + { + return data; + } + set + { + data = value as AssessmentSectionBase; + + if (data != null) + { + //TODO set data to map. + } + } + } + + public IMap Map + { + get + { + return map; + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -rb1ae263dccbb283a2feeb06e53d2486de7fd4258 -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision b1ae263dccbb283a2feeb06e53d2486de7fd4258) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -30,8 +30,6 @@ using Core.Common.Gui.ContextMenu; using Core.Common.Gui.Forms; using Core.Common.Gui.Plugin; -using Core.Components.Gis.Data; -using Core.Plugins.DotSpatial.Forms; using log4net; using Ringtoets.Common.Data; using Ringtoets.Common.Forms.PresentationObjects; @@ -40,7 +38,6 @@ using Ringtoets.HydraRing.Plugin; using Ringtoets.Integration.Data; using Ringtoets.Integration.Data.Contribution; -using Ringtoets.Integration.Data.Map; using Ringtoets.Integration.Data.Placeholders; using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; @@ -60,7 +57,6 @@ public class RingtoetsGuiPlugin : GuiPlugin { private static readonly ILog log = LogManager.GetLogger(typeof(GuiPlugin)); - private static AssessmentSectionMapData assessmentSectionMapData; public override IRibbonCommandHandler RibbonCommandHandler { @@ -95,21 +91,9 @@ } }; - yield return new ViewInfo + yield return new ViewInfo { GetViewName = (v, o) => RingtoetsFormsResources.TrajectMap_DisplayName, - GetViewData = assessmentSectionBase => - { - assessmentSectionMapData = new AssessmentSectionMapData(assessmentSectionBase); - return assessmentSectionMapData; - }, - CloseForData = (view, o) => - { - var sectionMapData = (AssessmentSectionMapData) view.Data; - var assessmentSection = o as AssessmentSectionBase; - - return assessmentSection != null && sectionMapData.AssessmentSection == assessmentSection; - }, Image = RingtoetsFormsResources.Map, }; } @@ -124,7 +108,6 @@ var assessmentSection = dataObject as AssessmentSectionBase; if (assessmentSection != null) { - yield return assessmentSection; yield return assessmentSection.FailureMechanismContribution; } } @@ -404,16 +387,16 @@ HydraringResources.HydraulicBoundaryDatabase_Connect_ToolTip, RingtoetsCommonFormsResources.DatabaseIcon, (sender, args) => { SelectDatabaseFile(nodeData); }); - var DesignWaterLevelItem = new StrictContextMenuItem( + var designWaterLevelItem = new StrictContextMenuItem( HydraringResources.DesignWaterLevel_Calculate, HydraringResources.DesignWaterLevel_Calculate_ToolTip, RingtoetsFormsResources.FailureMechanismIcon, null); if (string.IsNullOrEmpty(nodeData.BoundaryDatabase.FilePath)) { - DesignWaterLevelItem.Enabled = false; - DesignWaterLevelItem.ToolTipText = HydraringResources.DesignWaterLevel_No_HRD_To_Calculate; + designWaterLevelItem.Enabled = false; + designWaterLevelItem.ToolTipText = HydraringResources.DesignWaterLevel_No_HRD_To_Calculate; } return Gui.Get(nodeData, treeViewControl) @@ -423,7 +406,7 @@ .AddImportItem() .AddExportItem() .AddSeparator() - .AddCustomItem(DesignWaterLevelItem) + .AddCustomItem(designWaterLevelItem) .AddSeparator() .AddPropertiesItem() .Build(); @@ -516,7 +499,6 @@ if (hydraulicBoundaryLocationsImporter.Import(nodeData.BoundaryDatabase.Locations, selectedFile)) { SetBoundaryDatabaseData(nodeData, selectedFile, newVersion); - UpdateMap(); } } @@ -528,15 +510,6 @@ log.InfoFormat(HydraringResources.RingtoetsGuiPlugin_SetBoundaryDatabaseFilePath_Database_on_path__0__linked, selectedFile); } - private static void UpdateMap() - { - if (assessmentSectionMapData != null) - { - assessmentSectionMapData.UpdateHydraulicBoundaryDatabaseMap(); - assessmentSectionMapData.NotifyObservers(); - } - } - #endregion } } \ No newline at end of file Fisheye: Tag 56ff0f1d920928ea93ba1a739936bca2df327391 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Map/AssessmentSectionMapDataTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj =================================================================== diff -u -r2310b1df9f3fcfa1e01ee6eec2206a4dd0f38f5c -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj (.../Ringtoets.Integration.Data.Test.csproj) (revision 2310b1df9f3fcfa1e01ee6eec2206a4dd0f38f5c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj (.../Ringtoets.Integration.Data.Test.csproj) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -58,7 +58,6 @@ - Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -rde09e649989e2c4f858632345841f7b9971debe3 -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision de09e649989e2c4f858632345841f7b9971debe3) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -69,6 +69,7 @@ + @@ -100,6 +101,18 @@ {d749ee4c-ce50-4c17-bf01-9a953028c126} Core.Common.TestUtil + + {5A91174A-FB95-4C9D-9CA5-81C0B8D4361A} + Core.Components.DotSpatial.Forms + + + {318ba582-88c9-4816-a54a-a7e431461de3} + Core.Components.Gis + + + {610e0a9c-1997-4c43-a10e-39d4c66ada93} + Core.Plugins.DotSpatial + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -0,0 +1,75 @@ +// 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.Windows.Forms; +using Core.Common.Controls.Views; +using Core.Components.DotSpatial.Forms; +using NUnit.Framework; +using Ringtoets.Integration.Forms.Views; + +namespace Ringtoets.Integration.Forms.Test.Views +{ + [TestFixture] + public class AssessmentSectionViewTest + { + [Test] + public void DefaultConstructor_DefaultValues() + { + // Call + var view = new AssessmentSectionView(); + + // Assert + Assert.IsInstanceOf(view); + Assert.IsInstanceOf(view); + } + + [Test] + public void DefaultConstructor_Always_AddsBaseMap() + { + // Call + var view = new AssessmentSectionView(); + + // Assert + Assert.AreEqual(1, view.Controls.Count); + object mapObject = view.Controls[0]; + Assert.IsInstanceOf(mapObject); + + var map = (BaseMap)mapObject; + Assert.AreEqual(DockStyle.Fill, map.Dock); + Assert.NotNull(view.Map); + } + + [Test] + public void Data_SetToNull_BaseMapNoFeatures() + { + // Setup + var view = new AssessmentSectionView(); + var map = (BaseMap)view.Controls[0]; + + // Call + TestDelegate testDelegate = () => view.Data = null; + + // Assert + Assert.DoesNotThrow(testDelegate); + Assert.IsNull(map.Data); + } + } +} Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs =================================================================== diff -u -rb1ae263dccbb283a2feeb06e53d2486de7fd4258 -r56ff0f1d920928ea93ba1a739936bca2df327391 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision b1ae263dccbb283a2feeb06e53d2486de7fd4258) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 56ff0f1d920928ea93ba1a739936bca2df327391) @@ -82,8 +82,7 @@ TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.GenericInputOutputIcon, contributionViewInfo.Image); var mapViewInfo = viewInfos.Single(vi => vi.DataType == typeof(AssessmentSectionBase)); - Assert.AreEqual(typeof(MapDataView), mapViewInfo.ViewType); - Assert.AreEqual(typeof(MapData), mapViewInfo.ViewDataType); + Assert.AreEqual(typeof(AssessmentSectionView), mapViewInfo.ViewType); TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.Map, mapViewInfo.Image); } } @@ -139,7 +138,6 @@ // Assert CollectionAssert.AreEqual(new object[] { - assessmentSectionBase, assessmentSectionBase.FailureMechanismContribution }, childrenWithViewDefinitions); mocks.VerifyAll();