当前位置: 首页>>代码示例>>C#>>正文


C# IWorkspace.get_Datasets方法代码示例

本文整理汇总了C#中IWorkspace.get_Datasets方法的典型用法代码示例。如果您正苦于以下问题:C# IWorkspace.get_Datasets方法的具体用法?C# IWorkspace.get_Datasets怎么用?C# IWorkspace.get_Datasets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWorkspace的用法示例。


在下文中一共展示了IWorkspace.get_Datasets方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckForMissingDataSources

        public static void CheckForMissingDataSources(IWorkspace theWorkspace)
        {
            // This will create a list of unique DataSource entries, and check that each is available in the DataSources table.
            //  Should output a table detailing which DataSources there are, and which are not included in the DataSources table.

            // Make a collection to house all the unique DataSources
            System.Collections.ArrayList uniqueDs = new System.Collections.ArrayList();

            #region Top Level Datasets
            // Get the Dataset names for every dataset in the workspace.
            IEnumDataset workspaceDatasets = theWorkspace.get_Datasets(esriDatasetType.esriDTAny);
            uniqueDs = AddUniques(workspaceDatasets, uniqueDs);
            #endregion

            #region Check for Feature Datasets
            IEnumDataset featureDatasets = theWorkspace.get_Datasets(esriDatasetType.esriDTFeatureDataset);

            IDataset aFeatureDataset = featureDatasets.Next();
            while (aFeatureDataset != null)
            {
                IFeatureDataset thisFeatureDs = (IFeatureDataset)aFeatureDataset;
                IEnumDataset internalDatasets = thisFeatureDs.Subsets;
                uniqueDs = AddUniques(internalDatasets, uniqueDs);
                aFeatureDataset = featureDatasets.Next();
            }
            #endregion

            #region Check which are in the DataSources Table
            Dictionary<string, bool> validatedIds = CheckEachEntry(uniqueDs, theWorkspace);
            #endregion

            #region Generate an output
            // Output to Debug window

            //Generate WHERE clause to select from AZGeology
            string whereClause = "SysGUID = '";

            foreach (KeyValuePair<string,bool> anId in validatedIds)
            {
                System.Diagnostics.Debug.WriteLine(anId.Key + ": " + ((anId.Value == false) ? "Not Available" : "In DataSources Table"));
                if (anId.Value == false) { whereClause += anId.Key + "' OR SysGUID = '"; }
            }

            if (whereClause == "SysGUID = '")
            {
                System.Diagnostics.Debug.WriteLine("All Data Sources Are Accounted For!");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(whereClause.Remove(whereClause.Length - 15));
            }
            #endregion
        }
开发者ID:genhan2011,项目名称:ncgmp-toolbar,代码行数:53,代码来源:dataSourceChecker.cs

示例2: GetFeatureClassByName

 public static IFeatureClass GetFeatureClassByName(IWorkspace mWorkSpace, string name)
 {
     IFeatureClass pclass = null;
     IEnumDataset enumData = mWorkSpace.get_Datasets(esriDatasetType.esriDTFeatureClass);
     IDataset dataset = enumData.Next();
     while (dataset != null)
     {
         if (dataset.Name.Equals(name))
         {
             pclass = (IFeatureClass)dataset;
             break;
         }
         dataset = enumData.Next();
     }
     return pclass;
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:16,代码来源:DataEditCommon.cs

示例3: FindFeatureClassByName

		private IFeatureClass FindFeatureClassByName(IWorkspace workspace, string name, Microsoft.VisualBasic.Collection colFCByName)
		{
			IFeatureClass esriFeatureClass = null;

			try
			{
				// try to retrieve FeatureClass in collection
				esriFeatureClass = (IFeatureClass)colFCByName[name];
				return esriFeatureClass;
			}
			catch { }

			IEnumDataset enumDatasets;
			IDataset esriDataset;
			IFeatureClassContainer featContainer;

			// get datasets
			enumDatasets = workspace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
			enumDatasets.Reset();
			esriDataset = enumDatasets.Next();
			while (esriDataset != null)
			{
				// try to find class in dataset
				try
				{
					featContainer = (IFeatureClassContainer)esriDataset;
					// get FeatureClass from current dataset
					esriFeatureClass = featContainer.get_ClassByName(name);
					if (esriFeatureClass != null)
					{
						// if exists add to collection and quit
						colFCByName.Add(esriFeatureClass, name, null, null);
						return esriFeatureClass;
					}
				}
				catch { }
				// try another dataset
				esriDataset = enumDatasets.Next();
			}

			try
			{
				// try to find FeatureClass in workspace
				featContainer = (IFeatureClassContainer)workspace;
				esriFeatureClass = featContainer.get_ClassByName(name);
				if (esriFeatureClass != null)
				{
					// if exists add to collection and quit
					colFCByName.Add(esriFeatureClass, name, null, null);
					return esriFeatureClass;
				}
			}
			catch { }
			return null;
		}
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:55,代码来源:ElementFeatureAssociation.cs

示例4: WorkspaceCleanout

        protected string WorkspaceCleanout(IWorkspace theWorkspace, string errorFCName)
        {
            if (theWorkspace == null)
                return "Null workspace passed to WorkspaceCleanout";

            // Loop through all datasets. Kill if it isn't the error FC
            IEnumDataset theEnumDS = theWorkspace.get_Datasets(esriDatasetType.esriDTAny);
            IDataset theDataset = theEnumDS.Next();

            while (theDataset != null)
            {
                if (theDataset.Name.ToUpper().Equals(errorFCName.ToUpper()) == false)
                    theDataset.Delete();
                else if (theDataset is IFeatureClass == false)
                    theDataset.Delete();

                theDataset = theEnumDS.Next();
            }
            return null;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:20,代码来源:QAErrorStorage.cs

示例5: DeleteDatasetIfExist

 private Boolean DeleteDatasetIfExist(IWorkspace pWS, string sDatasetName)
 {
     IEnumDataset pEnumDataset = pWS.get_Datasets(esriDatasetType.esriDTAny);
     IDataset pDS = pEnumDataset.Next();
     while (pDS != null)
     {
         if (pDS.Name.ToLower() == sDatasetName.ToLower())
         {
             if (pDS.CanDelete())
             {
                 pDS.Delete();
                 return true;
             }
         }
         pDS = pEnumDataset.Next();
     }
     return false;
 }
开发者ID:afocusman,项目名称:PRSS_programYM,代码行数:18,代码来源:FrmReconstruct.cs

示例6: ResetLayerDatasource2

        /// <summary>
        /// 重置图层数据源
        /// </summary>
        /// <param name="pLayer"></param>
        /// <param name="pNewWksp"></param>
        /// <returns></returns>
        public static bool ResetLayerDatasource2(IDataLayer2 pLayer, IWorkspace pNewWksp)
        {
            if (pLayer == null || pNewWksp == null) return false;
            IEnumDataset pEnumDsName = pNewWksp.get_Datasets(esriDatasetType.esriDTFeatureDataset);
            IDataset pFtDsName = pEnumDsName.Next();
            IEnumDataset pEnumDs = pFtDsName.Subsets;
            try
            {
                if (!pLayer.InWorkspace(pNewWksp))
                {
                    IFeatureClassName pOldName = pLayer.DataSourceName as IFeatureClassName;

                    if (pOldName != null)
                    {
                        IDatasetName dsName = pOldName as IDatasetName;
                        IDataset pDs = null;
                        while ((pDs = pEnumDs.Next()) != null)
                        {
                            if (dsName.Name.Equals(pDs.Name, StringComparison.OrdinalIgnoreCase) ||
                                pDs.Name.Contains(dsName.Name.ToUpper()))
                            {
                                IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
                                if (pFeatureLayer == null) return true;
                                pFeatureLayer.FeatureClass = pDs as IFeatureClass;
                                return true;
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return false;
            }
            return true;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:44,代码来源:AEAccessFactory.cs

示例7: GetDatasetByName

        /// <summary>
        /// 根据名称获取数据库中对应图层(要素集)
        /// </summary>
        /// <params name="workspace"></params>
        /// <params name="dsName"></params>
        /// <returns></returns>
        public IDataset GetDatasetByName(IWorkspace workspace ,string dsName)
        {
            try
            {
                IEnumDataset enumDataset = workspace.get_Datasets(esriDatasetType.esriDTAny);
                IDataset dataset = enumDataset.Next();
                while (dataset != null)
                {
                    if (dataset.Name == dsName)
                    {
                        return dataset;
                    }
                    dataset = enumDataset.Next();
                }

                return null;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:28,代码来源:DrawSpecialCommon.cs

示例8: GenerateQuery

        /// <summary>
        /// (从Base库)生成Query库
        /// 默认的实现是从Base库导入
        /// </summary>
        /// <returns></returns>
        protected virtual bool GenerateQuery(IWorkspace wsBase)
        {
            string strWorkspace = this.m_TargetPath + "\\" + COMMONCONST.DB_Name_Query;
            IWorkspace wsQuery = null;
            if (!Hy.Common.Utility.Esri.AEAccessFactory.OpenPGDB(ref wsQuery, strWorkspace))
            {
                SendMessage(enumMessageType.Exception, "导入数据失败:无法打开Query库,请确认在创建任务文件结构时已创建Query库");
                return false;
            }
            //Hy.Common.Utility.Esri.AEAccessFactory.CreatePGDB(this.m_TargetPath, COMMONCONST.DB_Name_Query);
            //IFeatureDataset fdsTarget = CreateFeatureDataset(wsQuery, this.m_SpatialReference);

            Hy.Common.Utility.Esri.GPTool gpTool = new Hy.Common.Utility.Esri.GPTool();

            // 打开数据源
            if (wsBase == null)
            {
                SendMessage(enumMessageType.Exception, "创建Query库出错:无法打开Base库");

                return false;
            }

            // 获取FeatureClass名列表
            IEnumDataset enDataset = wsBase.get_Datasets(esriDatasetType.esriDTAny);
            IDataset dataset = enDataset.Next();
            while (dataset != null)
            {
                switch (dataset.Type)
                {
                    case esriDatasetType.esriDTTable:
                    case esriDatasetType.esriDTFeatureClass:
                        SendEvent(dataset.Name);
                        Hy.Common.Utility.Esri.DataConverter.ConvertTable(wsBase, wsQuery, dataset, GetObjectName(dataset.Name));
                        break;

                    case esriDatasetType.esriDTFeatureDataset:
                        IFeatureClassContainer fcContianer = dataset as IFeatureClassContainer;
                        for (int i = 0; i < fcContianer.ClassCount; i++)
                        {
                            IDataset dsSub = fcContianer.get_Class(i) as IDataset;
                            SendEvent(dsSub.Name);
                            Hy.Common.Utility.Esri.DataConverter.ConvertTable(wsBase, wsQuery, dsSub, GetObjectName(dsSub.Name));
                        }
                        break;

                    default:
                        break;
                }

                dataset = enDataset.Next();
            }

            // 释放
            enDataset = null;
            dataset = null;

            System.Runtime.InteropServices.Marshal.ReleaseComObject(wsBase);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(wsQuery);
            wsBase = null;
            wsQuery = null;
            GC.Collect();

            return true;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:69,代码来源:DefaultDataImport.cs

示例9: getElementINames

        /// <summary>
        /// returns a dictionary of elements by name/ elementobject
        /// </summary>
        /// <param name="geoDatabase">Iworkspace</param>
        /// <param name="dtype">data type</param>
        /// <returns>dicitonary key=name value=IName object</returns>
        public Dictionary<string, IName> getElementINames(IWorkspace wks, esriDatasetType dtype)
        {
            Dictionary<string,IName> lstFeatureClasses = new Dictionary<string,IName>();
            if (wks.Exists())
            {
                esriDatasetType dttype = esriDatasetType.esriDTAny;
                IEnumDataset eDatasets = wks.get_Datasets(dttype);
                IEnumDataset eDatasets2;
                IDataset dataset2;
                IDataset dataset = eDatasets.Next();
                while (dataset != null)
                {
                    dttype = dataset.Type;
                    switch (dttype)
                    {
                        case esriDatasetType.esriDTFeatureDataset:
                            eDatasets2 = dataset.Subsets;
                            dataset2 = eDatasets2.Next();
                            while (dataset2 != null)
                            {
                                if (dataset2.Type == dtype)
                                {
                                    lstFeatureClasses.Add(dataset2.BrowseName, dataset2.FullName);
                                }
                                dataset2 = eDatasets2.Next();
                            }
                            break;

                        default:
                            if (dttype == dtype)
                            {
                                lstFeatureClasses.Add(dataset.BrowseName, dataset.FullName);
                            }
                            break;
                    }
                    dataset = eDatasets.Next();
                }
            }

            return lstFeatureClasses;
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:47,代码来源:geodatabaseutility.cs

示例10: ConvertAnnotation

        /// <summary>
        /// 创建并导入注记层
        /// </summary>
        /// <param name="pInputCls"></param>
        /// <param name="Ws"></param>
        public static void ConvertAnnotation(IFeatureClass pInputCls, IWorkspace Ws)
        {
            try
            {

                IFields pFields = pInputCls.Fields;

                IEnumDataset pEnumDataset = Ws.get_Datasets(esriDatasetType.esriDTFeatureDataset);
                IFeatureDataset ipDataset = (IFeatureDataset)pEnumDataset.Next();
                IFeatureClass pOutputCls = CreateAnnotation(pInputCls, ipDataset, pFields);

                if (pOutputCls == null)
                {
                    return;
                }

                IFeatureCursor pInputCursor = pInputCls.Search(null, false);
                IFeature Inputfeature = pInputCursor.NextFeature();
                int index = -1;

                //获取输入图层的注记要素
                IElement ipElement = null;
                IAnnotationFeature ipAnno = null;
                IFeatureCursor _featureCursor;
                IFeatureBuffer _featureBuffer;
                IFields pOutputFields;
                IField ipField;
                object value;
                esriFieldType type;
                IAnnotationFeature ipAnnoOutput;
                IGeometry ipGeom;
                while (Inputfeature != null)
                {

                    if (Inputfeature.FeatureType == esriFeatureType.esriFTAnnotation)
                    {
                        ipAnno = (IAnnotationFeature)Inputfeature;
                        ipElement = ipAnno.Annotation;
                    }
                    _featureCursor = pOutputCls.Insert(true);
                    _featureBuffer = pOutputCls.CreateFeatureBuffer();

                    pOutputFields = pOutputCls.Fields;
                    for (int k = 0; k < pFields.FieldCount; k++)
                    {

                        ipField = pFields.get_Field(k);
                        value = Inputfeature.get_Value(k);
                        if (ipField.Name.ToUpper().Contains("SHAPE") || value == null || value.ToString() == "")
                        {
                            continue;

                        }
                        type = ipField.Type;
                        if (type != esriFieldType.esriFieldTypeOID && type != esriFieldType.esriFieldTypeGeometry)
                        {
                            int indexField = pOutputFields.FindField(ipField.Name);
                            try
                            {
                                _featureBuffer.set_Value(indexField, value);
                            }
                            catch(Exception exp)
                            {
                                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                            }

                        }
                        Marshal.ReleaseComObject(ipField);  //释放接口,hehy-20090303

                    }

                    //在输出图层中插入注记要素
                    ipAnnoOutput = (IAnnotationFeature)_featureBuffer;
                    ipAnnoOutput.Annotation = ipElement;
                    ipGeom = Inputfeature.ShapeCopy;
                    _featureBuffer.Shape = ipGeom;

                    _featureCursor.InsertFeature(_featureBuffer); //将输出图层中的要素保存

                    Marshal.ReleaseComObject(_featureCursor);  //释放接口,hehy-20090303
                    Marshal.ReleaseComObject(_featureBuffer);
                    Marshal.ReleaseComObject(Inputfeature);
                    Marshal.ReleaseComObject(ipAnnoOutput);

                    Inputfeature = pInputCursor.NextFeature();
                }

                Marshal.ReleaseComObject(pInputCursor);
            }
            catch(Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

            }
//.........这里部分代码省略.........
开发者ID:hy1314200,项目名称:HyDM,代码行数:101,代码来源:FeatClsOperAPI.cs

示例11: DirToGDB

        //������ţ�Raster-08
        //��������	DirToGDB
        //�������ܣ���һ���ռ��е�����RasterDataset����ȫ������IRasterCatalog�Ķ����С�
        //������
        //        pWs������RasterDataset �Ŀռ�
        //        pCatalog��IRasterCatalog
        public void DirToGDB(IWorkspace pWs, IFeatureClass pCatalog)
        {
            //IRasterWorkspaceEx pSDERasterWs;
            // pEunmDatasets;
            //IRasterCatalogItem pCatalogFeature;
            IRasterDataset pRasterDs;
            //pCursor;
            IFeatureBuffer pRow;
            //get the list of datasets in the input workspace
            IEnumDataset pEunmDatasets = pWs.get_Datasets(esriDatasetType.esriDTRasterDataset);
            pEunmDatasets.Reset();

            //load raster datasets from the input workspace
            pRasterDs = pEunmDatasets.Next() as IRasterDataset;
            IFeatureCursor pCursor = pCatalog.Insert(false);
            IRasterCatalog pCat = pCatalog as IRasterCatalog;
            IDataset pDs;
            //loop through all the datasets and load
            while (pRasterDs != null)
            {
                pDs = pRasterDs as IDataset;
                //StatusBar.Message(0) = "Loading " & pDs.Name & "......"
                pRow = pCatalog.CreateFeatureBuffer();
                //pRow.set_Value(pCat.RasterFieldIndex , createRasterValue(pRasterDs));
                pCursor.InsertFeature(pRow);
                pRasterDs = pEunmDatasets.Next() as IRasterDataset;
            }

            //cleanup
            pCatalog = null;
            //pSDERasterWs = null;
            pEunmDatasets = null;
            //pCatalogFeature = null;
            pRasterDs = null;
        }
开发者ID:chinasio,项目名称:minegis,代码行数:41,代码来源:LoadRasterToSDE.cs

示例12: PrepareForWorkspace

        private bool PrepareForWorkspace(IWorkspace wsTarget, out string strBaseName, out string strQueryName, out enumDataType baseDataType)
        {
            strBaseName = null;
            strQueryName = null;
            baseDataType = enumDataType.FileGDB;

            try
            {
                string strPath = wsTarget.PathName;
                IDataImport dataImport = new NoReferenceDataImport();
                dataImport.ImportingObjectChanged += new ImportingObjectChangedHandler(DataImport_ImportingObjectChanged);
                dataImport.Datasource = strPath;
                dataImport.TargetPath = TempPath;
                dataImport.JustCopy = true;

                // 获取空间参考
                ISpatialReference spatialRef = null;
                IEnumDataset enDataset = wsTarget.get_Datasets(esriDatasetType.esriDTAny);
                IDataset dsCurrent = enDataset.Next();
                while (dsCurrent != null)
                {
                    if (dsCurrent is IGeoDataset)
                    {
                        spatialRef = (dsCurrent as IGeoDataset).SpatialReference;
                        break;
                    }

                    dsCurrent = enDataset.Next();
                }
                dataImport.SpatialReference = spatialRef;
                enumDataType dataType = enumDataType.PGDB;

                // 设置数据类型
                string strName = System.IO.Path.GetExtension(strPath);
                if (string.IsNullOrEmpty(strName))  // Shp File
                {
                    dataType = enumDataType.SHP;
                }
                else if (strName.ToLower() == ".gdb")
                {
                    dataType = enumDataType.FileGDB;
                }
                else // MDB
                {
                    dataType = enumDataType.PGDB;
                }
                dataImport.DataType = dataType;
                if (dataType != enumDataType.PGDB)
                {
                    AEAccessFactory.CreatePGDB(TempPath, "Query.mdb");
                }

                dataImport.Import();

                // 获取Base/Query库Workspace和ADO连接
                strBaseName = (dataType == enumDataType.PGDB ? "Base.mdb" : (dataType == enumDataType.FileGDB ? "Base.gdb" : "Base"));
                strQueryName = (dataType == enumDataType.PGDB ? strBaseName : "Query.mdb");
                baseDataType = dataType;

                return true;
            }
            catch
            {
                return false;
            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:66,代码来源:ExtendChecker.cs

示例13: ConvertFeatureClass

        /// <summary>
        /// 拷贝源图层到空间数据集下的目标图层
        /// </summary>
        /// <param name="sourceWorkspace"></param>
        /// <param name="targetWorkspace"></param>
        /// <param name="nameOfSourceFeatureClass"></param>
        /// <param name="nameOfTargetFeatureClass"></param>
        public static void ConvertFeatureClass(IWorkspace sourceWorkspace, IWorkspace targetWorkspace,
                                               string nameOfSourceFeatureClass, string nameOfTargetFeatureClass)
        {
            try
            {
                //create source workspace name
                IDataset sourceWorkspaceDataset = (IDataset)sourceWorkspace;
                IWorkspaceName sourceWorkspaceName = (IWorkspaceName)sourceWorkspaceDataset.FullName;

                //create source dataset name
                IFeatureClassName sourceFeatureClassName = new FeatureClassNameClass();

                IDatasetName sourceDatasetName = (IDatasetName)sourceFeatureClassName;
                sourceDatasetName.WorkspaceName = sourceWorkspaceName;
                sourceDatasetName.Name = nameOfSourceFeatureClass;
                //create target workspace name
                IDataset targetWorkspaceDataset = (IDataset)targetWorkspace;
                IWorkspaceName targetWorkspaceName = (IWorkspaceName)targetWorkspaceDataset.FullName;
                //create target dataset name
                IFeatureClassName targetFeatureClassName = new FeatureClassNameClass();
                IDatasetName targetDatasetName = (IDatasetName)targetFeatureClassName;
                targetDatasetName.WorkspaceName = targetWorkspaceName;
                targetDatasetName.Name = nameOfTargetFeatureClass;
                //Open input Featureclass to get field definitions.
                IName sourceName = (IName)sourceFeatureClassName;
                IFeatureClass sourceFeatureClass = (IFeatureClass)sourceName.Open();
                //Validate the field names because you are converting between different workspace types.
                IFieldChecker fieldChecker = new FieldCheckerClass();
                IFields targetFeatureClassFields;
                IFields sourceFeatureClassFields = sourceFeatureClass.Fields;
                IEnumFieldError enumFieldError;
                // Most importantly set the input and validate workspaces!
                fieldChecker.InputWorkspace = sourceWorkspace;
                fieldChecker.ValidateWorkspace = targetWorkspace;
                fieldChecker.Validate(sourceFeatureClassFields, out enumFieldError, out targetFeatureClassFields);
                // Loop through the output fields to find the geomerty field
                IField geometryField;
                for (int i = 0; i < targetFeatureClassFields.FieldCount; i++)
                {
                    geometryField = targetFeatureClassFields.get_Field(i);
                    if (geometryField.Type == esriFieldType.esriFieldTypeGeometry)
                    {
                        // Get the geometry field's geometry defenition
                        IGeometryDef geometryDef = geometryField.GeometryDef;

                        //Give the geometry definition a spatial index grid count and grid size
                        IGeometryDefEdit targetFCGeoDefEdit = (IGeometryDefEdit)geometryDef;

                        //targetFCGeoDefEdit.GridCount_2 = 1;
                        //targetFCGeoDefEdit.set_GridSize(0, 1000);
                        //Allow ArcGIS to determine a valid grid size for the data loaded
                        targetFCGeoDefEdit.SpatialReference_2 = geometryField.GeometryDef.SpatialReference;
                        // we want to convert all of the features
                        IQueryFilter queryFilter = new QueryFilterClass();
                        queryFilter.WhereClause = "";

                        IEnumDataset pEnumDataset = targetWorkspace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
                        IFeatureDataset ipDataset = (IFeatureDataset)pEnumDataset.Next();
                        IDatasetName pTargetDsName = (IDatasetName)ipDataset.FullName;
                        // Load the feature class
                        IFeatureDataConverter fctofc = new FeatureDataConverterClass();

                        IEnumInvalidObject enumErrors =
                            fctofc.ConvertFeatureClass(sourceFeatureClassName, queryFilter,
                                                       pTargetDsName as IFeatureDatasetName, targetFeatureClassName,
                                                       geometryDef, targetFeatureClassFields, "", 1000, 0);
                        IInvalidObjectInfo obj = enumErrors.Next();
                        break;
                    }
                }
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return;
            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:85,代码来源:DataConverter.cs

示例14: ProjectWorkspaceContents

        public static ISpatialReference ProjectWorkspaceContents(
			IWorkspace w,
			FileInfo pgdb,
			Dictionary<string,ISpatialReference> outputSRDict,
			int hWnd)
        {
            bool bHaveStartedProjecting = false;
            string theBackup = "";
            IStepProgressor theStepProgressor = null;
            ISpatialReference theReturn = null;

            try
            {
                // Get the default SR (if set)
                ISpatialReference theDefaultSR = null;
                if (outputSRDict.ContainsKey("*"))
                    theDefaultSR = outputSRDict["*"];

                // Check for schema locks
                IEnumDataset theEnumDataset = w.get_Datasets(esriDatasetType.esriDTFeatureDataset);
                ISchemaLock theSLock = theEnumDataset.Next() as ISchemaLock;
                int datasetCount = 0;

                while (theSLock != null)
                {
                    datasetCount++;
                    try
                    {
                        theSLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
                        theSLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
                    }
                    catch (Exception ex)
                    {
                        string msg = "There is an exclusive lock. Please ensure you do not have ArcCatalog running.";
                        MessageBox.Show(msg);
                        throw new ExclusiveLockException(msg, ex);
                    }

                    theSLock = theEnumDataset.Next() as ISchemaLock;
                }

                if (hWnd != 0)
                {
                    IProgressDialogFactory theFactory = new ProgressDialogFactoryClass();
                    IProgressDialog2 thePDialog = (IProgressDialog2)theFactory.Create(null, hWnd);
                    theStepProgressor = (IStepProgressor)thePDialog;
                    thePDialog.Description = "";
                    thePDialog.Title = "Projecting Transaction";
                    thePDialog.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                    theStepProgressor = (IStepProgressor)thePDialog;
                    theStepProgressor.MinRange = 0;
                    theStepProgressor.MaxRange = datasetCount + 2;
                    theStepProgressor.StepValue = 1;
                }

                // Make a backup copy of the database
                //if (theStepProgressor != null) theStepProgressor.Message = "Creating backup file";
                //theBackup = CreateBackup(pgdb);
                if (theStepProgressor != null) theStepProgressor.Step();

                if (theStepProgressor != null) theStepProgressor.Message = "Initializing Geoprocessor";
                Geoprocessor theGP = SetupGPEnvironment(pgdb.FullName);
                if (theStepProgressor != null) theStepProgressor.Step();

                IGPProcess theGPProc = null;

                // Do feature datasets
                theEnumDataset = w.get_Datasets(esriDatasetType.esriDTFeatureDataset);
                IFeatureDataset theInFDataset = theEnumDataset.Next() as IFeatureDataset;

                // Mark that we're starting to edit the transaction
                tm.dao.MetadataDAO mdao = new tm.dao.MetadataDAO((IFeatureWorkspace)w);
                mdao.markStartReprojecting();
                bHaveStartedProjecting = true;

                while (theInFDataset != null)
                {
                    // Choose the output SR
                    ISpatialReference theOutputSR = null;
                    if (outputSRDict.ContainsKey(theInFDataset.Name))
                        theOutputSR = outputSRDict[theInFDataset.Name];
                    else
                        theOutputSR = theDefaultSR;

                    if (theOutputSR != null)
                    {
                        // Write the output SR to a prj file
                        string prjFile = CreatePrjFile(theOutputSR);
                        theReturn = theOutputSR;

                        string inFDName = pgdb.FullName + System.IO.Path.DirectorySeparatorChar + theInFDataset.Name;
                        string outFDName = inFDName + "_isdut";

                        if (theStepProgressor != null) theStepProgressor.Message = "Projecting " + theInFDataset.Name;

                        theGPProc = new ESRI.ArcGIS.DataManagementTools.Project(inFDName, outFDName, prjFile);

                        if (RunTool(theGP, theGPProc, null))
                        {
//.........这里部分代码省略.........
开发者ID:EAWCS1,项目名称:SUITT,代码行数:101,代码来源:ProjectTransactionCmd.cs

示例15: RenameClassObjects

        protected void RenameClassObjects(IWorkspace wsTarget)
        {
            int standardID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);
            IEnumDataset enDataset = wsTarget.get_Datasets(esriDatasetType.esriDTAny);
            IDataset dsCurrent = enDataset.Next();
            while (dsCurrent!=null)
            {
                switch (dsCurrent.Type)
                {
                    case esriDatasetType.esriDTTable:
                    case esriDatasetType.esriDTFeatureClass:
                        RenameClassObject(dsCurrent, standardID);
                        break;

                    case esriDatasetType.esriDTFeatureDataset:

                        //RenameClassObject(dsCurrent, standardID);  // FeatureDataset需要改吗

                        IEnumDataset enSubDataset = dsCurrent.Subsets;
                        IDataset subDataset = enSubDataset.Next();
                        while (subDataset != null)
                        {
                            RenameClassObject(subDataset, standardID);
                            subDataset = enSubDataset.Next();
                        }
                        break;
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(dsCurrent);

                dsCurrent = enDataset.Next();
            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:32,代码来源:DefaultDataImport.cs


注:本文中的IWorkspace.get_Datasets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。