mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Compare commits
2 commits
f63fba98c1
...
05750d669c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05750d669c | ||
|
|
65462697df |
|
|
@ -4,7 +4,7 @@ namespace MapControl
|
|||
{
|
||||
public class CenteredBoundingBox(Location center, double width, double height) : BoundingBox
|
||||
{
|
||||
public override Location Center { get; } = center;
|
||||
public override Location Center => center;
|
||||
public override double Width { get; } = Math.Max(width, 0d);
|
||||
public override double Height { get; } = Math.Max(height, 0d);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ namespace MapControl
|
|||
{
|
||||
private class Label(string latText, string lonText, double x, double y, double rotation)
|
||||
{
|
||||
public string LatitudeText { get; } = latText;
|
||||
public string LongitudeText { get; } = lonText;
|
||||
public double X { get; } = x;
|
||||
public double Y { get; } = y;
|
||||
public double Rotation { get; } = rotation;
|
||||
public string LatitudeText => latText;
|
||||
public string LongitudeText => lonText;
|
||||
public double X => x;
|
||||
public double Y => y;
|
||||
public double Rotation => rotation;
|
||||
}
|
||||
|
||||
private const double LineInterpolationResolution = 2d;
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ namespace MapControl
|
|||
{
|
||||
public abstract class Tile(int zoomLevel, int x, int y, int columnCount)
|
||||
{
|
||||
public int ZoomLevel { get; } = zoomLevel;
|
||||
public int X { get; } = x;
|
||||
public int Y { get; } = y;
|
||||
public int ZoomLevel => zoomLevel;
|
||||
public int X => x;
|
||||
public int Y => y;
|
||||
public int Row => y;
|
||||
public int Column { get; } = ((x % columnCount) + columnCount) % columnCount;
|
||||
public int Row => Y;
|
||||
|
||||
public bool IsPending { get; set; } = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
{
|
||||
public class TileMatrix(int zoomLevel, int xMin, int yMin, int xMax, int yMax)
|
||||
{
|
||||
public int ZoomLevel { get; } = zoomLevel;
|
||||
public int XMin { get; } = xMin;
|
||||
public int YMin { get; } = yMin;
|
||||
public int XMax { get; } = xMax;
|
||||
public int YMax { get; } = yMax;
|
||||
public int ZoomLevel => zoomLevel;
|
||||
public int XMin => xMin;
|
||||
public int YMin => yMin;
|
||||
public int XMax => xMax;
|
||||
public int YMax => yMax;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ namespace MapControl
|
|||
/// a MapTileLayer or a MapImageLayer should be updated immediately,
|
||||
/// or MapPath Data in projected map coordinates should be recalculated.
|
||||
/// </summary>
|
||||
public bool ProjectionChanged { get; } = projectionChanged;
|
||||
public bool ProjectionChanged => projectionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the view transform center has moved across 180° longitude.
|
||||
/// Used to control when a MapTileLayer should be updated immediately.
|
||||
/// </summary>
|
||||
public bool TransformCenterChanged { get; } = transformCenterChanged;
|
||||
public bool TransformCenterChanged => transformCenterChanged;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#if WPF
|
||||
using System;
|
||||
#if WPF
|
||||
using System.Windows;
|
||||
#elif AVALONIA
|
||||
using Avalonia;
|
||||
|
|
@ -10,12 +11,17 @@ namespace MapControl
|
|||
string identifier, double scale, Point topLeft,
|
||||
int tileWidth, int tileHeight, int matrixWidth, int matrixHeight)
|
||||
{
|
||||
public string Identifier { get; } = identifier;
|
||||
public double Scale { get; } = scale;
|
||||
public Point TopLeft { get; } = topLeft;
|
||||
public int TileWidth { get; } = tileWidth;
|
||||
public int TileHeight { get; } = tileHeight;
|
||||
public int MatrixWidth { get; } = matrixWidth;
|
||||
public int MatrixHeight { get; } = matrixHeight;
|
||||
public string Identifier => identifier;
|
||||
public double Scale => scale;
|
||||
public Point TopLeft => topLeft;
|
||||
public int TileWidth => tileWidth;
|
||||
public int TileHeight => tileHeight;
|
||||
public int MatrixWidth => matrixWidth;
|
||||
public int MatrixHeight => matrixHeight;
|
||||
|
||||
// Indicates if the total width in meters matches the earth circumference.
|
||||
//
|
||||
public bool HasFullHorizontalCoverage { get; } =
|
||||
Math.Abs(matrixWidth * tileWidth / scale - 360d * MapProjection.Wgs84MeterPerDegree) < 1e-3;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,18 +60,16 @@ namespace MapControl
|
|||
var xMax = (int)Math.Floor((bounds.X + bounds.Width) / WmtsTileMatrix.TileWidth);
|
||||
var yMax = (int)Math.Floor((bounds.Y + bounds.Height) / WmtsTileMatrix.TileHeight);
|
||||
|
||||
// Total tile matrix width in meters.
|
||||
//
|
||||
var totalWidth = WmtsTileMatrix.MatrixWidth * WmtsTileMatrix.TileWidth / WmtsTileMatrix.Scale;
|
||||
|
||||
if (Math.Abs(totalWidth - 360d * MapProjection.Wgs84MeterPerDegree) > 1d)
|
||||
if (!WmtsTileMatrix.HasFullHorizontalCoverage)
|
||||
{
|
||||
// No full longitudinal coverage, restrict x index.
|
||||
// Set X range limits.
|
||||
//
|
||||
xMin = Math.Max(xMin, 0);
|
||||
xMax = Math.Min(Math.Max(xMax, 0), WmtsTileMatrix.MatrixWidth - 1);
|
||||
}
|
||||
|
||||
// Set Y range limits.
|
||||
//
|
||||
yMin = Math.Max(yMin, 0);
|
||||
yMax = Math.Min(Math.Max(yMax, 0), WmtsTileMatrix.MatrixHeight - 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace MapControl
|
|||
Transform = new MatrixTransform()
|
||||
};
|
||||
|
||||
public WmtsTileMatrix WmtsTileMatrix { get; } = wmtsTileMatrix;
|
||||
public WmtsTileMatrix WmtsTileMatrix => wmtsTileMatrix;
|
||||
|
||||
public TileMatrix TileMatrix { get; private set; } = new TileMatrix(zoomLevel, 1, 1, 0, 0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue