Added Avalonia sample application

This commit is contained in:
ClemensFischer 2024-05-24 15:28:28 +02:00
parent dc8df5e486
commit 192ecbf4df
12 changed files with 364 additions and 12 deletions

View file

@ -47,9 +47,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.WPF", "MapUiTool
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caches", "Caches", "{69E6CD1A-5619-4549-95FF-2FD126F1A5D2}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caches", "Caches", "{69E6CD1A-5619-4549-95FF-2FD126F1A5D2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache", "Caches\FileDbCache\FileDbCache.csproj", "{E5A7A66A-36EC-4775-850A-A64253DF0383}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileDbCache", "Caches\FileDbCache\FileDbCache.csproj", "{E5A7A66A-36EC-4775-850A-A64253DF0383}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLiteCache", "Caches\SQLiteCache\SQLiteCache.csproj", "{FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SQLiteCache", "Caches\SQLiteCache\SQLiteCache.csproj", "{FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.Avalonia", "MapControl\Avalonia\MapControl.Avalonia.csproj", "{0D621538-3DAD-4D3A-BB2C-220B6C580E51}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AvaloniaApp", "SampleApps\AvaloniaApp\AvaloniaApp.csproj", "{68629CA3-4599-4737-B44C-40B513DD1385}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.Avalonia", "MapUiTools\Avalonia\MapUiTools.Avalonia.csproj", "{3D61474F-2F72-47E2-87AA-2881AB552D1A}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -367,6 +373,54 @@ Global
{FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}.Release|x64.Build.0 = Release|Any CPU {FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}.Release|x64.Build.0 = Release|Any CPU
{FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}.Release|x86.ActiveCfg = Release|Any CPU {FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}.Release|x86.ActiveCfg = Release|Any CPU
{FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}.Release|x86.Build.0 = Release|Any CPU {FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}.Release|x86.Build.0 = Release|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Debug|arm64.ActiveCfg = Debug|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Debug|arm64.Build.0 = Debug|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Debug|x64.ActiveCfg = Debug|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Debug|x64.Build.0 = Debug|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Debug|x86.ActiveCfg = Debug|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Debug|x86.Build.0 = Debug|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Release|Any CPU.Build.0 = Release|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Release|arm64.ActiveCfg = Release|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Release|arm64.Build.0 = Release|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Release|x64.ActiveCfg = Release|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Release|x64.Build.0 = Release|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Release|x86.ActiveCfg = Release|Any CPU
{0D621538-3DAD-4D3A-BB2C-220B6C580E51}.Release|x86.Build.0 = Release|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Debug|arm64.ActiveCfg = Debug|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Debug|arm64.Build.0 = Debug|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Debug|x64.ActiveCfg = Debug|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Debug|x64.Build.0 = Debug|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Debug|x86.ActiveCfg = Debug|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Debug|x86.Build.0 = Debug|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Release|Any CPU.Build.0 = Release|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Release|arm64.ActiveCfg = Release|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Release|arm64.Build.0 = Release|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Release|x64.ActiveCfg = Release|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Release|x64.Build.0 = Release|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Release|x86.ActiveCfg = Release|Any CPU
{68629CA3-4599-4737-B44C-40B513DD1385}.Release|x86.Build.0 = Release|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Debug|arm64.ActiveCfg = Debug|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Debug|arm64.Build.0 = Debug|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Debug|x64.ActiveCfg = Debug|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Debug|x64.Build.0 = Debug|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Debug|x86.ActiveCfg = Debug|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Debug|x86.Build.0 = Debug|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Release|Any CPU.Build.0 = Release|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Release|arm64.ActiveCfg = Release|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Release|arm64.Build.0 = Release|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Release|x64.ActiveCfg = Release|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Release|x64.Build.0 = Release|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Release|x86.ActiveCfg = Release|Any CPU
{3D61474F-2F72-47E2-87AA-2881AB552D1A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -390,6 +444,9 @@ Global
{12430DAE-DC53-4C37-95D5-B8923B5FD3D7} = {90C681E9-12AE-4B5F-932D-7EF5D35D8436} {12430DAE-DC53-4C37-95D5-B8923B5FD3D7} = {90C681E9-12AE-4B5F-932D-7EF5D35D8436}
{E5A7A66A-36EC-4775-850A-A64253DF0383} = {69E6CD1A-5619-4549-95FF-2FD126F1A5D2} {E5A7A66A-36EC-4775-850A-A64253DF0383} = {69E6CD1A-5619-4549-95FF-2FD126F1A5D2}
{FDD70FB5-3B6D-43DF-8C2E-04100315C8BC} = {69E6CD1A-5619-4549-95FF-2FD126F1A5D2} {FDD70FB5-3B6D-43DF-8C2E-04100315C8BC} = {69E6CD1A-5619-4549-95FF-2FD126F1A5D2}
{0D621538-3DAD-4D3A-BB2C-220B6C580E51} = {52AECE49-F314-4F76-98F2-FA800F07824B}
{68629CA3-4599-4737-B44C-40B513DD1385} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
{3D61474F-2F72-47E2-87AA-2881AB552D1A} = {90C681E9-12AE-4B5F-932D-7EF5D35D8436}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {458346DD-B23F-4FDC-8F9D-A10F1882A4DB} SolutionGuid = {458346DD-B23F-4FDC-8F9D-A10F1882A4DB}

View file

@ -0,0 +1,8 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="AvaloniaApp.App"
RequestedThemeVariant="Default">
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>

View file

@ -0,0 +1,27 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace AvaloniaApp
{
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow
{
//DataContext = new MainViewModel()
};
}
base.OnFrameworkInitializationCompleted();
}
}
}

View file

@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<DefineConstants>AVALONIA</DefineConstants>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="..\Shared\10_535_330.jpg" Link="10_535_330.jpg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</AvaloniaResource>
</ItemGroup>
<ItemGroup>
<Content Include="..\Shared\etna.kml" Link="etna.kml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\Avalonia\MapControl.Avalonia.csproj" />
<ProjectReference Include="..\..\MapUiTools\Avalonia\MapUiTools.Avalonia.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.10" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.10" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.10" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.10" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10" />
<PackageReference Include="Markdown.Avalonia.Tight" Version="11.0.2" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,113 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:md="clr-namespace:Markdown.Avalonia;assembly=Markdown.Avalonia"
xmlns:map="clr-namespace:MapControl;assembly=MapControl.Avalonia"
xmlns:tools="clr-namespace:MapControl.UiTools;assembly=MapUiTools.Avalonia"
xmlns:local="clr-namespace:AvaloniaApp"
x:Class="AvaloniaApp.MainWindow"
Title="MainWindow">
<Grid>
<map:Map x:Name="map" Center="53.5,8.2" ZoomLevel="11" DoubleTapped="OnMapDoubleTapped">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#AFFFFFFF"
DataContext="{Binding MapLayer, ElementName=map}">
<ProgressBar Width="100" Height="8" Margin="4,2" VerticalAlignment="Center"
Maximum="1" Value="{Binding LoadingProgress}">
<ProgressBar.Styles>
<Style Selector="ProgressBar[Value=0]">
<Setter Property="IsIndeterminate" Value="True"/>
</Style>
<Style Selector="ProgressBar[Value=1]">
<Setter Property="IsVisible" Value="False"/>
</Style>
</ProgressBar.Styles>
</ProgressBar>
<LayoutTransformControl Margin="4,2">
<LayoutTransformControl.LayoutTransform>
<ScaleTransform ScaleX="0.7" ScaleY="0.7"/>
</LayoutTransformControl.LayoutTransform>
<md:MarkdownScrollViewer Markdown="{Binding Description}"/>
</LayoutTransformControl>
</StackPanel>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6">
<tools:MapLayersMenuButton x:Name="mapLayersMenuButton"
Margin="2" ToolTip.Tip="Map Layers and Overlays" Map="{Binding ElementName=map}">
<tools:MapLayerItem Text="OpenStreetMap">
<map:MapTileLayer
TileSource="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
SourceName="OpenStreetMap"
Description="© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="OpenStreetMap German">
<map:MapTileLayer
TileSource="https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png"
SourceName="OpenStreetMap German"
Description="© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="OpenStreetMap French">
<map:MapTileLayer
TileSource="http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png"
SourceName="OpenStreetMap French"
Description="© [OpenStreetMap France](https://www.openstreetmap.fr/mentions-legales/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="OpenTopoMap">
<map:MapTileLayer
TileSource="https://tile.opentopomap.org/{z}/{x}/{y}.png"
SourceName="OpenTopoMap"
Description="© [OpenTopoMap](https://opentopomap.org/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="TopPlusOpen WMTS">
<map:WmtsTileLayer
CapabilitiesUri="https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml"
SourceName="TopPlusOpen"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="TopPlusOpen WMS">
<map:WmsImageLayer
ServiceUri="https://sgx.geodatenzentrum.de/wms_topplus_open"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wms-topplusopen-mit-layer-fur-normalausgabe-und-druck-wms-topplus-open.html)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="TopPlusOpen WMS Tiles">
<map:MapTileLayer
SourceName="TopPlusOpen"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wms-topplusopen-mit-layer-fur-normalausgabe-und-druck-wms-topplus-open.html)">
<map:MapTileLayer.TileSource>
<map:BoundingBoxTileSource UriTemplate="https://sgx.geodatenzentrum.de/wms_topplus_open?SERVICE=WMS&amp;VERSION=1.3.0&amp;REQUEST=GetMap&amp;CRS=EPSG:3857&amp;LAYERS=web&amp;STYLES=&amp;FORMAT=image/png&amp;WIDTH=256&amp;HEIGHT=256&amp;BBOX={west},{south},{east},{north}"/>
</map:MapTileLayer.TileSource>
</map:MapTileLayer>
</tools:MapLayerItem>
<tools:MapLayerItem Text="OpenStreetMap WMS">
<map:WmsImageLayer
ServiceUri="http://ows.terrestris.de/osm/service"
Description="© [terrestris GmbH &amp; Co. KG](http://ows.terrestris.de/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayersMenuButton.MapOverlays>
<tools:MapLayerItem Text="Seamarks">
<map:MapTileLayer
TileSource="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"
SourceName="Seamarks"
MinZoomLevel="9" MaxZoomLevel="18"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="Sample Image">
<Image Source="avares://AvaloniaApp/10_535_330.jpg" Stretch="Fill"
map:MapPanel.BoundingBox="53.54031,8.08594,53.74871,8.43750"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="Mount Etna KML">
<map:GroundOverlay SourcePath="etna.kml"/>
</tools:MapLayerItem>
</tools:MapLayersMenuButton.MapOverlays>
</tools:MapLayersMenuButton>
<tools:MapProjectionsMenuButton x:Name="mapProjectionsMenuButton"
Margin="2" ToolTip.Tip="Map Projections" Map="{Binding ElementName=map}">
<tools:MapProjectionItem Text="Web Mercator" Projection="EPSG:3857"/>
<tools:MapProjectionItem Text="Equirectangular" Projection="EPSG:4326"/>
<tools:MapProjectionItem Text="ETRS89 / UTM zone 32N" Projection="EPSG:25832"/>
<tools:MapProjectionItem Text="WGS84 / Auto UTM" Projection="AUTO2:42001"/>
</tools:MapProjectionsMenuButton>
</StackPanel>
</map:Map>
</Grid>
</Window>

View file

@ -0,0 +1,76 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
using MapControl;
using MapControl.UiTools;
using System;
using System.IO;
namespace AvaloniaApp
{
public partial class MainWindow : Window
{
static MainWindow()
{
//TileImageLoader.Cache = new MapControl.Caching.ImageFileCache(TileImageLoader.DefaultCacheFolder);
var bingMapsApiKeyPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "BingMapsApiKey.txt");
if (File.Exists(bingMapsApiKeyPath))
{
BingMapsTileLayer.ApiKey = File.ReadAllText(bingMapsApiKeyPath)?.Trim();
}
}
public MainWindow()
{
InitializeComponent();
if (!string.IsNullOrEmpty(BingMapsTileLayer.ApiKey))
{
mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{
Text = "Bing Maps Road",
Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.Road,
SourceName = "Bing Maps Road",
Description = "© [Microsoft](http://www.bing.com/maps/)"
}
});
mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{
Text = "Bing Maps Aerial",
Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.Aerial,
SourceName = "Bing Maps Aerial",
Description = "© [Microsoft](http://www.bing.com/maps/)",
MapForeground = Brushes.White,
MapBackground = Brushes.Black
}
});
mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{
Text = "Bing Maps Aerial with Labels",
Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.AerialWithLabels,
SourceName = "Bing Maps Hybrid",
Description = "© [Microsoft](http://www.bing.com/maps/)",
MapForeground = Brushes.White,
MapBackground = Brushes.Black
}
});
}
}
private void OnMapDoubleTapped(object sender, TappedEventArgs e)
{
map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
}
}
}

View file

@ -0,0 +1,24 @@
using Avalonia;
using System;
namespace AvaloniaApp
{
class Program
{
[STAThread]
public static void Main(string[] args)
{
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
public static AppBuilder BuildAvaloniaApp()
{
return AppBuilder
.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}
}
}

View file

@ -114,6 +114,7 @@
<map:Map x:Name="map" ManipulationMode="All" <map:Map x:Name="map" ManipulationMode="All"
Center="53.5,8.2" Center="53.5,8.2"
MinZoomLevel="2" MaxZoomLevel="21" ZoomLevel="11" MinZoomLevel="2" MaxZoomLevel="21" ZoomLevel="11"
DoubleTapped="MapDoubleTapped"
PointerPressed="MapPointerPressed" PointerPressed="MapPointerPressed"
PointerReleased="MapPointerReleased" PointerReleased="MapPointerReleased"
PointerMoved="MapPointerMoved" PointerMoved="MapPointerMoved"

View file

@ -87,6 +87,11 @@ namespace SampleApplication
map.TargetHeading = 0d; map.TargetHeading = 0d;
} }
private void MapDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
}
private async void MapPointerPressed(object sender, PointerRoutedEventArgs e) private async void MapPointerPressed(object sender, PointerRoutedEventArgs e)
{ {
if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse) if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)

View file

@ -36,14 +36,14 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240428000" /> <ProjectReference Include="..\..\MapControl\WinUI\MapControl.WinUI.csproj" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" /> <ProjectReference Include="..\..\MapUiTools\WinUI\MapUiTools.WinUI.csproj" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\MapControl\WinUI\MapControl.WinUI.csproj" /> <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240428000" />
<ProjectReference Include="..\..\MapUiTools\WinUI\MapUiTools.WinUI.csproj" /> <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup> </ItemGroup>
<!-- Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging <!-- Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging

View file

@ -183,8 +183,7 @@
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6"> <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6">
<tools:MapLayersMenuButton x:Name="mapLayersMenuButton" <tools:MapLayersMenuButton x:Name="mapLayersMenuButton"
Margin="2" ToolTip="Map Layers and Overlays" Margin="2" ToolTip="Map Layers and Overlays" Map="{Binding ElementName=map}">
Map="{Binding ElementName=map}">
<tools:MapLayerItem Text="OpenStreetMap"> <tools:MapLayerItem Text="OpenStreetMap">
<map:MapTileLayer <map:MapTileLayer
TileSource="https://tile.openstreetmap.org/{z}/{x}/{y}.png" TileSource="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
@ -220,6 +219,15 @@
ServiceUri="https://sgx.geodatenzentrum.de/wms_topplus_open" ServiceUri="https://sgx.geodatenzentrum.de/wms_topplus_open"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wms-topplusopen-mit-layer-fur-normalausgabe-und-druck-wms-topplus-open.html)"/> Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wms-topplusopen-mit-layer-fur-normalausgabe-und-druck-wms-topplus-open.html)"/>
</tools:MapLayerItem> </tools:MapLayerItem>
<tools:MapLayerItem Text="TopPlusOpen WMS Tiles">
<map:MapTileLayer
SourceName="TopPlusOpen"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wms-topplusopen-mit-layer-fur-normalausgabe-und-druck-wms-topplus-open.html)">
<map:MapTileLayer.TileSource>
<map:BoundingBoxTileSource UriTemplate="https://sgx.geodatenzentrum.de/wms_topplus_open?SERVICE=WMS&amp;VERSION=1.3.0&amp;REQUEST=GetMap&amp;CRS=EPSG:3857&amp;LAYERS=web&amp;STYLES=&amp;FORMAT=image/png&amp;WIDTH=256&amp;HEIGHT=256&amp;BBOX={west},{south},{east},{north}"/>
</map:MapTileLayer.TileSource>
</map:MapTileLayer>
</tools:MapLayerItem>
<tools:MapLayerItem Text="OpenStreetMap WMS"> <tools:MapLayerItem Text="OpenStreetMap WMS">
<map:WmsImageLayer <map:WmsImageLayer
ServiceUri="http://ows.terrestris.de/osm/service" ServiceUri="http://ows.terrestris.de/osm/service"
@ -249,8 +257,7 @@
</tools:MapLayersMenuButton> </tools:MapLayersMenuButton>
<tools:MapProjectionsMenuButton x:Name="mapProjectionsMenuButton" <tools:MapProjectionsMenuButton x:Name="mapProjectionsMenuButton"
Margin="2" ToolTip="Map Projections" Margin="2" ToolTip="Map Projections" Map="{Binding ElementName=map}">
Map="{Binding ElementName=map}">
<tools:MapProjectionItem Text="Web Mercator" Projection="EPSG:3857"/> <tools:MapProjectionItem Text="Web Mercator" Projection="EPSG:3857"/>
<tools:MapProjectionItem Text="Equirectangular" Projection="EPSG:4326"/> <tools:MapProjectionItem Text="Equirectangular" Projection="EPSG:4326"/>
<tools:MapProjectionItem Text="ETRS89 / UTM zone 32N" Projection="EPSG:25832"/> <tools:MapProjectionItem Text="ETRS89 / UTM zone 32N" Projection="EPSG:25832"/>

View file

@ -9,7 +9,7 @@
<Version>10.0.0</Version> <Version>10.0.0</Version>
<Authors>Clemens Fischer</Authors> <Authors>Clemens Fischer</Authors>
<Copyright>Copyright © 2024 Clemens Fischer</Copyright> <Copyright>Copyright © 2024 Clemens Fischer</Copyright>
<DefineConstants></DefineConstants> <DefineConstants>WPF</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>