mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 1.11.0: Fixed file URIs in TileImageLoader and MeasureOverride in MapPanel. Made properties Center, TargetCenter, ZoomLevel, TargetZoomLevel, Heading and TargetHeading bind two-way by default in WPF version.
This commit is contained in:
parent
dec591cf7a
commit
e733e98443
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,30 @@ namespace MapControl
|
|||
public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register(
|
||||
"Foreground", typeof(Brush), typeof(MapBase), new PropertyMetadata(new SolidColorBrush(Colors.Black)));
|
||||
|
||||
public static readonly DependencyProperty CenterProperty = DependencyProperty.Register(
|
||||
"Center", typeof(Location), typeof(MapBase), new PropertyMetadata(new Location(),
|
||||
(o, e) => ((MapBase)o).CenterPropertyChanged((Location)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetCenterProperty = DependencyProperty.Register(
|
||||
"TargetCenter", typeof(Location), typeof(MapBase), new PropertyMetadata(new Location(),
|
||||
(o, e) => ((MapBase)o).TargetCenterPropertyChanged((Location)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty ZoomLevelProperty = DependencyProperty.Register(
|
||||
"ZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
|
||||
(o, e) => ((MapBase)o).ZoomLevelPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetZoomLevelProperty = DependencyProperty.Register(
|
||||
"TargetZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
|
||||
(o, e) => ((MapBase)o).TargetZoomLevelPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty HeadingProperty = DependencyProperty.Register(
|
||||
"Heading", typeof(double), typeof(MapBase), new PropertyMetadata(0d,
|
||||
(o, e) => ((MapBase)o).HeadingPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetHeadingProperty = DependencyProperty.Register(
|
||||
"TargetHeading", typeof(double), typeof(MapBase), new PropertyMetadata(0d,
|
||||
(o, e) => ((MapBase)o).TargetHeadingPropertyChanged((double)e.NewValue)));
|
||||
|
||||
partial void Initialize()
|
||||
{
|
||||
Background = new SolidColorBrush(Colors.Transparent);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,36 @@ namespace MapControl
|
|||
public static readonly DependencyProperty ForegroundProperty =
|
||||
System.Windows.Controls.Control.ForegroundProperty.AddOwner(typeof(MapBase));
|
||||
|
||||
public static readonly DependencyProperty CenterProperty = DependencyProperty.Register(
|
||||
"Center", typeof(Location), typeof(MapBase), new FrameworkPropertyMetadata(
|
||||
new Location(), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
(o, e) => ((MapBase)o).CenterPropertyChanged((Location)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetCenterProperty = DependencyProperty.Register(
|
||||
"TargetCenter", typeof(Location), typeof(MapBase), new FrameworkPropertyMetadata(
|
||||
new Location(), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
(o, e) => ((MapBase)o).TargetCenterPropertyChanged((Location)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty ZoomLevelProperty = DependencyProperty.Register(
|
||||
"ZoomLevel", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(
|
||||
1d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
(o, e) => ((MapBase)o).ZoomLevelPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetZoomLevelProperty = DependencyProperty.Register(
|
||||
"TargetZoomLevel", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(
|
||||
1d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
(o, e) => ((MapBase)o).TargetZoomLevelPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty HeadingProperty = DependencyProperty.Register(
|
||||
"Heading", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(
|
||||
0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
(o, e) => ((MapBase)o).HeadingPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetHeadingProperty = DependencyProperty.Register(
|
||||
"TargetHeading", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(
|
||||
0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
(o, e) => ((MapBase)o).TargetHeadingPropertyChanged((double)e.NewValue)));
|
||||
|
||||
static MapBase()
|
||||
{
|
||||
UIElement.ClipToBoundsProperty.OverrideMetadata(
|
||||
|
|
|
|||
|
|
@ -43,18 +43,6 @@ namespace MapControl
|
|||
"TileOpacity", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
|
||||
(o, e) => ((MapBase)o).tileContainer.Opacity = (double)e.NewValue));
|
||||
|
||||
public static readonly DependencyProperty CenterProperty = DependencyProperty.Register(
|
||||
"Center", typeof(Location), typeof(MapBase), new PropertyMetadata(new Location(),
|
||||
(o, e) => ((MapBase)o).CenterPropertyChanged((Location)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetCenterProperty = DependencyProperty.Register(
|
||||
"TargetCenter", typeof(Location), typeof(MapBase), new PropertyMetadata(new Location(),
|
||||
(o, e) => ((MapBase)o).TargetCenterPropertyChanged((Location)e.NewValue)));
|
||||
|
||||
internal static readonly DependencyProperty CenterPointProperty = DependencyProperty.Register(
|
||||
"CenterPoint", typeof(Point), typeof(MapBase), new PropertyMetadata(new Point(),
|
||||
(o, e) => ((MapBase)o).CenterPointPropertyChanged((Point)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty MinZoomLevelProperty = DependencyProperty.Register(
|
||||
"MinZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
|
||||
(o, e) => ((MapBase)o).MinZoomLevelPropertyChanged((double)e.NewValue)));
|
||||
|
|
@ -63,25 +51,13 @@ namespace MapControl
|
|||
"MaxZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(18d,
|
||||
(o, e) => ((MapBase)o).MaxZoomLevelPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty ZoomLevelProperty = DependencyProperty.Register(
|
||||
"ZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
|
||||
(o, e) => ((MapBase)o).ZoomLevelPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetZoomLevelProperty = DependencyProperty.Register(
|
||||
"TargetZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
|
||||
(o, e) => ((MapBase)o).TargetZoomLevelPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty HeadingProperty = DependencyProperty.Register(
|
||||
"Heading", typeof(double), typeof(MapBase), new PropertyMetadata(0d,
|
||||
(o, e) => ((MapBase)o).HeadingPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty TargetHeadingProperty = DependencyProperty.Register(
|
||||
"TargetHeading", typeof(double), typeof(MapBase), new PropertyMetadata(0d,
|
||||
(o, e) => ((MapBase)o).TargetHeadingPropertyChanged((double)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty CenterScaleProperty = DependencyProperty.Register(
|
||||
"CenterScale", typeof(double), typeof(MapBase), null);
|
||||
|
||||
internal static readonly DependencyProperty CenterPointProperty = DependencyProperty.Register(
|
||||
"CenterPoint", typeof(Point), typeof(MapBase), new PropertyMetadata(new Point(),
|
||||
(o, e) => ((MapBase)o).CenterPointPropertyChanged((Point)e.NewValue)));
|
||||
|
||||
private readonly TileContainer tileContainer = new TileContainer();
|
||||
private readonly MapTransform mapTransform = new MercatorTransform();
|
||||
private readonly MatrixTransform scaleTransform = new MatrixTransform();
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public class MapImageLayer : MapPanel
|
||||
{
|
||||
private static readonly DependencyProperty RelativeImageSizeProperty = DependencyProperty.Register(
|
||||
public static readonly DependencyProperty RelativeImageSizeProperty = DependencyProperty.Register(
|
||||
"RelativeImageSize", typeof(double), typeof(MapImageLayer), new PropertyMetadata(1d));
|
||||
|
||||
private readonly DispatcherTimer updateTimer;
|
||||
private string uriFormat;
|
||||
private bool updateInProgress;
|
||||
private int currentImageIndex;
|
||||
private bool updateInProgress;
|
||||
|
||||
public MapImageLayer()
|
||||
{
|
||||
|
|
@ -180,7 +180,7 @@ namespace MapControl
|
|||
private void UpdateImage(double west, double east, double south, double north, ImageSource image)
|
||||
{
|
||||
var mapImage = (MapImage)Children[currentImageIndex];
|
||||
mapImage.BeginAnimation(Image.OpacityProperty,
|
||||
mapImage.BeginAnimation(UIElement.OpacityProperty,
|
||||
new DoubleAnimation
|
||||
{
|
||||
To = 0d,
|
||||
|
|
@ -197,7 +197,7 @@ namespace MapControl
|
|||
mapImage.South = south;
|
||||
mapImage.North = north;
|
||||
mapImage.Source = image;
|
||||
mapImage.BeginAnimation(Image.OpacityProperty, new DoubleAnimation(1d, Tile.AnimationDuration));
|
||||
mapImage.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(1d, Tile.AnimationDuration));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ namespace MapControl
|
|||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
|
||||
|
||||
foreach (UIElement element in InternalChildren)
|
||||
{
|
||||
element.Measure(availableSize);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ using System.Windows;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ namespace MapControl
|
|||
{
|
||||
if (uri.Scheme == "file") // create from FileStream as creating from URI leaves the file open
|
||||
{
|
||||
image = CreateImage(uri.AbsolutePath);
|
||||
image = CreateImage(uri.LocalPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -259,7 +259,7 @@ namespace MapControl
|
|||
{
|
||||
try
|
||||
{
|
||||
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
|
||||
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
image = BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.11.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue