diff --git a/.idea/.idea.GisDevelop_Exp/.idea/indexLayout.xml b/.idea/.idea.GisDevelop_Exp/.idea/indexLayout.xml
new file mode 100644
index 0000000..c9bbc2f
--- /dev/null
+++ b/.idea/.idea.GisDevelop_Exp/.idea/indexLayout.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ ../../GisDevelop
+
+
+
+
+
\ No newline at end of file
diff --git a/GisDevelop_Exp/AttributeQuery.xaml b/GisDevelop_Exp/AttributeQuery.xaml
new file mode 100644
index 0000000..d5c96d8
--- /dev/null
+++ b/GisDevelop_Exp/AttributeQuery.xaml
@@ -0,0 +1,28 @@
+
+
+
diff --git a/GisDevelop_Exp/AttributeQuery.xaml.cs b/GisDevelop_Exp/AttributeQuery.xaml.cs
new file mode 100644
index 0000000..533ce1d
--- /dev/null
+++ b/GisDevelop_Exp/AttributeQuery.xaml.cs
@@ -0,0 +1,190 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Esri.ArcGISRuntime.Data;
+
+namespace GisDevelop_Exp
+{
+ ///
+ /// Interaction logic for AttributeQuery.xaml
+ ///
+ public partial class AttributeQuery : Window
+ {
+ private List _tables;// 表集合
+ private String sqlString; //查询语句的where子句
+ private FeatureTable selectedTable;// 当前所选要素表对象
+
+ public AttributeQuery()
+ {
+ InitializeComponent();
+ Tables = new List();//初始化表集合
+ sqlString = string.Empty;//初始化字符串
+ selectedTable = null;
+ listBoxFields.Items.Clear();//清空字段组合框的内容
+ listBoxFieldValue.Items.Clear();//清空字段值组合框的内容
+ textBoxWhere.Text = string.Empty;//清空文本框
+ }
+
+ public List Tables
+ {
+ get { return _tables; }
+ set { _tables = value; }
+ }
+ public string SqlString
+ {
+ get { return sqlString; }
+ set { sqlString = value; }
+ }
+
+
+ private void AttributeQuery_OnLoaded(object sender, RoutedEventArgs e)
+ {
+ if(Tables .Count > 0)//表集合不为空
+ {
+ foreach (FeatureTable tb in Tables)// 遍历表,将表名加入组合框
+ {
+ comboBoxLayers.Items.Add(tb.TableName);
+ }
+ }
+ }
+
+ private void ComboBoxLayers_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (comboBoxLayers.SelectedIndex > -1)//选项有效
+ {
+ selectedTable = Tables.ElementAt(comboBoxLayers.SelectedIndex);//根据索引取得表对象
+ if(selectedTable !=null)
+ {
+ listBoxFields.Items.Clear();//清空字段组合框内容
+ foreach (Field fld in selectedTable.Fields)//遍历表字段集合,将字段名加入组合框
+ {
+ listBoxFields.Items.Add(fld.Name);
+ }
+ }
+ }
+ }
+
+
+ private async void ListBoxFields_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (selectedTable !=null && listBoxFields.SelectedIndex > -1)//选项有效
+ {
+ Field selectedField =
+ selectedTable.Fields.ElementAt(listBoxFields.SelectedIndex);//取得索引的字段
+ FeatureQueryResult result = await selectedTable.QueryFeaturesAsync(new
+ QueryParameters());//构建查询参数对象在表对象上进行查询
+ if (result == null) return;
+ listBoxFieldValue.Items.Clear();//清空字段值列表框内容
+ foreach (Feature ft in result)//遍历查询结果
+ {
+ string strValue = ft.GetAttributeValue(selectedField).ToString();//取得当前字段值
+ if (!listBoxFieldValue.Items.Contains(strValue))//检查该值是否已存在
+ {
+ listBoxFieldValue.Items.Add(strValue);//加入字段值列表框
+ }
+ }
+ }
+ }
+
+ private void ListBoxFields_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (listBoxFields.SelectedIndex > -1)//选择项有效
+ {
+ string strSelField = listBoxFields.SelectedItem.ToString();
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text ," ", strSelField); //将所选项填入文本框中
+ }
+ }
+
+
+ private void ListBoxFieldValue_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (listBoxFieldValue.SelectedIndex > -1)//所选项有效
+ {
+ string strSelValue = listBoxFieldValue.SelectedItem.ToString();
+ if(textBoxWhere.Text.EndsWith("and") || textBoxWhere.Text.EndsWith("or"))//如果文本框字符串结尾为and和or则返回
+ {
+ return;
+ }
+ else
+ {
+ int idx = textBoxWhere.Text.LastIndexOf("'"); //查找最后一个'符号
+ int idx2 = textBoxWhere.Text.LastIndexOf("%"); //如果为模糊查询,则插入值在%号前面
+ if (idx2 > 0)
+ idx = idx2;
+ if (idx > 0)
+ {
+ textBoxWhere.Text = textBoxWhere.Text.Insert(idx, strSelValue); //在文本框字符串中插入字段值
+ }
+ }
+ }
+ }
+
+ private void OperatorButtonClick(object sender, RoutedEventArgs e)
+ {
+ Button btn = (Button)sender;//获取button按钮对象
+ switch (btn.Name)//根据button对象的名称来判断当前按下的按钮
+ {
+ case "buttonEqual"://等于
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "= ''");
+ break;
+ case "buttonNotEqual"://不等
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "<> ''");
+ break;
+ case "buttonLike"://模糊谓词like
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "like '%%'");
+ break;
+ case "buttonLessThan"://小于
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "< ''");
+ break;
+ case "buttonLessEqual"://小于等于
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "<= ''");
+ break;
+ case "buttonAnd"://与谓词and
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "and");
+ break;
+ case "buttonGreaterThan"://大于
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "> ''");
+ break;
+ case "buttonGreaterEqual"://大于等于
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", ">= ''");
+ break;
+ case "buttonOr"://或谓词or
+ textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "or");
+ break;
+ }
+ }
+
+ private async void ButtonBase_OK_OnClick(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = true;//设置窗体对话框退出时的结果为true
+ if (selectedTable != null)//当前选择的表对象存在
+ {
+ QueryParameters qParams = new QueryParameters();//创建查询参数对象
+ qParams.WhereClause = textBoxWhere.Text.Trim();//获取文本框中的字符串作为查询参数对象的where子句
+ FeatureQueryResult result =await selectedTable.QueryFeaturesAsync(qParams);//在表上进行查询
+ if(result != null)//查询结果不为空
+ {
+ QueryResultWindow qsw = new QueryResultWindow();//构造查询结果窗体对象
+ qsw.FeatureQuerySet = result;//设置查询结果对象引用
+ qsw.ShowDialog(); //以对话框形式显示窗体
+ }
+ }
+ }
+
+
+ private void ButtonBase_Cancel_OnClick(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = false;
+ }
+ }
+}
diff --git a/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml b/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml
new file mode 100644
index 0000000..91cf60c
--- /dev/null
+++ b/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
diff --git a/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml.cs b/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml.cs
new file mode 100644
index 0000000..a671fe6
--- /dev/null
+++ b/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Esri.ArcGISRuntime.Data;
+
+namespace GisDevelop_Exp
+{
+ ///
+ /// Interaction logic for LocationQueryResultsWindow.xaml
+ ///
+ public partial class ExtentLocationQueryResultsWindow : Window
+ {
+ public List resultCollection;//地图识别操作结果集合
+ private bool isClosed;//窗体关闭标记
+ private QueryResult curSelLayer;//当前选择的图层
+
+ public List ResultCollection
+ {
+ get => resultCollection;
+ set => resultCollection = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ public bool IsClosed
+ {
+ get { return isClosed; }
+ }
+
+ public ExtentLocationQueryResultsWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void LocationQueryResultsWindow_OnActivated(object? sender, EventArgs e)
+ {
+ if(resultCollection!=null)//查询结果集不为空
+ {
+ comboBoxLayer.Items.Clear();//清空图层组合框的内容
+ foreach (QueryResult result in resultCollection)
+ {
+ comboBoxLayer.Items.Add(result.Name);
+ }
+
+ QueryResult firstQueryResult = resultCollection.First();//获取第一个集合中第一个图层
+ curSelLayer = firstQueryResult;
+ List> selFeatures = firstQueryResult.Attributes;//获取图层中所有要素
+ comboBoxRecord.Items.Clear();//清空记录组合框的内容
+ for(int i = 1; i <= selFeatures.Count; i++)
+ {
+ comboBoxRecord.Items.Add(i);//遍历要素集合,为记录组合框添加项
+ }
+ IDictionary firstAttribute = selFeatures.First();//取得要素集合中第一个要素
+ dataGridContent.AutoGenerateColumns = true;//数据格网对象自动生成列
+ dataGridContent.ItemsSource = firstAttribute;//设置数据格网中项的数据源
+ comboBoxLayer.SelectedIndex = 0;
+ comboBoxRecord.SelectedIndex = 0;
+ }
+ }
+
+ private void LocationQueryResultsWindow_OnClosed(object? sender, EventArgs e)
+ {
+ isClosed = true;
+ }
+
+ private void ComboBoxLayer_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if(comboBoxLayer.SelectedIndex>-1)//索引有效
+ {
+ curSelLayer = resultCollection[comboBoxLayer.SelectedIndex];//取得索引对应的要素图层
+ comboBoxRecord.Items.Clear();//清空记录组合框的 内容
+ for(int i = 1; i <= curSelLayer.Attributes.Count; i++)
+ {
+ comboBoxRecord.Items.Add(i);//遍历图层记录数,为记录组合框添加项
+ }
+ IDictionary curAttribute = curSelLayer.Attributes.First();//取得记录集中的第一个要素
+ dataGridContent.ItemsSource = curAttribute;//设置数据格网对象中项的数据源
+ comboBoxRecord.SelectedIndex = 0;
+ }
+ }
+
+ private void ComboBoxRecord_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if(curSelLayer !=null && comboBoxRecord.SelectedIndex > -1)//当前图层不为空,所选记录索引有效
+ {
+ IDictionary curAttribute =
+ curSelLayer.Attributes[comboBoxRecord.SelectedIndex];//获取索引所在要素
+ dataGridContent.ItemsSource = curAttribute;//设置数据格网对象中项的数据源
+ }
+ }
+ }
+}
diff --git a/GisDevelop_Exp/GisDevelop_Exp.csproj b/GisDevelop_Exp/GisDevelop_Exp.csproj
index 61b8517..a4d043f 100644
--- a/GisDevelop_Exp/GisDevelop_Exp.csproj
+++ b/GisDevelop_Exp/GisDevelop_Exp.csproj
@@ -16,4 +16,19 @@
+
+
+ MSBuild:Compile
+ Wpf
+ Designer
+
+
+
+
+
+ Code
+ ExtentLocationQueryResultsWindow.xaml
+
+
+
diff --git a/GisDevelop_Exp/LocationQueryResultsWindow.xaml b/GisDevelop_Exp/LocationQueryResultsWindow.xaml
new file mode 100644
index 0000000..dd4a428
--- /dev/null
+++ b/GisDevelop_Exp/LocationQueryResultsWindow.xaml
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/GisDevelop_Exp/LocationQueryResultsWindow.xaml.cs b/GisDevelop_Exp/LocationQueryResultsWindow.xaml.cs
new file mode 100644
index 0000000..f6b5916
--- /dev/null
+++ b/GisDevelop_Exp/LocationQueryResultsWindow.xaml.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Esri.ArcGISRuntime.Data;
+
+namespace GisDevelop_Exp
+{
+ ///
+ /// Interaction logic for LocationQueryResultsWindow.xaml
+ ///
+ public partial class LocationQueryResultsWindow : Window
+ {
+ private IReadOnlyList resultCollection;//地图识别操作结果集合
+ private bool isClosed;//窗体关闭标记
+ private IdentifyLayerResult curSelLayer;//当前选择的图层
+ public IReadOnlyList ResultCollection
+ {
+ get { return resultCollection; }
+ set { resultCollection = value; }
+ }
+ public bool IsClosed
+ {
+ get { return isClosed; }
+ }
+
+ public LocationQueryResultsWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void LocationQueryResultsWindow_OnActivated(object? sender, EventArgs e)
+ {
+ if(resultCollection!=null)//查询结果集不为空
+ {
+ comboBoxLayer.Items.Clear();//清空图层组合框的内容
+ foreach (IdentifyLayerResult result in resultCollection)//遍历集合
+ {
+ comboBoxLayer.Items.Add(result.LayerContent.Name);//添加图层名到图层组合框
+ }
+ IdentifyLayerResult firstLayerResult = resultCollection.First();//获取第一个集合中第一个图层
+ IReadOnlyList selFeatures = firstLayerResult.GeoElements;//获取图层中所有要素
+ comboBoxRecord.Items.Clear();//清空记录组合框的内容
+ for(int i = 1; i <= selFeatures.Count; i++)
+ {
+ comboBoxRecord.Items.Add(i);//遍历要素集合,为记录组合框添加项
+ }
+ Feature ft = (Feature)selFeatures.First();//取得要素集合中第一个要素
+ dataGridContent.AutoGenerateColumns = true;//数据格网对象自动生成列
+ dataGridContent.ItemsSource = ft.Attributes;//设置数据格网中项的数据源
+ comboBoxLayer.SelectedIndex = 0;
+ comboBoxRecord.SelectedIndex = 0;
+ }
+ }
+
+ private void LocationQueryResultsWindow_OnClosed(object? sender, EventArgs e)
+ {
+ isClosed = true;
+ }
+
+
+ private void ComboBoxLayer_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if(comboBoxLayer.SelectedIndex>-1)//索引有效
+ {
+ curSelLayer = resultCollection[comboBoxLayer.SelectedIndex];//取得索引对应的要素图层
+ comboBoxRecord.Items.Clear();//清空记录组合框的 内容
+ for(int i = 1; i <= curSelLayer.GeoElements.Count; i++)
+ {
+ comboBoxRecord.Items.Add(i);//遍历图层记录数,为记录组合框添加项
+ }
+ Feature ft = (Feature ) curSelLayer.GeoElements.First();//取得记录集中的第一个要素
+ dataGridContent.ItemsSource = ft.Attributes;//设置数据格网对象中项的数据源
+ comboBoxRecord.SelectedIndex = 0;
+ }
+ }
+
+ private void ComboBoxRecord_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if(curSelLayer !=null && comboBoxRecord.SelectedIndex > -1)//当前图层不为空,所选记录索引有效
+ {
+ Feature ft = (Feature )
+ curSelLayer.GeoElements[comboBoxRecord.SelectedIndex];//获取索引所在要素
+ dataGridContent.ItemsSource = ft.Attributes;//设置数据格网对象中项的数据源
+ }
+ }
+ }
+}
diff --git a/GisDevelop_Exp/MainWindow.xaml b/GisDevelop_Exp/MainWindow.xaml
index 9eb98cf..07de407 100644
--- a/GisDevelop_Exp/MainWindow.xaml
+++ b/GisDevelop_Exp/MainWindow.xaml
@@ -58,7 +58,7 @@
@@ -67,7 +67,7 @@
+ MouseRightButtonDown="MainMapView_OnMouseRightButtonDown"/>
_basemapOptions = new Dictionary()
{
@@ -161,14 +166,12 @@ namespace GisDevelop_Exp
for (int i = 0; i < fileDialog.FileNames.Length; i++)
{
String filePath = fileDialog.FileNames.GetValue(i).ToString();
-
ShapefileFeatureTable openedFeature = await ShapefileFeatureTable.OpenAsync(filePath);
FeatureLayer opendFeatureLayer = new FeatureLayer(openedFeature);
MainMapView.Map.OperationalLayers.Add(opendFeatureLayer);
await MainMapView.SetViewpointGeometryAsync(openedFeature.Extent);
}
}
-
AddLayerNameToList();
}
@@ -1008,7 +1011,7 @@ namespace GisDevelop_Exp
}
}
- if(selByGeometryType == 1)//检查是否为按照位置查询中的点选
+ if(m_CurOper == CURRENTOPERATION.ClickQuery)//检查是否为按照位置查询中的点选
{
IInputElement ie = (IInputElement)sender;//转换事件宿主对象为IInputElement对象
IReadOnlyList< IdentifyLayerResult> results =await
@@ -1029,6 +1032,81 @@ namespace GisDevelop_Exp
locationQueryResultsWindow.Activate();//使子窗体处于激活状态
}
}
+ else if (m_CurOper == CURRENTOPERATION.ExtentQuery)
+ {
+ if (_startLocation == null)
+ {
+ MainMapView.GraphicsOverlays.Clear();
+ this._startLocation = location;
+ }
+ else
+ {
+ MapPoint _curLocation = location;
+ List extentPoints = new List();
+ extentPoints.Add(new MapPoint(_startLocation.X, _startLocation.Y));
+ extentPoints.Add(new MapPoint(_startLocation.X, location.Y));
+ extentPoints.Add(new MapPoint(location.X, location.Y));
+ extentPoints.Add(new MapPoint(location.X, _startLocation.Y));
+ Polygon polygon = new Polygon(extentPoints);
+ 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);
+ Graphic polygonGraphic = new Graphic(polygon, fillSymbol);
+ MainMapView.GraphicsOverlays.Add(new GraphicsOverlay());
+ MainMapView.GraphicsOverlays[0].Graphics.Add(polygonGraphic);
+
+ Envelope selEnv = new Envelope(this._startLocation.X, this._startLocation.Y, location.X,
+ location.Y, MainMapView.SpatialReference);
+ QueryParameters pQueryPara = new QueryParameters();
+ pQueryPara.Geometry = selEnv;
+ pQueryPara.SpatialRelationship = SpatialRelationship.Intersects;
+ // _featureLayer = MainMapView.Map.OperationalLayers[0] as FeatureLayer;
+ List queryResults = new List();
+ foreach (FeatureLayer featureLayer in MainMapView.Map.OperationalLayers)
+ {
+ await featureLayer.SelectFeaturesAsync(pQueryPara,
+ Esri.ArcGISRuntime.Mapping.SelectionMode.New);
+
+ FeatureQueryResult pQueryResult = await featureLayer.GetSelectedFeaturesAsync();
+
+ List pListFeatures = pQueryResult.ToList();
+ if (pListFeatures.Count <= 0)
+ {
+ return;
+ }
+
+ EnvelopeBuilder pEnvBuilder = new EnvelopeBuilder(featureLayer.SpatialReference);
+ for (int i = 0; i < pListFeatures.Count; i++)
+ {
+ pEnvBuilder.UnionOf(pListFeatures[i].Geometry.Extent);
+ }
+
+ await MainMapView.SetViewpointGeometryAsync(pEnvBuilder.ToGeometry(), 50);
+ Feature pFeature;
+ string sInfo = "";
+ IReadOnlyList pFields = pQueryResult.Fields;
+ string featureLayerName = featureLayer.Name;
+ List> attributes = new List>();
+ for (int i = 0; i < pListFeatures.Count; i++)
+ {
+ pFeature = pListFeatures[i];
+ IDictionary FeatureAttri = pFeature.Attributes;
+ string featureName = pFeature.FeatureTable.Layer.Name;
+ attributes.Add(FeatureAttri);
+ }
+ queryResults.Add(new QueryResult(featureLayerName, attributes));
+ }
+
+ ExtentLocationQueryResultsWindow resultsWindow = new ExtentLocationQueryResultsWindow();
+ resultsWindow.resultCollection = queryResults;
+ resultsWindow.Show();
+ resultsWindow.Activate();
+ MainMapView.GraphicsOverlays.Clear();
+ _startLocation = null;
+ }
+ }
}
private void Menu_Layers_Options_OnClick(object sender, RoutedEventArgs e)
@@ -1559,8 +1637,14 @@ namespace GisDevelop_Exp
private void Menu_Query_Point_OnClick(object sender, RoutedEventArgs e)
{
selByGeometryType = 1;//设置其值为1
+ m_CurOper = CURRENTOPERATION.ClickQuery;
+ }
+
+
+ private void Menu_Query_Envelope_OnClick(object sender, RoutedEventArgs e)
+ {
+ selByGeometryType = 2;//设置其值为2
+ m_CurOper = CURRENTOPERATION.ExtentQuery;
}
-
-
}
}
\ No newline at end of file
diff --git a/GisDevelop_Exp/QueryResult.cs b/GisDevelop_Exp/QueryResult.cs
new file mode 100644
index 0000000..6682a72
--- /dev/null
+++ b/GisDevelop_Exp/QueryResult.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+
+namespace GisDevelop_Exp;
+
+public class QueryResult
+{
+ private string name;
+ private List> attributes;
+
+ public QueryResult(string name, List> Attributes)
+ {
+ this.name = name;
+ this.attributes = Attributes;
+ }
+
+ public string Name
+ {
+ get => name;
+ set => name = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ public List> Attributes
+ {
+ get => attributes;
+ set => attributes = value ?? throw new ArgumentNullException(nameof(value));
+ }
+}
\ No newline at end of file
diff --git a/GisDevelop_Exp/QueryResultWindow.xaml b/GisDevelop_Exp/QueryResultWindow.xaml
new file mode 100644
index 0000000..dbd1507
--- /dev/null
+++ b/GisDevelop_Exp/QueryResultWindow.xaml
@@ -0,0 +1,14 @@
+
+
+
diff --git a/GisDevelop_Exp/QueryResultWindow.xaml.cs b/GisDevelop_Exp/QueryResultWindow.xaml.cs
new file mode 100644
index 0000000..ee30ae8
--- /dev/null
+++ b/GisDevelop_Exp/QueryResultWindow.xaml.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Esri.ArcGISRuntime.Data;
+using Esri.ArcGISRuntime.Mapping;
+
+namespace GisDevelop_Exp
+{
+ ///
+ /// Interaction logic for QueryResultWindow.xaml
+ ///
+ public partial class QueryResultWindow : Window
+ {
+ public QueryResultWindow()
+ {
+ InitializeComponent();
+ }
+
+ private FeatureQueryResult featureQuerySet; //查询结果集合
+ public FeatureQueryResult FeatureQuerySet
+ {
+ get { return featureQuerySet; }
+ set { featureQuerySet = value; }
+ }
+
+ private void QueryResultWindow_OnLoaded(object sender, RoutedEventArgs e)
+ {
+ if (featureQuerySet != null)//结果不为空
+ {
+ dataGridResult.AutoGenerateColumns = true;//数据格网控件自动生成列
+ for(int i=1;i<= featureQuerySet.Count();i++)
+ {
+ comboBoxSelectionCount.Items.Add(i);//按照查询结果集中要素的数目为组合框添加项
+ }
+ Feature ft = featureQuerySet.First();//取得查询结果集合中第一个要素
+ dataGridResult.ItemsSource = ft.Attributes;//设置数据格网对象中项的数据源
+ // ft.FeatureTable.FeatureLayer.SelectFeature(ft);
+ comboBoxSelectionCount.SelectedIndex = 0;
+ ((FeatureLayer)ft.FeatureTable.Layer).SelectFeature(ft);
+ }
+ }
+
+
+ private void ComboBoxSelectionCount_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (featureQuerySet != null)//查询结果集不为空
+ {
+ int idx = comboBoxSelectionCount.SelectedIndex;//获得选择项的索引
+ if (idx > -1)
+ {
+ Feature ft = featureQuerySet.ElementAt(idx);//获取索引所在的要素对象
+ dataGridResult.ItemsSource = ft.Attributes;//设置数据格网对象中项的数据源
+ // ft.FeatureTable.FeatureLayer.ClearSelection();//清空图层中的原有的选择
+ // ft.FeatureTable.FeatureLayer.SelectFeature(ft);//在图层中重新选择当前所选要素
+ }
+ }
+ }
+ }
+}