Index: Core/Components/src/Core.Components.Charting.Forms/Core.Components.Charting.Forms.csproj
===================================================================
diff -u -r25bdf707d3cd78e182705e16371a376222b7ee79 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.Charting.Forms/Core.Components.Charting.Forms.csproj (.../Core.Components.Charting.Forms.csproj) (revision 25bdf707d3cd78e182705e16371a376222b7ee79)
+++ Core/Components/src/Core.Components.Charting.Forms/Core.Components.Charting.Forms.csproj (.../Core.Components.Charting.Forms.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -39,6 +39,7 @@
Properties\GlobalAssembly.cs
+
@@ -48,6 +49,10 @@
+
+ {3bbfd65b-b277-4e50-ae6d-bd24c3434609}
+ Core.Common.Base
+ {9a2d67e6-26ac-4d17-b11a-2b4372f2f572}Core.Common.Controls
Index: Core/Components/src/Core.Components.Charting.Forms/IChartControl.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Charting.Forms/IChartControl.cs (revision 0)
+++ Core/Components/src/Core.Components.Charting.Forms/IChartControl.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -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 Core.Components.Charting.Data;
+
+namespace Core.Components.Charting.Forms
+{
+ ///
+ /// Interface describing general chart interactions.
+ ///
+ public interface IChartControl
+ {
+ ///
+ /// Gets a value indicating whether or not the chart 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.
+ ///
+ bool IsRectangleZoomingEnabled { get; }
+
+ ///
+ /// Gets or sets the data to show in the .
+ ///
+ ChartData Data { get; set; }
+
+ ///
+ /// Toggles panning of the . Panning is invoked by clicking the left mouse-button.
+ ///
+ void TogglePanning();
+
+ ///
+ /// Toggles rectangle zooming of the . Rectangle zooming is invoked by clicking the left mouse-button.
+ ///
+ void ToggleRectangleZooming();
+
+ ///
+ /// Zooms to a level so that everything is in view.
+ ///
+ void ZoomToAll();
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Charting.Forms/IChartView.cs
===================================================================
diff -u -r25bdf707d3cd78e182705e16371a376222b7ee79 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.Charting.Forms/IChartView.cs (.../IChartView.cs) (revision 25bdf707d3cd78e182705e16371a376222b7ee79)
+++ Core/Components/src/Core.Components.Charting.Forms/IChartView.cs (.../IChartView.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -24,13 +24,13 @@
namespace Core.Components.Charting.Forms
{
///
- /// Interface describing that contain a as one of its components.
+ /// Interface describing that contain a as one of its components.
///
public interface IChartView : IView
{
///
- /// Gets the set for this .
+ /// Gets the set for this .
///
- IChart Chart { get; }
+ IChartControl Chart { get; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj
===================================================================
diff -u -rc8848af0c6f8780634dcce2013e606f090da6577 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj (.../Core.Components.Charting.csproj) (revision c8848af0c6f8780634dcce2013e606f090da6577)
+++ Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj (.../Core.Components.Charting.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -43,7 +43,6 @@
-
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Charting/IChart.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/src/Core.Components.DotSpatial.Forms/BaseMap.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/src/Core.Components.DotSpatial.Forms/Core.Components.DotSpatial.Forms.csproj
===================================================================
diff -u -r3aa114b55dd6caa46890a54af64fba874497c135 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.DotSpatial.Forms/Core.Components.DotSpatial.Forms.csproj (.../Core.Components.DotSpatial.Forms.csproj) (revision 3aa114b55dd6caa46890a54af64fba874497c135)
+++ Core/Components/src/Core.Components.DotSpatial.Forms/Core.Components.DotSpatial.Forms.csproj (.../Core.Components.DotSpatial.Forms.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -91,7 +91,7 @@
Properties\GlobalAssembly.cs
-
+ Component
@@ -110,6 +110,10 @@
{aa47e858-a2a7-470e-8b2d-c76ae8ed9ccd}Core.Components.DotSpatial
+
+ {4a06df0d-5d75-4bad-a95a-a3db9b7c4ad5}
+ Core.Components.Gis.Forms
+ {318ba582-88c9-4816-a54a-a7e431461de3}Core.Components.Gis
Index: Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (revision 0)
+++ Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,202 @@
+// 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 Core.Common.Base;
+using Core.Components.DotSpatial.Converter;
+using Core.Components.DotSpatial.MapFunctions;
+using Core.Components.Gis.Data;
+using Core.Components.Gis.Forms;
+
+using DotSpatial.Controls;
+
+using MapFunctionPan = Core.Components.DotSpatial.MapFunctions.MapFunctionPan;
+
+namespace Core.Components.DotSpatial.Forms
+{
+ ///
+ /// This class describes a map view with configured projection and function mode.
+ ///
+ public sealed class MapControl : Control, IMapControl, IObserver
+ {
+ private readonly MapDataFactory mapDataFactory = new MapDataFactory();
+
+ private MapData data;
+ private Map map;
+ private IMapFunction mapFunctionSelectionZoom;
+ private MouseCoordinatesMapExtension mouseCoordinatesMapExtension;
+ private IMapFunction mapFunctionPanning;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ public MapControl()
+ {
+ InitializeMapView();
+ TogglePanning();
+ }
+
+ public bool IsPanningEnabled { get; private set; }
+
+ public bool IsRectangleZoomingEnabled { get; private set; }
+ public bool IsMouseCoordinatesVisible { get; private set; }
+
+ public MapData Data
+ {
+ get
+ {
+ return data;
+ }
+ set
+ {
+ if (IsDisposed)
+ {
+ return;
+ }
+
+ DetachFromData();
+ data = value;
+ AttachToData();
+ DrawFeatureSets();
+ }
+ }
+
+ public void ZoomToAll()
+ {
+ map.ZoomToMaxExtent();
+ }
+
+ public void TogglePanning()
+ {
+ if (!IsPanningEnabled)
+ {
+ ResetDefaultInteraction();
+ map.FunctionMode = FunctionMode.Pan;
+ IsPanningEnabled = true;
+ map.Cursor = Cursors.Hand;
+
+ if (mapFunctionPanning == null)
+ {
+ mapFunctionPanning = new MapFunctionPan(map);
+ }
+ map.ActivateMapFunction(mapFunctionPanning);
+ }
+ }
+
+ public void ToggleRectangleZooming()
+ {
+ if (!IsRectangleZoomingEnabled)
+ {
+ ResetDefaultInteraction();
+ map.FunctionMode = FunctionMode.Select;
+ IsRectangleZoomingEnabled = true;
+
+ if (mapFunctionSelectionZoom == null)
+ {
+ mapFunctionSelectionZoom = new MapFunctionSelectionZoom(map);
+ }
+ map.ActivateMapFunction(mapFunctionSelectionZoom);
+ }
+ }
+
+ public void ToggleMouseCoordinatesVisibility()
+ {
+ if (!IsMouseCoordinatesVisible)
+ {
+ mouseCoordinatesMapExtension.Activate();
+ IsMouseCoordinatesVisible = true;
+ }
+ else
+ {
+ mouseCoordinatesMapExtension.Deactivate();
+ IsMouseCoordinatesVisible = false;
+ }
+ }
+
+ public void UpdateObserver()
+ {
+ DrawFeatureSets();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ ;
+ map.Dispose();
+ mouseCoordinatesMapExtension.Dispose();
+ base.Dispose(disposing);
+ }
+
+ private void ResetDefaultInteraction()
+ {
+ IsPanningEnabled = false;
+ IsRectangleZoomingEnabled = false;
+ }
+
+ ///
+ /// Attaches the to the currently set , if there is any.
+ ///
+ private void AttachToData()
+ {
+ if (data != null)
+ {
+ data.Attach(this);
+ }
+ }
+
+ ///
+ /// Detaches the to the currently set , if there is any.
+ ///
+ private void DetachFromData()
+ {
+ if (data != null)
+ {
+ data.Detach(this);
+ }
+ }
+
+ private void DrawFeatureSets()
+ {
+ map.ClearLayers();
+ if (data != null)
+ {
+ foreach (IMapFeatureLayer mapLayer in mapDataFactory.Create(data))
+ {
+ map.Layers.Add(mapLayer);
+ }
+ }
+ }
+
+ private void InitializeMapView()
+ {
+ map = new Map
+ {
+ ProjectionModeDefine = ActionMode.Never,
+ Dock = DockStyle.Fill,
+ FunctionMode = FunctionMode.Pan,
+ };
+
+ mouseCoordinatesMapExtension = new MouseCoordinatesMapExtension(map);
+ ToggleMouseCoordinatesVisibility();
+
+ Controls.Add(map);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj
===================================================================
diff -u -r87ecbdded83da959215bb92dab301a769b67282b -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj (.../Core.Components.DotSpatial.csproj) (revision 87ecbdded83da959215bb92dab301a769b67282b)
+++ Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj (.../Core.Components.DotSpatial.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -97,9 +97,9 @@
-
+
+
-
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/src/Core.Components.DotSpatial/MapFunctionPan.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/src/Core.Components.DotSpatial/MapFunctionSelectionZoom.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/src/Core.Components.DotSpatial/MapFunctions/MapFunctionPan.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.DotSpatial/MapFunctions/MapFunctionPan.cs (revision 0)
+++ Core/Components/src/Core.Components.DotSpatial/MapFunctions/MapFunctionPan.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,62 @@
+// 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.MapFunctions
+{
+ ///
+ /// 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/MapFunctions/MapFunctionSelectionZoom.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.DotSpatial/MapFunctions/MapFunctionSelectionZoom.cs (revision 0)
+++ Core/Components/src/Core.Components.DotSpatial/MapFunctions/MapFunctionSelectionZoom.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,154 @@
+// 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.Drawing;
+using System.Drawing.Drawing2D;
+using System.Windows.Forms;
+
+using DotSpatial.Controls;
+using DotSpatial.Data;
+using DotSpatial.Symbology;
+using DotSpatial.Topology;
+
+using Point = System.Drawing.Point;
+
+namespace Core.Components.DotSpatial.MapFunctions
+{
+ ///
+ /// that can zoom into the map using left mouse clicks or rectangle dragging..
+ ///
+ /// This is a copy of with the following changes:
+ ///
+ /// It does not zoom out on right mouse clicks.
+ /// It does not zoom when the location of the cursus on is equal to the location set at
+ /// .
+ ///
+ ///
+ public class MapFunctionSelectionZoom : MapFunction
+ {
+ private readonly Pen selectionPen;
+ private readonly Cursor defaultCursor = Cursors.Default;
+ private Point currentPoint;
+ private Coordinate geoStartPoint;
+ private bool isDragging;
+ private Point startPoint = Point.Empty;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Any valid interface.
+ public MapFunctionSelectionZoom(IMap map) : base(map)
+ {
+ selectionPen = new Pen(Color.Black)
+ {
+ DashStyle = DashStyle.Dash
+ };
+ YieldStyle = YieldStyles.LeftButton | YieldStyles.RightButton;
+ FunctionActivated += ActivateFunction;
+ }
+
+ protected override void OnDraw(MapDrawArgs e)
+ {
+ if (isDragging)
+ {
+ var rectangle = Opp.RectangleFromPoints(startPoint, currentPoint);
+ rectangle.Width -= 1;
+ rectangle.Height -= 1;
+ e.Graphics.DrawRectangle(Pens.White, rectangle);
+ e.Graphics.DrawRectangle(selectionPen, rectangle);
+ }
+ base.OnDraw(e);
+ }
+
+ protected override void OnMouseDown(GeoMouseArgs e)
+ {
+ if (e.Button == MouseButtons.Left)
+ {
+ startPoint = e.Location;
+ currentPoint = startPoint;
+ geoStartPoint = e.GeographicLocation;
+ isDragging = true;
+ Map.IsBusy = true;
+ Map.Cursor = Cursors.SizeNWSE;
+ }
+ base.OnMouseDown(e);
+ }
+
+ protected override void OnMouseMove(GeoMouseArgs e)
+ {
+ if (isDragging)
+ {
+ int x = Math.Min(Math.Min(startPoint.X, currentPoint.X), e.X);
+ int y = Math.Min(Math.Min(startPoint.Y, currentPoint.Y), e.Y);
+ int mx = Math.Max(Math.Max(startPoint.X, currentPoint.X), e.X);
+ int my = Math.Max(Math.Max(startPoint.Y, currentPoint.Y), e.Y);
+ currentPoint = e.Location;
+ Map.Invalidate(new Rectangle(x, y, mx - x, my - y));
+ }
+ base.OnMouseMove(e);
+ }
+
+ protected override void OnMouseUp(GeoMouseArgs e)
+ {
+ if (!(e.Map.IsZoomedToMaxExtent && e.Button == MouseButtons.Right))
+ {
+ e.Map.IsZoomedToMaxExtent = false;
+ var handled = false;
+ currentPoint = e.Location;
+
+ Map.Invalidate();
+ if (isDragging)
+ {
+ if (startPoint == currentPoint)
+ {
+ handled = true;
+ }
+ else if (geoStartPoint != null)
+ {
+ IEnvelope env = new Envelope(geoStartPoint.X, e.GeographicLocation.X,
+ geoStartPoint.Y, e.GeographicLocation.Y);
+ if (Math.Abs(e.X - startPoint.X) > 1 && Math.Abs(e.Y - startPoint.Y) > 1)
+ {
+ e.Map.ViewExtents = env.ToExtent();
+ handled = true;
+ }
+ }
+ }
+ isDragging = false;
+
+ if (handled == false)
+ {
+ e.Map.MapFrame.ResetExtents();
+ }
+ }
+
+ base.OnMouseUp(e);
+ Map.IsBusy = false;
+ Map.Cursor = defaultCursor;
+ }
+
+ private void ActivateFunction(object sender, EventArgs e)
+ {
+ Map.Cursor = defaultCursor;
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis.Forms/Core.Components.Gis.Forms.csproj
===================================================================
diff -u -r25bdf707d3cd78e182705e16371a376222b7ee79 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.Gis.Forms/Core.Components.Gis.Forms.csproj (.../Core.Components.Gis.Forms.csproj) (revision 25bdf707d3cd78e182705e16371a376222b7ee79)
+++ Core/Components/src/Core.Components.Gis.Forms/Core.Components.Gis.Forms.csproj (.../Core.Components.Gis.Forms.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -39,10 +39,15 @@
Properties\GlobalAssembly.cs
+
+
+ {3bbfd65b-b277-4e50-ae6d-bd24c3434609}
+ Core.Common.Base
+ {9A2D67E6-26AC-4D17-B11A-2B4372F2F572}Core.Common.Controls
Index: Core/Components/src/Core.Components.Gis.Forms/IMapControl.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis.Forms/IMapControl.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis.Forms/IMapControl.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,71 @@
+// 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 Core.Components.Gis.Data;
+
+namespace Core.Components.Gis.Forms
+{
+ ///
+ /// Interface describing general map interactions.
+ ///
+ public interface IMapControl
+ {
+ ///
+ /// 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 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 IsMouseCoordinatesVisible { get; }
+
+ ///
+ /// Gets or sets the data to show in the .
+ ///
+ MapData Data { get; set; }
+
+ ///
+ /// Zooms to a level so that everything is in view.
+ ///
+ void ZoomToAll();
+
+ ///
+ /// Toggles panning of the . Panning is invoked by clicking the left mouse-button.
+ ///
+ void TogglePanning();
+
+ ///
+ /// Toggles rectangle zooming of the . Rectangle zooming is invoked by clicking the left mouse-button.
+ ///
+ void ToggleRectangleZooming();
+
+ ///
+ /// Toggles the visibility mouse coordinates of the .
+ ///
+ void ToggleMouseCoordinatesVisibility();
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis.Forms/IMapView.cs
===================================================================
diff -u -r86e717a5477d55d1c4351f2857a1d76e220a3ab4 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.Gis.Forms/IMapView.cs (.../IMapView.cs) (revision 86e717a5477d55d1c4351f2857a1d76e220a3ab4)
+++ Core/Components/src/Core.Components.Gis.Forms/IMapView.cs (.../IMapView.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -24,13 +24,13 @@
namespace Core.Components.Gis.Forms
{
///
- /// Interface describing that contain a as one of its components.
+ /// Interface describing that contain a as one of its components.
///
public interface IMapView : IView
{
///
- /// Gets the set for this .
+ /// Gets the set for this .
///
- IMap Map { get; }
+ IMapControl Map { get; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj
===================================================================
diff -u -r295f682376c0fdfe225ce196a5d654964a3c81bd -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj (.../Core.Components.Gis.csproj) (revision 295f682376c0fdfe225ce196a5d654964a3c81bd)
+++ Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj (.../Core.Components.Gis.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -48,7 +48,6 @@
-
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Gis/IMap.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/src/Core.Components.OxyPlot.Forms/ChartControl.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.OxyPlot.Forms/ChartControl.cs (revision 0)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/ChartControl.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,159 @@
+// 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.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using Core.Common.Base;
+using Core.Components.Charting.Forms;
+using Core.Components.Charting.Data;
+using Core.Components.OxyPlot.Converter;
+using OxyPlot.WindowsForms;
+
+namespace Core.Components.OxyPlot.Forms
+{
+ ///
+ /// This class describes a plot view with configured representation of axes.
+ ///
+ public sealed class ChartControl : Control, IObserver, IChartControl
+ {
+ private readonly SeriesFactory seriesFactory = new SeriesFactory();
+
+ private ChartData data;
+
+ private LinearPlotView view;
+ private DynamicPlotController controller;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ public ChartControl()
+ {
+ InitializePlotView();
+ MinimumSize = new Size(50, 75);
+ }
+
+ ///
+ /// Attaches the to the currently set , if there is any.
+ ///
+ private void AttachToData()
+ {
+ if (data != null)
+ {
+ data.Attach(this);
+ }
+ }
+
+ ///
+ /// Detaches the to the currently set , if there is any.
+ ///
+ private void DetachFromData()
+ {
+ if (data != null)
+ {
+ data.Detach(this);
+ }
+ }
+
+ ///
+ /// Initialize the for the .
+ ///
+ private void InitializePlotView()
+ {
+ view = new LinearPlotView();
+ controller = new DynamicPlotController();
+ view.Controller = controller;
+ Controls.Add(view);
+ }
+
+ ///
+ /// Draws series based on the currently set .
+ ///
+ private void DrawSeries()
+ {
+ view.Model.Series.Clear();
+ if (data != null)
+ {
+ foreach (var series in seriesFactory.Create(data))
+ {
+ view.Model.Series.Add(series);
+ }
+ }
+ view.InvalidatePlot(true);
+ }
+
+ #region IChart
+
+ public bool IsPanningEnabled
+ {
+ get
+ {
+ return controller.IsPanningEnabled;
+ }
+ }
+
+ public bool IsRectangleZoomingEnabled
+ {
+ get
+ {
+ return controller.IsRectangleZoomingEnabled;
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public ChartData Data
+ {
+ get
+ {
+ return data;
+ }
+ set
+ {
+ DetachFromData();
+ data = value;
+ AttachToData();
+ DrawSeries();
+ }
+ }
+
+ public void TogglePanning()
+ {
+ controller.TogglePanning();
+ }
+
+ public void ToggleRectangleZooming()
+ {
+ controller.ToggleRectangleZooming();
+ }
+
+ public void ZoomToAll()
+ {
+ view.ZoomToAll();
+ }
+
+ public void UpdateObserver()
+ {
+ DrawSeries();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot.Forms/Core.Components.OxyPlot.Forms.csproj
===================================================================
diff -u -rc8848af0c6f8780634dcce2013e606f090da6577 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.OxyPlot.Forms/Core.Components.OxyPlot.Forms.csproj (.../Core.Components.OxyPlot.Forms.csproj) (revision c8848af0c6f8780634dcce2013e606f090da6577)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/Core.Components.OxyPlot.Forms.csproj (.../Core.Components.OxyPlot.Forms.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -53,7 +53,7 @@
Properties\GlobalAssembly.cs
-
+ Component
@@ -82,6 +82,10 @@
Core.Common.VersionFalse
+
+ {2465cca1-c505-4827-9454-4fd5fd9194cd}
+ Core.Components.Charting.Forms
+ {516EBC95-B8F2-428C-B7F6-733F01BF8FDD}Core.Components.Charting
Index: Core/Components/src/Core.Components.OxyPlot.Forms/LinearPlotView.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.OxyPlot.Forms/LinearPlotView.cs (.../LinearPlotView.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/LinearPlotView.cs (.../LinearPlotView.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -44,8 +44,8 @@
{
Axes =
{
- CreateAxis(Resources.BaseChart_XAxisTitle, AxisPosition.Bottom),
- CreateAxis(Resources.BaseChart_YAxisTitle, AxisPosition.Left)
+ CreateAxis(Resources.ChartControl_XAxisTitle, AxisPosition.Bottom),
+ CreateAxis(Resources.ChartControl_YAxisTitle, AxisPosition.Left)
}
};
Index: Core/Components/src/Core.Components.OxyPlot.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -rc8848af0c6f8780634dcce2013e606f090da6577 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.OxyPlot.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c8848af0c6f8780634dcce2013e606f090da6577)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.17929
+// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -63,18 +63,18 @@
///
/// Looks up a localized string similar to L.
///
- public static string BaseChart_XAxisTitle {
+ public static string ChartControl_XAxisTitle {
get {
- return ResourceManager.GetString("BaseChart_XAxisTitle", resourceCulture);
+ return ResourceManager.GetString("ChartControl_XAxisTitle", resourceCulture);
}
}
///
/// Looks up a localized string similar to Hoogte.
///
- public static string BaseChart_YAxisTitle {
+ public static string ChartControl_YAxisTitle {
get {
- return ResourceManager.GetString("BaseChart_YAxisTitle", resourceCulture);
+ return ResourceManager.GetString("ChartControl_YAxisTitle", resourceCulture);
}
}
}
Index: Core/Components/src/Core.Components.OxyPlot.Forms/Properties/Resources.resx
===================================================================
diff -u -r9b19f753c055f426fcea7b6c01cdf43c8d9f2468 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/src/Core.Components.OxyPlot.Forms/Properties/Resources.resx (.../Resources.resx) (revision 9b19f753c055f426fcea7b6c01cdf43c8d9f2468)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/Properties/Resources.resx (.../Resources.resx) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -117,10 +117,10 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
L
-
+
Hoogte
\ No newline at end of file
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/test/Core.Components.DotSpatial.Forms.Test/BaseMapTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/Core.Components.DotSpatial.Forms.Test.csproj
===================================================================
diff -u -rdb3aa610228b657d23bba55a4ff26a1e359e9847 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/test/Core.Components.DotSpatial.Forms.Test/Core.Components.DotSpatial.Forms.Test.csproj (.../Core.Components.DotSpatial.Forms.Test.csproj) (revision db3aa610228b657d23bba55a4ff26a1e359e9847)
+++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/Core.Components.DotSpatial.Forms.Test.csproj (.../Core.Components.DotSpatial.Forms.Test.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -90,7 +90,7 @@
-
+
@@ -112,6 +112,10 @@
{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
Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (revision 0)
+++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,307 @@
+// 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.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 DotSpatial.Controls;
+using NUnit.Framework;
+
+namespace Core.Components.DotSpatial.Forms.Test
+{
+ [TestFixture]
+ public class MapControlTest
+ {
+ [Test]
+ public void DefaultConstructor_DefaultValues()
+ {
+ // Call
+ using (var map = new MapControl())
+ {
+ // Assert
+ Assert.IsInstanceOf(map);
+ Assert.IsInstanceOf(map);
+ Assert.IsNull(map.Data);
+ Assert.IsTrue(map.IsPanningEnabled);
+ Assert.IsFalse(map.IsRectangleZoomingEnabled);
+ Assert.IsTrue(map.IsMouseCoordinatesVisible);
+ }
+ }
+
+ [Test]
+ public void Data_UnknownMapData_ThrowsNotSupportedException()
+ {
+ // Setup
+ using (var map = new MapControl())
+ {
+ var testData = new TestMapData("test data");
+
+ // Call
+ TestDelegate test = () => map.Data = testData;
+
+ // Assert
+ Assert.Throws(test);
+ }
+ }
+
+ [Test]
+ public void Data_Null_ReturnsNull()
+ {
+ // Setup
+ using (var map = new MapControl())
+ {
+ // Call
+ map.Data = null;
+
+ // Assert
+ Assert.IsNull(map.Data);
+ }
+ }
+
+ [Test]
+ public void Data_NotNull_ReturnsData()
+ {
+ // Setup
+ using (var map = new MapControl())
+ {
+ var testData = new MapPointData(Enumerable.Empty(), "test data");
+
+ // Call
+ map.Data = testData;
+
+ // Assert
+ Assert.AreSame(testData, map.Data);
+ }
+ }
+
+ [Test]
+ public void Data_SetPointData_MapPointLayerAdded()
+ {
+ // Setup
+ using (var map = new MapControl())
+ {
+ var testData = new MapPointData(Enumerable.Empty(), "test data");
+ var mapView = map.Controls.OfType
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/test/Core.Components.DotSpatial.Test/MapFunctionPanTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/test/Core.Components.DotSpatial.Test/MapFunctionSelectionZoomTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/test/Core.Components.DotSpatial.Test/MapFunctions/MapFunctionPanTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.DotSpatial.Test/MapFunctions/MapFunctionPanTest.cs (revision 0)
+++ Core/Components/test/Core.Components.DotSpatial.Test/MapFunctions/MapFunctionPanTest.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,55 @@
+// 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;
+
+using MapFunctionPan = Core.Components.DotSpatial.MapFunctions.MapFunctionPan;
+
+namespace Core.Components.DotSpatial.Test.MapFunctions
+{
+ [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/MapFunctions/MapFunctionSelectionZoomTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.DotSpatial.Test/MapFunctions/MapFunctionSelectionZoomTest.cs (revision 0)
+++ Core/Components/test/Core.Components.DotSpatial.Test/MapFunctions/MapFunctionSelectionZoomTest.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,71 @@
+// 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 Core.Components.DotSpatial.MapFunctions;
+
+using DotSpatial.Controls;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+namespace Core.Components.DotSpatial.Test.MapFunctions
+{
+ [TestFixture]
+ public class MapFunctionSelectionZoomTest
+ {
+ [Test]
+ public void Constructor_Always_ExpectedValues()
+ {
+ // 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
Fisheye: Tag 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f refers to a dead (removed) revision in file `Core/Components/test/Core.Components.OxyPlot.Forms.Test/BaseChartTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/ChartControlTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.OxyPlot.Forms.Test/ChartControlTest.cs (revision 0)
+++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/ChartControlTest.cs (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -0,0 +1,218 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using Core.Common.Base;
+using Core.Common.Utils.Reflection;
+using Core.Components.Charting.Data;
+using Core.Components.Charting.TestUtil;
+using NUnit.Framework;
+using OxyPlot.WindowsForms;
+
+namespace Core.Components.OxyPlot.Forms.Test
+{
+ [TestFixture]
+ public class ChartControlTest
+ {
+ [Test]
+ public void DefaultConstructor_PropertiesSet()
+ {
+ // Call
+ var chart = new ChartControl();
+
+ // Assert
+ Assert.IsInstanceOf(chart);
+ Assert.AreEqual(75, chart.MinimumSize.Height);
+ Assert.AreEqual(50, chart.MinimumSize.Width);
+ Assert.IsNull(chart.Data);
+ Assert.IsTrue(chart.IsPanningEnabled);
+ Assert.IsFalse(chart.IsRectangleZoomingEnabled);
+ }
+
+ [Test]
+ public void Data_NotKnownChartData_ThrowsNotSupportedException()
+ {
+ // Setup
+ var chart = new ChartControl();
+ var testData = new TestChartData();
+
+ // Call
+ TestDelegate test = () => chart.Data = testData;
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Data_Null_ReturnsNull()
+ {
+ // Setup
+ var chart = new ChartControl();
+
+ // Call
+ chart.Data = null;
+
+ // Assert
+ Assert.IsNull(chart.Data);
+ }
+
+ [Test]
+ public void Data_KnownChartData_ChartControlAttachedSeriesAdded()
+ {
+ // Setup
+ var chart = new ChartControl();
+ var testData = new LineData(Enumerable.Empty>());
+ var observers = TypeUtils.GetField>(testData, "observers");
+ var view = TypeUtils.GetField(chart, "view");
+
+ // Call
+ chart.Data = testData;
+
+ // Assert
+ CollectionAssert.AreEqual(new[]
+ {
+ chart
+ }, observers);
+ Assert.AreEqual(1, view.Model.Series.Count);
+ }
+
+ [Test]
+ public void Data_NewDataSet_ChartControlDetachedFromOldAttachedToNewSeriesUpdated()
+ {
+ // Setup
+ var chart = new ChartControl();
+ var testDataOld = new LineData(Enumerable.Empty>());
+ var testDataNew = new LineData(Enumerable.Empty>());
+ var observersOld = TypeUtils.GetField>(testDataOld, "observers");
+ var observersNew = TypeUtils.GetField>(testDataNew, "observers");
+ var view = TypeUtils.GetField(chart, "view");
+
+ // Call
+ chart.Data = testDataOld;
+ chart.Data = testDataNew;
+
+ // Assert
+ CollectionAssert.IsEmpty(observersOld);
+ CollectionAssert.AreEqual(new[]
+ {
+ chart
+ }, observersNew);
+ Assert.AreEqual(1, view.Model.Series.Count);
+ }
+
+ [Test]
+ public void Data_DataSetNewValueIsNull_ChartControlDetachedSeriesCleared()
+ {
+ // Setup
+ var chart = new ChartControl();
+ var testData = new LineData(Enumerable.Empty>());
+ var observers = TypeUtils.GetField>(testData, "observers");
+ var view = TypeUtils.GetField(chart, "view");
+
+ chart.Data = testData;
+
+ // Precondition
+ Assert.AreEqual(1, view.Model.Series.Count);
+
+ // Call
+ chart.Data = null;
+
+ // Assert
+ CollectionAssert.IsEmpty(observers);
+ CollectionAssert.IsEmpty(view.Model.Series);
+ }
+
+ [Test]
+ public void TogglePanning_Always_PanningEnabled()
+ {
+ // Setup
+ var chart = new ChartControl();
+
+ // Precondition
+ Assert.IsTrue(chart.IsPanningEnabled);
+
+ // Call
+ chart.TogglePanning();
+
+ // Assert
+ Assert.IsTrue(chart.IsPanningEnabled);
+ Assert.IsFalse(chart.IsRectangleZoomingEnabled);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void ToggleRectangleZooming_Always_ChangesState(bool isRectangleZooming)
+ {
+ // Setup
+ var chart = new ChartControl();
+ if (isRectangleZooming)
+ {
+ chart.ToggleRectangleZooming();
+ }
+
+ // Precondition
+ Assert.AreEqual(isRectangleZooming, chart.IsRectangleZoomingEnabled);
+ Assert.AreEqual(!isRectangleZooming, chart.IsPanningEnabled);
+
+ // Call
+ chart.ToggleRectangleZooming();
+
+ // Assert
+ Assert.IsTrue(chart.IsRectangleZoomingEnabled);
+ }
+
+ [Test]
+ public void ZoomToAll_ChartInForm_ViewInvalidatedSeriesSame()
+ {
+ // Setup
+ var form = new Form();
+ var chart = new ChartControl();
+ var testData = new LineData(Enumerable.Empty>());
+ var view = TypeUtils.GetField(chart, "view");
+ var invalidated = 0;
+
+ chart.Data = testData;
+ var series = view.Model.Series.ToList();
+
+ form.Controls.Add(chart);
+ view.Invalidated += (sender, args) => invalidated++;
+
+ form.Show();
+
+ // Call
+ chart.ZoomToAll();
+
+ // Assert
+ Assert.AreEqual(1, invalidated);
+ CollectionAssert.AreEqual(series, view.Model.Series);
+ }
+
+ [Test]
+ public void UpdateObserver_ChartInForm_ViewInvalidatedSeriesRenewed()
+ {
+ // Setup
+ var form = new Form();
+ var chart = new ChartControl();
+ var testData = new LineData(Enumerable.Empty>());
+ var view = TypeUtils.GetField(chart, "view");
+ var invalidated = 0;
+
+ chart.Data = testData;
+ var series = view.Model.Series.ToList();
+
+ form.Controls.Add(chart);
+ view.Invalidated += (sender, args) => invalidated++;
+
+ form.Show();
+
+ // Call
+ chart.UpdateObserver();
+
+ // Assert
+ Assert.AreEqual(1, invalidated);
+ Assert.AreEqual(1, view.Model.Series.Count);
+ Assert.AreNotSame(series[0], view.Model.Series[0]);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/Core.Components.OxyPlot.Forms.Test.csproj
===================================================================
diff -u -r74cd1965818ae9b23da6cad8776b7da2868be4a7 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/test/Core.Components.OxyPlot.Forms.Test/Core.Components.OxyPlot.Forms.Test.csproj (.../Core.Components.OxyPlot.Forms.Test.csproj) (revision 74cd1965818ae9b23da6cad8776b7da2868be4a7)
+++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/Core.Components.OxyPlot.Forms.Test.csproj (.../Core.Components.OxyPlot.Forms.Test.csproj) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -59,7 +59,7 @@
-
+
@@ -79,6 +79,10 @@
{D749EE4C-CE50-4C17-BF01-9A953028C126}Core.Common.TestUtil
+
+ {2465cca1-c505-4827-9454-4fd5fd9194cd}
+ Core.Components.Charting.Forms
+ {516EBC95-B8F2-428C-B7F6-733F01BF8FDD}Core.Components.Charting
Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs
===================================================================
diff -u -rd4aa34af2a210f8c40a469601be17e038791dd2b -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs (.../LinearPlotViewTest.cs) (revision d4aa34af2a210f8c40a469601be17e038791dd2b)
+++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs (.../LinearPlotViewTest.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -25,7 +25,7 @@
var axes = view.Model.Axes;
Assert.AreEqual(2, axes.Count);
CollectionAssert.AllItemsAreInstancesOfType(axes, typeof(LinearAxis));
- CollectionAssert.AreEqual(new [] {Resources.BaseChart_XAxisTitle, Resources.BaseChart_YAxisTitle} , axes.Select(a => a.Title));
+ CollectionAssert.AreEqual(new [] {Resources.ChartControl_XAxisTitle, Resources.ChartControl_YAxisTitle} , axes.Select(a => a.Title));
CollectionAssert.AreEqual(new [] {AxisPosition.Bottom, AxisPosition.Left} , axes.Select(a => a.Position));
CollectionAssert.AreEqual(new [] {TickStyle.None, TickStyle.None} , axes.Select(a => a.TickStyle));
CollectionAssert.AreEqual(new [] {new[] { 0.0 }, new[] { 0.0 }} , axes.Select(a => a.ExtraGridlines));
Index: Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs
===================================================================
diff -u -r86e717a5477d55d1c4351f2857a1d76e220a3ab4 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs (.../MapDataView.cs) (revision 86e717a5477d55d1c4351f2857a1d76e220a3ab4)
+++ Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs (.../MapDataView.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -21,7 +21,6 @@
using System.Windows.Forms;
using Core.Components.DotSpatial.Forms;
-using Core.Components.Gis;
using Core.Components.Gis.Data;
using Core.Components.Gis.Forms;
@@ -32,19 +31,19 @@
///
public partial class MapDataView : UserControl, IMapView
{
- private readonly BaseMap baseMap;
+ private readonly MapControl mapControl;
private MapData data;
///
/// Creates a new instance of .
///
public MapDataView()
{
- baseMap = new BaseMap
+ mapControl = new MapControl
{
Dock = DockStyle.Fill
};
- Controls.Add(baseMap);
+ Controls.Add(mapControl);
}
public object Data
@@ -64,11 +63,11 @@
}
}
- public IMap Map
+ public IMapControl Map
{
get
{
- return baseMap;
+ return mapControl;
}
}
}
Index: Core/Plugins/src/Core.Plugins.DotSpatial/Legend/MapLegendView.cs
===================================================================
diff -u -rc9f9c04e4fc62406231afd07d63cd7da11673ec6 -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f
--- Core/Plugins/src/Core.Plugins.DotSpatial/Legend/MapLegendView.cs (.../MapLegendView.cs) (revision c9f9c04e4fc62406231afd07d63cd7da11673ec6)
+++ Core/Plugins/src/Core.Plugins.DotSpatial/Legend/MapLegendView.cs (.../MapLegendView.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
@@ -33,7 +33,7 @@
namespace Core.Plugins.DotSpatial.Legend
{
///
- /// The view which shows the data that is added to a .
+ /// The view which shows the data that is added to a .
///
public sealed partial class MapLegendView : UserControl, IView
{
@@ -122,9 +122,9 @@
Text = mapDataCollection => mapDataCollection.Name,
Image = mapDataCollection => GuiResources.folder,
ChildNodeObjects = mapDataCollection => mapDataCollection.List.Reverse().Cast