Compare commits

...

2 commits

Author SHA1 Message Date
ClemensFischer 96513468d8 .NET 10 2025-11-14 16:56:11 +01:00
ClemensFischer 36883a8d9d Fixed TileSource (14.2.0) 2025-11-14 15:02:48 +01:00
31 changed files with 74 additions and 43 deletions

View file

@ -3,7 +3,7 @@
<Product>XAML Map Control</Product>
<Authors>Clemens Fischer</Authors>
<Copyright>Copyright © 2025 Clemens Fischer</Copyright>
<Version>14.1.0</Version>
<Version>15.0.0</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>MapControl.MBTiles</RootNamespace>
<AssemblyTitle>XAML Map Control MBTiles Library for Avalonia UI</AssemblyTitle>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<DefineConstants>UWP</DefineConstants>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0-windows;net462</TargetFrameworks>
<TargetFrameworks>net10.0-windows;net462</TargetFrameworks>
<LangVersion Condition="'$(TargetFramework)'=='net462'">12.0</LangVersion>
<UseWPF>true</UseWPF>
<DefineConstants>WPF</DefineConstants>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<DefineConstants>WINUI</DefineConstants>
<RootNamespace>MapControl.MBTiles</RootNamespace>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>MapControl</RootNamespace>
<AssemblyTitle>XAML Map Control Library for Avalonia UI</AssemblyTitle>

View file

@ -2,6 +2,7 @@
using Avalonia.Controls;
using Avalonia.Media;
using System;
using Brush = Avalonia.Media.IBrush;
namespace MapControl
{

View file

@ -14,6 +14,7 @@ using Microsoft.UI.Xaml.Media;
#elif AVALONIA
using Avalonia;
using Avalonia.Media;
using Brush = Avalonia.Media.IBrush;
using PathFigureCollection = Avalonia.Media.PathFigures;
#endif

View file

@ -24,6 +24,11 @@ namespace MapControl
/// </summary>
public partial class MapTileLayer : TilePyramidLayer
{
private const int TileSize = 256;
private static readonly Point MapTopLeft = new(-180d * MapProjection.Wgs84MeterPerDegree,
180d * MapProjection.Wgs84MeterPerDegree);
public static readonly DependencyProperty MinZoomLevelProperty =
DependencyPropertyHelper.Register<MapTileLayer, int>(nameof(MinZoomLevel), 0);
@ -33,11 +38,6 @@ namespace MapControl
public static readonly DependencyProperty ZoomLevelOffsetProperty =
DependencyPropertyHelper.Register<MapTileLayer, double>(nameof(ZoomLevelOffset), 0d);
private const int TileSize = 256;
private static readonly Point MapTopLeft = new(-180d * MapProjection.Wgs84MeterPerDegree,
180d * MapProjection.Wgs84MeterPerDegree);
/// <summary>
/// A default MapTileLayer using OpenStreetMap data.
/// </summary>
@ -48,6 +48,11 @@ namespace MapControl
Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
};
public MapTileLayer()
{
MapPanel.SetRenderTransform(this, new MatrixTransform());
}
public override IReadOnlyCollection<string> SupportedCrsIds { get; } = [WebMercatorProjection.DefaultCrsId];
public TileMatrix TileMatrix { get; private set; }

View file

@ -165,7 +165,7 @@ namespace MapControl
}
else if (uri.Scheme != "http" && uri.Scheme != "https" || string.IsNullOrEmpty(cacheName))
{
await tile.LoadImageAsync(() => ImageLoader.LoadImageAsync(uri)).ConfigureAwait(false);
await tile.LoadImageAsync(() => tileSource.LoadImageAsync(uri)).ConfigureAwait(false);
}
else
{
@ -173,7 +173,7 @@ namespace MapControl
if (buffer != null)
{
await tile.LoadImageAsync(() => ImageLoader.LoadImageAsync(buffer)).ConfigureAwait(false);
await tile.LoadImageAsync(() => tileSource.LoadImageAsync(buffer)).ConfigureAwait(false);
}
}
}

View file

@ -69,8 +69,6 @@ namespace MapControl
updateTimer = new UpdateTimer { Interval = UpdateInterval };
updateTimer.Tick += (s, e) => UpdateTiles();
MapPanel.SetRenderTransform(this, new MatrixTransform());
#if WPF
RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);
#elif UWP || WINUI

View file

@ -1,4 +1,5 @@
using System;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
#if WPF
@ -14,7 +15,7 @@ using ImageSource = Avalonia.Media.IImage;
namespace MapControl
{
/// <summary>
/// Provides the download Uri or ImageSource of map tiles.
/// Provides the download Uri or ImageSource of map tiles. Used by TileImageLoader.
/// </summary>
#if UWP || WINUI
[Windows.Foundation.Metadata.CreateFromString(MethodName = "Parse")]
@ -24,15 +25,38 @@ namespace MapControl
public class TileSource
{
/// <summary>
/// Gets the image request Uri for the specified zoom level and tile indices.
/// May return null when the image shall be loaded by the LoadImageAsync method.
/// Gets an image request Uri for the specified zoom level and tile indices.
/// May return null when the image shall be loaded by
/// the LoadImageAsync(zoomLevel, column, row) method.
/// </summary>
public virtual Uri GetUri(int zoomLevel, int column, int row) => null;
public virtual Uri GetUri(int zoomLevel, int column, int row)
{
return null;
}
/// <summary>
/// Loads a tile image without an Uri.
/// </summary>
public virtual Task<ImageSource> LoadImageAsync(int zoomLevel, int column, int row) => null;
public virtual Task<ImageSource> LoadImageAsync(int zoomLevel, int column, int row)
{
return null;
}
/// <summary>
/// Loads a tile image from an Uri.
/// </summary>
public virtual Task<ImageSource> LoadImageAsync(Uri uri)
{
return ImageLoader.LoadImageAsync(uri);
}
/// <summary>
/// Loads a tile image from an encoded frame buffer.
/// </summary>
public virtual Task<ImageSource> LoadImageAsync(byte[] buffer)
{
return ImageLoader.LoadImageAsync(buffer);
}
/// <summary>
/// Creates a TileSource instance from an Uri template string.

View file

@ -117,12 +117,14 @@ namespace MapControl
{
// Arrange tiles relative to XMin/YMin.
//
var x = WmtsTileMatrix.TileWidth * (tile.X - TileMatrix.XMin);
var y = WmtsTileMatrix.TileHeight * (tile.Y - TileMatrix.YMin);
var tileWidth = WmtsTileMatrix.TileWidth;
var tileHeight = WmtsTileMatrix.TileHeight;
var x = tileWidth * (tile.X - TileMatrix.XMin);
var y = tileHeight * (tile.Y - TileMatrix.YMin);
tile.Image.Width = WmtsTileMatrix.TileWidth;
tile.Image.Height = WmtsTileMatrix.TileHeight;
tile.Image.Arrange(new Rect(x, y, WmtsTileMatrix.TileWidth, WmtsTileMatrix.TileHeight));
tile.Image.Width = tileWidth;
tile.Image.Height = tileHeight;
tile.Image.Arrange(new Rect(x, y, tileWidth, tileHeight));
}
return finalSize;

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<DefineConstants>UWP</DefineConstants>

View file

@ -54,7 +54,7 @@
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="0"/>
<Setter Property="Padding" Value="3,6,4,6"/>
<Setter Property="Padding" Value="4,6"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="map:Pushpin">

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0-windows;net462</TargetFrameworks>
<TargetFrameworks>net10.0-windows;net462</TargetFrameworks>
<LangVersion Condition="'$(TargetFramework)'=='net462'">12.0</LangVersion>
<UseWPF>true</UseWPF>
<DefineConstants>WPF</DefineConstants>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<DefineConstants>WINUI</DefineConstants>
<RootNamespace>MapControl</RootNamespace>

View file

@ -54,7 +54,7 @@
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="0"/>
<Setter Property="Padding" Value="6,3,6,4"/>
<Setter Property="Padding" Value="6,4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="map:Pushpin">

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>MapControl.Projections</RootNamespace>
<AssemblyTitle>XAML Map Control Projections Library for Avalonia UI</AssemblyTitle>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<DefineConstants>UWP</DefineConstants>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0-windows;net462</TargetFrameworks>
<TargetFrameworks>net10.0-windows;net462</TargetFrameworks>
<LangVersion Condition="'$(TargetFramework)'=='net462'">12.0</LangVersion>
<UseWPF>true</UseWPF>
<DefineConstants>WPF</DefineConstants>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<DefineConstants>WINUI</DefineConstants>
<RootNamespace>MapControl.Projections</RootNamespace>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>MapControl.UiTools</RootNamespace>
<AssemblyTitle>XAML Map Control UI Tools Library for Avalonia UI</AssemblyTitle>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<DefineConstants>UWP</DefineConstants>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0-windows;net462</TargetFrameworks>
<TargetFrameworks>net10.0-windows;net462</TargetFrameworks>
<LangVersion Condition="'$(TargetFramework)'=='net462'">12.0</LangVersion>
<UseWPF>true</UseWPF>
<DefineConstants>WPF</DefineConstants>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<DefineConstants>WINUI</DefineConstants>
<RootNamespace>MapControl.UiTools</RootNamespace>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>SampleApplication</RootNamespace>
<AssemblyTitle>XAML Map Control Avalonia Sample Application</AssemblyTitle>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<RootNamespace>ProjectionDemo</RootNamespace>
<AssemblyTitle>XAML Map Control Projection Demo Application</AssemblyTitle>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<Platforms>x86;x64;arm64</Platforms>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<Platforms>x86;x64;arm64</Platforms>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net9.0-windows;net48</TargetFrameworks>
<TargetFrameworks>net10.0-windows;net48</TargetFrameworks>
<UseWPF>true</UseWPF>
<DefineConstants>WPF</DefineConstants>
<RootNamespace>SampleApplication</RootNamespace>