Ejemplo n.º 1
0
        public static List <string> GetRasterNames(string sPath, List <WorkspaceInfo> pWorkspaceList)
        {
            IWorkspace    workspace = ControlAPI.GetWorkspace(sPath, DataType.raster, pWorkspaceList);
            List <string> result;

            if (workspace == null)
            {
                result = null;
            }
            else
            {
                List <string>    list            = new List <string>();
                IEnumDatasetName enumDatasetName = workspace.get_DatasetNames(esriDatasetType.esriDTRasterDataset);
                try
                {
                    IDatasetName datasetName;
                    while ((datasetName = enumDatasetName.Next()) != null)
                    {
                        list.Add(datasetName.Name);
                    }
                    result = list;
                }
                finally
                {
                    if (enumDatasetName != null)
                    {
                        Marshal.ReleaseComObject(enumDatasetName);
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 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);
     }
 }