当前位置: 首页>>代码示例>>C#>>正文


C# FeatureLayer.GetSelection方法代码示例

本文整理汇总了C#中FeatureLayer.GetSelection方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureLayer.GetSelection方法的具体用法?C# FeatureLayer.GetSelection怎么用?C# FeatureLayer.GetSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FeatureLayer的用法示例。


在下文中一共展示了FeatureLayer.GetSelection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSelectedFeatures

 private async void GetSelectedFeatures(FeatureLayer selectedFeatureLayer)
 {
     //Get the active map view.
     var mapView = MapView.Active;
     if (mapView == null || selectedFeatureLayer == null) return;
     await QueuedTask.Run(() =>
     {
         // Get all selected features for selectedFeatureLayer
         // and populate a datatable with data and column headers
         var resultTable = new DataTable();
         using (var rowCursor = selectedFeatureLayer.GetSelection().Search(null))
         {
             bool bDefineColumns = true;
             while (rowCursor.MoveNext())
             {
                 var anyRow = rowCursor.Current;
                 if (bDefineColumns)
                 {
                     foreach (var fld in anyRow.GetFields().Where(fld => fld.FieldType != FieldType.Geometry))
                     {
                         resultTable.Columns.Add(new DataColumn(fld.Name, typeof(string)) { Caption = fld.AliasName });
                     }
                 }
                 var addRow = resultTable.NewRow();
                 foreach (var fld in anyRow.GetFields().Where(fld => fld.FieldType != FieldType.Geometry))
                 {
                     addRow[fld.Name] = (anyRow[fld.Name] == null) ? string.Empty : anyRow[fld.Name].ToString();
                 }
                 resultTable.Rows.Add(addRow);
                 bDefineColumns = false;
             }
         }
         lock (_lockSelectedFeaturesDataTable) _selectedFeaturesDataTable = resultTable;
     }).ContinueWith(t =>
     {
         if (t.Exception != null)
         {
             var aggException = t.Exception.Flatten();
             foreach (var exception in aggException.InnerExceptions)
                 System.Diagnostics.Debug.WriteLine(exception.Message);
         }
     });
     NotifyPropertyChanged(() => SelectedFeatureDataTable);
 }
开发者ID:ChaitG,项目名称:arcgis-pro-sdk-community-samples,代码行数:44,代码来源:AttributeDockpaneViewModel.cs


注:本文中的FeatureLayer.GetSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。