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


C# IFeatureClass.CreateFeature方法代码示例

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


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

示例1: CreateFeature

        public static void CreateFeature(IFeatureClass featureClass, IPoint point)
        {
            // Build the feature
            IFeature feature = featureClass.CreateFeature();
            feature.Shape = point;

            //Update a value on string field - name of the new feature (city)
            int fieldIndex = featureClass.FindField("AREANAME");
            feature.set_Value(fieldIndex, "Mentone");

            //Commit the new feature to the geodatabase
            feature.Store();
        }
开发者ID:ApexGIS,项目名称:developer-support,代码行数:13,代码来源:_CreateFeature.cs

示例2: CreateFeature

        /// <summary>
        /// ���ݼ���ͼ�������Ҫ��
        /// </summary>
        /// <params name="featureLayer">��ǰ�༭ͼ��</params>
        /// <params name="geom">Ҫ�ؼ���</params>
        public static void CreateFeature(IFeatureClass featureClass, IGeometryArray geometryArray2, List<ziduan> list)
        {
            IWorkspaceEdit workspaceEdit = null;
            IFeatureCursor featureCursor = null;

            try
            {
                IDataset dataset = (IDataset)featureClass;
                IWorkspace workspace = dataset.Workspace;
                workspaceEdit = workspace as IWorkspaceEdit;

                workspaceEdit.StartEditing(true);
                workspaceEdit.StartEditOperation();
                for (int i = 0; i < geometryArray2.Count; i++)
                {
                    IFeature feature = featureClass.CreateFeature();
                    IGeometry mGeometry = geometryArray2.get_Element(i);
                    DataEditCommon.ZMValue(feature, mGeometry);     //����ͼ��Zֵ����
                    feature.Shape = mGeometry;
                    if (list != null)
                    {
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (feature.Fields.FindField(list[j].name) > 0)
                            {
                                feature.set_Value(feature.Fields.FindField(list[j].name), list[j].value);
                            }
                        }
                    }
                    if (feature.Fields.FindField("id") > 0)
                    {
                        feature.set_Value(feature.Fields.FindField("id"), (i + 1).ToString());
                    }
                    if (feature.Fields.FindField("Contour") > 0)
                    {
                        feature.set_Value(feature.Fields.FindField("Contour"), feature.Shape.Envelope.ZMax);
                    }
                    feature.Store();
                }
                workspaceEdit.StopEditOperation();
                workspaceEdit.StopEditing(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                workspaceEdit.AbortEditOperation();
                workspaceEdit.StopEditing(false);
            }
            finally
            {
                if (featureCursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);  //�ͷ�ָ��
                }
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:61,代码来源:DataEditCommon.cs

示例3: NodeToFeatureClass

        private void NodeToFeatureClass(osm osmDocument, IFeatureClass pointFeatureClass)
        {
            // initial safety check -- consider throwing an exception instead
            if (osmDocument == null)
            {
                return;
            }

            if (osmDocument.Items == null)
            {
                return;
            }

            if (pointFeatureClass == null)
            {
                return;
            }

            //
            int tagCollectionPointFieldIndex = pointFeatureClass.FindField("osmTags");
            int osmUserPointFieldIndex = pointFeatureClass.FindField("osmuser");
            int osmUIDPointFieldIndex = pointFeatureClass.FindField("osmuid");
            int osmVisiblePointFieldIndex = pointFeatureClass.FindField("osmvisible");
            int osmVersionPointFieldIndex = pointFeatureClass.FindField("osmversion");
            int osmChangesetPointFieldIndex = pointFeatureClass.FindField("osmchangeset");
            int osmTimeStampPointFieldIndex = pointFeatureClass.FindField("osmtimestamp");
            int osmIDPointFieldIndex = pointFeatureClass.FindField("OSMID");

            ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass();
            ISpatialReference wgs84 = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984) as ISpatialReference;

            foreach (var documentItem in osmDocument.Items)
            {
                if (documentItem is node)
                {
                   // if (DoesHaveKeys(documentItem))
                   // {
                        node currentNode = documentItem as node;

                        IFeature newPointFeature = pointFeatureClass.CreateFeature();

                        IPoint pointGeometry = new PointClass();
                        pointGeometry.X = Convert.ToDouble(currentNode.lon, new CultureInfo("en-US"));
                        pointGeometry.Y = Convert.ToDouble(currentNode.lat, new CultureInfo("en-US"));
                        pointGeometry.SpatialReference = wgs84;

                        newPointFeature.Shape = pointGeometry;

                        if (osmUserPointFieldIndex != -1)
                        {
                        newPointFeature.set_Value(osmUserPointFieldIndex, currentNode.user);
                        }
                        if (osmUIDPointFieldIndex != -1)
                        {
                            newPointFeature.set_Value(osmUIDPointFieldIndex, currentNode.uid);
                        }
                        if (osmVisiblePointFieldIndex != -1)
                        {
                            newPointFeature.set_Value(osmVisiblePointFieldIndex, currentNode.visible);
                        }
                        if (osmVersionPointFieldIndex != -1)
                        {
                            newPointFeature.set_Value(osmVersionPointFieldIndex, Convert.ToInt32(currentNode.version));
                        }
                        if (osmChangesetPointFieldIndex != -1)
                        {
                            newPointFeature.set_Value(osmChangesetPointFieldIndex, Convert.ToInt32(currentNode.changeset));
                        }
                        if (osmTimeStampPointFieldIndex != -1)
                        {
                            newPointFeature.set_Value(osmTimeStampPointFieldIndex, Convert.ToDateTime(currentNode.timestamp));
                        }
                        if (osmIDPointFieldIndex != -1)
                        {
                            newPointFeature.set_Value(osmIDPointFieldIndex, Convert.ToInt32(currentNode.id));
                        }

                        _osmUtility.insertOSMTags(tagCollectionPointFieldIndex, newPointFeature, currentNode.tag);

                        newPointFeature.Store();
                 //   }
                }
            }
        }
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:84,代码来源:OSMConflictEditorUI.cs

示例4: WriteFeatureDataTable2shp

        // FeatureDataTablet to shapefile
        private void WriteFeatureDataTable2shp(GeometryType gtype, FeatureDataTable ftable, IFeatureClass fc, String shapefilePath)
        {
            int rowCount = ftable.Rows.Count;
            int colCount = ftable.Columns.Count;
            int geometryColIndex = ftable.GeometryColumnIndex;
            //GeometryType gtype = selLayer.GeometryType;
            toolStripProgressBar1.Maximum = rowCount;
            toolStripProgressBar1.Value = 0;
            toolStripProgressBar1.Visible = true;

            // for each selected features
            for (int i = 0; i < rowCount; i++)
            {
                toolStripProgressBar1.Value = i + 1;
                selectionStripStatusLabel1.Text = toolStripProgressBar1.Value.ToString() + "/" + rowCount.ToString() + " features exported .";
                toolStripStatusLabel2.Text = shapefilePath;
                Application.DoEvents();

                // create a new feature
                IFeature feature = fc.CreateFeature();
                DataRow arow = ftable.Rows[i];
                string globalid;
                if (arow.Table.Columns.Contains("GlobalID"))
                {
                    globalid = arow["GlobalID"].ToString();
                }
                else
                {
                    globalid = arow["OBJECTID"].ToString();
                }

                // geometry
                ESRI.ArcGIS.Mobile.Geometries.Geometry mobileGeometry = arow[geometryColIndex] as ESRI.ArcGIS.Mobile.Geometries.Geometry;
                byte[] mobileGeometryByteArray = mobileGeometry.ExportToEsriShape();
                int len = mobileGeometryByteArray.Length;
                switch (gtype)
                {
                    case GeometryType.Point:
                        ESRI.ArcGIS.Geometry.IPoint aoShape = new ESRI.ArcGIS.Geometry.PointClass();
                        ((ESRI.ArcGIS.Geometry.IESRIShape)aoShape).ImportFromESRIShape(ref len, ref mobileGeometryByteArray[0]);
                        feature.Shape = aoShape;
                        break;

                    case GeometryType.Multipoint:
                        ESRI.ArcGIS.Geometry.IMultipoint aoShape2 = new ESRI.ArcGIS.Geometry.MultipointClass();
                        ((ESRI.ArcGIS.Geometry.IESRIShape)aoShape2).ImportFromESRIShape(ref len, ref mobileGeometryByteArray[0]);
                        feature.Shape = aoShape2;
                        break;

                    case GeometryType.Polyline:
                        ESRI.ArcGIS.Geometry.IPolyline aoShape3 = new ESRI.ArcGIS.Geometry.PolylineClass();
                        ((ESRI.ArcGIS.Geometry.IESRIShape)aoShape3).ImportFromESRIShape(ref len, ref mobileGeometryByteArray[0]);
                        feature.Shape = aoShape3;
                        break;

                    case GeometryType.Polygon:
                        ESRI.ArcGIS.Geometry.IPolygon aoShape4 = new ESRI.ArcGIS.Geometry.PolygonClass();
                        ((ESRI.ArcGIS.Geometry.IESRIShape)aoShape4).ImportFromESRIShape(ref len, ref mobileGeometryByteArray[0]);
                        feature.Shape = aoShape4;
                        break;
                }

                // insert other attributes
                // in mobile cache, the last col is for geometry
                // in shapefile, fid and shape fields are first two, for other fields index = +2
                for (int col = 0; col < colCount - 1; col++)
                {
                    // type
                    DataColumn dc = ftable.Columns[col];
                    Type dt = dc.DataType;

                    // guid or globalid, change to string
                    if (dt == typeof(Guid) || (dt == typeof(ESRI.ArcGIS.Mobile.GlobalId)))
                    {
                        feature.set_Value(col + 2, arow[col].ToString());
                        //feature.Store();
                        continue;
                    }

                    // if blob field, write to file
                    if (dt == typeof(Byte[]))
                    {
                        continue;
                    }
                    // raster field, write to jpg files
                    if (dt == typeof(Bitmap))
                    {
                        string photofoldername = shapefilePath + "\\" + dc.ColumnName;
                        if (!Directory.Exists(photofoldername))
                            continue;

                        // get bitmap from a raster field, save to ImageSource
                        System.Windows.Media.ImageSource imgsrc = null;
                        Bitmap bitmap = arow[col] as Bitmap;
                        if (bitmap == null)
                            continue;

                        System.Windows.Int32Rect rect = new System.Windows.Int32Rect(0, 0, bitmap.Width, bitmap.Height);
                        IntPtr hBitmap = IntPtr.Zero;
//.........这里部分代码省略.........
开发者ID:EricG66,项目名称:mobileCache2Shape1011,代码行数:101,代码来源:Form1.cs

示例5: catch

 object ICopyFeatures.CopyFromMdb(IFeature copiedFeature, IFeatureClass toFeatureClass)
 {
     MessageBox.Show(string.Format("line 492 DataManager \n{0}", copiedFeature.get_Value(2)));
        IFeature newfeature = toFeatureClass.CreateFeature();
        var simplifiedFeature = newfeature as IFeatureSimplify;
        IGeometry myGeometry = copiedFeature.ShapeCopy;
        try
        {
        simplifiedFeature.SimplifyGeometry(myGeometry);
        newfeature.Shape = myGeometry;
        newfeature.Store();
        }
        catch (Exception e1) { MessageBox.Show(string.Format("line 501 DataManager \n{0}", e1)); }
        //MessageBox.Show(string.Format("line 503 DataManager \n{0}", newfeature.OID));
        //return newfeature.OID;
        return 1;
 }
开发者ID:truonghinh,项目名称:TnX,代码行数:17,代码来源:DataManager.cs

示例6: createFeatureClass

 private void createFeatureClass()
 {
     string ftClsPath = rsUtil.TempMosaicDir+"\\catBnd.shp";
     IFields flds = new FieldsClass();
     IFieldsEdit fldsE = (IFieldsEdit)flds;
     IField fld = new FieldClass();
     IFieldEdit fldE = (IFieldEdit)fld;
     fldE.Name_2 = "catIndex";
     fldE.Type_2 = esriFieldType.esriFieldTypeSmallInteger;
     fldsE.AddField(fldE);
     ftCls = geoUtil.createFeatureClass(ftClsPath, fldsE, esriGeometryType.esriGeometryPolygon, sr);
     int catInd = ftCls.FindField("catIndex");
     int cnt = 0;
     foreach (IRaster rs in inrs)
     {
         IFeature ftr = ftCls.CreateFeature();
         ftr.set_Value(catInd, cnt);
         IEnvelope ext = ((IRasterProps)rs).Extent;
         IPolygon poly = new PolygonClass();
         IPointCollection pColl = (IPointCollection)poly;
         pColl.AddPoint(ext.UpperLeft);
         pColl.AddPoint(ext.UpperRight);
         pColl.AddPoint(ext.LowerRight);
         pColl.AddPoint(ext.LowerLeft);
         poly.Close();
         ftr.Shape = poly;
         ftr.Store();
         cnt++;
     }
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:30,代码来源:mergeFunctionArguments.cs

示例7: populateFCWithGoogleMapsEngineLayer

        /*
         * A function to populate a referenced Feature Class (fc) with the contents of a Google Maps Engine map layer
         */
        protected void populateFCWithGoogleMapsEngineLayer(ref IFeatureClass fc, string mapId, string parentId, MapsEngine.DataModel.gme.MapLayer layer)
        {
            // create a new feature
            IFeature feature;

            log.Debug("Creating a feature for layer " + layer.id);

            // attempt to process the assets within a the layer
            try
            {
                // fetch the layer asset object from the API
                log.Debug("Fetching an asset object for the layer.");
                MapsEngine.DataModel.gme.Asset layerAsset = api.getAssetById(ext.getToken(), layer.id);

                // create a new feature
                log.Debug("Creating a new feature.");
                feature = fc.CreateFeature();

                // Update the values for this feature
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_CustomerId_Name), mapId.Split("-".ToCharArray())[0]);
                log.Debug(Properties.Resources.GeodatabaseUtilities_schema_CustomerId_Name + ": " + mapId.Split("-".ToCharArray())[0]);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetId_Name), layer.id);
                log.Debug(Properties.Resources.GeodatabaseUtilities_schema_AssetId_Name + ": " + layer.id);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_MapAssetId_Name), mapId);
                log.Debug(Properties.Resources.GeodatabaseUtilities_schema_MapAssetId_Name + ": " + mapId);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetType_Name), layerAsset.type);
                log.Debug(Properties.Resources.GeodatabaseUtilities_schema_AssetType_Name + ": " + layerAsset.type);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetName_Name), layerAsset.name);
                log.Debug(Properties.Resources.GeodatabaseUtilities_schema_AssetName_Name + ": " + layerAsset.name);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_ParentAssetId_Name), parentId);
                log.Debug(Properties.Resources.GeodatabaseUtilities_schema_ParentAssetId_Name + ": " + parentId);

                // attempt to set the description object
                try
                {
                    // set the layer description value (truncate if necessary)
                    feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetDescription_Name)
                        , layerAsset.description.Length > 256
                        ? layerAsset.description.Substring(0, 252) + "..."
                        : layerAsset.description);
                    log.Debug(Properties.Resources.GeodatabaseUtilities_schema_AssetDescription_Name + ": " + layerAsset.description);
                }
                catch (System.Exception ex)
                {
                    // log warning
                    log.Warn(ex);
                }

                // verify the layer has a bbox and has two valid points
                if (layerAsset.bbox != null && layerAsset.bbox.Count() == 4)
                {
                    // deterine the maximum and minimum bounds of all layers within this map
                    // 0=West, 1=South, 2=East, 3=North
                    double XMAX = layerAsset.bbox[2];
                    log.Debug("XMAX: " + XMAX);
                    double YMAX = layerAsset.bbox[3];
                    log.Debug("YMAX: " + YMAX);
                    double XMIN = layerAsset.bbox[0];
                    log.Debug("XMIN: " + XMIN);
                    double YMIN = layerAsset.bbox[1];
                    log.Debug("YMIN: " + YMIN);

                    // determine the map extent based on the layers maximum extent
                    IPoint pExtentNE = new Point();
                    pExtentNE.X = XMAX;
                    pExtentNE.Y = YMAX;
                    IPoint pExtentSW = new Point();
                    pExtentSW.X = XMIN;
                    pExtentSW.Y = YMIN;
                    IPoint pExtentNW = new Point();
                    pExtentNW.X = XMIN;
                    pExtentNW.Y = YMAX;
                    IPoint pExtentSE = new Point();
                    pExtentSE.X = XMAX;
                    pExtentSE.Y = YMIN;

                    // define the polygon bounding box (NE/SW) as a point collection
                    IPointCollection pExtentPointCol = new Polygon();
                    pExtentPointCol.AddPoint(pExtentNE, Type.Missing, Type.Missing);
                    pExtentPointCol.AddPoint(pExtentSE, Type.Missing, Type.Missing);
                    pExtentPointCol.AddPoint(pExtentSW, Type.Missing, Type.Missing);
                    pExtentPointCol.AddPoint(pExtentNW, Type.Missing, Type.Missing);

                    // create a polygon, p, from the point collection, then close the polygon
                    IPolygon pExtent = (IPolygon)pExtentPointCol;
                    pExtent.Close();

                    // add the polygon, p, as the new feature's geometry
                    if (pExtent != null)
                    {
                        // set the shape geometry
                        log.Debug("Setting the feature's geometry as the polygon.");
                        feature.Shape = pExtent;
                    }
                    else
                    {
                        // set the feature's goemetry as the default world
//.........这里部分代码省略.........
开发者ID:domesticmouse,项目名称:mapsengine-arcgis-connector,代码行数:101,代码来源:GoogleMapsEngineFeatureClassManagement.cs

示例8: Append3DFile

        public static bool Append3DFile(string str3DFile, IFeatureClass fClassTarget , string strSpatialRef, ref IFeature feature3D)
        {
            try
            {

                string strTempPath=System.IO.Path.GetPathRoot(System.Environment.SystemDirectory);
                string strOutputTemp = System.IO.Path.Combine(strTempPath, "temp.shp");

                if (System.IO.File.Exists(strOutputTemp) && !DeleteDataset(strOutputTemp))
                {
                    ErrorMessage = "无法使用临时文件";
                    return false;
                }

                if (!Import3DFile(str3DFile, strOutputTemp, strSpatialRef))
                {
                    return false;
                }

                IWorkspace wsTemp =Hy.Esri.Utility.WorkspaceHelper.OpenWorkspace(Hy.Esri.Utility.enumWorkspaceType.File, strTempPath);
                IFeatureClass fClassTemp = (wsTemp as IFeatureWorkspace).OpenFeatureClass("temp");
                IFeatureCursor fCursorTemp = fClassTemp.Search(null, false);
                IFeature fTemp = fCursorTemp.NextFeature();
                if (fTemp == null)
                {
                    ErrorMessage = "追加的中转过程出错!";
                    return false;
                }
                IGeometry geo3D = (fTemp.Shape as IClone).Clone() as IGeometry;

                //IFeatureClass fClass = (wsTarget as IFeatureWorkspace).OpenFeatureClass(featureClassName);
                //feature3D = fClass.CreateFeature();
                feature3D = fClassTarget.CreateFeature();
                feature3D.Shape = geo3D;
                feature3D.Store();

                System.Runtime.InteropServices.Marshal.ReleaseComObject(fTemp);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(fCursorTemp);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(fClassTemp);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(wsTemp);

                return true;

                //string outPut = WorkspaceHelper.GetGpString(wsTarget, featrueDatasetName, featureClassName);
                //IFeature newFeature = null;
                //Append gpAppend = new Append();
                //gpAppend.inputs = strOutputTemp;
                //gpAppend.output = newFeature;
                //gpAppend.target = outPut;

                //Geoprocessor geoProcessor = new Geoprocessor();
                //geoProcessor.OverwriteOutput = true;
                //IGeoProcessorResult gpResult = geoProcessor.Execute(gpAppend, null) as IGeoProcessorResult;

                //return gpResult.Status == esriJobStatus.esriJobSucceeded;
            }
            catch(Exception exp)
            {
                ErrorMessage = exp.Message;
                return false;
            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:62,代码来源:GpTool.cs

示例9: Insert

        /// <summary>
        /// 插入新记录-方法自身开始结束编辑,实体类和几何的数量和列表序号要一一对应
        /// </summary>
        /// <param name="FC">要素类</param>
        /// <param name="listModel">实体类属性表</param>
        /// <param name="listGeometry">要素几何</param>
        /// <param name="SaveCount">每次保存的入库行数</param>
        /// <returns>null为成功,其他为错误信息</returns>
        private string Insert(IFeatureClass FC, List<model> listModel, List<IGeometry> listGeometry, int SaveCount)
        {
            try
            {
                int count = listModel.Count;
                int count2 = listGeometry.Count;
                if (count == 0)
                    return "实体类为空";
                if (count != count2)
                    return "实体类和要素几何数目不同";

                IWorkspaceEdit WSE = (FC as IDataset).Workspace as IWorkspaceEdit;
                WSE.StartEditing(false);
                WSE.StartEditOperation();

                int flag = 0;

                for (int i = 0; i < count; i++)
                {
                    model model = listModel[i];

                    IFeature F = FC.CreateFeature();
                    if (listGeometry[i] != null)
                        F.Shape = listGeometry[i];

                    int index = -1;

                    #region 属性表赋值

                    index = FC.FindField("OBJECTID ");
                    if (index != -1)
                        F.set_Value(index, model.OBJECTID);

                    index = FC.FindField("YSJWJMC ");
                    if (index != -1)
                        F.set_Value(index, model.YSJWJMC);

                    index = FC.FindField("CPMC ");
                    if (index != -1)
                        F.set_Value(index, model.CPMC);

                    index = FC.FindField("TM ");
                    if (index != -1)
                        F.set_Value(index, model.TM);

                    index = FC.FindField("TH ");
                    if (index != -1)
                        F.set_Value(index, model.TH);

                    index = FC.FindField("MJ ");
                    if (index != -1)
                        F.set_Value(index, model.MJ);

                    index = FC.FindField("DMFBL ");
                    if (index != -1)
                        F.set_Value(index, model.DMFBL);

                    index = FC.FindField("SJL ");
                    if (index != -1)
                        F.set_Value(index, model.SJL);

                    index = FC.FindField("SJGS ");
                    if (index != -1)
                        F.set_Value(index, model.SJGS);

                    index = FC.FindField("CPSYQDWMC ");
                    if (index != -1)
                        F.set_Value(index, model.CPSYQDWMC);

                    index = FC.FindField("SJJKGLDWMC ");
                    if (index != -1)
                        F.set_Value(index, model.SJJKGLDWMC);

                    index = FC.FindField("CPSCDWMC ");
                    if (index != -1)
                        F.set_Value(index, model.CPSCDWMC);

                    index = FC.FindField("CPCBDWMC ");
                    if (index != -1)
                        F.set_Value(index, model.CPCBDWMC);

                    index = FC.FindField("CPSCRQ ");
                    if (index != -1)
                        F.set_Value(index, model.CPSCRQ);

                    index = FC.FindField("DXLB ");
                    if (index != -1)
                        F.set_Value(index, model.DXLB);

                    index = FC.FindField("XBJD ");
                    if (index != -1)
                        F.set_Value(index, model.XBJD);
//.........这里部分代码省略.........
开发者ID:tanghaojie,项目名称:SDECodeBuilder,代码行数:101,代码来源:Class1.cs

示例10: updateAcetate

        public static void updateAcetate(SEE see, IFeatureClass featureClass, ISDUTExtension ext)
        {
            if(see == null)
            {
                return;
            }

            Logger.Write("Update acetate");
            IFeature feat = null;
            if(featureClass.FeatureCount(null) < 1)
            {
                feat = featureClass.CreateFeature();
                feat.Shape = see.Shape;
                feat.Store();
            }
            else
            {
                feat = featureClass.Update(null,false).NextFeature();
                feat.Shape = see.Shape;
                feat.Store();
            }
            Logger.Write("Update acetate -- Refresh");

            ((IActiveView)ext.FocusMap).Refresh();
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:25,代码来源:CmdNew.cs

示例11: populateFCWithGoogleMapsEngineMap

        /*
         * A function to populate a referenced FeatureClass (fc) with the contents of a Google Maps Engine map
         */
        public void populateFCWithGoogleMapsEngineMap(ref IFeatureClass fc, ref MapsEngine.DataModel.gme.Map map)
        {
            // create a feature object
            log.Debug("Creating a new Feature object to be used later in populating the FC.");
            IFeature feature = fc.CreateFeature();

            log.Debug("Creating feature for map " + map.id);

            // create a projectId value from the MapId
            String projectId = map.id.Split("-".ToCharArray())[0];

            // Update the values for this feature
            feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_CustomerId_Name), projectId);
            log.Debug(Properties.Resources.GeodatabaseUtilities_schema_CustomerId_Name + ": " + projectId);
            feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetId_Name), map.id);
            log.Debug(Properties.Resources.GeodatabaseUtilities_schema_AssetId_Name + ": " + map.id);
            feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_MapAssetId_Name), map.id);
            log.Debug(Properties.Resources.GeodatabaseUtilities_schema_MapAssetId_Name + ": " + map.id);
            feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetType_Name), "map");
            log.Debug(Properties.Resources.GeodatabaseUtilities_schema_AssetType_Name + ": " + "map");
            feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetName_Name), map.name);
            log.Debug(Properties.Resources.GeodatabaseUtilities_schema_AssetName_Name + ": " + map.name);
            feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_ParentAssetId_Name), projectId);
            log.Debug(Properties.Resources.GeodatabaseUtilities_schema_ParentAssetId_Name + ": " + projectId);

            // attempt to set the description
            try
            {
                // attempt to set the feature description (truncating if necessary)
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetDescription_Name)
                    , map.description.Length > 256
                    ? map.description.Substring(0, 252) + "..."
                    : map.description);
                log.Debug(Properties.Resources.GeodatabaseUtilities_schema_AssetDescription_Name + ": " + map.description);
            }
            catch (System.Exception ex)
            {
                // warn
                log.Warn(ex);
            }

            // check to see if the bbox object is not null
            log.Debug("Adding spatial representation if available.");
            if (map.bbox != null && map.bbox.Count() == 4)
            {
                // deterine the maximum and minimum bounds of all layers within this map
                // 0=West, 1=South, 2=East, 3=North
                double XMAX = map.bbox[2];
                log.Debug("XMAX: " + XMAX);
                double YMAX = map.bbox[3];
                log.Debug("YMAX: " + YMAX);
                double XMIN = map.bbox[0];
                log.Debug("XMIN: " + XMIN);
                double YMIN = map.bbox[1];
                log.Debug("YMIN: " + YMIN);


                // determine the map extent based on the layers maximum extent
                IPoint pExtentNE = new Point();
                pExtentNE.X = XMAX;
                pExtentNE.Y = YMAX;
                IPoint pExtentSW = new Point();
                pExtentSW.X = XMIN;
                pExtentSW.Y = YMIN;
                IPoint pExtentNW = new Point();
                pExtentNW.X = XMIN;
                pExtentNW.Y = YMAX;
                IPoint pExtentSE = new Point();
                pExtentSE.X = XMAX;
                pExtentSE.Y = YMIN;

                // define the polygon bounding box (NE/SW) as a point collection
                log.Debug("Building polygon object.");
                IPointCollection pExtentPointCol = new Polygon();
                pExtentPointCol.AddPoint(pExtentNE, Type.Missing, Type.Missing);
                pExtentPointCol.AddPoint(pExtentSE, Type.Missing, Type.Missing);
                pExtentPointCol.AddPoint(pExtentSW, Type.Missing, Type.Missing);
                pExtentPointCol.AddPoint(pExtentNW, Type.Missing, Type.Missing);

                // create a polygon, p, from the point collection, then close the polygon
                IPolygon pExtent = (IPolygon)pExtentPointCol;
                pExtent.Close();

                // add the polygon, p, as the new feature's geometry
                if (pExtent != null)
                {
                    log.Debug("Setting feature's geometry.");
                    feature.Shape = pExtent;
                }
                else
                {
                    log.Warn("Polygon is not valid, setting feature geometry to default worldwide.");
                    feature.Shape = worldPolygon;
                }
            }
            else
            {
//.........这里部分代码省略.........
开发者ID:domesticmouse,项目名称:mapsengine-arcgis-connector,代码行数:101,代码来源:GoogleMapsEngineFeatureClassManagement.cs

示例12: populateFCWithGoogleMapsEngineFolders

        /*
         * A function to populate a referenced Feature Class (fc) with the contents of a Google Mpas Engine map folder
         */
        protected void populateFCWithGoogleMapsEngineFolders(ref IFeatureClass fc, string mapId, string parentId, List<MapsEngine.DataModel.gme.MapFolder> folders)
        {
            // establish a feature object
            IFeature feature;

            // add all child folder within this map
            for (int f = 0; f < folders.Count(); f++)
            {
                // grap the current folder
                MapsEngine.DataModel.gme.MapFolder folder = folders[f];

                // add all child layers within this map
                foreach (MapsEngine.DataModel.gme.MapLayer layer in folder.layers)
                {
                    populateFCWithGoogleMapsEngineLayer(ref fc, mapId, "Folder" + f, layer);
                }

                // create a new feature
                feature = fc.CreateFeature();

                // Update the values for this feature
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_CustomerId_Name), mapId.Split("-".ToCharArray())[0]);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetId_Name), "Folder" + f);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_MapAssetId_Name), mapId);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetType_Name), "folder");
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_AssetName_Name), "Folder " + f);
                feature.set_Value(fc.FindField(Properties.Resources.GeodatabaseUtilities_schema_ParentAssetId_Name), parentId);

                // Commit the new feature to fc
                feature.Store();

                // if the folder contains subfolders, add them
                if (folder.folders != null && folder.folders.Count() > 0)
                {
                    populateFCWithGoogleMapsEngineFolders(ref fc, mapId, "Folder" + f, folder.folders);
                }
            }
        }
开发者ID:domesticmouse,项目名称:mapsengine-arcgis-connector,代码行数:41,代码来源:GoogleMapsEngineFeatureClassManagement.cs

示例13: CreateFeatureNoEditor

 /// <summary>
 /// ���ݼ���ͼ�������Ҫ��
 /// </summary>
 /// <params name="featureLayer">��ǰ�༭ͼ��</params>
 /// <params name="geom">Ҫ�ؼ���</params>
 public static void CreateFeatureNoEditor(IFeatureClass featureClass, IGeometry geometry, List<ziduan> list)
 {
     IFeature feature = featureClass.CreateFeature();
     DataEditCommon.ZMValue(feature, geometry);     //����ͼ��Zֵ����
     feature.Shape = geometry;
     if (list != null)
     {
         for (int j = 0; j < list.Count; j++)
         {
             if (feature.Fields.FindField(list[j].name) > 0)
             {
                 feature.set_Value(feature.Fields.FindField(list[j].name), list[j].value);
             }
         }
     }
     feature.Store();
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:22,代码来源:DataEditCommon.cs

示例14: insertRecords

 private bool insertRecords(IFeatureClass ftrCls, IFeature ftr, List<IGeometry> geoLst)
 {
     bool x = false;
     try
     {
         IFields flds = ftr.Fields;
         foreach (IGeometry geo in geoLst)
         {
             IFeature nFtr = ftrCls.CreateFeature();
             for (int f = 0; f < flds.FieldCount; f++)
             {
                 IField fld = flds.get_Field(f);
                 esriFieldType fldType = fld.Type;
                 int nFldIndex = nFtr.Fields.FindField(fld.Name);
                 if (fld.Editable==true && (fldType == esriFieldType.esriFieldTypeString || fldType == esriFieldType.esriFieldTypeSmallInteger || fldType == esriFieldType.esriFieldTypeSingle || fldType == esriFieldType.esriFieldTypeInteger || fldType == esriFieldType.esriFieldTypeDouble))
                 {
                     nFtr.set_Value(nFldIndex, ftr.get_Value(f));
                     if (fld.Name == "Shape_Area")
                     {
                         nFtr.set_Value(nFtr.Fields.FindField("Shape_Area"),((IArea)geo).Area);
                     }
                 }
             }
             nFtr.Shape = geo;
             nFtr.Store();
         }
         x = true;
     }
     catch (Exception e)
     {
         x = false;
         Console.WriteLine(e.ToString());
     }
     return x;
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:35,代码来源:landFire.cs

示例15: AddFeatureToFeatureClass

 //向shp中添加要素  pPolygon多边形   pFeatureClass多边形shp
 public static void AddFeatureToFeatureClass(IPolygon pPolygon, IFeatureClass pFeatureClass)
 {
     IFeature pFeature = pFeatureClass.CreateFeature();
     pFeature.Shape = pPolygon;
     pFeature.Store();
 }
开发者ID:AgentWord,项目名称:SiPing,代码行数:7,代码来源:Coordinate.cs


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