public static void OpenGeodatabase(string sPath, ImageListBoxControl imageListBoxControl1, DataType type, List <WorkspaceInfo> pWorkspaceList, esriGeometryType geometryType, bool bAppend = false, bool bAddTable = false) { IWorkspace workspace = ControlAPI.GetWorkspace(sPath, type, pWorkspaceList); imageListBoxControl1.BeginUpdate(); try { if (!bAppend) { imageListBoxControl1.Items.Clear(); } if (workspace != null) { ControlAPI.AddFeatureDatasetToListBox(workspace, imageListBoxControl1, type); ControlAPI.AddFeatureClassToListBox(workspace, imageListBoxControl1, type, geometryType); if (bAddTable) { ControlAPI.AddTableToListBox(workspace, imageListBoxControl1); } } } catch { XtraMessageBox.Show("无效的数据,加载数据失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } finally { imageListBoxControl1.EndUpdate(); } }
public static void AddFeatureClassToListBox(IWorkspace pWorkspace, ImageListBoxControl imageListBoxControl1, DataType dataType, esriGeometryType geometryType) { if (pWorkspace != null) { IEnumDatasetName pEnumDatasetName = pWorkspace.get_DatasetNames(esriDatasetType.esriDTFeatureClass); ControlAPI.AddFeatureClassToListBox(pEnumDatasetName, imageListBoxControl1, dataType, geometryType); } }
public static void ListShpFiles(string sPath, ImageListBoxControl imageListBoxControl1, List <WorkspaceInfo> pWorkspaceList, esriGeometryType geometryType) { string[] files = Directory.GetFiles(sPath, "*.shp"); if (files != null && files.Length != 0) { IWorkspace workspace = ControlAPI.GetWorkspace(sPath, DataType.shp, pWorkspaceList); ControlAPI.AddFeatureClassToListBox(workspace, imageListBoxControl1, DataType.shp, geometryType); } }