diff --git a/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs b/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs index 969bf3c2..a2995c7f 100644 --- a/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs +++ b/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs b/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs index cc33c8ea..8f5ab96e 100644 --- a/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs +++ b/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs b/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs index 983860e4..7a08c5cd 100644 --- a/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs +++ b/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs b/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs index 7835e5a2..80cb7cb8 100644 --- a/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs +++ b/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/MapProjection.cs b/MapControl/MapProjection.cs index a4e9488e..82d38d2a 100644 --- a/MapControl/MapProjection.cs +++ b/MapControl/MapProjection.cs @@ -139,8 +139,10 @@ namespace MapControl { ViewportScale = GetViewportScale(zoomLevel); + var center = LocationToPoint(mapCenter); + ViewportTransform.Matrix = MatrixEx.TranslateScaleRotateTranslate( - LocationToPoint(mapCenter), ViewportScale, -ViewportScale, heading, viewportCenter); + center.X, center.Y, ViewportScale, -ViewportScale, heading, viewportCenter.X, viewportCenter.Y); } /// diff --git a/MapControl/MapTileLayer.cs b/MapControl/MapTileLayer.cs index 4368d0a2..ed2f37de 100644 --- a/MapControl/MapTileLayer.cs +++ b/MapControl/MapTileLayer.cs @@ -319,24 +319,19 @@ namespace MapControl } } - private Point GetTileCenter(double tileScale) // map center in tile index coordinates - { - return new Point( - tileScale * (0.5 + parentMap.Center.Longitude / 360d), - tileScale * (0.5 - WebMercatorProjection.LatitudeToY(parentMap.Center.Latitude) / 360d)); - } - private TileGrid GetTileGrid() { var tileZoomLevel = Math.Max(0, (int)Math.Round(parentMap.ZoomLevel + ZoomLevelOffset)); var tileScale = (1 << tileZoomLevel); var scale = tileScale / (Math.Pow(2d, parentMap.ZoomLevel) * TileSource.TileSize); - var tileCenter = GetTileCenter(tileScale); - var viewCenter = new Point(parentMap.RenderSize.Width / 2d, parentMap.RenderSize.Height / 2d); + var tileCenterX = tileScale * (0.5 + parentMap.Center.Longitude / 360d); + var tileCenterY = tileScale * (0.5 - WebMercatorProjection.LatitudeToY(parentMap.Center.Latitude) / 360d); + var viewCenterX = parentMap.RenderSize.Width / 2d; + var viewCenterY = parentMap.RenderSize.Height / 2d; var transform = new MatrixTransform { - Matrix = MatrixEx.TranslateScaleRotateTranslate(viewCenter, scale, -parentMap.Heading, tileCenter) + Matrix = MatrixEx.TranslateScaleRotateTranslate(viewCenterX, viewCenterY, scale, scale, -parentMap.Heading, tileCenterX, tileCenterY) }; var bounds = transform.TransformBounds(new Rect(0d, 0d, parentMap.RenderSize.Width, parentMap.RenderSize.Height)); @@ -350,12 +345,15 @@ namespace MapControl { var tileScale = (1 << TileGrid.ZoomLevel); var scale = Math.Pow(2d, parentMap.ZoomLevel) / tileScale; - var tileCenter = GetTileCenter(tileScale); - var tileOrigin = new Point(TileSource.TileSize * (tileCenter.X - TileGrid.XMin), TileSource.TileSize * (tileCenter.Y - TileGrid.YMin)); - var viewCenter = new Point(parentMap.RenderSize.Width / 2d, parentMap.RenderSize.Height / 2d); + var tileCenterX = tileScale * (0.5 + parentMap.Center.Longitude / 360d); + var tileCenterY = tileScale * (0.5 - WebMercatorProjection.LatitudeToY(parentMap.Center.Latitude) / 360d); + var tileOriginX = TileSource.TileSize * (tileCenterX - TileGrid.XMin); + var tileOriginY = TileSource.TileSize * (tileCenterY - TileGrid.YMin); + var viewCenterX = parentMap.RenderSize.Width / 2d; + var viewCenterY = parentMap.RenderSize.Height / 2d; - ((MatrixTransform)RenderTransform).Matrix = - MatrixEx.TranslateScaleRotateTranslate(tileOrigin, scale, parentMap.Heading, viewCenter); + ((MatrixTransform)RenderTransform).Matrix = MatrixEx.TranslateScaleRotateTranslate( + tileOriginX, tileOriginY, scale, scale, parentMap.Heading, viewCenterX, viewCenterY); } private void UpdateTiles() diff --git a/MapControl/MatrixEx.Silverlight.WinRT.cs b/MapControl/MatrixEx.Silverlight.WinRT.cs index 82fed90b..1bd346c3 100644 --- a/MapControl/MatrixEx.Silverlight.WinRT.cs +++ b/MapControl/MatrixEx.Silverlight.WinRT.cs @@ -16,27 +16,17 @@ namespace MapControl internal static class MatrixEx { /// - /// Used in MapProjection. + /// Used in MapProjection and MapTileLayer. /// public static Matrix TranslateScaleRotateTranslate( - Point translation1, double scaleX, double scaleY, double rotationAngle, Point translation2) + double translation1X, double translation1Y, + double scaleX, double scaleY, double rotationAngle, + double translation2X, double translation2Y) { - return new Matrix(1d, 0d, 0d, 1d, -translation1.X, -translation1.Y) + return new Matrix(1d, 0d, 0d, 1d, -translation1X, -translation1Y) .Scale(scaleX, scaleY) .Rotate(rotationAngle) - .Translate(translation2.X, translation2.Y); - } - - /// - /// Used in TileLayer. - /// - public static Matrix TranslateScaleRotateTranslate( - Point translation1, double scale, double rotationAngle, Point translation2) - { - return new Matrix(1d, 0d, 0d, 1d, -translation1.X, -translation1.Y) - .Scale(scale, scale) - .Rotate(rotationAngle) - .Translate(translation2.X, translation2.Y); + .Translate(translation2X, translation2Y); } private static Matrix Translate(this Matrix matrix, double offsetX, double offsetY) diff --git a/MapControl/MatrixEx.WPF.cs b/MapControl/MatrixEx.WPF.cs index 8590a55d..2fbde59a 100644 --- a/MapControl/MatrixEx.WPF.cs +++ b/MapControl/MatrixEx.WPF.cs @@ -2,7 +2,6 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using System.Windows; using System.Windows.Media; namespace MapControl @@ -13,25 +12,14 @@ namespace MapControl /// Used in MapProjection. /// public static Matrix TranslateScaleRotateTranslate( - Point translation1, double scaleX, double scaleY, double rotationAngle, Point translation2) + double translation1X, double translation1Y, + double scaleX, double scaleY, double rotationAngle, + double translation2X, double translation2Y) { - var matrix = new Matrix(1d, 0d, 0d, 1d, -translation1.X, -translation1.Y); + var matrix = new Matrix(1d, 0d, 0d, 1d, -translation1X, -translation1Y); matrix.Scale(scaleX, scaleY); matrix.Rotate(rotationAngle); - matrix.Translate(translation2.X, translation2.Y); - return matrix; - } - - /// - /// Used in MapTileLayer. - /// - public static Matrix TranslateScaleRotateTranslate( - Point translation1, double scale, double rotationAngle, Point translation2) - { - var matrix = new Matrix(1d, 0d, 0d, 1d, -translation1.X, -translation1.Y); - matrix.Scale(scale, scale); - matrix.Rotate(rotationAngle); - matrix.Translate(translation2.X, translation2.Y); + matrix.Translate(translation2X, translation2Y); return matrix; } } diff --git a/MapControl/Properties/AssemblyInfo.cs b/MapControl/Properties/AssemblyInfo.cs index c9a05a9e..09dbf19e 100644 --- a/MapControl/Properties/AssemblyInfo.cs +++ b/MapControl/Properties/AssemblyInfo.cs @@ -14,8 +14,8 @@ using System.Windows; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/WinRT/Properties/AssemblyInfo.cs b/MapControl/WinRT/Properties/AssemblyInfo.cs index 45361c9a..a4ff706a 100644 --- a/MapControl/WinRT/Properties/AssemblyInfo.cs +++ b/MapControl/WinRT/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs index d759df81..236ce48e 100644 --- a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs +++ b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs index ce8a91ec..1b342302 100644 --- a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs +++ b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs index 7bbc5358..71785d8a 100644 --- a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs +++ b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: ComVisible(false)] diff --git a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs index 2aebec42..3b80a77e 100644 --- a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs +++ b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.3.0")] -[assembly: AssemblyFileVersion("3.3.0")] +[assembly: AssemblyVersion("3.4.0")] +[assembly: AssemblyFileVersion("3.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)]