Index: Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj =================================================================== diff -u -ra1ec5faebf7ccf8e67fa34a2b73cd1063ab48840 -rf14469a6c1b70d2c2366c5050e1bfaf1c846e697 --- Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj (.../Core.Plugins.DotSpatial.csproj) (revision a1ec5faebf7ccf8e67fa34a2b73cd1063ab48840) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj (.../Core.Plugins.DotSpatial.csproj) (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -36,18 +36,6 @@ False ..\..\..\..\lib\DotSpatial.1.8\DotSpatial.Data.dll - - False - ..\..\..\..\lib\DotSpatial.1.8\DotSpatial.Mono.dll - - - False - ..\..\..\..\lib\DotSpatial.1.8\DotSpatial.Projections.dll - - - False - ..\..\..\..\lib\DotSpatial.1.8\DotSpatial.Serialization.dll - False ..\..\..\..\lib\DotSpatial.1.8\DotSpatial.Topology.dll @@ -76,12 +64,6 @@ - - UserControl - - - MapDataView.cs - UserControl Index: Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialPlugin.cs =================================================================== diff -u -ra1ec5faebf7ccf8e67fa34a2b73cd1063ab48840 -rf14469a6c1b70d2c2366c5050e1bfaf1c846e697 --- Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialPlugin.cs (.../DotSpatialPlugin.cs) (revision a1ec5faebf7ccf8e67fa34a2b73cd1063ab48840) +++ Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialPlugin.cs (.../DotSpatialPlugin.cs) (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -20,15 +20,11 @@ // All rights reserved. using System; -using System.Collections.Generic; using Core.Common.Gui; using Core.Common.Gui.Forms; using Core.Common.Gui.Plugin; -using Core.Common.Gui.Properties; -using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using Core.Plugins.DotSpatial.Commands; -using Core.Plugins.DotSpatial.Forms; using Core.Plugins.DotSpatial.Legend; namespace Core.Plugins.DotSpatial @@ -69,15 +65,6 @@ base.Dispose(); } - public override IEnumerable GetViewInfos() - { - yield return new ViewInfo - { - Image = Resources.DocumentHS, - GetViewName = (v, o) => Resources.DotSpatialPlugin_GetViewInfoObjects_Map - }; - } - private MapLegendController CreateLegendController(IViewController viewController) { if (viewController == null) Fisheye: Tag f14469a6c1b70d2c2366c5050e1bfaf1c846e697 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.Designer.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f14469a6c1b70d2c2366c5050e1bfaf1c846e697 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Core.Plugins.DotSpatial.Test.csproj =================================================================== diff -u -ra1ec5faebf7ccf8e67fa34a2b73cd1063ab48840 -rf14469a6c1b70d2c2366c5050e1bfaf1c846e697 --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Core.Plugins.DotSpatial.Test.csproj (.../Core.Plugins.DotSpatial.Test.csproj) (revision a1ec5faebf7ccf8e67fa34a2b73cd1063ab48840) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Core.Plugins.DotSpatial.Test.csproj (.../Core.Plugins.DotSpatial.Test.csproj) (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -62,7 +62,6 @@ - Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/DotSpatialPluginTest.cs =================================================================== diff -u -ra1ec5faebf7ccf8e67fa34a2b73cd1063ab48840 -rf14469a6c1b70d2c2366c5050e1bfaf1c846e697 --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/DotSpatialPluginTest.cs (.../DotSpatialPluginTest.cs) (revision a1ec5faebf7ccf8e67fa34a2b73cd1063ab48840) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/DotSpatialPluginTest.cs (.../DotSpatialPluginTest.cs) (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -32,7 +32,6 @@ using Core.Common.Gui.Settings; using Core.Components.DotSpatial.Forms; using Core.Components.Gis.Data; -using Core.Plugins.DotSpatial.Forms; using Core.Plugins.DotSpatial.Legend; using NUnit.Framework; using Rhino.Mocks; @@ -107,26 +106,6 @@ } [Test] - public void GetViewInfoObjects_Always_ReturnsMapDataViewInfo() - { - // Setup - using (var plugin = new DotSpatialPlugin()) - { - using (var view = new MapDataView()) - { - // Call - var views = plugin.GetViewInfos().ToArray(); - - // Assert - Assert.AreEqual(1, views.Length); - Assert.AreEqual(typeof(MapData), views[0].DataType); - Assert.AreEqual(typeof(MapDataView), views[0].ViewType); - Assert.AreEqual("Kaart", views[0].GetViewName(view, null)); - } - } - } - - [Test] [RequiresSTA] [TestCase(true)] [TestCase(false)] Fisheye: Tag f14469a6c1b70d2c2366c5050e1bfaf1c846e697 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.DotSpatial.Test/Forms/MapDataViewTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj =================================================================== diff -u -r31d4921763c045040f9300542aed356147966cc8 -rf14469a6c1b70d2c2366c5050e1bfaf1c846e697 --- Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj (.../Demo.Ringtoets.csproj) (revision 31d4921763c045040f9300542aed356147966cc8) +++ Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj (.../Demo.Ringtoets.csproj) (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -70,6 +70,12 @@ ChartDataView.cs + + UserControl + + + MapDataView.cs + @@ -107,6 +113,16 @@ Core.Components.Charting False + + {5A91174A-FB95-4C9D-9CA5-81C0B8D4361A} + Core.Components.DotSpatial.Forms + False + + + {4A06DF0D-5D75-4BAD-A95A-A3DB9B7C4AD5} + Core.Components.Gis.Forms + False + {318ba582-88c9-4816-a54a-a7e431461de3} Core.Components.Gis @@ -120,6 +136,7 @@ {4163B996-3455-4324-A38A-9F2F0E6FCB52} Core.Plugins.Chart + False {d4200f43-3f72-4f42-af0a-8ced416a38ec} @@ -183,6 +200,9 @@ + + MapDataView.cs + Index: Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectPlugin.cs =================================================================== diff -u -r31d4921763c045040f9300542aed356147966cc8 -rf14469a6c1b70d2c2366c5050e1bfaf1c846e697 --- Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectPlugin.cs (.../DemoProjectPlugin.cs) (revision 31d4921763c045040f9300542aed356147966cc8) +++ Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectPlugin.cs (.../DemoProjectPlugin.cs) (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -2,10 +2,13 @@ using Core.Common.Gui.Forms; using Core.Common.Gui.Plugin; using Core.Components.Charting.Data; -using Core.Plugins.Chart.Properties; +using Core.Components.Gis.Data; using Demo.Ringtoets.Ribbons; using Demo.Ringtoets.Views; +using ChartResources = Core.Plugins.Chart.Properties.Resources; +using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources; + namespace Demo.Ringtoets.GUIs { /// @@ -25,9 +28,15 @@ { yield return new ViewInfo { - Image = Resources.ChartIcon, - GetViewName = (v, o) => Resources.OxyPlotPlugin_GetViewInfos_Diagram + Image = ChartResources.ChartIcon, + GetViewName = (v, o) => ChartResources.OxyPlotPlugin_GetViewInfos_Diagram }; + + yield return new ViewInfo + { + Image = CoreCommonGuiResources.DocumentHS, + GetViewName = (v, o) => CoreCommonGuiResources.DotSpatialPlugin_GetViewInfoObjects_Map + }; } } } \ No newline at end of file Index: Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.Designer.cs =================================================================== diff -u --- Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.Designer.cs (revision 0) +++ Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.Designer.cs (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -0,0 +1,57 @@ +namespace Demo.Ringtoets.Views +{ + partial class MapDataView + { + /// + /// 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() + { + this.mapControl = new Core.Components.DotSpatial.Forms.MapControl(); + this.SuspendLayout(); + // + // mapControl1 + // + this.mapControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.mapControl.Location = new System.Drawing.Point(0, 0); + this.mapControl.Name = "mapControl1"; + this.mapControl.Size = new System.Drawing.Size(150, 150); + this.mapControl.TabIndex = 0; + this.mapControl.Text = "mapControl1"; + // + // MapDataView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.mapControl); + this.Name = "MapDataView"; + this.ResumeLayout(false); + + } + + #endregion + + private Core.Components.DotSpatial.Forms.MapControl mapControl; + } +} Index: Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.cs =================================================================== diff -u --- Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.cs (revision 0) +++ Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.cs (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -0,0 +1,53 @@ +using System.Windows.Forms; +using Core.Components.Gis.Data; +using Core.Components.Gis.Forms; + +namespace Demo.Ringtoets.Views +{ + /// + /// This class represents a simple view with a map, to which data can be added. + /// + public partial class MapDataView : UserControl, IMapView + { + private MapDataCollection data; + + /// + /// Creates a new instance of . + /// + public MapDataView() + { + InitializeComponent(); + } + + public object Data + { + get + { + return data; + } + set + { + data = (MapDataCollection)value; + + if (data != null) + { + foreach (var mapData in data.List) + { + Map.Data.Add(mapData); + } + + Map.Data.Name = data.Name; + Map.Data.NotifyObservers(); + } + } + } + + public IMapControl Map + { + get + { + return mapControl; + } + } + } +} Index: Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.resx =================================================================== diff -u --- Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.resx (revision 0) +++ Demo/Ringtoets/src/Demo.Ringtoets/Views/MapDataView.resx (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Demo.Ringtoets.Test.csproj =================================================================== diff -u -r1f0be1a4230b2ef4f2382feb75e425d4fb51d083 -rf14469a6c1b70d2c2366c5050e1bfaf1c846e697 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Demo.Ringtoets.Test.csproj (.../Demo.Ringtoets.Test.csproj) (revision 1f0be1a4230b2ef4f2382feb75e425d4fb51d083) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Demo.Ringtoets.Test.csproj (.../Demo.Ringtoets.Test.csproj) (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -68,6 +68,7 @@ + @@ -90,6 +91,18 @@ {516EBC95-B8F2-428C-B7F6-733F01BF8FDD} Core.Components.Charting + + {5A91174A-FB95-4C9D-9CA5-81C0B8D4361A} + Core.Components.DotSpatial.Forms + + + {4a06df0d-5d75-4bad-a95a-a3db9b7c4ad5} + Core.Components.Gis.Forms + + + {318ba582-88c9-4816-a54a-a7e431461de3} + Core.Components.Gis + {DADAA0A5-288C-49CB-9F08-337F16832C86} Core.Components.OxyPlot.Forms Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectPluginTest.cs =================================================================== diff -u -r1f0be1a4230b2ef4f2382feb75e425d4fb51d083 -rf14469a6c1b70d2c2366c5050e1bfaf1c846e697 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectPluginTest.cs (.../DemoProjectPluginTest.cs) (revision 1f0be1a4230b2ef4f2382feb75e425d4fb51d083) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectPluginTest.cs (.../DemoProjectPluginTest.cs) (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -2,6 +2,7 @@ using Core.Common.Gui.Forms; using Core.Common.Gui.Plugin; using Core.Components.Charting.Data; +using Core.Components.Gis.Data; using Demo.Ringtoets.GUIs; using Demo.Ringtoets.Views; using NUnit.Framework; @@ -30,16 +31,21 @@ // Setup using (var plugin = new DemoProjectPlugin()) { - var view = new ChartDataView(); - // Call var views = plugin.GetViewInfos().ToArray(); // Assert - Assert.AreEqual(1, views.Length); - Assert.AreEqual(typeof(ChartDataCollection), views[0].DataType); - Assert.AreEqual(typeof(ChartDataView), views[0].ViewType); - Assert.AreEqual("Diagram", views[0].GetViewName(view, null)); + Assert.AreEqual(2, views.Length); + + ViewInfo chartViewInfo = views[0]; + Assert.AreEqual(typeof(ChartDataCollection), chartViewInfo.DataType); + Assert.AreEqual(typeof(ChartDataView), chartViewInfo.ViewType); + Assert.AreEqual("Diagram", chartViewInfo.GetViewName(new ChartDataView(), null)); + + ViewInfo mapViewInfo = views[1]; + Assert.AreEqual(typeof(MapData), mapViewInfo.DataType); + Assert.AreEqual(typeof(MapDataView), mapViewInfo.ViewType); + Assert.AreEqual("Kaart", mapViewInfo.GetViewName(new MapDataView(), null)); } } } Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/MapDataViewTest.cs =================================================================== diff -u --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/MapDataViewTest.cs (revision 0) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/MapDataViewTest.cs (revision f14469a6c1b70d2c2366c5050e1bfaf1c846e697) @@ -0,0 +1,135 @@ +// 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 System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base.Geometry; +using Core.Common.Controls.Views; +using Core.Components.DotSpatial.Forms; +using Core.Components.Gis.Data; +using Core.Components.Gis.Features; +using Core.Components.Gis.Geometries; +using Demo.Ringtoets.Views; +using NUnit.Framework; + +namespace Demo.Ringtoets.Test.Views +{ + [TestFixture] + public class MapDataViewTest + { + [Test] + public void DefaultConstructor_DefaultValues() + { + // Call + using (var mapView = new MapDataView()) + { + // Assert + Assert.IsInstanceOf(mapView); + Assert.IsInstanceOf(mapView); + } + } + + [Test] + public void DefaultConstructor_Always_AddsMapControl() + { + // Call + using (var mapView = new MapDataView()) + { + // Assert + Assert.AreEqual(1, mapView.Controls.Count); + object mapObject = mapView.Controls[0]; + Assert.IsInstanceOf(mapObject); + + var map = (MapControl)mapObject; + Assert.AreEqual(DockStyle.Fill, map.Dock); + Assert.NotNull(mapView.Map); + } + } + + [Test] + public void Data_SetToNull_MapControlNotUpdated() + { + // Setup + using (var mapView = new MapDataView()) + { + var map = (MapControl)mapView.Controls[0]; + var mapData = map.Data; + + // Call + TestDelegate testDelegate = () => mapView.Data = null; + + // Assert + Assert.DoesNotThrow(testDelegate); + Assert.AreSame(mapData, map.Data); + } + } + + [Test] + public void Data_SetToObject_ThrowsInvalidCastException() + { + // Setup + using (var mapView = new MapDataView()) + { + // Call + TestDelegate testDelegate = () => mapView.Data = new object(); + + // Assert + Assert.Throws(testDelegate); + } + } + + [Test] + public void Data_SetToMapCollectionData_MapDataSet() + { + // Setup + var features = new Collection + { + new MapFeature(new Collection + { + new MapGeometry(new[] + { + Enumerable.Empty() + }) + }) + }; + + using (var mapView = new MapDataView()) + { + var map = (MapControl)mapView.Controls[0]; + var pointData = new MapPointData(features, "test data"); + var collection = new MapDataCollection(new List + { + pointData + }, "test"); + + // Call + mapView.Data = collection; + + // Assert + Assert.AreSame(pointData, map.Data.List.First()); + Assert.AreSame(collection, mapView.Data); + } + } + } +} \ No newline at end of file