XAML-Map-Control/MapControl/Shared/MatrixFactory.cs

31 lines
985 B
C#
Raw Normal View History

2020-03-20 18:12:56 +01:00
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// <20> 2020 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
#if !WINDOWS_UWP
using System.Windows;
using System.Windows.Media;
#endif
namespace MapControl
{
public static class MatrixFactory
{
public static Matrix Create(Point translation1, double scaleX, double scaleY, double rotation, Point translation2)
{
var matrix = new Matrix(scaleX, 0d, 0d, scaleY, -scaleX * translation1.X, -scaleY * translation1.Y);
matrix.Rotate(rotation);
matrix.Translate(translation2.X, translation2.Y);
return matrix;
}
public static Matrix Create(double scale, double rotation, Point translation)
{
var matrix = new Matrix(scale, 0d, 0d, scale, 0d, 0d);
matrix.Rotate(rotation);
matrix.Translate(translation.X, translation.Y);
return matrix;
}
}
}