From cc948d9ce68f15e8dfd10be6b87fab482e464b6c Mon Sep 17 00:00:00 2001 From: PeterZhong Date: Mon, 30 Sep 2024 10:38:38 +0800 Subject: [PATCH] 3.5 Add simple eagle map view --- GisDevelop_Exp/MainWindow.xaml | 5 ++++- GisDevelop_Exp/MainWindow.xaml.cs | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/GisDevelop_Exp/MainWindow.xaml b/GisDevelop_Exp/MainWindow.xaml index 27ff939..9262ab5 100644 --- a/GisDevelop_Exp/MainWindow.xaml +++ b/GisDevelop_Exp/MainWindow.xaml @@ -18,6 +18,9 @@ - + + + + diff --git a/GisDevelop_Exp/MainWindow.xaml.cs b/GisDevelop_Exp/MainWindow.xaml.cs index ce7c41a..0232a58 100644 --- a/GisDevelop_Exp/MainWindow.xaml.cs +++ b/GisDevelop_Exp/MainWindow.xaml.cs @@ -14,6 +14,9 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Esri.ArcGISRuntime.Geometry; +using Esri.ArcGISRuntime.Symbology; +using Color = System.Drawing.Color; namespace GisDevelop_Exp { @@ -26,6 +29,7 @@ namespace GisDevelop_Exp public MainWindow() { InitializeComponent(); + EagleMapView.Map = new Map(BasemapStyle.ArcGISImageryStandard); } private void Menu_OpenShp_Click(object sender, RoutedEventArgs e) @@ -87,5 +91,20 @@ namespace GisDevelop_Exp { OpenGeoDatabase(); } + + private void MainMapView_OnViewpointChanged(object? sender, EventArgs e) + { + EagleMapView.GraphicsOverlays.Clear(); + Esri.ArcGISRuntime.Geometry.Polygon vExtent = MainMapView.VisibleArea; + Envelope eagleViewEnvelop = vExtent.Extent; + Color lineColor = Color.FromArgb(255, 255, 0, 0); + SimpleLineSymbol lineSymbol = new Esri.ArcGISRuntime.Symbology.SimpleLineSymbol(SimpleLineSymbolStyle.Dash, lineColor,2.0); + Color fillColor = Color.FromArgb(0, 0, 0, 0); + SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, fillColor, lineSymbol); + var graphicOverlay = new Esri.ArcGISRuntime.UI.GraphicsOverlay(); + var envGraphic = new Esri.ArcGISRuntime.UI.Graphic(eagleViewEnvelop, fillSymbol); + graphicOverlay.Graphics.Add(envGraphic); + EagleMapView.GraphicsOverlays.Add(graphicOverlay); + } } }