diff --git a/Caching/FileDbCache/Properties/AssemblyInfo.cs b/Caching/FileDbCache/Properties/AssemblyInfo.cs
index e81e01a7..402ea30f 100644
--- a/Caching/FileDbCache/Properties/AssemblyInfo.cs
+++ b/Caching/FileDbCache/Properties/AssemblyInfo.cs
@@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("1.12.0")]
-[assembly: AssemblyFileVersion("1.12.0")]
+[assembly: AssemblyVersion("1.12.1")]
+[assembly: AssemblyFileVersion("1.12.1")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/Caching/ImageFileCache/Properties/AssemblyInfo.cs b/Caching/ImageFileCache/Properties/AssemblyInfo.cs
index 9991b02f..ce0663f6 100644
--- a/Caching/ImageFileCache/Properties/AssemblyInfo.cs
+++ b/Caching/ImageFileCache/Properties/AssemblyInfo.cs
@@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("1.12.0")]
-[assembly: AssemblyFileVersion("1.12.0")]
+[assembly: AssemblyVersion("1.12.1")]
+[assembly: AssemblyFileVersion("1.12.1")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/MapControl.sln b/MapControl.sln
index abec6eea..af9fb9bf 100644
--- a/MapControl.sln
+++ b/MapControl.sln
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
+# Visual Studio 2013
+VisualStudioVersion = 12.0.30501.0
+MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache", "Caching\FileDbCache\FileDbCache.csproj", "{EF44F661-B98A-4676-927F-85D138F82300}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageFileCache", "Caching\ImageFileCache\ImageFileCache.csproj", "{86470440-FEE2-4120-AF5A-3762FB9C536F}"
diff --git a/MapControl/Map.Silverlight.cs b/MapControl/Map.Silverlight.cs
index ffabcefa..2d0dc797 100644
--- a/MapControl/Map.Silverlight.cs
+++ b/MapControl/Map.Silverlight.cs
@@ -12,8 +12,8 @@ namespace MapControl
///
public class Map : MapBase
{
- public static readonly DependencyProperty MouseWheelZoomChangeProperty = DependencyProperty.Register(
- "MouseWheelZoomChange", typeof(double), typeof(Map), new PropertyMetadata(1d));
+ public static readonly DependencyProperty MouseWheelZoomDeltaProperty = DependencyProperty.Register(
+ "MouseWheelZoomDelta", typeof(double), typeof(Map), new PropertyMetadata(1d));
private Point? mousePosition;
@@ -28,15 +28,15 @@ namespace MapControl
///
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
///
- public double MouseWheelZoomChange
+ public double MouseWheelZoomDelta
{
- get { return (double)GetValue(MouseWheelZoomChangeProperty); }
- set { SetValue(MouseWheelZoomChangeProperty, value); }
+ get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
+ set { SetValue(MouseWheelZoomDeltaProperty, value); }
}
private void OnMouseWheel(object sender, MouseWheelEventArgs e)
{
- var zoomChange = MouseWheelZoomChange * (double)e.Delta / 120d;
+ var zoomChange = MouseWheelZoomDelta * (double)e.Delta / 120d;
ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomChange);
}
diff --git a/MapControl/Map.WPF.cs b/MapControl/Map.WPF.cs
index 7538eac3..d111b249 100644
--- a/MapControl/Map.WPF.cs
+++ b/MapControl/Map.WPF.cs
@@ -15,8 +15,8 @@ namespace MapControl
public static readonly DependencyProperty ManipulationModeProperty = DependencyProperty.Register(
"ManipulationMode", typeof(ManipulationModes), typeof(Map), new PropertyMetadata(ManipulationModes.All));
- public static readonly DependencyProperty MouseWheelZoomChangeProperty = DependencyProperty.Register(
- "MouseWheelZoomChange", typeof(double), typeof(Map), new PropertyMetadata(1d));
+ public static readonly DependencyProperty MouseWheelZoomDeltaProperty = DependencyProperty.Register(
+ "MouseWheelZoomDelta", typeof(double), typeof(Map), new PropertyMetadata(1d));
private Point? mousePosition;
@@ -37,18 +37,18 @@ namespace MapControl
///
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
///
- public double MouseWheelZoomChange
+ public double MouseWheelZoomDelta
{
- get { return (double)GetValue(MouseWheelZoomChangeProperty); }
- set { SetValue(MouseWheelZoomChangeProperty, value); }
+ get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
+ set { SetValue(MouseWheelZoomDeltaProperty, value); }
}
protected override void OnMouseWheel(MouseWheelEventArgs e)
{
base.OnMouseWheel(e);
- var zoomChange = MouseWheelZoomChange * (double)e.Delta / 120d;
- ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomChange);
+ var zoomDelta = MouseWheelZoomDelta * (double)e.Delta / 120d;
+ ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomDelta);
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
@@ -79,7 +79,7 @@ namespace MapControl
if (mousePosition.HasValue)
{
var position = e.GetPosition(this);
- TranslateMap((Point)(position - mousePosition));
+ TranslateMap((Point)(position - mousePosition.Value));
mousePosition = position;
}
}
diff --git a/MapControl/Map.WinRT.cs b/MapControl/Map.WinRT.cs
index 2d00341f..e0f93aa5 100644
--- a/MapControl/Map.WinRT.cs
+++ b/MapControl/Map.WinRT.cs
@@ -14,8 +14,8 @@ namespace MapControl
///
public class Map : MapBase
{
- public static readonly DependencyProperty MouseWheelZoomChangeProperty = DependencyProperty.Register(
- "MouseWheelZoomChange", typeof(double), typeof(Map), new PropertyMetadata(1d));
+ public static readonly DependencyProperty MouseWheelZoomDeltaProperty = DependencyProperty.Register(
+ "MouseWheelZoomDelta", typeof(double), typeof(Map), new PropertyMetadata(1d));
private Point? mousePosition;
@@ -36,16 +36,16 @@ namespace MapControl
///
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
///
- public double MouseWheelZoomChange
+ public double MouseWheelZoomDelta
{
- get { return (double)GetValue(MouseWheelZoomChangeProperty); }
- set { SetValue(MouseWheelZoomChangeProperty, value); }
+ get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
+ set { SetValue(MouseWheelZoomDeltaProperty, value); }
}
private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
{
var point = e.GetCurrentPoint(this);
- var zoomChange = MouseWheelZoomChange * (double)point.Properties.MouseWheelDelta / 120d;
+ var zoomChange = MouseWheelZoomDelta * (double)point.Properties.MouseWheelDelta / 120d;
ZoomMap(point.Position, TargetZoomLevel + zoomChange);
}
diff --git a/MapControl/MapBase.Silverlight.WinRT.cs b/MapControl/MapBase.Silverlight.WinRT.cs
index 5d6b88f7..0877bb12 100644
--- a/MapControl/MapBase.Silverlight.WinRT.cs
+++ b/MapControl/MapBase.Silverlight.WinRT.cs
@@ -54,7 +54,7 @@ namespace MapControl
private void OnRenderSizeChanged(object sender, SizeChangedEventArgs e)
{
- ((RectangleGeometry)Clip).Rect = new Rect(0d, 0d, RenderSize.Width, RenderSize.Height);
+ ((RectangleGeometry)Clip).Rect = new Rect(new Point(), e.NewSize);
ResetTransformOrigin();
UpdateTransform();
}
diff --git a/MapControl/MapBase.cs b/MapControl/MapBase.cs
index 6f6a07d8..dd65cbe7 100644
--- a/MapControl/MapBase.cs
+++ b/MapControl/MapBase.cs
@@ -381,8 +381,8 @@ namespace MapControl
{
var p1 = MapTransform.Transform(southWest);
var p2 = MapTransform.Transform(northEast);
- var lonScale = ActualWidth / (p2.X - p1.X) * 360d / TileSource.TileSize;
- var latScale = ActualHeight / (p2.Y - p1.Y) * 360d / TileSource.TileSize;
+ var lonScale = RenderSize.Width / (p2.X - p1.X) * 360d / TileSource.TileSize;
+ var latScale = RenderSize.Height / (p2.Y - p1.Y) * 360d / TileSource.TileSize;
var lonZoom = Math.Log(lonScale, 2d);
var latZoom = Math.Log(latScale, 2d);
diff --git a/MapControl/MapControl.Silverlight.csproj b/MapControl/MapControl.Silverlight.csproj
index 401338c1..23e1528e 100644
--- a/MapControl/MapControl.Silverlight.csproj
+++ b/MapControl/MapControl.Silverlight.csproj
@@ -64,9 +64,7 @@
$(TargetFrameworkDirectory)System.Core.dll
-
-
diff --git a/MapControl/MapGraticule.Silverlight.WinRT.cs b/MapControl/MapGraticule.Silverlight.WinRT.cs
index 747a2aa3..546c5933 100644
--- a/MapControl/MapGraticule.Silverlight.WinRT.cs
+++ b/MapControl/MapGraticule.Silverlight.WinRT.cs
@@ -150,7 +150,7 @@ namespace MapControl
}
var geometry = (PathGeometry)path.Data;
- var bounds = ParentMap.ViewportTransform.Inverse.TransformBounds(new Rect(0d, 0d, ParentMap.RenderSize.Width, ParentMap.RenderSize.Height));
+ var bounds = ParentMap.ViewportTransform.Inverse.TransformBounds(new Rect(new Point(), ParentMap.RenderSize));
var start = ParentMap.MapTransform.Transform(new Point(bounds.X, bounds.Y));
var end = ParentMap.MapTransform.Transform(new Point(bounds.X + bounds.Width, bounds.Y + bounds.Height));
var minSpacing = MinLineSpacing * 360d / (Math.Pow(2d, ParentMap.ZoomLevel) * 256d);
diff --git a/MapControl/MapImageLayer.cs b/MapControl/MapImageLayer.cs
index b79c5394..9aa5bc97 100644
--- a/MapControl/MapImageLayer.cs
+++ b/MapControl/MapImageLayer.cs
@@ -40,7 +40,7 @@ namespace MapControl
Children.Add(new MapImage { Opacity = 0d });
updateTimer.Interval = TileContainer.UpdateInterval;
- updateTimer.Tick += (o, e) => UpdateImage();
+ updateTimer.Tick += (s, e) => UpdateImage();
}
///
@@ -119,15 +119,15 @@ namespace MapControl
{
updateTimer.Stop();
- if (ParentMap != null && ActualWidth > 0 && ActualHeight > 0)
+ if (ParentMap != null && RenderSize.Width > 0 && RenderSize.Height > 0)
{
updateInProgress = true;
var relativeSize = Math.Max(RelativeImageSize, 1d);
- var width = ActualWidth * relativeSize;
- var height = ActualHeight * relativeSize;
- var dx = (ActualWidth - width) / 2d;
- var dy = (ActualHeight - height) / 2d;
+ var width = RenderSize.Width * relativeSize;
+ var height = RenderSize.Height * relativeSize;
+ var dx = (RenderSize.Width - width) / 2d;
+ var dy = (RenderSize.Height - height) / 2d;
var loc1 = ParentMap.ViewportPointToLocation(new Point(dx, dy));
var loc2 = ParentMap.ViewportPointToLocation(new Point(dx + width, dy));
diff --git a/MapControl/MapItemsControl.Silverlight.WinRT.cs b/MapControl/MapItemsControl.Silverlight.WinRT.cs
index 3ac9704f..1787444c 100644
--- a/MapControl/MapItemsControl.Silverlight.WinRT.cs
+++ b/MapControl/MapItemsControl.Silverlight.WinRT.cs
@@ -27,5 +27,10 @@ namespace MapControl
{
return new MapItem();
}
+
+ protected override bool IsItemItsOwnContainerOverride(object item)
+ {
+ return item is MapItem;
+ }
}
}
diff --git a/MapControl/MapItemsControl.WPF.cs b/MapControl/MapItemsControl.WPF.cs
index 20d8f10e..af165538 100644
--- a/MapControl/MapItemsControl.WPF.cs
+++ b/MapControl/MapItemsControl.WPF.cs
@@ -38,6 +38,11 @@ namespace MapControl
return new MapItem();
}
+ protected override bool IsItemItsOwnContainerOverride(object item)
+ {
+ return item is MapItem;
+ }
+
///
/// Gets or sets a Geometry that selects all items inside its fill area, i.e.
/// where Geometry.FillContains returns true for the item's viewport position.
diff --git a/MapControl/MapPanel.Silverlight.WinRT.cs b/MapControl/MapPanel.Silverlight.WinRT.cs
index eb1921e6..c7bf1e30 100644
--- a/MapControl/MapPanel.Silverlight.WinRT.cs
+++ b/MapControl/MapPanel.Silverlight.WinRT.cs
@@ -39,8 +39,8 @@ namespace MapControl
///
public static void AddParentMapHandlers(FrameworkElement element)
{
- element.Loaded += (o, e) => GetParentMap(element);
- element.Unloaded += (o, e) => element.ClearValue(ParentMapProperty);
+ element.Loaded += (s, e) => GetParentMap(element);
+ element.Unloaded += (s, e) => element.ClearValue(ParentMapProperty);
}
public static MapBase GetParentMap(UIElement element)
diff --git a/MapControl/MapPanel.cs b/MapControl/MapPanel.cs
index 2c709f11..94193a69 100644
--- a/MapControl/MapPanel.cs
+++ b/MapControl/MapPanel.cs
@@ -89,12 +89,15 @@ namespace MapControl
{
var location = GetLocation(element);
- ArrangeElement(element, finalSize, location != null);
-
if (location != null)
{
+ ArrangeElementWithLocation(element);
SetViewportPosition(element, parentMap, location);
}
+ else
+ {
+ ArrangeElementWithoutLocation(element, finalSize);
+ }
}
return finalSize;
@@ -138,9 +141,14 @@ namespace MapControl
var parentMap = mapElement != null ? mapElement.ParentMap : GetParentMap(element);
var location = e.NewValue as Location;
- if ((location != null) != (e.OldValue != null))
+ if (location == null)
{
- ArrangeElement(element, null, location != null);
+ ArrangeElementWithoutLocation(element, Size.Empty);
+ }
+ else if (e.OldValue == null)
+ {
+ // Arrange element once when Location was null before
+ ArrangeElementWithLocation(element);
}
SetViewportPosition(element, parentMap, location);
@@ -153,7 +161,7 @@ namespace MapControl
if (parentMap != null && location != null)
{
- // keep viewport position near map center
+ // Keep ViewportPosition near map center
var mapPosition = parentMap.MapTransform.Transform(location, parentMap.Center.Longitude);
viewportPosition = parentMap.ViewportTransform.Transform(mapPosition);
element.SetValue(ViewportPositionProperty, viewportPosition);
@@ -194,87 +202,92 @@ namespace MapControl
translateTransform.Y = viewportPosition.Y;
}
- private static void ArrangeElement(UIElement element, Size? panelSize, bool hasLocation)
+ private static void ArrangeElementWithLocation(UIElement element)
{
var rect = new Rect(0d, 0d, element.DesiredSize.Width, element.DesiredSize.Height);
var frameworkElement = element as FrameworkElement;
if (frameworkElement != null)
{
- if (hasLocation)
+ switch (frameworkElement.HorizontalAlignment)
{
- switch (frameworkElement.HorizontalAlignment)
- {
- case HorizontalAlignment.Center:
- rect.X = -rect.Width / 2d;
- break;
+ case HorizontalAlignment.Center:
+ rect.X = -rect.Width / 2d;
+ break;
- case HorizontalAlignment.Right:
- rect.X = -rect.Width;
- break;
+ case HorizontalAlignment.Right:
+ rect.X = -rect.Width;
+ break;
- default:
- break;
- }
-
- switch (frameworkElement.VerticalAlignment)
- {
- case VerticalAlignment.Center:
- rect.Y = -rect.Height / 2d;
- break;
-
- case VerticalAlignment.Bottom:
- rect.Y = -rect.Height;
- break;
-
- default:
- break;
- }
+ default:
+ break;
}
- else if (frameworkElement.HorizontalAlignment != HorizontalAlignment.Left ||
- frameworkElement.VerticalAlignment != VerticalAlignment.Top)
+
+ switch (frameworkElement.VerticalAlignment)
{
- if (!panelSize.HasValue)
- {
- var panel = frameworkElement.Parent as Panel;
- panelSize = panel != null ? panel.RenderSize : new Size();
- }
+ case VerticalAlignment.Center:
+ rect.Y = -rect.Height / 2d;
+ break;
- switch (frameworkElement.HorizontalAlignment)
- {
- case HorizontalAlignment.Center:
- rect.X = (panelSize.Value.Width - rect.Width) / 2d;
- break;
+ case VerticalAlignment.Bottom:
+ rect.Y = -rect.Height;
+ break;
- case HorizontalAlignment.Right:
- rect.X = panelSize.Value.Width - rect.Width;
- break;
+ default:
+ break;
+ }
+ }
- case HorizontalAlignment.Stretch:
- rect.Width = panelSize.Value.Width;
- break;
+ element.Arrange(rect);
+ }
- default:
- break;
- }
+ private static void ArrangeElementWithoutLocation(UIElement element, Size parentSize)
+ {
+ var rect = new Rect(0d, 0d, element.DesiredSize.Width, element.DesiredSize.Height);
+ var frameworkElement = element as FrameworkElement;
- switch (frameworkElement.VerticalAlignment)
- {
- case VerticalAlignment.Center:
- rect.Y = (panelSize.Value.Height - rect.Height) / 2d;
- break;
+ if (frameworkElement != null)
+ {
+ if (parentSize.IsEmpty)
+ {
+ var parent = frameworkElement.Parent as UIElement;
+ parentSize = parent != null ? parent.RenderSize : new Size();
+ }
- case VerticalAlignment.Bottom:
- rect.Y = panelSize.Value.Height - rect.Height;
- break;
+ switch (frameworkElement.HorizontalAlignment)
+ {
+ case HorizontalAlignment.Center:
+ rect.X = (parentSize.Width - rect.Width) / 2d;
+ break;
- case VerticalAlignment.Stretch:
- rect.Height = panelSize.Value.Height;
- break;
+ case HorizontalAlignment.Right:
+ rect.X = parentSize.Width - rect.Width;
+ break;
- default:
- break;
- }
+ case HorizontalAlignment.Stretch:
+ rect.Width = parentSize.Width;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (frameworkElement.VerticalAlignment)
+ {
+ case VerticalAlignment.Center:
+ rect.Y = (parentSize.Height - rect.Height) / 2d;
+ break;
+
+ case VerticalAlignment.Bottom:
+ rect.Y = parentSize.Height - rect.Height;
+ break;
+
+ case VerticalAlignment.Stretch:
+ rect.Height = parentSize.Height;
+ break;
+
+ default:
+ break;
}
}
diff --git a/MapControl/Properties/AssemblyInfo.cs b/MapControl/Properties/AssemblyInfo.cs
index 4cde0355..ada7175a 100644
--- a/MapControl/Properties/AssemblyInfo.cs
+++ b/MapControl/Properties/AssemblyInfo.cs
@@ -3,10 +3,10 @@ using System.Runtime.InteropServices;
using System.Windows;
#if SILVERLIGHT
-[assembly: AssemblyTitle("Silverlight Map Control")]
+[assembly: AssemblyTitle("XAML Map Control (Silverlight)")]
[assembly: AssemblyDescription("XAML Map Control Library for Silverlight")]
#else
-[assembly: AssemblyTitle("WPF Map Control")]
+[assembly: AssemblyTitle("XAML Map Control (WPF)")]
[assembly: AssemblyDescription("XAML Map Control Library for WPF")]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
#endif
@@ -15,8 +15,8 @@ using System.Windows;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("1.12.0")]
-[assembly: AssemblyFileVersion("1.12.0")]
+[assembly: AssemblyVersion("1.12.1")]
+[assembly: AssemblyFileVersion("1.12.1")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/MapControl/TileImageLoader.WPF.cs b/MapControl/TileImageLoader.WPF.cs
index 104cb46d..71d50119 100644
--- a/MapControl/TileImageLoader.WPF.cs
+++ b/MapControl/TileImageLoader.WPF.cs
@@ -66,7 +66,9 @@ namespace MapControl
internal void BeginGetTiles(TileLayer tileLayer, IEnumerable tiles)
{
- if (tiles.Any())
+ var tileList = tiles.ToList();
+
+ if (tileList.Count > 0)
{
// get current TileLayer property values in UI thread
var dispatcher = tileLayer.Dispatcher;
@@ -76,7 +78,7 @@ namespace MapControl
var animateOpacity = tileLayer.AnimateTileOpacity;
ThreadPool.QueueUserWorkItem(o =>
- GetTiles(tiles.ToList(), dispatcher, tileSource, sourceName, maxDownloads, animateOpacity));
+ GetTiles(tileList, dispatcher, tileSource, sourceName, maxDownloads, animateOpacity));
}
}
diff --git a/MapControl/TileLayer.Silverlight.WinRT.cs b/MapControl/TileLayer.Silverlight.WinRT.cs
index f0e33c49..154ee159 100644
--- a/MapControl/TileLayer.Silverlight.WinRT.cs
+++ b/MapControl/TileLayer.Silverlight.WinRT.cs
@@ -19,14 +19,15 @@ namespace MapControl
RenderTransform = transform;
}
- protected Panel TileContainer
+ private Panel TileContainer
{
get { return Parent as Panel; }
}
- protected void RenderTiles()
+ private void RenderTiles()
{
Children.Clear();
+
foreach (var tile in tiles)
{
Children.Add(tile.Image);
diff --git a/MapControl/TileLayer.WPF.cs b/MapControl/TileLayer.WPF.cs
index 6426e19f..cc27909c 100644
--- a/MapControl/TileLayer.WPF.cs
+++ b/MapControl/TileLayer.WPF.cs
@@ -17,12 +17,12 @@ namespace MapControl
public Brush Background { get; set; }
- protected ContainerVisual TileContainer
+ private ContainerVisual TileContainer
{
get { return Parent as ContainerVisual; }
}
- protected void RenderTiles()
+ private void RenderTiles()
{
using (var drawingContext = RenderOpen())
{
diff --git a/MapControl/TileLayer.cs b/MapControl/TileLayer.cs
index fe59f271..e393a18d 100644
--- a/MapControl/TileLayer.cs
+++ b/MapControl/TileLayer.cs
@@ -41,8 +41,9 @@ namespace MapControl
private readonly MatrixTransform transform = new MatrixTransform();
private readonly TileImageLoader tileImageLoader = new TileImageLoader();
- private List tiles = new List();
private string description = string.Empty;
+ private TileSource tileSource;
+ private List tiles = new List();
private Int32Rect grid;
private int zoomLevel;
@@ -59,7 +60,6 @@ namespace MapControl
partial void Initialize();
public string SourceName { get; set; }
- public TileSource TileSource { get; set; }
public int MinZoomLevel { get; set; }
public int MaxZoomLevel { get; set; }
public int MaxParallelDownloads { get; set; }
@@ -73,10 +73,36 @@ namespace MapControl
set { description = value.Replace("{y}", DateTime.Now.Year.ToString()); }
}
+ public TileSource TileSource
+ {
+ get { return tileSource; }
+ set
+ {
+ tileSource = value;
+
+ if (grid.Width > 0 && grid.Height > 0)
+ {
+ tileImageLoader.CancelGetTiles();
+ tiles.Clear();
+
+ if (tileSource != null)
+ {
+ SelectTiles();
+ RenderTiles();
+ tileImageLoader.BeginGetTiles(this, tiles.Where(t => !t.HasImageSource));
+ }
+ else
+ {
+ RenderTiles();
+ }
+ }
+ }
+ }
+
public string TileSourceUriFormat
{
- get { return TileSource != null ? TileSource.UriFormat : string.Empty; }
- set { TileSource = new TileSource(value); }
+ get { return tileSource != null ? tileSource.UriFormat : string.Empty; }
+ set { TileSource = !string.IsNullOrWhiteSpace(value) ? new TileSource(value) : null; }
}
internal void SetTransformMatrix(Matrix transformMatrix)
@@ -84,14 +110,14 @@ namespace MapControl
transform.Matrix = transformMatrix;
}
- protected internal virtual void UpdateTiles(int zoomLevel, Int32Rect grid)
+ internal void UpdateTiles(int zoomLevel, Int32Rect grid)
{
this.grid = grid;
this.zoomLevel = zoomLevel;
tileImageLoader.CancelGetTiles();
- if (TileSource != null)
+ if (tileSource != null)
{
SelectTiles();
RenderTiles();
@@ -99,14 +125,14 @@ namespace MapControl
}
}
- protected internal virtual void ClearTiles()
+ internal void ClearTiles()
{
tileImageLoader.CancelGetTiles();
tiles.Clear();
RenderTiles();
}
- protected void SelectTiles()
+ private void SelectTiles()
{
var maxZoomLevel = Math.Min(zoomLevel, MaxZoomLevel);
var minZoomLevel = maxZoomLevel;
diff --git a/MapControl/WinRT/MapControl.WinRT.csproj b/MapControl/WinRT/MapControl.WinRT.csproj
index cd2ebb61..af7c1cfd 100644
--- a/MapControl/WinRT/MapControl.WinRT.csproj
+++ b/MapControl/WinRT/MapControl.WinRT.csproj
@@ -14,9 +14,9 @@
en-US
512
{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 12.0
+ Windows
8.1
- 12
-
true
diff --git a/MapControl/WinRT/Properties/AssemblyInfo.cs b/MapControl/WinRT/Properties/AssemblyInfo.cs
index da6d02d7..e6822839 100644
--- a/MapControl/WinRT/Properties/AssemblyInfo.cs
+++ b/MapControl/WinRT/Properties/AssemblyInfo.cs
@@ -1,15 +1,15 @@
using System.Reflection;
using System.Runtime.InteropServices;
-[assembly: AssemblyTitle("WinRT Map Control")]
+[assembly: AssemblyTitle("XAML Map Control (WinRT)")]
[assembly: AssemblyDescription("XAML Map Control Library for Windows Runtime")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("1.12.0")]
-[assembly: AssemblyFileVersion("1.12.0")]
+[assembly: AssemblyVersion("1.12.1")]
+[assembly: AssemblyFileVersion("1.12.1")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/Common/ViewModel.cs b/SampleApps/Common/ViewModel.cs
index 5b18d00d..ea11efd5 100644
--- a/SampleApps/Common/ViewModel.cs
+++ b/SampleApps/Common/ViewModel.cs
@@ -173,7 +173,7 @@ namespace ViewModel
Interval = TimeSpan.FromSeconds(0.1)
};
- timer.Tick += (sender, e) =>
+ timer.Tick += (s, e) =>
{
var p = Points.Last();
p.Location = new Location(p.Location.Latitude + 0.001, p.Location.Longitude + 0.002);
@@ -181,7 +181,7 @@ namespace ViewModel
if (p.Location.Latitude > 54d)
{
p.Name = "Stopped";
- ((DispatcherTimer)sender).Stop();
+ ((DispatcherTimer)s).Stop();
}
};
diff --git a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
index e941c3ff..585f0146 100644
--- a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
+++ b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
@@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("1.12.0")]
-[assembly: AssemblyFileVersion("1.12.0")]
+[assembly: AssemblyVersion("1.12.1")]
+[assembly: AssemblyFileVersion("1.12.1")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/SilverlightApplication/MainPage.xaml b/SampleApps/SilverlightApplication/MainPage.xaml
index 734127a4..dec6834b 100644
--- a/SampleApps/SilverlightApplication/MainPage.xaml
+++ b/SampleApps/SilverlightApplication/MainPage.xaml
@@ -38,8 +38,6 @@