mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
WMTS support for Avalonia
This commit is contained in:
parent
eb990ab9ee
commit
18a2f31fb3
|
|
@ -37,6 +37,12 @@
|
|||
<Compile Include="..\Shared\ViewRect.cs" Link="ViewRect.cs" />
|
||||
<Compile Include="..\Shared\WebMercatorProjection.cs" Link="WebMercatorProjection.cs" />
|
||||
<Compile Include="..\Shared\WmsImageLayer.cs" Link="WmsImageLayer.cs" />
|
||||
<Compile Include="..\Shared\WmtsCapabilities.cs" Link="WmtsCapabilities.cs" />
|
||||
<Compile Include="..\Shared\WmtsTileLayer.cs" Link="WmtsTileLayer.cs" />
|
||||
<Compile Include="..\Shared\WmtsTileMatrix.cs" Link="WmtsTileMatrix.cs" />
|
||||
<Compile Include="..\Shared\WmtsTileMatrixLayer.cs" Link="WmtsTileMatrixLayer.cs" />
|
||||
<Compile Include="..\Shared\WmtsTileMatrixSet.cs" Link="WmtsTileMatrixSet.cs" />
|
||||
<Compile Include="..\Shared\WmtsTileSource.cs" Link="WmtsTileSource.cs" />
|
||||
<Compile Include="..\WPF\Timer.WPF.cs" Link="Timer.WPF.cs" />
|
||||
<Compile Include="..\WPF\TypeConverters.WPF.cs" Link="TypeConverters.WPF.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -46,20 +46,20 @@ namespace MapControl
|
|||
|
||||
public static readonly DependencyProperty LocationProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<MapPanel, Location>("Location", null, false,
|
||||
(obj, oldVale, newValue) => (obj.Parent as MapPanel)?.InvalidateArrange());
|
||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||
|
||||
public static readonly DependencyProperty BoundingBoxProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<MapPanel, BoundingBox>("BoundingBox", null, false,
|
||||
(obj, oldVale, newValue) => (obj.Parent as MapPanel)?.InvalidateArrange());
|
||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||
|
||||
private static readonly DependencyProperty ViewPositionProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<MapPanel, Point?>("ViewPosition");
|
||||
|
||||
private static readonly DependencyProperty ParentMapProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<MapPanel, MapBase>("ParentMap", null, true,
|
||||
(obj, oldVale, newValue) =>
|
||||
(element, oldValue, newValue) =>
|
||||
{
|
||||
if (obj is IMapElement mapElement)
|
||||
if (element is IMapElement mapElement)
|
||||
{
|
||||
mapElement.ParentMap = newValue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace MapControl
|
|||
{
|
||||
public static readonly DependencyProperty TileSourceProperty =
|
||||
DependencyPropertyHelper.Register<MapTileLayerBase, TileSource>(nameof(TileSource), null, false,
|
||||
async (obj, oldVale, newValue) => await obj.Update(true));
|
||||
async (layer, oldValue, newValue) => await layer.Update(true));
|
||||
|
||||
public static readonly DependencyProperty SourceNameProperty =
|
||||
DependencyPropertyHelper.Register<MapTileLayerBase, string>(nameof(SourceName));
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Copyright © 2024 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using Avalonia.Interactivity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -15,6 +16,8 @@ using Windows.UI.Xaml;
|
|||
#elif WINUI
|
||||
using Windows.Foundation;
|
||||
using Microsoft.UI.Xaml;
|
||||
#elif AVALONIA
|
||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
|
|
@ -24,15 +27,15 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public class WmtsTileLayer : MapTileLayerBase
|
||||
{
|
||||
public static readonly DependencyProperty CapabilitiesUriProperty = DependencyProperty.Register(
|
||||
nameof(CapabilitiesUri), typeof(Uri), typeof(WmtsTileLayer),
|
||||
new PropertyMetadata(null, (o, e) => ((WmtsTileLayer)o).TileMatrixSets.Clear()));
|
||||
public static readonly DependencyProperty CapabilitiesUriProperty =
|
||||
DependencyPropertyHelper.Register<WmtsTileLayer, Uri>(nameof(CapabilitiesUri), null, false,
|
||||
(layer, oldValue, newValue) => layer.TileMatrixSets.Clear());
|
||||
|
||||
public static readonly DependencyProperty LayerProperty = DependencyProperty.Register(
|
||||
nameof(Layer), typeof(string), typeof(WmtsTileLayer), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty LayerProperty =
|
||||
DependencyPropertyHelper.Register<WmtsTileLayer, string>(nameof(Layer));
|
||||
|
||||
public static readonly DependencyProperty PreferredTileMatrixSetsProperty = DependencyProperty.Register(
|
||||
nameof(PreferredTileMatrixSets), typeof(string[]), typeof(WmtsTileLayer), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty PreferredTileMatrixSetsProperty =
|
||||
DependencyPropertyHelper.Register<WmtsTileLayer, string[]>(nameof(PreferredTileMatrixSets));
|
||||
|
||||
public WmtsTileLayer()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ using Windows.UI.Xaml.Media;
|
|||
using Windows.Foundation;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
#elif AVALONIA
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
|
|
@ -25,7 +28,8 @@ namespace MapControl
|
|||
//
|
||||
public WmtsTileMatrixLayer(WmtsTileMatrix tileMatrix, int zoomLevel)
|
||||
{
|
||||
RenderTransform = new MatrixTransform();
|
||||
MapPanel.SetRenderTransform(this, new MatrixTransform());
|
||||
|
||||
WmtsTileMatrix = tileMatrix;
|
||||
TileMatrix = new TileMatrix(zoomLevel, 1, 1, 0, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue