using ESRI.ArcGIS.esriSystem; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.Geometry; using KGIS.Framework.Maps; using KGIS.Framework.OpenData.Control; using KGIS.Framework.OpenData.Filter; using KGIS.Framework.OpenData.InterFace; using KGIS.Framework.Utils; using Kingo.Plugin.BGResultManager.ViewModel; using Kingo.PluginServiceInterface; using System.Collections.Generic; using System.Windows; namespace Kingo.Plugin.BGResultManager.View { /// /// FrmBGDataImport.xaml 的交互逻辑 /// public partial class FrmBGDataImport : BaseWindow { private IGeometry _SelectedGeo { get; set; } public FrmBGDataImport() { InitializeComponent(); if ((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ProjSuffix == ".KBG") { DataContext = new ImportBGDataViewModel(this); } } private void BtnSelectedFWData_Click(object sender, RoutedEventArgs e) { // 获取源数据 OpenDataDialog pDialog = new OpenDataDialog(); ISpatialDataObjectFilter pOFilter; pOFilter = new FilterFeatureDatasetsAndFeatureClasses(); pDialog.AddFilter(pOFilter, true); pDialog.Title = "选择划入范围数据"; pDialog.AllowMultiSelect = false; pDialog.RestoreLocation = true; pDialog.StartLocation = pDialog.FinalLocation; if (pDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && pDialog.Selection.Count > 0) { List distObj = pDialog.Selection; foreach (var obj in distObj) { if (obj.DatasetType == esriDatasetType.esriDTFeatureClass) { IFeatureClass fc = (obj.DatasetName as IName).Open() as IFeatureClass; if (fc != null) { IFeatureCursor cur = fc.Search(null, true); IFeature f = null; while ((f = cur.NextFeature()) != null) { _SelectedGeo = f.ShapeCopy; break; } } this.btnSelectedFWPath.EditValue = obj.FullName; } } } } private void btnCancel_Click(object sender, RoutedEventArgs e) { Close(); } } }