mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Version 5.1: Use C# 7
This commit is contained in:
parent
310f0cca9a
commit
7bd1d450dc
18 changed files with 42 additions and 35 deletions
|
|
@ -61,7 +61,7 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public virtual Vector GetRelativeScale(Location location)
|
||||
{
|
||||
return new Vector(1, 1);
|
||||
return new Vector(1d, 1d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace MapControl
|
|||
{
|
||||
public const int TileSize = 256;
|
||||
|
||||
public static readonly Point TileMatrixTopLeft = new Point(
|
||||
public static readonly Point MapTopLeft = new Point(
|
||||
-180d * MapProjection.Wgs84MetersPerDegree, 180d * MapProjection.Wgs84MetersPerDegree);
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -114,8 +114,8 @@ namespace MapControl
|
|||
|
||||
var tileMatrixScale = ViewTransform.ZoomLevelToScale(TileMatrix.ZoomLevel);
|
||||
|
||||
((MatrixTransform)RenderTransform).Matrix = ParentMap.ViewTransform.GetTileLayerTransform(
|
||||
tileMatrixScale, TileMatrixTopLeft, tileMatrixOrigin);
|
||||
((MatrixTransform)RenderTransform).Matrix =
|
||||
ParentMap.ViewTransform.GetTileLayerTransform(tileMatrixScale, MapTopLeft, tileMatrixOrigin);
|
||||
}
|
||||
|
||||
private bool SetTileMatrix()
|
||||
|
|
@ -126,15 +126,14 @@ namespace MapControl
|
|||
|
||||
// bounds in tile pixels from view size
|
||||
//
|
||||
var tileBounds = ParentMap.ViewTransform.GetTileMatrixBounds(
|
||||
tileMatrixScale, TileMatrixTopLeft, ParentMap.RenderSize);
|
||||
var bounds = ParentMap.ViewTransform.GetTileMatrixBounds(tileMatrixScale, MapTopLeft, ParentMap.RenderSize);
|
||||
|
||||
// tile column and row index bounds
|
||||
//
|
||||
var xMin = (int)Math.Floor(tileBounds.X / TileSize);
|
||||
var yMin = (int)Math.Floor(tileBounds.Y / TileSize);
|
||||
var xMax = (int)Math.Floor((tileBounds.X + tileBounds.Width) / TileSize);
|
||||
var yMax = (int)Math.Floor((tileBounds.Y + tileBounds.Height) / TileSize);
|
||||
var xMin = (int)Math.Floor(bounds.X / TileSize);
|
||||
var yMin = (int)Math.Floor(bounds.Y / TileSize);
|
||||
var xMax = (int)Math.Floor((bounds.X + bounds.Width) / TileSize);
|
||||
var yMax = (int)Math.Floor((bounds.Y + bounds.Height) / TileSize);
|
||||
|
||||
if (TileMatrix != null &&
|
||||
TileMatrix.ZoomLevel == tileMatrixZoomLevel &&
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public class WorldMercatorProjection : MapProjection
|
||||
{
|
||||
public static double ConvergenceTolerance = 1e-6;
|
||||
public static int MaxIterations = 10;
|
||||
public static double ConvergenceTolerance { get; set; } = 1e-6;
|
||||
public static int MaxIterations { get; set; } = 10;
|
||||
|
||||
private static readonly double maxLatitude = YToLatitude(180d);
|
||||
|
||||
|
|
@ -72,8 +72,7 @@ namespace MapControl
|
|||
|
||||
var lat = latitude * Math.PI / 180d;
|
||||
|
||||
return Math.Log(Math.Tan(lat / 2d + Math.PI / 4d)
|
||||
* ConformalFactor(lat)) * 180d / Math.PI; // p.44 (7-7)
|
||||
return Math.Log(Math.Tan(lat / 2d + Math.PI / 4d) * ConformalFactor(lat)) * 180d / Math.PI; // p.44 (7-7)
|
||||
}
|
||||
|
||||
public static double YToLatitude(double y)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue