2012-11-22 21:42:29 +01:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2013-01-17 18:48:38 +01:00
|
|
|
|
// Copyright © 2013 Clemens Fischer
|
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;
|
|
|
|
|
|
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
|
|
|
|
|
|
private const FillBehavior AnimationFillBehavior = FillBehavior.HoldEnd;
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register(
|
|
|
|
|
|
"Foreground", typeof(Brush), typeof(MapBase), null);
|
|
|
|
|
|
|
|
|
|
|
|
partial void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|