mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Correct comments
This commit is contained in:
parent
0cbb85c7db
commit
2028e3cf90
|
|
@ -153,7 +153,7 @@ namespace MapControl
|
||||||
var tileMatrixZoomLevel = (int)Math.Floor(ParentMap.ZoomLevel - ZoomLevelOffset + 0.001);
|
var tileMatrixZoomLevel = (int)Math.Floor(ParentMap.ZoomLevel - ZoomLevelOffset + 0.001);
|
||||||
var tileMatrixScale = MapBase.ZoomLevelToScale(tileMatrixZoomLevel);
|
var tileMatrixScale = MapBase.ZoomLevelToScale(tileMatrixZoomLevel);
|
||||||
|
|
||||||
// Bounds in tile pixels from view size.
|
// Tile matrix bounds in pixels.
|
||||||
//
|
//
|
||||||
var bounds = ParentMap.ViewTransform.GetTileMatrixBounds(tileMatrixScale, MapTopLeft, ParentMap.ActualWidth, ParentMap.ActualHeight);
|
var bounds = ParentMap.ViewTransform.GetTileMatrixBounds(tileMatrixScale, MapTopLeft, ParentMap.ActualWidth, ParentMap.ActualHeight);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the index bounds of a tile matrix.
|
/// Gets the pixel bounds of a tile matrix.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Rect GetTileMatrixBounds(double tileMatrixScale, Point tileMatrixTopLeft, double viewWidth, double viewHeight)
|
public Rect GetTileMatrixBounds(double tileMatrixScale, Point tileMatrixTopLeft, double viewWidth, double viewHeight)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace MapControl
|
||||||
|
|
||||||
public bool UpdateTiles(ViewTransform viewTransform, double viewWidth, double viewHeight)
|
public bool UpdateTiles(ViewTransform viewTransform, double viewWidth, double viewHeight)
|
||||||
{
|
{
|
||||||
// Bounds in tile pixels from view size.
|
// Tile matrix bounds in pixels.
|
||||||
//
|
//
|
||||||
var bounds = viewTransform.GetTileMatrixBounds(WmtsTileMatrix.Scale, WmtsTileMatrix.TopLeft, viewWidth, viewHeight);
|
var bounds = viewTransform.GetTileMatrixBounds(WmtsTileMatrix.Scale, WmtsTileMatrix.TopLeft, viewWidth, viewHeight);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BitmapTileMatrixLayer(WmtsTileMatrix wmtsTileMatrix, int zoomLevel) : FrameworkElement
|
public class BitmapTileMatrixLayer(WmtsTileMatrix wmtsTileMatrix, int zoomLevel) : UIElement
|
||||||
{
|
{
|
||||||
private readonly ImageBrush imageBrush = new ImageBrush
|
private readonly ImageBrush imageBrush = new ImageBrush
|
||||||
{
|
{
|
||||||
|
|
@ -42,8 +42,6 @@ namespace MapControl
|
||||||
Transform = new MatrixTransform()
|
Transform = new MatrixTransform()
|
||||||
};
|
};
|
||||||
|
|
||||||
private WriteableBitmap bitmap;
|
|
||||||
|
|
||||||
public WmtsTileMatrix WmtsTileMatrix { get; } = wmtsTileMatrix;
|
public WmtsTileMatrix WmtsTileMatrix { get; } = wmtsTileMatrix;
|
||||||
|
|
||||||
public TileMatrix TileMatrix { get; private set; } = new TileMatrix(zoomLevel, 1, 1, 0, 0);
|
public TileMatrix TileMatrix { get; private set; } = new TileMatrix(zoomLevel, 1, 1, 0, 0);
|
||||||
|
|
@ -67,7 +65,7 @@ namespace MapControl
|
||||||
|
|
||||||
public bool UpdateTiles(ViewTransform viewTransform, double viewWidth, double viewHeight)
|
public bool UpdateTiles(ViewTransform viewTransform, double viewWidth, double viewHeight)
|
||||||
{
|
{
|
||||||
// Bounds in tile pixels from view size.
|
// Tile matrix bounds in pixels.
|
||||||
//
|
//
|
||||||
var bounds = viewTransform.GetTileMatrixBounds(WmtsTileMatrix.Scale, WmtsTileMatrix.TopLeft, viewWidth, viewHeight);
|
var bounds = viewTransform.GetTileMatrixBounds(WmtsTileMatrix.Scale, WmtsTileMatrix.TopLeft, viewWidth, viewHeight);
|
||||||
|
|
||||||
|
|
@ -114,9 +112,7 @@ namespace MapControl
|
||||||
var width = WmtsTileMatrix.TileWidth * (TileMatrix.XMax - TileMatrix.XMin + 1);
|
var width = WmtsTileMatrix.TileWidth * (TileMatrix.XMax - TileMatrix.XMin + 1);
|
||||||
var height = WmtsTileMatrix.TileHeight * (TileMatrix.YMax - TileMatrix.YMin + 1);
|
var height = WmtsTileMatrix.TileHeight * (TileMatrix.YMax - TileMatrix.YMin + 1);
|
||||||
|
|
||||||
bitmap = new WriteableBitmap(width, height, 96, 96, PixelFormats.Pbgra32, null);
|
imageBrush.ImageSource = new WriteableBitmap(width, height, 96, 96, PixelFormats.Pbgra32, null);
|
||||||
|
|
||||||
imageBrush.ImageSource = bitmap;
|
|
||||||
imageBrush.Viewport = new Rect(0, 0, width, height);
|
imageBrush.Viewport = new Rect(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,7 +163,7 @@ namespace MapControl
|
||||||
WmtsTileMatrix.TileWidth,
|
WmtsTileMatrix.TileWidth,
|
||||||
WmtsTileMatrix.TileHeight);
|
WmtsTileMatrix.TileHeight);
|
||||||
|
|
||||||
bitmap.WritePixels(rect, tile.PixelBuffer, 4 * WmtsTileMatrix.TileWidth, 0);
|
((WriteableBitmap)imageBrush.ImageSource).WritePixels(rect, tile.PixelBuffer, 4 * WmtsTileMatrix.TileWidth, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTileCompleted(object sender, EventArgs e)
|
private void OnTileCompleted(object sender, EventArgs e)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue