From fe1ac924b4eb499d3b21062516b3bdeeccb2f47f Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Sat, 3 Dec 2022 20:57:34 +0100 Subject: [PATCH] Test WMS FeatureInfo --- SampleApps/WinUiApp/MainWindow.xaml | 1 + SampleApps/WinUiApp/MainWindow.xaml.cs | 16 ++++++++++++++++ SampleApps/WpfApplication/MainWindow.xaml.cs | 16 ++++++++-------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/SampleApps/WinUiApp/MainWindow.xaml b/SampleApps/WinUiApp/MainWindow.xaml index c3b5c077..fd3fa924 100644 --- a/SampleApps/WinUiApp/MainWindow.xaml +++ b/SampleApps/WinUiApp/MainWindow.xaml @@ -107,6 +107,7 @@ diff --git a/SampleApps/WinUiApp/MainWindow.xaml.cs b/SampleApps/WinUiApp/MainWindow.xaml.cs index cf074bcf..c34e643b 100644 --- a/SampleApps/WinUiApp/MainWindow.xaml.cs +++ b/SampleApps/WinUiApp/MainWindow.xaml.cs @@ -2,10 +2,12 @@ using MapControl.Caching; using MapControl.UiTools; using Microsoft.UI; +using Microsoft.UI.Input; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; using System; +using System.Diagnostics; using System.Globalization; using System.IO; using System.Threading.Tasks; @@ -100,6 +102,20 @@ namespace SampleApplication map.TargetHeading = 0d; } + private async void MapPointerPressed(object sender, PointerRoutedEventArgs e) + { + if (map.MapLayer is WmsImageLayer wmsLayer && + e.Pointer.PointerDeviceType == PointerDeviceType.Mouse) + { + PointerPoint point = e.GetCurrentPoint(map); + + if (point.Properties.IsRightButtonPressed) + { + Debug.WriteLine(await wmsLayer.GetFeatureInfoAsync(point.Position)); + } + } + } + private void MapPointerMoved(object sender, PointerRoutedEventArgs e) { var location = map.ViewToLocation(e.GetCurrentPoint(map).Position); diff --git a/SampleApps/WpfApplication/MainWindow.xaml.cs b/SampleApps/WpfApplication/MainWindow.xaml.cs index 49b8bd45..b386f91f 100644 --- a/SampleApps/WpfApplication/MainWindow.xaml.cs +++ b/SampleApps/WpfApplication/MainWindow.xaml.cs @@ -75,14 +75,6 @@ namespace SampleApplication map.TargetHeading = 0d; } - private async void MapMouseRightButtonDown(object sender, MouseButtonEventArgs e) - { - if (map.MapLayer is WmsImageLayer wmsLayer) - { - Debug.WriteLine(await wmsLayer.GetFeatureInfoAsync(e.GetPosition(map))); - } - } - private void MapMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 2) @@ -91,6 +83,14 @@ namespace SampleApplication } } + private async void MapMouseRightButtonDown(object sender, MouseButtonEventArgs e) + { + if (map.MapLayer is WmsImageLayer wmsLayer) + { + Debug.WriteLine(await wmsLayer.GetFeatureInfoAsync(e.GetPosition(map))); + } + } + private void MapMouseMove(object sender, MouseEventArgs e) { var location = map.ViewToLocation(e.GetPosition(map));