mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Version 1.12.1: Some cleanup and minor improvements.
This commit is contained in:
parent
4f37eaa914
commit
ed140c6d01
36 changed files with 220 additions and 194 deletions
|
|
@ -12,8 +12,8 @@ namespace MapControl
|
|||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <summary>
|
||||
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ namespace MapControl
|
|||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,9 +64,7 @@
|
|||
<Reference Include="System.Core">
|
||||
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Windows.Browser" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AnimationEx.Silverlight.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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -27,5 +27,10 @@ namespace MapControl
|
|||
{
|
||||
return new MapItem();
|
||||
}
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item)
|
||||
{
|
||||
return item is MapItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ namespace MapControl
|
|||
return new MapItem();
|
||||
}
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item)
|
||||
{
|
||||
return item is MapItem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ namespace MapControl
|
|||
/// </summary>
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@ namespace MapControl
|
|||
|
||||
internal void BeginGetTiles(TileLayer tileLayer, IEnumerable<Tile> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,8 +41,9 @@ namespace MapControl
|
|||
|
||||
private readonly MatrixTransform transform = new MatrixTransform();
|
||||
private readonly TileImageLoader tileImageLoader = new TileImageLoader();
|
||||
private List<Tile> tiles = new List<Tile>();
|
||||
private string description = string.Empty;
|
||||
private TileSource tileSource;
|
||||
private List<Tile> tiles = new List<Tile>();
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
||||
<TargetFrameworkVersion />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue