コード例 #1
0
        //3/10/2009	删除工作空间内的所有要素类
        public static void DeleteAllFeatCls(IWorkspace pworkspace)
        {
            IEnumDataset    pEnumFeatDataset = default(IEnumDataset);
            IDataset        pDataset         = default(IDataset);
            IFeatureDataset pFeatDataset     = default(IFeatureDataset);

            pEnumFeatDataset = pworkspace.get_Datasets(esriDatasetType.esriDTAny);
            pEnumFeatDataset.Reset();
            pDataset = pEnumFeatDataset.Next();
            while ((pDataset != null))
            {
                if (pDataset.CanDelete())
                {
                    if (pDataset.Type == esriDatasetType.esriDTFeatureDataset)
                    {
                        pFeatDataset = (IFeatureDataset)pDataset;
                        pFeatDataset.Delete();
                    }
                    else
                    {
                        pDataset.Delete();
                    }
                    //pDataset.Delete()
                    pDataset = pEnumFeatDataset.Next();
                }
            }
        }
コード例 #2
0
ファイル: Member.cs プロジェクト: johnforrest/GeoCoding
        /// <summary>
        /// 删除工作空间里的所有要素
        /// </summary>
        /// <param name="workspace">工作空间</param>
        public void DeleteAllFeatureClass(IWorkspace workspace)
        {
            IEnumDataset enumDataset = workspace.get_Datasets(esriDatasetType.esriDTAny);

            enumDataset.Reset();
            IDataset dataset = enumDataset.Next();

            while (dataset != null)
            {
                if (dataset.CanDelete())
                {
                    if (dataset.Type == esriDatasetType.esriDTFeatureDataset)
                    {
                        IFeatureDataset featureDataset = dataset as IFeatureDataset;
                        featureDataset.Delete();
                    }
                    else
                    {
                        dataset.Delete();
                    }
                    dataset = enumDataset.Next();
                }
            }
        }
コード例 #3
0
ファイル: ProjectTransactionCmd.cs プロジェクト: EAWCS1/SUITT
        private static void WriteOutputBack(IFeatureDataset theInFDataset, IFeatureDataset theOutFDataset)
        {
            //Debug.Print("Can delete " + theInFDataset.Name + "? " + theInFDataset.CanDelete());
            //Debug.Print("Can rename " + theOutFDataset.Name + "? " + theOutFDataset.CanRename());
            string origName = theInFDataset.Name;
            theInFDataset.Delete();
            theOutFDataset.Rename(origName);

            IEnumDataset theEnumDS = theOutFDataset.Subsets;
            IDataset theDS = theEnumDS.Next();

            while (theDS != null)
            {
                //Debug.Print("Need to rename " + theDS.Name);

                string theNewName = theDS.Name;
                while (theNewName.EndsWith("_1"))
                    theNewName = theNewName.Substring(0, theNewName.Length - 2);

                theDS.Rename(theNewName);
                //Debug.Print("Renamed to " + theNewName);
                theDS = theEnumDS.Next();
            }
        }