XAML-Map-Control/MapControl/MapBase.Silverlight.WinRT.cs

52 lines
1.7 KiB
C#
Raw Normal View History

// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © Clemens Fischer 2012-2013
// Licensed under the Microsoft Public License (Ms-PL)
#if NETFX_CORE
using Windows.Foundation;
using Windows.UI;
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), new PropertyMetadata(new SolidColorBrush(Colors.Black)));
partial void Initialize()
{
Background = new SolidColorBrush(Colors.Transparent);
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);
}
}
}