mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
30 lines
982 B
C#
30 lines
982 B
C#
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
|
// Copyright © 2012 Clemens Fischer
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
using System.Windows.Media;
|
|
|
|
namespace MapControl
|
|
{
|
|
internal partial class TileContainer : ContainerVisual
|
|
{
|
|
private Matrix GetTransformMatrix(Matrix transform, double scale)
|
|
{
|
|
transform.Scale(scale, scale);
|
|
transform.Translate(offset.X, offset.Y);
|
|
transform.RotateAt(rotation, origin.X, origin.Y);
|
|
return transform;
|
|
}
|
|
|
|
private Matrix GetTileIndexMatrix(int numTiles)
|
|
{
|
|
var mapToTileScale = (double)numTiles / 360d;
|
|
var transform = ViewportTransform.Matrix;
|
|
transform.Invert(); // view to map coordinates
|
|
transform.Translate(180d, -180d);
|
|
transform.Scale(mapToTileScale, -mapToTileScale); // map coordinates to tile indices
|
|
return transform;
|
|
}
|
|
}
|
|
}
|