Exemplo n.º 1
0
        private IFeatureClass method_2(IFeatureWorkspace ifeatureWorkspace_0, string string_4,
                                       esriFeatureType esriFeatureType_0, esriGeometryType esriGeometryType_0, IFields ifields_0)
        {
            IFeatureClass class2 = null;
            string        str;
            IFieldChecker checker = new FieldCheckerClass
            {
                ValidateWorkspace = ifeatureWorkspace_0 as IWorkspace
            };

            checker.ValidateTableName(string_4, out str);
            IObjectClassDescription description = null;

            if (esriFeatureType_0 == esriFeatureType.esriFTAnnotation)
            {
                return(this.method_1(ifeatureWorkspace_0, string_4, 1000.0, new TextSymbolClass(), ifields_0));
            }
            description = new FeatureClassDescriptionClass();
            IFieldsEdit requiredFields = description.RequiredFields as IFieldsEdit;
            IFieldEdit  edit2          = null;
            int         index          = requiredFields.FindField((description as IFeatureClassDescription).ShapeFieldName);

            edit2 = requiredFields.get_Field(index) as IFieldEdit;
            IGeometryDefEdit geometryDef  = edit2.GeometryDef as IGeometryDefEdit;
            esriFeatureType  esriFTSimple = esriFeatureType.esriFTSimple;

            edit2.GeometryDef_2 = geometryDef;
            for (int i = 0; i < ifields_0.FieldCount; i++)
            {
                requiredFields.AddField(ifields_0.get_Field(i));
            }
            try
            {
                class2 = ifeatureWorkspace_0.CreateFeatureClass(string_4, requiredFields, null, null, esriFTSimple,
                                                                (description as IFeatureClassDescription).ShapeFieldName, "");
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
            return(class2);
        }
Exemplo n.º 2
0
        public void MergeOnto(IFields ffs)
        {
            IFieldsEdit    fe        = ffs as IFieldsEdit;
            List <AoField> to_append = new List <AoField>();

            foreach (AoField f in m_fields)
            {
                int idx = fe.FindField(f.Name);
                if (idx == -1)                   // already there.
                {
                    to_append.Add(f);
                }
                else                     // new
                {
                    fe.set_Field(idx, f.Field);
                }
            }

            foreach (AoField f in to_append)
            {
                fe.AddField(f.Field);
            }
        }
Exemplo n.º 3
0
        //创建featureclass
        private IFeatureClass CreateFeatureClass(string name, IFeatureClass pFeaCls, IFeatureDataset pFeaDataset, IFeatureWorkspace pWks)
        {
            UID uidCLSID  = null;
            UID uidCLSEXT = null;


            try
            {
                IObjectClassDescription pObjCls = null;
                if (uidCLSID == null)
                {
                    //esriGeometryType GeometryType;
                    uidCLSID = new UIDClass();
                    switch (pFeaCls.FeatureType)
                    {
                    case (esriFeatureType.esriFTSimple):
                        uidCLSID.Value = "{52353152-891A-11D0-BEC6-00805F7C4268}";
                        break;

                    case (esriFeatureType.esriFTSimpleJunction):
                        //GeometryType = esriGeometryType.esriGeometryPoint;
                        uidCLSID.Value = "{CEE8D6B8-55FE-11D1-AE55-0000F80372B4}";
                        break;

                    case (esriFeatureType.esriFTComplexJunction):
                        uidCLSID.Value = "{DF9D71F4-DA32-11D1-AEBA-0000F80372B4}";
                        break;

                    case (esriFeatureType.esriFTSimpleEdge):
                        //GeometryType = esriGeometryType.esriGeometryPolyline;
                        uidCLSID.Value = "{E7031C90-55FE-11D1-AE55-0000F80372B4}";
                        break;

                    case (esriFeatureType.esriFTComplexEdge):
                        //GeometryType = esriGeometryType.esriGeometryPolyline;
                        uidCLSID.Value = "{A30E8A2A-C50B-11D1-AEA9-0000F80372B4}";
                        break;

                    case (esriFeatureType.esriFTAnnotation):
                        //GeometryType = esriGeometryType.esriGeometryPolygon;
                        uidCLSID.Value = "{E3676993-C682-11D2-8A2A-006097AFF44E}";
                        break;

                    case (esriFeatureType.esriFTDimension):
                        //GeometryType = esriGeometryType.esriGeometryPolygon;
                        uidCLSID.Value = "{496764FC-E0C9-11D3-80CE-00C04F601565}";
                        break;
                    }
                }

                // 设置 uidCLSEXT (if Null)
                if (uidCLSEXT == null)
                {
                    switch (pFeaCls.FeatureType)
                    {
                    case (esriFeatureType.esriFTAnnotation):
                        uidCLSEXT       = new UIDClass();
                        uidCLSEXT.Value = "{24429589-D711-11D2-9F41-00C04F6BC6A5}";
                        pObjCls         = new AnnotationFeatureClassDescriptionClass();
                        break;

                    case (esriFeatureType.esriFTDimension):
                        uidCLSEXT       = new UIDClass();
                        uidCLSEXT.Value = "{48F935E2-DA66-11D3-80CE-00C04F601565}";
                        break;
                    }
                }
                //IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)pWorkspace;
                IFieldChecker fdCheker = new FieldCheckerClass();//yjl20110804 add
                pEnumFieldError            = null;
                pFixedField                = null;
                fdCheker.ValidateWorkspace = pWks as IWorkspace;
                fdCheker.Validate(pFeaCls.Fields, out pEnumFieldError, out pFixedField);

                //string strShapeFieldName = pfeaturelayer.FeatureClass.ShapeFieldName;//geometry字段名
                //string[] strShapeNames = strShapeFieldName.Split('.');
                //strShapeFieldName = strShapeNames[strShapeNames.GetLength(0) - 1];

                IFields pFields = new FieldsClass();
                if (pObjCls != null)
                {
                    IFeatureClassDescription pClsDes = pObjCls as IFeatureClassDescription;
                    pFields = pObjCls.RequiredFields;
                }

                IFieldsEdit pFieldsEdit = pFields as IFieldsEdit;

                for (int i = 0; i < pFeaCls.Fields.FieldCount; i++)
                {
                    IField   pf            = pFeaCls.Fields.get_Field(i);
                    string   strFieldName  = pf.Name;
                    string[] strFieldNames = strFieldName.Split('.');

                    bool blnfind = false;
                    for (int j = 0; j < pFields.FieldCount; j++)
                    {
                        IField   pf2        = pFields.get_Field(j);
                        string[] strfields2 = pf2.Name.Split('.');
                        if (strfields2[strfields2.GetLength(0) - 1].ToUpper() == strFieldNames[strFieldNames.GetLength(0) - 1].ToUpper())
                        {
                            blnfind = true;
                            break;
                        }
                    }

                    if (blnfind)
                    {
                        continue;
                    }

                    if (pFeaCls.FeatureType == esriFeatureType.esriFTAnnotation)
                    {
                        if (pFeaCls.ShapeFieldName == pf.Name)
                        {
                            continue;
                        }
                    }

                    if (pFeaCls.LengthField != null)
                    {
                        if (pFeaCls.LengthField.Name == pf.Name)
                        {
                            continue;
                        }
                    }
                    if (pFeaCls.AreaField != null)
                    {
                        if (pFeaCls.AreaField.Name == pf.Name)
                        {
                            continue;
                        }
                    }

                    IClone     pClone         = pFeaCls.Fields.get_Field(i) as IClone;
                    IField     pTempField     = pClone.Clone() as IField;
                    IFieldEdit pTempFieldEdit = pTempField as IFieldEdit;

                    if (pFieldsEdit.FindField(strFieldNames[strFieldNames.GetLength(0) - 1]) > -1)
                    {
                        continue;
                    }

                    pTempFieldEdit.Name_2 = strFieldNames[strFieldNames.GetLength(0) - 1];
                    pFieldsEdit.AddField(pTempField);
                }

                string   strShapeFieldName = pFeaCls.ShapeFieldName;
                string[] strShapeNames     = strShapeFieldName.Split('.');
                strShapeFieldName = strShapeNames[strShapeNames.GetLength(0) - 1];

                //修改geometrydef
                IField pFieldShape = pFeaCls.Fields.get_Field(pFeaCls.Fields.FindField(pFeaCls.ShapeFieldName));

                if (pFieldShape != null)
                {
                    IFieldEdit pFieldShapeEdit = pFields.get_Field(pFields.FindField(strShapeFieldName)) as IFieldEdit;
                    pFieldShapeEdit.GeometryDef_2 = pFieldShape.GeometryDef;
                }

                IGeometryDef pGeoDef  = pFieldShape.GeometryDef;
                double       dblIndex = pGeoDef.get_GridSize(0);

                //添加两个字段一个时间 一个名称
                if (pFields.FindField("ImportTime") < 0)
                {
                    IField     pNewField1 = new FieldClass();
                    IFieldEdit pNewEdit1  = pNewField1 as IFieldEdit;
                    pNewEdit1.Name_2      = "ImportTime";
                    pNewEdit1.AliasName_2 = "入库时间";
                    pNewEdit1.Type_2      = esriFieldType.esriFieldTypeDate;
                    pFieldsEdit.AddField(pNewField1);
                }

                if (pFields.FindField("ImportUser") < 0)
                {
                    IField     pNewField2 = new FieldClass();
                    IFieldEdit pNewEdit2  = pNewField2 as IFieldEdit;
                    pNewEdit2.Name_2      = "ImportUser";
                    pNewEdit2.AliasName_2 = "入库人";
                    pNewEdit2.Type_2      = esriFieldType.esriFieldTypeString;
                    pFieldsEdit.AddField(pNewField2);
                }

                IFeatureClass targetFeatureclass = null;


                if (pFeaCls.FeatureType == esriFeatureType.esriFTAnnotation)
                {
                    IAnnoClass pAnno = pFeaCls.Extension as IAnnoClass;

                    IFeatureWorkspaceAnno pWksAnno = pWks as IFeatureWorkspaceAnno;
                    IGraphicsLayerScale   pGl      = new GraphicsLayerScaleClass();
                    pGl.ReferenceScale = pAnno.ReferenceScale;
                    pGl.Units          = pAnno.ReferenceScaleUnits;
                    targetFeatureclass = pWksAnno.CreateAnnotationClass(name, pFields, pFeaCls.CLSID, pFeaCls.EXTCLSID, strShapeFieldName, "", pFeaDataset, null, pAnno.AnnoProperties, pGl, pAnno.SymbolCollection, false);
                }
                else
                {
                    if (pFeaDataset != null)
                    {
                        targetFeatureclass = pFeaDataset.CreateFeatureClass(name, pFixedField, uidCLSID, uidCLSEXT, pFeaCls.FeatureType, strShapeFieldName, "");
                    }
                    else
                    {
                        targetFeatureclass = pWks.CreateFeatureClass(name, pFixedField, uidCLSID, uidCLSEXT, pFeaCls.FeatureType, strShapeFieldName, "");
                    }
                }

                return(targetFeatureclass);
            }
            catch (Exception ex)
            {
                if (ex.Message == "Cannot create a low precision dataset in a high precision database.")
                {
                    MessageBox.Show("数据必须是ArcGis9.2的数据,请将数据处理成ArcGis9.2的数据!");
                }
            }
            IFeatureClass featureclass = null;

            return(featureclass);
        }
Exemplo n.º 4
0
        private IFeatureClass method_1()
        {
            IFeatureClass class2 = null;

            if (this.iname_0 == null)
            {
                return(null);
            }
            object          obj2      = this.iname_0.Open();
            IWorkspace      workspace = null;
            IFeatureDataset dataset   = null;

            if (obj2 is IWorkspace)
            {
                workspace = obj2 as IWorkspace;
            }
            else if (obj2 is IFeatureDataset)
            {
                dataset   = obj2 as IFeatureDataset;
                workspace = dataset.Workspace;
            }
            IObjectClassDescription description = null;

            description = new FeatureClassDescriptionClass();
            IFieldsEdit requiredFields = description.RequiredFields as IFieldsEdit;
            IFieldEdit  field          = null;
            IFieldEdit  edit3          = null;
            int         index          = requiredFields.FindField((description as IFeatureClassDescription).ShapeFieldName);

            edit3 = requiredFields.get_Field(index) as IFieldEdit;
            IGeometryDefEdit geometryDef = edit3.GeometryDef as IGeometryDefEdit;

            if (this.cboGeometryType.SelectedIndex == 0)
            {
                geometryDef.GeometryType_2 = esriGeometryType.esriGeometryPoint;
            }
            else if (this.cboGeometryType.SelectedIndex == 1)
            {
                geometryDef.GeometryType_2 = esriGeometryType.esriGeometryMultipoint;
            }
            else if (this.cboGeometryType.SelectedIndex == 2)
            {
                geometryDef.GeometryType_2 = esriGeometryType.esriGeometryPolyline;
            }
            else if (this.cboGeometryType.SelectedIndex == 3)
            {
                geometryDef.GeometryType_2 = esriGeometryType.esriGeometryPolygon;
            }
            ISpatialReference spatialReference = geometryDef.SpatialReference;

            if (this.txtCoordinate.Tag is ISpatialReference)
            {
                spatialReference = this.txtCoordinate.Tag as ISpatialReference;
            }
            geometryDef.HasZ_2 = this.chkHasZ.Checked;
            geometryDef.HasM_2 = this.chkHasM.Checked;
            SpatialReferenctOperator.ChangeCoordinateSystem(workspace as IGeodatabaseRelease, spatialReference, false);
            geometryDef.SpatialReference_2 = spatialReference;
            esriFeatureType esriFTSimple = esriFeatureType.esriFTSimple;

            field             = new FieldClass();
            field.Name_2      = "Code";
            field.AliasName_2 = "要素编号";
            field.Type_2      = esriFieldType.esriFieldTypeInteger;
            requiredFields.AddField(field);
            string name = this.method_0(workspace, this.txtFeatureClassName.Text);

            try
            {
                if (dataset == null)
                {
                    class2 = (workspace as IFeatureWorkspace).CreateFeatureClass(name, requiredFields, null, null,
                                                                                 esriFTSimple, "Shape", "");
                }
                else
                {
                    class2 = dataset.CreateFeatureClass(name, requiredFields, null, null, esriFTSimple, "Shape", "");
                }
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
            return(class2);
        }
Exemplo n.º 5
0
        //added by chulili 
        //函数功能:创建一个新的地物类 传入参数:地物类名称  参考的featurelayer 地物类所在工作空间  CLSID CLSEXT 地物类几何类型
        //传出参数:地物类
        //函数来源:借鉴同事代码  
        private static IFeatureClass CreateFeatureClass(string name, IFeatureLayer pfeaturelayer, IWorkspace pWorkspace, UID uidCLSID, UID uidCLSEXT, esriGeometryType GeometryType)
        {
            try
            {
                if (uidCLSID == null)
                {
                    uidCLSID = new UIDClass();
                    switch (pfeaturelayer.FeatureClass.FeatureType)
                    {
                        case (esriFeatureType.esriFTSimple):
                            uidCLSID.Value = "{52353152-891A-11D0-BEC6-00805F7C4268}";
                            break;
                        case (esriFeatureType.esriFTSimpleJunction):
                            GeometryType = esriGeometryType.esriGeometryPoint;
                            uidCLSID.Value = "{CEE8D6B8-55FE-11D1-AE55-0000F80372B4}";
                            break;
                        case (esriFeatureType.esriFTComplexJunction):
                            uidCLSID.Value = "{DF9D71F4-DA32-11D1-AEBA-0000F80372B4}";
                            break;
                        case (esriFeatureType.esriFTSimpleEdge):
                            GeometryType = esriGeometryType.esriGeometryPolyline;
                            uidCLSID.Value = "{E7031C90-55FE-11D1-AE55-0000F80372B4}";
                            break;
                        case (esriFeatureType.esriFTComplexEdge):
                            GeometryType = esriGeometryType.esriGeometryPolyline;
                            uidCLSID.Value = "{A30E8A2A-C50B-11D1-AEA9-0000F80372B4}";
                            break;
                        case (esriFeatureType.esriFTAnnotation):
                            GeometryType = esriGeometryType.esriGeometryPolygon;
                            uidCLSID.Value = "{E3676993-C682-11D2-8A2A-006097AFF44E}";
                            break;
                        case (esriFeatureType.esriFTDimension):
                            GeometryType = esriGeometryType.esriGeometryPolygon;
                            uidCLSID.Value = "{496764FC-E0C9-11D3-80CE-00C04F601565}";
                            break;
                    }
                }

                // 设置 uidCLSEXT (if Null)
                if (uidCLSEXT == null)
                {
                    switch (pfeaturelayer.FeatureClass.FeatureType)
                    {
                        case (esriFeatureType.esriFTAnnotation):
                            uidCLSEXT = new UIDClass();
                            uidCLSEXT.Value = "{24429589-D711-11D2-9F41-00C04F6BC6A5}";
                            break;
                        case (esriFeatureType.esriFTDimension):
                            uidCLSEXT = new UIDClass();
                            uidCLSEXT.Value = "{48F935E2-DA66-11D3-80CE-00C04F601565}";
                            break;
                    }
                }

                IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)pWorkspace;
                IFields pFields = new FieldsClass();
                IFieldsEdit pFieldsEdit = pFields as IFieldsEdit;
                //为地物类添加字段
                for (int i = 0; i < pfeaturelayer.FeatureClass.Fields.FieldCount; i++)
                {
                    IClone pClone = pfeaturelayer.FeatureClass.Fields.get_Field(i) as IClone;
                    IField pTempField = pClone.Clone() as IField;
                    IFieldEdit pTempFieldEdit = pTempField as IFieldEdit;
                    string strFieldName = pTempField.Name;
                    string[] strFieldNames = strFieldName.Split('.');

                    if (pFieldsEdit.FindField(strFieldNames[strFieldNames.GetLength(0) - 1]) > -1) continue;

                    pTempFieldEdit.Name_2 = strFieldNames[strFieldNames.GetLength(0) - 1];
                    pFieldsEdit.AddField(pTempField);
                }

                string strShapeFieldName = pfeaturelayer.FeatureClass.ShapeFieldName;
                string[] strShapeNames = strShapeFieldName.Split('.');
                strShapeFieldName = strShapeNames[strShapeNames.GetLength(0) - 1];


                IFeatureClass targetFeatureclass = pFeatureWorkspace.CreateFeatureClass("" + name + "", pFields, uidCLSID, uidCLSEXT, pfeaturelayer.FeatureClass.FeatureType, strShapeFieldName, "");

                return targetFeatureclass;
            }
            catch (Exception ex)
            {
                if (ex.Message == "Cannot create a low precision dataset in a high precision database.")
                {
                    MessageBox.Show("数据必须是ArcGis9.3的数据,请将数据处理成ArcGis9.2的数据!");
                }
            }
            IFeatureClass featureclass = null;
            return featureclass;
        }
Exemplo n.º 6
0
        public IFeatureClass CreateFeatureClass(IWorkspace workspace, IFeatureDataset featureDataset = null, ISpatialReference spatialReference = null)
        {
            try
            {
                _fieldMappingInts = new Dictionary <int, int>();
                IFeatureWorkspace featureWorkspace = workspace as IFeatureWorkspace;
                if (featureWorkspace == null)
                {
                    return(null);
                }
                IFeatureClassDescription featureClassDescription = new FeatureClassDescriptionClass();
                IObjectClassDescription  objectClassDescription  = featureClassDescription as IObjectClassDescription;
                IFields     requiredFields     = objectClassDescription.RequiredFields;
                IFieldsEdit requiredFieldsEdit = requiredFields as IFieldsEdit;
                for (int i = 0; i < requiredFields.FieldCount; i++)
                {
                    if (requiredFieldsEdit.Field[i].Type == esriFieldType.esriFieldTypeGeometry)
                    {
                        IFieldEdit       requiredFieldEdit = requiredFieldsEdit.Field[i] as IFieldEdit;
                        IGeometryDef     geometryDef       = new GeometryDefClass();
                        IGeometryDefEdit geometryDefEdit   = geometryDef as IGeometryDefEdit;
                        geometryDefEdit.GeometryType_2     = _featureLayer.FeatureClass.ShapeType;
                        geometryDefEdit.SpatialReference_2 = spatialReference ?? FeatureClassUtil.GetGeometryDef(_featureLayer.FeatureClass).SpatialReference;
                        requiredFieldEdit.GeometryDef_2    = geometryDefEdit;
                    }
                }
                for (int i = 0; i < _selectedFieldList.Count; i++)
                {
                    IField field = _selectedFieldList[i];
                    if (requiredFieldsEdit.FindField(field.Name) >= 0)
                    {
                        continue;
                    }
                    IField     newField     = new FieldClass();
                    IFieldEdit newFieldEdit = newField as IFieldEdit;
                    newFieldEdit.Name_2         = field.Name;
                    newFieldEdit.AliasName_2    = field.AliasName;
                    newFieldEdit.DefaultValue_2 = field.DefaultValue;
                    newFieldEdit.Domain_2       = field.Domain;
                    newFieldEdit.DomainFixed_2  = field.DomainFixed;
                    newFieldEdit.Editable_2     = field.Editable;
                    newFieldEdit.IsNullable_2   = field.IsNullable;
                    newFieldEdit.Length_2       = field.Length;
                    newFieldEdit.Precision_2    = field.Precision;
                    newFieldEdit.Required_2     = field.Required;
                    newFieldEdit.Scale_2        = field.Scale;
                    newFieldEdit.Type_2         = field.Type;
                    requiredFieldsEdit.AddField(newFieldEdit);
                }

                IFieldChecker   fieldChecker    = new FieldCheckerClass();
                IEnumFieldError enumFieldError  = null;
                IFields         validatedFields = null;
                fieldChecker.ValidateWorkspace = workspace;
                fieldChecker.Validate(requiredFields, out enumFieldError, out validatedFields);
                string        esriName     = ((IDataset)_featureLayer.FeatureClass).Name;
                IFeatureClass featureClass = null;
                if (featureDataset == null)
                {
                    featureClass = featureWorkspace.CreateFeatureClass(esriName, requiredFields, objectClassDescription.InstanceCLSID,
                                                                       objectClassDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple,
                                                                       _featureLayer.FeatureClass.ShapeFieldName, "");
                }
                else
                {
                    featureClass = featureDataset.CreateFeatureClass(esriName, requiredFields, objectClassDescription.InstanceCLSID,
                                                                     objectClassDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple,
                                                                     _featureLayer.FeatureClass.ShapeFieldName, "");
                }

                foreach (IField field in _selectedFieldList)
                {
                    if (field.Editable)
                    {
                        _fieldMappingInts.Add(featureClass.FindField(field.Name), _featureLayer.FeatureClass.FindField(field.Name));
                    }
                }

                return(featureClass);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
        public static IFeatureClass CreateSignsFeatureClass(IFeatureClass linesFeatureClass, string name)
        {
            // Locations are all relative to the location of the reference lines.
            // For geodatabase, signs feature class is at the same location and the streets table
            // is at the level of the containing feature dataset.
            // For shapefile, both are at the same location as the reference lines.

            // start with the initial set of required fields for a feature class

            IFeatureClassDescription fcDescription = new FeatureClassDescriptionClass();
            IObjectClassDescription  ocDescription = fcDescription as IObjectClassDescription;
            IFieldsEdit outFields = ocDescription.RequiredFields as IFieldsEdit;

            // make the shape field to be of type polyline with the same spatial reference as the reference lines

            IField           shapeField  = outFields.get_Field(outFields.FindField(fcDescription.ShapeFieldName));
            IGeometryDefEdit geomDefEdit = shapeField.GeometryDef as IGeometryDefEdit;

            geomDefEdit.GeometryType_2     = esriGeometryType.esriGeometryPolyline;
            geomDefEdit.SpatialReference_2 = (linesFeatureClass as IGeoDataset).SpatialReference;

            // add the other fields to the feature class

            IFieldEdit field = new FieldClass();

            field.Name_2   = "ExitName";
            field.Type_2   = esriFieldType.esriFieldTypeString;
            field.Length_2 = 24;
            outFields.AddField(field);

            string currentNumber;

            for (int i = 0; i < MaxBranchCount; i++)
            {
                currentNumber = Convert.ToString(i, System.Globalization.CultureInfo.InvariantCulture);

                field          = new FieldClass();
                field.Name_2   = "Branch" + currentNumber;
                field.Type_2   = esriFieldType.esriFieldTypeString;
                field.Length_2 = 180;
                outFields.AddField(field);

                field          = new FieldClass();
                field.Name_2   = "Branch" + currentNumber + "Dir";
                field.Type_2   = esriFieldType.esriFieldTypeString;
                field.Length_2 = 5;
                outFields.AddField(field);

                field          = new FieldClass();
                field.Name_2   = "Branch" + currentNumber + "Lng";
                field.Type_2   = esriFieldType.esriFieldTypeString;
                field.Length_2 = 2;
                outFields.AddField(field);

                field          = new FieldClass();
                field.Name_2   = "Toward" + currentNumber;
                field.Type_2   = esriFieldType.esriFieldTypeString;
                field.Length_2 = 180;
                outFields.AddField(field);

                field          = new FieldClass();
                field.Name_2   = "Toward" + currentNumber + "Lng";
                field.Type_2   = esriFieldType.esriFieldTypeString;
                field.Length_2 = 2;
                outFields.AddField(field);
            }

            // make the feature class

            IFeatureDataset pFeatureDataset = linesFeatureClass.FeatureDataset;
            IWorkspace      pWorkspace      = (linesFeatureClass as IDataset).Workspace;

            if (pFeatureDataset != null)
            {
                return(pFeatureDataset.CreateFeatureClass(name, outFields, ocDescription.InstanceCLSID,
                                                          ocDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple, fcDescription.ShapeFieldName, ""));
            }
            else if (pWorkspace is IFeatureWorkspace)
            {
                return((pWorkspace as IFeatureWorkspace).CreateFeatureClass(name, outFields, ocDescription.InstanceCLSID,
                                                                            ocDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple, fcDescription.ShapeFieldName, ""));
            }
            else
            {
                return(null);   // not expected
            }
        }