Index: Core/Components/src/Core.Components.DotSpatial.Forms/BaseMap.cs =================================================================== diff -u -ra793fc9845a2b861d885170d22cd2353a7146403 -r87ecbdded83da959215bb92dab301a769b67282b --- Core/Components/src/Core.Components.DotSpatial.Forms/BaseMap.cs (.../BaseMap.cs) (revision a793fc9845a2b861d885170d22cd2353a7146403) +++ Core/Components/src/Core.Components.DotSpatial.Forms/BaseMap.cs (.../BaseMap.cs) (revision 87ecbdded83da959215bb92dab301a769b67282b) @@ -39,6 +39,7 @@ private Map map; private IMapFunction mapFunctionSelectionZoom; private MouseCoordinatesMapExtension mouseCoordinatesMapExtension; + private IMapFunction mapFunctionPanning; /// /// Creates a new instance of . @@ -86,6 +87,13 @@ ResetDefaultInteraction(); map.FunctionMode = FunctionMode.Pan; IsPanningEnabled = true; + map.Cursor = Cursors.Hand; + + if (mapFunctionPanning == null) + { + mapFunctionPanning = new MapFunctionPan(map); + } + map.ActivateMapFunction(mapFunctionPanning); } } @@ -101,7 +109,6 @@ { mapFunctionSelectionZoom = new MapFunctionSelectionZoom(map); } - map.ActivateMapFunction(mapFunctionSelectionZoom); } } @@ -126,7 +133,8 @@ } protected override void Dispose(bool disposing) - {; + { + ; map.Dispose(); mouseCoordinatesMapExtension.Dispose(); base.Dispose(disposing); Index: Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj =================================================================== diff -u -r0ae90fc4b743f3808ba0d620682e8fde7417fa40 -r87ecbdded83da959215bb92dab301a769b67282b --- Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj (.../Core.Components.DotSpatial.csproj) (revision 0ae90fc4b743f3808ba0d620682e8fde7417fa40) +++ Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj (.../Core.Components.DotSpatial.csproj) (revision 87ecbdded83da959215bb92dab301a769b67282b) @@ -97,6 +97,7 @@ + Index: Core/Components/src/Core.Components.DotSpatial/MapFunctionPan.cs =================================================================== diff -u --- Core/Components/src/Core.Components.DotSpatial/MapFunctionPan.cs (revision 0) +++ Core/Components/src/Core.Components.DotSpatial/MapFunctionPan.cs (revision 87ecbdded83da959215bb92dab301a769b67282b) @@ -0,0 +1,61 @@ +// 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.Windows.Forms; +using DotSpatial.Controls; + +namespace Core.Components.DotSpatial +{ + /// + /// that handles events to update . + /// + public class MapFunctionPan : global::DotSpatial.Controls.MapFunctionPan + { + private readonly Cursor defaultCursor = Cursors.Default; + + /// + /// Initializes a new instance of the MapFunctionPan class. + /// + /// Any valid interface. + public MapFunctionPan(IMap map) : base(map) + { + FunctionActivated += ActivateFunction; + MouseDown += OnMouseDown; + MouseUp += OnMouseUp; + } + + private void ActivateFunction(object sender, EventArgs e) + { + Map.Cursor = defaultCursor; + } + + private void OnMouseUp(object sender, GeoMouseArgs e) + { + Map.Cursor = defaultCursor; + } + + private void OnMouseDown(object sender, GeoMouseArgs geoMouseArgs) + { + Map.Cursor = Cursors.Hand; + } + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.DotSpatial/MapFunctionSelectionZoom.cs =================================================================== diff -u -r36407e74a45099ec88e3b8d8ef78ac049b224fff -r87ecbdded83da959215bb92dab301a769b67282b --- Core/Components/src/Core.Components.DotSpatial/MapFunctionSelectionZoom.cs (.../MapFunctionSelectionZoom.cs) (revision 36407e74a45099ec88e3b8d8ef78ac049b224fff) +++ Core/Components/src/Core.Components.DotSpatial/MapFunctionSelectionZoom.cs (.../MapFunctionSelectionZoom.cs) (revision 87ecbdded83da959215bb92dab301a769b67282b) @@ -42,6 +42,7 @@ public class MapFunctionSelectionZoom : MapFunction { private readonly Pen selectionPen; + private readonly Cursor defaultCursor = Cursors.Default; private Point currentPoint; private Coordinate geoStartPoint; private bool isDragging; @@ -50,6 +51,7 @@ /// /// Creates a new instance of . /// + /// Any valid interface. public MapFunctionSelectionZoom(IMap map) : base(map) { selectionPen = new Pen(Color.Black) @@ -153,12 +155,12 @@ base.OnMouseUp(e); Map.IsBusy = false; - Map.Cursor = Cursors.Default; + Map.Cursor = defaultCursor; } private void ActivateFunction(object sender, EventArgs e) { - Map.Cursor = Cursors.Default; + Map.Cursor = defaultCursor; } } } \ No newline at end of file Index: Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj =================================================================== diff -u -r0ae90fc4b743f3808ba0d620682e8fde7417fa40 -r87ecbdded83da959215bb92dab301a769b67282b --- Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj (.../Core.Components.DotSpatial.Test.csproj) (revision 0ae90fc4b743f3808ba0d620682e8fde7417fa40) +++ Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj (.../Core.Components.DotSpatial.Test.csproj) (revision 87ecbdded83da959215bb92dab301a769b67282b) @@ -107,6 +107,7 @@ + Index: Core/Components/test/Core.Components.DotSpatial.Test/MapFunctionPanTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.DotSpatial.Test/MapFunctionPanTest.cs (revision 0) +++ Core/Components/test/Core.Components.DotSpatial.Test/MapFunctionPanTest.cs (revision 87ecbdded83da959215bb92dab301a769b67282b) @@ -0,0 +1,50 @@ +// 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.Windows.Forms; +using DotSpatial.Controls; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Core.Components.DotSpatial.Test +{ + [TestFixture] + public class MapFunctionPanTest + { + [Test] + public void Constructor_ActivateEvent_ExpectedValues() + { + // Setup + var mockingRepository = new MockRepository(); + var mapMock = mockingRepository.StrictMock(); + mapMock.Expect(m => m.Cursor).SetPropertyWithArgument(Cursors.Default); + mockingRepository.ReplayAll(); + + // Call + MapFunctionPan mapFunction = new MapFunctionPan(mapMock); + mapFunction.Activate(); + + // Assert + Assert.IsInstanceOf(mapFunction); + mockingRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.DotSpatial.Test/MapFunctionSelectionZoomTest.cs =================================================================== diff -u -rdb3aa610228b657d23bba55a4ff26a1e359e9847 -r87ecbdded83da959215bb92dab301a769b67282b --- Core/Components/test/Core.Components.DotSpatial.Test/MapFunctionSelectionZoomTest.cs (.../MapFunctionSelectionZoomTest.cs) (revision db3aa610228b657d23bba55a4ff26a1e359e9847) +++ Core/Components/test/Core.Components.DotSpatial.Test/MapFunctionSelectionZoomTest.cs (.../MapFunctionSelectionZoomTest.cs) (revision 87ecbdded83da959215bb92dab301a769b67282b) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Windows.Forms; using DotSpatial.Controls; using NUnit.Framework; using Rhino.Mocks; @@ -34,12 +35,32 @@ // Setup var mockingRepository = new MockRepository(); var mapMock = mockingRepository.StrictMock(); + mockingRepository.ReplayAll(); // Call MapFunctionSelectionZoom mapFunction = new MapFunctionSelectionZoom(mapMock); // Assert Assert.IsInstanceOf(mapFunction); + mockingRepository.VerifyAll(); } + + [Test] + public void Constructor_ActivateEvent_ExpectedValues() + { + // Setup + var mockingRepository = new MockRepository(); + var mapMock = mockingRepository.StrictMock(); + mapMock.Expect(m => m.Cursor).SetPropertyWithArgument(Cursors.Default); + mockingRepository.ReplayAll(); + + // Call + MapFunctionSelectionZoom mapFunction = new MapFunctionSelectionZoom(mapMock); + mapFunction.Activate(); + + // Assert + Assert.IsInstanceOf(mapFunction); + mockingRepository.VerifyAll(); + } } } \ No newline at end of file