2012-11-22 21:42:29 +01:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2013-05-07 18:12:25 +02:00
|
|
|
|
// Copyright © Clemens Fischer 2012-2013
|
2012-11-22 21:42:29 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2012-12-09 22:18:31 +01:00
|
|
|
|
#if NETFX_CORE
|
2012-11-22 21:42:29 +01:00
|
|
|
|
using Windows.Foundation;
|
2013-04-21 23:56:08 +02:00
|
|
|
|
using Windows.UI;
|
2012-11-22 21:42:29 +01:00
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
|
using Windows.UI.Xaml.Media;
|
|
|
|
|
|
using Windows.UI.Xaml.Media.Animation;
|
|
|
|
|
|
#else
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
using System.Windows.Media.Animation;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class MapBase
|
|
|
|
|
|
{
|
|
|
|
|
|
// Set FillBehavior.HoldEnd to prevent animation from returning
|
|
|
|
|
|
// to local value before invoking the Completed handler
|
2013-06-19 18:57:54 +02:00
|
|
|
|
private const FillBehavior AnimationFillBehavior = FillBehavior.HoldEnd;
|
2012-11-22 21:42:29 +01:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register(
|
2013-04-12 19:59:16 +02:00
|
|
|
|
"Foreground", typeof(Brush), typeof(MapBase), new PropertyMetadata(new SolidColorBrush(Colors.Black)));
|
2012-11-22 21:42:29 +01:00
|
|
|
|
|
|
|
|
|
|
partial void Initialize()
|
|
|
|
|
|
{
|
2013-05-13 23:49:48 +02:00
|
|
|
|
Background = new SolidColorBrush(Colors.Transparent);
|
2012-11-22 21:42:29 +01:00
|
|
|
|
Clip = new RectangleGeometry();
|
|
|
|
|
|
Children.Add(tileContainer);
|
|
|
|
|
|
|
|
|
|
|
|
SizeChanged += OnRenderSizeChanged;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnRenderSizeChanged(object sender, SizeChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
((RectangleGeometry)Clip).Rect = new Rect(0d, 0d, RenderSize.Width, RenderSize.Height);
|
|
|
|
|
|
ResetTransformOrigin();
|
|
|
|
|
|
UpdateTransform();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void SetTransformMatrixes(double scale)
|
|
|
|
|
|
{
|
|
|
|
|
|
scaleTransform.Matrix = new Matrix(scale, 0d, 0d, scale, 0d, 0d);
|
|
|
|
|
|
rotateTransform.Matrix = Matrix.Identity.Rotate(Heading);
|
|
|
|
|
|
scaleRotateTransform.Matrix = scaleTransform.Matrix.Multiply(rotateTransform.Matrix);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|