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


C# IFeatureClass.AddField方法代码示例

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


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

示例1: AddField

 public  void AddField(IFeatureClass pFeatureClass,string fieldName,esriFieldType fieldType)
 {
     //如果存在不必添加字段,直接返回
     if (pFeatureClass.FieldExistCheck(fieldName)) return;
     var pField = new FieldClass();
     var pFieldEdit = (IFieldEdit)pField;
     pFieldEdit.Name_2 = fieldName;
     pFieldEdit.Type_2 = fieldType;  
     pFeatureClass.AddField(pFieldEdit);
 }
开发者ID:gaufung,项目名称:Accessibility,代码行数:10,代码来源:ShapeOp.cs

示例2: AddField

        private static void AddField(IFeatureClass featureClass, string fieldName, esriFieldType fieldType)
        {
            IField newField = new FieldClass();
            ((IFieldEdit)newField).Name_2 = fieldName;
            ((IFieldEdit)newField).Type_2 = fieldType;

            var schemaLock = (ISchemaLock)featureClass;
            try
            {
                // Get an exclusive schema lock to change the schema.
                schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
                featureClass.AddField(newField);
            }
            finally
            {
                //release the exclusive schema lock
                schemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
            }
        }
开发者ID:regan-sarwas,项目名称:AlaskaPak,代码行数:19,代码来源:AddCoords.cs

示例3: AddField

        /// <summary>
        /// 给图层添加字段
        /// </summary>
        /// <param name="strFieldCode"></param>
        /// <param name="strFieldName"></param>
        /// <param name="pFtCls"></param>
        public static void AddField(string strFieldCode, string strFieldName, Type pType, int nLength,
            IFeatureClass pFtCls)
        {
            try
            {
                ///创建一新字段
                esriFieldType fieldType = GetFieldType(pType);
                IField pField = new FieldClass();
                IFieldEdit pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = nLength;
                pFieldEdit.Name_2 = strFieldName;
                pFieldEdit.AliasName_2 = strFieldName;
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = true;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;

                pFtCls.AddField(pField);
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:30,代码来源:FeatClsOperAPI.cs

示例4: setFeatureClassFieldValue

 private void setFeatureClassFieldValue(IFeatureClass feacls, string strfield, int val)
 {
     if(feacls.FindField(strfield)<0)
     {
         IField field = new FieldClass();
         IFieldEdit fe = field as IFieldEdit;
         fe.Name_2 = strfield;
         fe.Type_2 = esriFieldType.esriFieldTypeInteger;
         feacls.AddField(field);
     }
     int index = feacls.FindField(strfield);
     IFeatureCursor cursor = feacls.Search(null, false);
     IFeature fea = cursor.NextFeature();
     while (fea != null)
     {
         fea.set_Value(index, val);
         fea.Store();
         fea = cursor.NextFeature();
     }
 }
开发者ID:weigiser,项目名称:AOProjects,代码行数:20,代码来源:PolygonsPartitionAggregation.cs

示例5: AddAField

 internal static bool AddAField(IFeatureClass pFeatureClass, string pFieldName, esriFieldType pFieldType, int pLength)
 {
     IField tField = new FieldClass();
     IFieldEdit tFieldEdit = tField as IFieldEdit;
     tFieldEdit.Type_2 = pFieldType;
     tFieldEdit.Name_2 = pFieldName;
     if (pFieldType == esriFieldType.esriFieldTypeString)
     {
         tFieldEdit.Length_2 = pLength;
     }
     ISchemaLock tSchemaLock = (ISchemaLock)pFeatureClass;
     bool successful = false;
     try
     {
         tSchemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
         pFeatureClass.AddField(tField);
         successful = true;
     }
     catch (Exception ex)
     {
         ServerLogger servLogger = new ServerLogger();
         servLogger.LogMessage(ServerLogger.msgType.debug, "add field to output", 8000,
                 "Couldn't get schema lock to add field " + pFieldName + " to output!" + ex.Message);
     }
     finally
     {
         tSchemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
     }
     //logger.LogMessage(ServerLogger.msgType.debug, "AddAField", 99,
     //                                     "Added field: " + pFieldName+", success: "+successful.ToString());
     return successful;
 }
开发者ID:harry-gibson,项目名称:watershed-soe,代码行数:32,代码来源:WatershedSOE.cs

示例6: AddFields

        /// <summary>
        /// ��ͼ������ֶ�
        /// </summary>
        /// <param name="pFtCls"></param>
        private void AddFields(IFeatureClass pFtCls)
        {
            try
            {
                IField pField = new FieldClass();
                IFieldEdit pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 80;
                pFieldEdit.Name_2 = "�������";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 80;
                pFieldEdit.Name_2 = "ͼ����";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 80;
                pFieldEdit.Name_2 = "�ֶ�����";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 20;
                pFieldEdit.Name_2 = "��ʶ��";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 80;
                pFieldEdit.Name_2 = "ͼ��2";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 20;
                pFieldEdit.Name_2 = "��ʶ��2";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 50;
                pFieldEdit.Name_2 = "����ͼ����";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 255;
                pFieldEdit.Name_2 = "��������";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 50;
                pFieldEdit.Name_2 = "�Ƿ�����";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeSmallInteger;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Length_2 = 255;
                pFieldEdit.Name_2 = "˵��";
                pFieldEdit.IsNullable_2 = true;
                pFieldEdit.Required_2 = false;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                pFtCls.AddField(pField);

                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
//.........这里部分代码省略.........
开发者ID:hy1314200,项目名称:HyDM,代码行数:101,代码来源:ErrorExporter.cs

示例7: AddField

        internal static void AddField(IFeatureClass featureClass, string name, esriFieldType type)
        {
            IFieldEdit field = new FieldClass();
            field.Name_2 = name;
            field.Type_2 = type;

            featureClass.AddField(field);
        }
开发者ID:EsriCanada,项目名称:TechTrek_Idol_2016,代码行数:8,代码来源:GPHelperFunctions.cs

示例8: AdicionarColuna

        private static void AdicionarColuna(IField field, IFeatureLayer fLayer, IFeatureClass pFeatureClassShp, List<String> camposAdicionados)
        {
            IFieldEdit fldDomain = new FieldClass();
            string aliasName = field.AliasName;
            string fieldName = field.Name;
            fldDomain.AliasName_2 = GetNomeNovo(aliasName, pFeatureClassShp, camposAdicionados);
            fldDomain.Name_2 = GetNomeNovo(fieldName, pFeatureClassShp, camposAdicionados);
            fldDomain.Editable_2 = true;
            fldDomain.Length_2 = 254;

            fldDomain.Type_2 = esriFieldType.esriFieldTypeString;

            pFeatureClassShp.AddField(fldDomain);
            camposAdicionados.Add(fldDomain.Name);
        }
开发者ID:ezequias,项目名称:Esri,代码行数:15,代码来源:GisUtils.cs


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