mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-02 19:46:29 +02:00
Use DrawingTileMatrixLayer
This commit is contained in:
parent
5daaf01f6b
commit
86955a4f2a
|
|
@ -171,7 +171,7 @@ namespace MapControl
|
||||||
|
|
||||||
private void DrawCylindricalGraticule(PathFigureCollection figures, List<Label> labels)
|
private void DrawCylindricalGraticule(PathFigureCollection figures, List<Label> labels)
|
||||||
{
|
{
|
||||||
var boundingBox = ParentMap.ViewRectToBoundingBox(new Rect(0, 0, ParentMap.ActualWidth, ParentMap.ActualHeight));
|
var boundingBox = ParentMap.ViewRectToBoundingBox(new Rect(0d, 0d, ParentMap.ActualWidth, ParentMap.ActualHeight));
|
||||||
var latLabelStart = Math.Ceiling(boundingBox.South / lineDistance) * lineDistance;
|
var latLabelStart = Math.Ceiling(boundingBox.South / lineDistance) * lineDistance;
|
||||||
var lonLabelStart = Math.Ceiling(boundingBox.West / lineDistance) * lineDistance;
|
var lonLabelStart = Math.Ceiling(boundingBox.West / lineDistance) * lineDistance;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,12 @@ using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
|
#if WPF
|
||||||
|
using TileMatrixLayer = DrawingTileMatrixLayer;
|
||||||
|
#else
|
||||||
|
using TileMatrixLayer = WmtsTileMatrixLayer;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Displays map tiles from a Web Map Tile Service (WMTS).
|
/// Displays map tiles from a Web Map Tile Service (WMTS).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -78,7 +84,7 @@ namespace MapControl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override IReadOnlyCollection<string> SupportedCrsIds => TileMatrixSets.Keys;
|
public override IReadOnlyCollection<string> SupportedCrsIds => TileMatrixSets.Keys;
|
||||||
|
|
||||||
protected IEnumerable<WmtsTileMatrixLayer> ChildLayers => Children.Cast<WmtsTileMatrixLayer>();
|
protected IEnumerable<TileMatrixLayer> ChildLayers => Children.Cast<TileMatrixLayer>();
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize)
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
{
|
{
|
||||||
|
|
@ -94,7 +100,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
foreach (var layer in ChildLayers)
|
foreach (var layer in ChildLayers)
|
||||||
{
|
{
|
||||||
layer.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
|
layer.Arrange(new Rect(0d, 0d, finalSize.Width, finalSize.Height));
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalSize;
|
return finalSize;
|
||||||
|
|
@ -176,10 +182,10 @@ namespace MapControl
|
||||||
|
|
||||||
foreach (var tileMatrix in tileMatrixes)
|
foreach (var tileMatrix in tileMatrixes)
|
||||||
{
|
{
|
||||||
// Pass index of tileMatrix in tileMatrixSet as zoom level to WmtsTileMatrixLayer ctor.
|
// Pass index of tileMatrix in tileMatrixSet as zoom level to TileMatrixLayer ctor.
|
||||||
//
|
//
|
||||||
var layer = layers.FirstOrDefault(layer => layer.WmtsTileMatrix == tileMatrix) ??
|
var layer = layers.FirstOrDefault(layer => layer.WmtsTileMatrix == tileMatrix) ??
|
||||||
new WmtsTileMatrixLayer(tileMatrix, tileMatrixSet.IndexOf(tileMatrix));
|
new TileMatrixLayer(tileMatrix, tileMatrixSet.IndexOf(tileMatrix));
|
||||||
|
|
||||||
if (layer.UpdateTiles(ParentMap.ViewTransform, ParentMap.ActualWidth, ParentMap.ActualHeight))
|
if (layer.UpdateTiles(ParentMap.ViewTransform, ParentMap.ActualWidth, ParentMap.ActualHeight))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue