From b5a8793281c14ea6c9b96d6ea0d988b388616776 Mon Sep 17 00:00:00 2001 From: PeterZhong Date: Thu, 5 Dec 2024 12:16:44 +0800 Subject: [PATCH] Basic Query Windows --- GisDevelop_Exp/MainWindow.xaml | 9 ++++++ GisDevelop_Exp/MainWindow.xaml.cs | 52 ++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/GisDevelop_Exp/MainWindow.xaml b/GisDevelop_Exp/MainWindow.xaml index db3102e..9eb98cf 100644 --- a/GisDevelop_Exp/MainWindow.xaml +++ b/GisDevelop_Exp/MainWindow.xaml @@ -54,6 +54,15 @@ + + + + + + + + + listOfClipGraphics; //几何操作时选择的图形 + + private int selByGeometryType = 0; + + LocationQueryResultsWindow locationQueryResultsWindow ; private readonly Dictionary _basemapOptions = new Dictionary() { @@ -954,7 +958,7 @@ namespace GisDevelop_Exp m_CurOper = CURRENTOPERATION.DrawPoint; } - private void MainMapView_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + private async void MainMapView_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { IInputElement mv = (IInputElement)sender; MapPoint location = MainMapView.ScreenToLocation(e.GetPosition(mv)); @@ -1003,6 +1007,28 @@ namespace GisDevelop_Exp linesList.Add(lineGraphic); } } + + if(selByGeometryType == 1)//检查是否为按照位置查询中的点选 + { + IInputElement ie = (IInputElement)sender;//转换事件宿主对象为IInputElement对象 + IReadOnlyList< IdentifyLayerResult> results =await + MainMapView.IdentifyLayersAsync(e.GetPosition(ie), 15, false);//根据鼠标点在所有图层中进行查询 + if(results!=null)//查询结果不为空 + { + if (locationQueryResultsWindow != null && + locationQueryResultsWindow.IsClosed)//位置查询结果子窗体已关闭 + { + locationQueryResultsWindow = null;//将子窗体对象置为空 + } + if (locationQueryResultsWindow == null) + { + locationQueryResultsWindow = new LocationQueryResultsWindow();//构造新的子窗体对象 + } + locationQueryResultsWindow.ResultCollection = results;//为子窗体引用查询结果集对象 + locationQueryResultsWindow.Show();//显示该子窗体 + locationQueryResultsWindow.Activate();//使子窗体处于激活状态 + } + } } private void Menu_Layers_Options_OnClick(object sender, RoutedEventArgs e) @@ -1512,5 +1538,29 @@ namespace GisDevelop_Exp { MessageBox.Show("此功能暂未实现"); } + + private void Menu_Attribute_Query_OnClick(object sender, RoutedEventArgs e) + { + List myTables; + myTables = new List(); + for(int i=0;i