Index: Core/Components/src/Core.Components.DotSpatial.Forms/BaseMap.cs
===================================================================
diff -u -r0ae90fc4b743f3808ba0d620682e8fde7417fa40 -r33d1826440741f2fa8b53129d59c532f110dc2bf
--- Core/Components/src/Core.Components.DotSpatial.Forms/BaseMap.cs (.../BaseMap.cs) (revision 0ae90fc4b743f3808ba0d620682e8fde7417fa40)
+++ Core/Components/src/Core.Components.DotSpatial.Forms/BaseMap.cs (.../BaseMap.cs) (revision 33d1826440741f2fa8b53129d59c532f110dc2bf)
@@ -54,6 +54,7 @@
public bool IsPanningEnabled { get; private set; }
public bool IsRectangleZoomingEnabled { get; private set; }
+ public bool IsMouseCoordinatesEnabled { get; private set; }
public MapData Data
{
@@ -107,6 +108,20 @@
}
}
+ public void ToggleMouseCoordinates()
+ {
+ if (!IsMouseCoordinatesEnabled)
+ {
+ mouseCoordinatesMapExtension.Activate();
+ IsMouseCoordinatesEnabled = true;
+ }
+ else
+ {
+ mouseCoordinatesMapExtension.Deactivate();
+ IsMouseCoordinatesEnabled = false;
+ }
+ }
+
public void UpdateObserver()
{
DrawFeatureSets();
Index: Core/Components/src/Core.Components.DotSpatial/MouseCoordinatesMapExtension.cs
===================================================================
diff -u -r0ae90fc4b743f3808ba0d620682e8fde7417fa40 -r33d1826440741f2fa8b53129d59c532f110dc2bf
--- Core/Components/src/Core.Components.DotSpatial/MouseCoordinatesMapExtension.cs (.../MouseCoordinatesMapExtension.cs) (revision 0ae90fc4b743f3808ba0d620682e8fde7417fa40)
+++ Core/Components/src/Core.Components.DotSpatial/MouseCoordinatesMapExtension.cs (.../MouseCoordinatesMapExtension.cs) (revision 33d1826440741f2fa8b53129d59c532f110dc2bf)
@@ -42,7 +42,8 @@
textBox = new TextBox
{
AutoSize = true,
- BorderStyle = BorderStyle.None
+ BorderStyle = BorderStyle.None,
+ Width = 160
};
}
Index: Core/Components/src/Core.Components.Gis/IMap.cs
===================================================================
diff -u -rdb3aa610228b657d23bba55a4ff26a1e359e9847 -r33d1826440741f2fa8b53129d59c532f110dc2bf
--- Core/Components/src/Core.Components.Gis/IMap.cs (.../IMap.cs) (revision db3aa610228b657d23bba55a4ff26a1e359e9847)
+++ Core/Components/src/Core.Components.Gis/IMap.cs (.../IMap.cs) (revision 33d1826440741f2fa8b53129d59c532f110dc2bf)
@@ -29,16 +29,21 @@
public interface IMap
{
///
- /// Gets a value indicating whether or not the chart can be panned with the left mouse button.
+ /// Gets a value indicating whether or not the map can be panned with the left mouse button.
///
bool IsPanningEnabled { get; }
///
- /// Gets a value indicating whether or not the chart can be zoomed by rectangle with the left mouse button.
+ /// Gets a value indicating whether or not the map can be zoomed by rectangle with the left mouse button.
///
bool IsRectangleZoomingEnabled { get; }
///
+ /// Gets a value indicating whether or not the map coordinates of the mouse should be shown.
+ ///
+ bool IsMouseCoordinatesEnabled { get; }
+
+ ///
/// Gets or sets the data to show in the .
///
MapData Data { get; set; }
@@ -57,5 +62,10 @@
/// Toggles rectangle zooming of the . Rectangle zooming is invoked by clicking the left mouse-button.
///
void ToggleRectangleZooming();
+
+ ///
+ /// Toggles mouse coordinates of the .
+ ///
+ void ToggleMouseCoordinates();
}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/BaseMapTest.cs
===================================================================
diff -u -r627807d4cf1d72af4dcc65aef9ad56a1b089ec04 -r33d1826440741f2fa8b53129d59c532f110dc2bf
--- Core/Components/test/Core.Components.DotSpatial.Forms.Test/BaseMapTest.cs (.../BaseMapTest.cs) (revision 627807d4cf1d72af4dcc65aef9ad56a1b089ec04)
+++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/BaseMapTest.cs (.../BaseMapTest.cs) (revision 33d1826440741f2fa8b53129d59c532f110dc2bf)
@@ -230,6 +230,30 @@
}
[Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void ToggleMouseCoordinates_Always_ChangesState(bool isShowingCoordinates)
+ {
+ // Setup
+ var map = new BaseMap();
+
+ if (isShowingCoordinates)
+ {
+ // Make sure the state is correct
+ map.ToggleMouseCoordinates();
+
+ // Precondition
+ Assert.IsTrue(map.IsMouseCoordinatesEnabled);
+ }
+
+ // Call
+ map.ToggleMouseCoordinates();
+
+ // Assert
+ Assert.AreNotEqual(isShowingCoordinates, map.IsMouseCoordinatesEnabled);
+ }
+
+ [Test]
[RequiresSTA]
public void UpdateObserver_MapInForm_MapLayersRenewed()
{
Index: Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj
===================================================================
diff -u -r3aa114b55dd6caa46890a54af64fba874497c135 -r33d1826440741f2fa8b53129d59c532f110dc2bf
--- Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj (.../Core.Plugins.DotSpatial.csproj) (revision 3aa114b55dd6caa46890a54af64fba874497c135)
+++ Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj (.../Core.Plugins.DotSpatial.csproj) (revision 33d1826440741f2fa8b53129d59c532f110dc2bf)
@@ -150,6 +150,9 @@
+
+
+