Example #1
0
        /// <summary>
        /// Opens the geodatabase.
        /// </summary>
        /// <param name="sPath">The s path.</param>
        /// <param name="imageListBoxControl1">The image ListBox control1.</param>
        /// <param name="type">The type.</param>
        /// <param name="pWorkspaceList">The p workspace list.</param>
        /// <param name="geometryType">Type of the geometry.</param>
        /// <param name="bAppend">if set to <c>true</c> [b append].</param>
        /// <param name="bAddTable">if set to <c>true</c> [b add table].</param>
        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);

            if (workspace != null)
            {
                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);
                        }
                    }
                }
                finally
                {
                    imageListBoxControl1.EndUpdate();
                }
            }
        }
Example #2
0
 /// <summary>
 /// Adds the feature class to ListBox.
 /// </summary>
 /// <param name="pWorkspace">The p workspace.</param>
 /// <param name="imageListBoxControl1">The image ListBox control1.</param>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="geometryType">Type of the geometry.</param>
 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);
     }
 }
Example #3
0
 /// <summary>
 /// Lists the SHP files.
 /// </summary>
 /// <param name="sPath">The s path.</param>
 /// <param name="imageListBoxControl1">The image ListBox control1.</param>
 /// <param name="pWorkspaceList">The p workspace list.</param>
 /// <param name="geometryType">Type of the geometry.</param>
 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);
     }
 }