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


C# IFeatureClass类代码示例

本文整理汇总了C#中IFeatureClass的典型用法代码示例。如果您正苦于以下问题:C# IFeatureClass类的具体用法?C# IFeatureClass怎么用?C# IFeatureClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Convert

        /// <summary>
        /// 转换
        /// </summary>
        /// <param name="pFeatureClass">要素类</param>
        /// <param name="fieldName">栅格采用的字段</param>
        /// <param name="rasterWorkSpace">输出栅格的工作空间</param>
        /// <param name="newRasterName">新的栅格名称</param>
        public void Convert(IFeatureClass pFeatureClass,
            string fieldName,
            string rasterWorkSpace,
            string newRasterName)
        {
            FileHelper.DeleteFile(rasterWorkSpace, newRasterName, ".tif", ".tfw",".tif.aux");
            IFeatureClassDescriptor featureClassDescriptor = new FeatureClassDescriptorClass();
            featureClassDescriptor.Create(pFeatureClass, null, fieldName);
            IGeoDataset geoDataset = (IGeoDataset)featureClassDescriptor;
            IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactoryClass();           
            IWorkspace workspace = workspaceFactory.OpenFromFile(rasterWorkSpace, 0);
            IConversionOp conversionOp = new RasterConversionOpClass();
            IRasterAnalysisEnvironment rasterAnalysisEnvironment = (IRasterAnalysisEnvironment)conversionOp;
            rasterAnalysisEnvironment.OutWorkspace = workspace;

       
            //set cell size
            rasterAnalysisEnvironment.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref _cellSize);
            //set output extent  
            object objectMissing = Type.Missing;
            rasterAnalysisEnvironment.SetExtent(esriRasterEnvSettingEnum.esriRasterEnvValue, ref _extentEnvelope, ref objectMissing);
            //set output spatial reference 
            rasterAnalysisEnvironment.OutSpatialReference = ((IGeoDataset)pFeatureClass).SpatialReference;
            //convertion
            conversionOp.ToRasterDataset(geoDataset, _rasterType, workspace, newRasterName);              
        }    
开发者ID:gaufung,项目名称:Accessibility,代码行数:33,代码来源:RasterConvertion.cs

示例2: LoadListView

        public static void LoadListView(IFeatureClass pFC, ListView listView1)
        {
            try
            {

                listView1.Columns.Clear();
                //添加一个空
                ColumnHeader columnHeader = new ColumnHeader();

                listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                columnHeader
                });
                columnHeader.Text = "";

                for (int i = 0; i < pFC.Fields.FieldCount; i++)
                {
                    ColumnHeader columnHeader1 = new ColumnHeader();

                    listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                columnHeader1
                });
                    IFields pFields = pFC.Fields;

                    IField pField = pFields.get_Field(i);

                    columnHeader1.Text = pField.AliasName;

                }

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

示例3: FindValue

        public Dictionary<string,object> FindValue(IFeatureClass pFeatureClass, string keyName, string targetName)
        {
            //int keyFieldIndex = pFeatureClass.Fields.FindField(keyField);
            //int targetFieldIndex = pFeatureClass.Fields.FindField(targetField);
            //IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);
            //IFeature pFeature;
            //while ((pFeature = pFeatureCursor.NextFeature()) != null)
            //{
            //    if (pFeature.Value[keyFieldIndex].ToString() == keyValue) break;

            //}
            //Marshal.ReleaseComObject(pFeatureCursor);
            //return pFeature == null ? null : pFeature.Value[targetFieldIndex];
            int keyFieldIndex = pFeatureClass.Fields.FindField(keyName);
            int targetFieldIndex = pFeatureClass.Fields.FindField(targetName);
            Dictionary<string,object> dic=new Dictionary<string, object>(pFeatureClass.FeatureCount(null));
            IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);
            IFeature pFeature;
            while ((pFeature = pFeatureCursor.NextFeature()) != null)
            {
                if (!dic.ContainsKey(pFeature.Value[keyFieldIndex].ToString()))
                {
                    dic.Add(pFeature.Value[keyFieldIndex].ToString(), pFeature.Value[targetFieldIndex]);
                    
                }
            }
            Marshal.ReleaseComObject(pFeatureCursor);
            return dic;
        }
开发者ID:gaufung,项目名称:Accessibility,代码行数:29,代码来源:ShapeOp.cs

示例4: Intsect

        public IFeatureClass Intsect(IFeatureClass _pFtClass, IFeatureClass _pFtOverlay, string _FilePath, string _pFileName)
        {
            IFeatureClassName pOutPut = new FeatureClassNameClass();

            pOutPut.ShapeType = _pFtClass.ShapeType;

            pOutPut.ShapeFieldName = _pFtClass.ShapeFieldName;

            pOutPut.FeatureType = esriFeatureType.esriFTSimple;

            IWorkspaceName pWsN = new WorkspaceNameClass();

            pWsN.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory";

            pWsN.PathName = _FilePath;

            IDatasetName pDatasetName = pOutPut as IDatasetName;

            pDatasetName.Name = _pFileName;

            pDatasetName.WorkspaceName = pWsN;

            IBasicGeoprocessor pBasicGeo = new BasicGeoprocessorClass();

            IFeatureClass pFeatureClass = pBasicGeo.Intersect(_pFtClass as ITable, false, _pFtOverlay as ITable, false, 0.1, pOutPut);

            return pFeatureClass;
        }
开发者ID:Krystal001025,项目名称:temp,代码行数:28,代码来源:InterSect.cs

示例5: BufferAnalysis

        public static void BufferAnalysis(IFeatureClass feacls,string dist)
        {
            IGeoProcessor2 gp = new GeoProcessorClass();
            gp.OverwriteOutput = true;

            IGeoProcessorResult result = new GeoProcessorResultClass();

            //gp.SetEnvironmentValue("workspace", @"e:\data");

            IVariantArray vararr = new VarArrayClass();
            object sev = null;
            try
            {
                vararr.Add(feacls);
                vararr.Add(@"e:\data\wwwwwww.shp");
                vararr.Add(dist);

                result = gp.Execute("Buffer_analysis", vararr, null);

                while (result.Status == esriJobStatus.esriJobExecuting)
                    Thread.Sleep(1000);

                MessageBox.Show(gp.GetMessages(ref sev));
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                MessageBox.Show(gp.GetMessages(ref sev));
            }
        }
开发者ID:weigiser,项目名称:AOProjects,代码行数:30,代码来源:GeoProcessingHelperClass.cs

示例6: GradePartition

 public GradePartition(IFeatureClass feacls,string divideField,double[] interval)
 {
     _feacls = feacls;
     _divideFiled = divideField;
     _isDivideOnInterval = true;
     _interval = interval;
 }
开发者ID:weigiser,项目名称:AOProjects,代码行数:7,代码来源:PolygonsAggregationClass.cs

示例7: GetDistinctValue

        /// <summary>
        /// 获得字段唯一值
        /// </summary>
        public List<object> GetDistinctValue(IFeatureClass FC, string FieldName)
        {
            if (FC.Fields.FindField(FieldName) < 0)
                return null;

            try
            {
                List<object> DistinctValue = new List<object>();

                IDataset Dataset = (IDataset)FC;
                IFeatureWorkspace FWS = (IFeatureWorkspace)Dataset.Workspace;
                IQueryDef QueryDef = FWS.CreateQueryDef();
                QueryDef.Tables = Dataset.Name;
                QueryDef.SubFields = "DISTINCT(" + FieldName + ")";
                ICursor Cursor = QueryDef.Evaluate();
                IRow Row = Cursor.NextRow();
                while (Row != null)
                {
                    object o = Row.get_Value(0);
                    DistinctValue.Add(o);

                    Row = Cursor.NextRow();
                }
                return DistinctValue;
            }
            catch
            {
                return null;
            }
        }
开发者ID:tanghaojie,项目名称:SDECodeBuilder,代码行数:33,代码来源:CommonClass.cs

示例8: ZFeatureClass

        public ZFeatureClass(IFeatureClass featureClass)
            : base(featureClass as IDataset)
        {
            this.Subtypes = new ObservableCollection<ZSubtype>();
            this.Fields = new ObservableCollection<ZField>();
            this.Id = featureClass.FeatureClassID;

            ISubtypes subtypes = (ISubtypes)featureClass;
            if (subtypes.HasSubtype) {
                IEnumSubtype enumSubtype = subtypes.Subtypes;
                int code;
                string subtypeName = enumSubtype.Next(out code);
                while (!string.IsNullOrEmpty(subtypeName)) {
                    this.Subtypes.Add(new ZSubtype(this, code, subtypeName));
                    subtypeName = enumSubtype.Next(out code);
                }
            }
            else {
                this.Subtypes.Add(new ZDefaultSubtype(this));
            }

            IFields fields = featureClass.Fields;
            for (int i = 0; i < fields.FieldCount; i++) {
                IField field = fields.get_Field(i);
                this.Fields.Add(new ZField(this, field));
            }
        }
开发者ID:qjw2bqn,项目名称:Esri-Geometry-Network-Configuration-Manager,代码行数:27,代码来源:ZFeatureClass.cs

示例9: dataPrepAdjustAccuracyAssessment

 public dataPrepAdjustAccuracyAssessment(IFeatureClass ProjectArea, IFeatureClass Map, string originalAccuracyAssessmentModel, string adjustedAccuracyAssessmentModel)
 {
     projectArea = ProjectArea;
     ftrMap = Map;
     oModel = originalAccuracyAssessmentModel;
     aModel = adjustedAccuracyAssessmentModel;
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:7,代码来源:dataPrepAdjustAccuracyAssessment.cs

示例10: QAExceptionStorage

        public QAExceptionStorage(IWorkspace isdutWorkspace, string schemaOwner, string operationalDSName)
        {
            if (isdutWorkspace == null)
                throw new ArgumentNullException("isdutWorkspace", "Cannot pass null workspace to QAExceptionStorage");

            // Locate the ISDUT.ISDUT_DATA_EXCEPTION_POINTS featureclass in the workspace
            IFeatureClass theFC = null;
            string theFCName = "";
            try
            {
                theFCName = FEATURECLASS_NAME;
                theFC = ((IFeatureWorkspace)isdutWorkspace).OpenFeatureClass(theFCName);
            }
            catch (Exception) {}

            if (theFC == null)
                throw new ErrorStorageException("isdutWorkspace does not contain a featureclass named '" + theFCName + "'", null);

            // Check the featureclass definition
            string theMessage = this.FeatureClassSchemaCheck(theFC);
            if (theMessage != null && theMessage.Length > 0)
            {
                throw new ErrorStorageException(theMessage, null);
            }

            this._operationalDSName = operationalDSName;
            this._exceptionFC = theFC;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:28,代码来源:QAExceptionStorage.cs

示例11: OnActivate

        protected override void OnActivate()
        {
            //get the cadastral editor and target fabric
              m_pCadEd = (ICadastralEditor)ArcMap.Application.FindExtensionByName("esriCadastralUI.CadastralEditorExtension");
              m_pCadFab = m_pCadEd.CadastralFabric;

              if (m_pCadFab == null)
              {
            MessageBox.Show("No target fabric found. Please add a fabric to the map start editing, and try again.");
            return;
              }

              m_pFabricLines = (IFeatureClass)m_pCadFab.get_CadastralTable(esriCadastralFabricTable.esriCFTLines);

              m_editor.CurrentTask = null;
              m_edSketch = m_editor as IEditSketch3;
              m_edSketch.GeometryType = esriGeometryType.esriGeometryPolyline;
              m_csc = new TraceConstructorClass();
              m_csc.Initialize(m_editor);
              m_edSketch.ShapeConstructor = m_csc;
              m_csc.Activate();

              // Setup events
              m_editEvents.OnSketchModified += OnSketchModified;
              m_editEvents5.OnShapeConstructorChanged += OnShapeConstructorChanged;
              m_editEvents.OnSketchFinished += OnSketchFinished;
        }
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:27,代码来源:SampleTraceTool1.cs

示例12: Geoprocessor

 void IAppend.Append(IFeatureClass fcSource, IFeatureClass fcTarget)
 {
     Geoprocessor gp = new Geoprocessor();
        ESRI.ArcGIS.DataManagementTools.Append pAppend = new ESRI.ArcGIS.DataManagementTools.Append(fcSource, fcTarget);
        gp.SetEnvironmentValue("workspace",this._environment);
        pAppend.schema_type = "NO_TEST";
        runTool(gp, pAppend, null);
 }
开发者ID:truonghinh,项目名称:TnX,代码行数:8,代码来源:DataManager.cs

示例13: DelFeatureFile

 //����һ��FeatureClassΪ�ļ� by gisoracle
 //public void saveFeatureClass(IFeatureClass pFeatureClass, string fileName)
 //{
 //    try
 //    {
 //        string sFileName = System.IO.Path.GetFileName(fileName);
 //        string sFilePath = System.IO.Path.GetDirectoryName(fileName);
 //        IDataset pDataset = pFeatureClass as IDataset;
 //        IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
 //        IFeatureWorkspace pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(sFilePath, 0) as IFeatureWorkspace;
 //        IWorkspace pWorkspace = pFeatureWorkspace as IWorkspace;
 //        if (pWorkspace.Exists() == true)
 //        {
 //            //DelFeatureFile(sFilePath, sFileName);
 //        }
 //        //pDataset.Copy(sFileName, pFeatureWorkspace as IWorkspace);
 //    }
 //    catch { MessageBox.Show("����"); }
 //}
 //by gisoracle
 public static void DelFeatureFile(IFeatureClass pFeatureClass, string sName)
 {
     if (pFeatureClass!= null)
     {
         IDataset dataset = pFeatureClass as IDataset;
         dataset.Delete();
     }
 }
开发者ID:lovelll,项目名称:DQHP,代码行数:28,代码来源:frmClips.cs

示例14: OperateForm

 public OperateForm(IFeatureClass FeatureClass, IFeature Feature)
 {
     this.FeatureClass = FeatureClass;
     this.Feature = Feature;
     this.FieldIndexDict = GISHelper.GetFieldIndexDict(FeatureClass);
     Init();
     InitializeComponent();
 }
开发者ID:LooWooTech,项目名称:Traffic,代码行数:8,代码来源:OperateForm.cs

示例15: ConvertToRecordset

        /// <summary>
        /// Converts feature class to a recordset.
        /// </summary>
        /// <param name="fc">The fc.</param>
        /// <returns></returns>
        public IRecordSet2 ConvertToRecordset(IFeatureClass fc)
        {
            IRecordSet recSet = new RecordSetClass();
            IRecordSetInit recSetInit = recSet as IRecordSetInit;
            recSetInit.SetSourceTable(fc as ITable, null);

            return (IRecordSet2)recSetInit;
        }
开发者ID:mapbutcher,项目名称:EsriToGeoJson,代码行数:13,代码来源:GeoJsonExport.cs


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