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


C# IFeatureClass.GetFeature方法代码示例

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


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

示例1: GetHistoryList

        /// <summary>
        /// 获取历史记录列表
        /// </summary>
        /// <param name="fid">要获取历史记录的要素</param>
        /// <param name="fc"></param>
        /// <param name="historyFC"></param>
        /// <returns>历史记录列表,每一个值都是objectid,而不是道路编号</returns>
        public static List<int> GetHistoryList(int fid, IFeatureClass fc, IFeatureClass historyFC)
        {
            var f = fc.GetFeature(fid);
            if (f == null) return null;

            var historyList = new List<int>();
            var o = f.get_Value(f.Fields.FindField(ParentIDFieldName));
            if (o == null || o == DBNull.Value) return historyList;

            var parentNo = Convert.ToInt32(o);
            int id;
            while(parentNo != -1)
            {
                parentNo = GetParentNo(parentNo, historyFC, out id);
                if (id != -1) historyList.Add(id);
            }
            return historyList;
        }
开发者ID:LooWooTech,项目名称:Traffic,代码行数:25,代码来源:RoadMerger.cs

示例2: Store

        public void Store(IFeatureClass exceptionFC)
        {
            IFeatureBuffer theFBuffer;

            // New exceptions need to be inserted
            if (this.ObjectID == -1)
            {
                theFBuffer = exceptionFC.CreateFeatureBuffer();
            }
            else
            {
                theFBuffer = (IFeatureBuffer)exceptionFC.GetFeature(this.ObjectID);
            }

            int idx;
            idx = theFBuffer.Fields.FindField("ATTACHMENT");
            theFBuffer.set_Value(idx, this._attachment);

            //idx = theFBuffer.Fields.FindField("DATA_EXCEPTION_POINT_ID");
            //theFBuffer.set_Value(idx, {populated by trigger});

            idx = theFBuffer.Fields.FindField("DATA_EXCEPTION_STATUS");
            theFBuffer.set_Value(idx, this._status);

            idx = theFBuffer.Fields.FindField("EXCEPTION_DESCRIPTION");
            theFBuffer.set_Value(idx, this._description);

            idx = theFBuffer.Fields.FindField("LATITUDE");
            theFBuffer.set_Value(idx, this._location.Y);

            idx = theFBuffer.Fields.FindField("LONGITUDE");
            theFBuffer.set_Value(idx, this._location.X);

            idx = theFBuffer.Fields.FindField("OPERATIONAL_DATASET_NAME");
            theFBuffer.set_Value(idx, this._operationDSName);

            idx = theFBuffer.Fields.FindField("QA_TEST_NAME");
            theFBuffer.set_Value(idx, this._testName);

            // Shape
            theFBuffer.Shape = this._location;

            if (this.ObjectID == -1)
            {
                ICursor theInsertCursor = ((ITable)exceptionFC).Insert(false);
                this._objectID = (int)theInsertCursor.InsertRow(theFBuffer);
                theInsertCursor.Flush();

                Marshal.ReleaseComObject(theInsertCursor);
            }
            else
            {
                ((IFeature)theFBuffer).Store();
            }
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:55,代码来源:QAException.cs

示例3: ProcessLayer

        private bool ProcessLayer(
			string layerKey,
			IFeatureClass workingFC,
			IFeatureClass editsFC,
			IFeatureClass pristineFC,
			IPolygon seeBounds,
			double shiftLimit)
        {
            if (workingFC == null
                || editsFC == null
                || pristineFC == null
                || seeBounds == null
                || seeBounds.IsEmpty == true)
            {
                this.LogMessage("Bad arguments passed to ProcessLayer");
                return false;
            }

            // Loop through Inserts, Updates, Deletes
            IFeatureCursor theInsCursor = null;
            IFeatureCursor theUpdCursor = null;
            IFeatureCursor theDelCursor = null;

            int workingOID = -1;
            int pristineOID = -1;

            try
            {
                string theTxID = this.TxID;

                theInsCursor = this._eDao.getInserts(layerKey);
                theUpdCursor = this._eDao.getUpdates(layerKey);
                theDelCursor = this._eDao.getDeletes(layerKey);

                IFeature theWorkingFeature = null;
                IFeature thePristineFeature = null;

                string[] pks = new String[1] { workingFC.Fields.get_Field(0).Name }; //this._tmConfig.get_LayerConfig(layerKey).Keys;
                IQueryFilter thePKFilter = null;

                IFeature theEditIndicator = theInsCursor.NextFeature();
                while (theEditIndicator != null)
                {
                    thePKFilter = DAOUtils.setupFilter(theEditIndicator, pks);

                    if (thePKFilter != null)
                    {
                        // Pass working feature, no original feature
                        int idx = theEditIndicator.Fields.FindField(EditsDAO.EDIT_OID_LOG);
                        int oid = Convert.ToInt32(theEditIndicator.get_Value(idx));
                        theWorkingFeature = workingFC.GetFeature(oid);
                        this.LogMessage("Checking insert " + theEditIndicator.OID + ". Biz Where clause: " + thePKFilter.WhereClause);
                        this.LogMessage("Working OID: " + oid + " Null? " + Convert.ToString(theWorkingFeature == null));
                        workingOID = oid;
                        thePristineFeature = null;
                        pristineOID = -1;

                        this.EvaluateEditInSee(theWorkingFeature, thePristineFeature, seeBounds, theTxID, thePKFilter.WhereClause, shiftLimit);
                    }
                    else
                    {
                        this.CreateMissingPKError(theEditIndicator, pks, "insert");
                    }
                    theEditIndicator = theInsCursor.NextFeature();
                }

                theEditIndicator = theUpdCursor.NextFeature();
                while (theEditIndicator != null)
                {
                    thePKFilter = DAOUtils.setupFilter(theEditIndicator, pks);

                    if (thePKFilter != null)
                    {
                        // Pass working feature, pristine feature
                        int idx = theEditIndicator.Fields.FindField(EditsDAO.EDIT_OID_LOG);
                        int oid = Convert.ToInt32(theEditIndicator.get_Value(idx));
                        theWorkingFeature = workingFC.GetFeature(oid);
                        this.LogMessage("Checking update " + theEditIndicator.OID + ". Biz Where clause: " + thePKFilter.WhereClause);
                        this.LogMessage("Working OID: " + oid + " Null? " + Convert.ToString(theWorkingFeature == null));
                        workingOID = oid;

                        thePristineFeature = null;
                        IFeatureCursor thePristineCursor = null;

                        try
                        {
                            thePristineCursor = pristineFC.Search(thePKFilter, false);
                            thePristineFeature = thePristineCursor.NextFeature();
                            pristineOID = thePristineFeature.OID;
                        }
                        catch (Exception)
                        { }
                        finally
                        {
                            if (thePristineCursor != null)
                            {
                                Marshal.ReleaseComObject(thePristineCursor);
                            }
                        }

//.........这里部分代码省略.........
开发者ID:EAWCS1,项目名称:SUITT,代码行数:101,代码来源:GeometryEditsInSEE.cs

示例4: MatchTable


//.........这里部分代码省略.........
              fieldsToCopy.GetAllProperties(out copyTo, out copyFrom);
              string[] copyToArray = copyTo as string[];
              object[] copyFromArray = copyFrom as object[];
              string matchStatus = "U";

              // Populate the output feature class
              while (row != null)
              {
              featureBuffer = outputFeatureClass.CreateFeatureBuffer();
              foreach (KeyValuePair<int,string> entry in addressFieldIndexes)
              {
                  if (entry.Key != -1)
                      address = row.get_Value(entry.Key) as string;
                  else
                      address = row.get_Value(0) as string;

                  addressProperties.SetProperty(entry.Value, address);
              }

              resultSet = MatchAddress(addressProperties);

              // Get all of the fields and values of the result
              resultSet.GetAllProperties(out key, out value);
              string[] names = key as string[];
              object[] items = value as object[];

              // Output match fields and values
              // Insert the Feature into the output featureClass and get the next row
              if (m_needToUpdate)
              {
                  _log.Debug("IAddressGeocoding Updating Feature" + row.OID.ToString());

                  // Record is being rematched so find record to update
                  IFeature feature = outputFeatureClass.GetFeature(row.OID);

                  for (int i = 0; i < names.Length; i++)
                  {
                      if (names[i] == "Shape")
                          feature.Shape = items[i] as IGeometry;
                      else
                      {
                          if (names[i] == "Status")
                          {
                              matchStatus = items[i] as string;
                              feature.set_Value(outputFeatureClass.FindField(names[i]), items[i]);
                          }
                      }
                  }

                  // Set the match type
                  if (outputFeatureClass.FindField("Match_type") != -1)
                  {
                      feature.set_Value(outputFeatureClass.FindField("Match_type"), "A");
                  }

                  // Copy over values from address table
                  for (int j = 0; j < copyToArray.Length; j++)
                  {
                      feature.set_Value(outputFeatureClass.FindField(copyToArray[j]),
                      row.get_Value(addressTable.FindField(copyFromArray[j] as string)));
                  }

                  updateCursor.UpdateFeature(feature);
              }
              else
              {
开发者ID:EsriUK,项目名称:dynamic-locator-sdk,代码行数:67,代码来源:LocatorWrapper.cs

示例5: SearchSpatialFilter

        /// <summary>
        /// ����λ�ڻ������еĵ�Ҫ��- ʹ��ISpatialFilter
        /// </summary>
        /// <param name="ipPtFeaCls">��ͼ��</param>
        /// <param name="ipBufferFeaCls">������ͼ��</param>
        /// <returns></returns>
        private bool SearchSpatialFilter(IFeatureClass ipPtFeaCls,
                                         IFeatureClass ipBufferFeaCls)
        {
            if (ipBufferFeaCls == null || ipPtFeaCls == null) return false;

            ISpatialFilter pSpatialFilter = new SpatialFilterClass(); //(CLSID_SpatialFilter);

            // 1. ���ÿռ��ϵ
            pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

            // 2.���ù��˼���
            string shapeFieldName = ipPtFeaCls.ShapeFieldName;
            pSpatialFilter.GeometryField = shapeFieldName;

            // ���cursor
            IFeatureCursor ipResultFtCur = null;

            // ����Դͼ��Ҫ��
            IFeatureCursor ipFeatCursor;
            IFeature ipFeature;

            IQueryFilter pQueryFilter = new QueryFilterClass(); //(CLSID_QueryFilter);
            string SubFields = "OID,Shape";
            pQueryFilter.SubFields = SubFields;
            ipFeatCursor = ipBufferFeaCls.Search(pQueryFilter, true);
            ipFeature = ipFeatCursor.NextFeature();

            m_aryResult = new List<PointDistInfo>();
            while (ipFeature != null)
            {
                IGeometry ipGeometry1, ipGeometry2;
                int OID1, OID2;
                ipGeometry1 = ipFeature.Shape;
                OID1 = ipFeature.OID;

                if (ipGeometry1 == null)
                {
                    ipFeature = ipFeatCursor.NextFeature();
                    continue;
                }

                pSpatialFilter.Geometry = ipGeometry1;

                if (ipResultFtCur != null)
                {
                    Marshal.ReleaseComObject(ipResultFtCur);
                }
                ipResultFtCur = ipPtFeaCls.Search(pSpatialFilter, true);

                // ��ӵ��������
                if (ipResultFtCur == null)
                {
                    ipFeature = ipFeatCursor.NextFeature();
                    continue;
                }

                IFeature ipResFeature = ipResultFtCur.NextFeature();

                while (ipResFeature != null)
                {
                    OID2 = ipResFeature.OID;

                    // ID��ͬ��˵����ͬһ���㡣ID1:��������ID2:�����ڻ������еĵ�
                    if (OID1 == OID2)
                    {
                        ipResFeature = ipResultFtCur.NextFeature();
                        continue;
                    }

                    // ��ҽ����¼
                    PointDistInfo PtInfo;
                    // OID1
                    PtInfo.OID1 = OID1;
                    // OID2
                    PtInfo.OID2 = OID2;

                    IFeature ipFeat = null;
                    //if (OID1 == 58)
                    //{
                    //   //XtraMessageBox.Show("RulePointDist:SearchSpatialFiler :OIDΪ58�ĵ����޷���ȡ������ԭ��");
                    //   break;

                    //}

                    try
                    {
                        ipFeat = ipPtFeaCls.GetFeature(OID1);
                    }
                    catch (Exception ex)
                    {
                        SendMessage(enumMessageType.Exception, "��ȡҪ�س����"+ex.ToString());
                        break;
                    }

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

示例6: SearchPoints

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ipPtFeaCls"></param>
        /// <returns></returns>
        private bool SearchPoints(IFeatureClass ipPtFeaCls)
        {
            if (ipPtFeaCls == null) return false;
            try
            {
                // ����Դͼ��Ҫ��
                IQueryFilter ipQuery = new QueryFilterClass();
                ipQuery.SubFields = "OBJECTID,Shape,BSM";
                IFeatureCursor ipFeatCursor = ipPtFeaCls.Search(ipQuery, true);
                IFeature ipFeature = ipFeatCursor.NextFeature();

                IGeometry ipGeometry = null;
                int OID1 = -1;
                m_aryResult = new List<PointDistInfo>();
                int iDecimal = 0;

                int iParmer = GetParameter(m_pPara.dPointDist, out iDecimal);
                while (ipFeature != null)
                {
                    ipGeometry = ipFeature.Shape;
                    OID1 = ipFeature.OID;
                    if (ipGeometry == null)
                    {
                        ipFeature = ipFeatCursor.NextFeature();
                        continue;
                    }
                    else
                    {
                        if (ipGeometry.GeometryType == esriGeometryType.esriGeometryPoint ||
                            ipGeometry.GeometryType == esriGeometryType.esriGeometryMultipoint)
                        {
                            IPoint ipT = (IPoint)ipGeometry;
                            int dx = Convert.ToInt32(Math.Round(ipT.X, iDecimal) * iParmer);
                            int dy = Convert.ToInt32(Math.Round(ipT.Y, iDecimal) * iParmer);
                            string str = dx.ToString() + "_" + dy.ToString();
                            if (!m_PointtoOID.Contains(str))
                            //����һhashtable���Ե�ġ�x_y��������ɵ��ַ���Ϊkey�������У�x��y��ȡһλС����������������IJ�������"<=0.1"��Ч,�����x_y��keyֵ��ͬ������������϶�>=0.1
                            {
                                m_PointtoOID.Add(str, OID1);
                            }
                            else
                            {
                                object OID = m_PointtoOID[str];
                                IFeature OriginFeature = ipPtFeaCls.GetFeature((int)OID);
                                IPoint OriginPoint = (IPoint)OriginFeature.Shape;
                                // ��������
                                double dDist = (ipT.X - OriginPoint.X) * (ipT.X - OriginPoint.X) +
                                               (ipT.Y - OriginPoint.Y) * (ipT.Y - OriginPoint.Y);
                                ///���Ҵ�������
                                if ((int)OID != OID1 && Math.Round(Math.Sqrt(dDist), 2) < m_pPara.dPointDist)
                                {
                                    //m_OIDtoOID.Add(OID1, OID);

                                    if (!m_RepeatOIDtoOID.Contains(str))
                                    {
                                        string strTemp = OID1.ToString();
                                        m_RepeatOIDtoOID.Add(str, strTemp);
                                    }
                                    else
                                    {
                                        string strTemp = m_RepeatOIDtoOID[str].ToString() + "," + OID1;
                                        m_RepeatOIDtoOID[str] = strTemp;
                                    }

                                    //// ��ҽ����¼
                                    //PointDistInfo PtInfo = new PointDistInfo();

                                    //PtInfo.dDistance = Math.Round(Math.Sqrt(dDist), 2);

                                    //PtInfo.OID1 = Convert.ToInt32(OID1);
                                    //PtInfo.OID2 = Convert.ToInt32(OID);

                                    //m_aryResult.Add(PtInfo);
                                }
                            }
                        }
                    }
                    ipFeature = ipFeatCursor.NextFeature();
                }
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:91,代码来源:RulePointDist.cs

示例7: DrawSelectResult

 private void DrawSelectResult(IFeatureClass fishnetFeaCls)
 {
     //第八, 按不同的成绩用不同的颜色画方块.
     for (int i = 0; i < featureList.Count; i++)
     {
         if (((Feature)featureList[i]).inUse == 1)
         {
             GisUtil.drawPolygonByScore(fishnetFeaCls.GetFeature(i).ShapeCopy, ((Feature)featureList[i]).score, mapControl);
         }
         else
         {
             GisUtil.drawPolygonByScore(fishnetFeaCls.GetFeature(i).ShapeCopy, 0, mapControl);
         }
     }
 }
开发者ID:wingzhangmaybe,项目名称:CGXM,代码行数:15,代码来源:SiteSelector.cs

示例8: overlapStandard

        private List<double> overlapStandard(IFeatureClass featureClass, string targetLayerName)
        {
            List<double> overlapList = new List<double>();
            IFeatureClass targetFeatureClass = GisUtil.getFeatureClass(mapFolder, targetLayerName);
            for (int i = 0; i < featureClass.FeatureCount(null); i++)
            {
                IFeature feature = featureClass.GetFeature(i);
                IGeometry geometry = feature.ShapeCopy;
                geometry.SpatialReference = mapControl.SpatialReference;
                ITopologicalOperator tpOp = geometry as ITopologicalOperator;
                IArea area = geometry as IArea;
                ISpatialFilter cityFilter = new SpatialFilterClass();
                cityFilter.Geometry = geometry;
                cityFilter.GeometryField = "SHAPE";
                cityFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                IFeatureCursor feaCursor = targetFeatureClass.Search(cityFilter, false);

                //获取所有与该块相交的要素, 然后检测其相交的面积, 依照比例计算最终的值.
                IFeature cityFea = feaCursor.NextFeature();
                double overlap = 0;
                while (cityFea != null)
                {
                    if (cityFea != null)
                    {
                        IGeometry intersectedGeom = tpOp.Intersect(cityFea.ShapeCopy, esriGeometryDimension.esriGeometry2Dimension);
                        IArea intersectedGeomArea = intersectedGeom as IArea;
                        //获取gridcode.
                        ITable table = cityFea.Table;
                        IRow row = table.GetRow(0);
                        int fieldNum = table.FindField("GRIDCODE");
                        double value = (double)cityFea.get_Value(fieldNum);
                        overlap = overlap + value * (intersectedGeomArea.Area / area.Area);
                    }
                    cityFea = feaCursor.NextFeature();
                }
                overlapList.Add(overlap);
            }
            return overlapList;
        }
开发者ID:wingzhangmaybe,项目名称:CGXM,代码行数:39,代码来源:SiteSelector.cs

示例9: distanceStandard

        private List<double> distanceStandard(IFeatureClass featureClass, string targetLayerName)
        {
            List<double> distanceList = new List<double>();
            IFeatureClass targetFeatureClass = GisUtil.getFeatureClass(mapFolder, targetLayerName);
            //将所有的geometry放入一个arraylist.
            List<IGeometry> geometryList = new List<IGeometry>();
            for (int i = 0; i < targetFeatureClass.FeatureCount(null); i++)
            {
                geometryList.Add(targetFeatureClass.GetFeature(i).ShapeCopy);
            }
            IGeometry geometry = GisUtil.unionAllFeature(geometryList);
            IProximityOperator proOp = geometry as IProximityOperator;

            //求到路的距离.
            for (int i = 0; i < featureClass.FeatureCount(null); i++)
            {
                IFeature fea = featureClass.GetFeature(i);
                IGeometry geom = fea.ShapeCopy;
                geom.SpatialReference = mapControl.SpatialReference;
                double distance = proOp.ReturnDistance(geom);
                distanceList.Add(distance);
            }
            return distanceList;
        }
开发者ID:wingzhangmaybe,项目名称:CGXM,代码行数:24,代码来源:SiteSelector.cs

示例10: IntersectRestraint

        private List<double> IntersectRestraint(IFeatureClass featureClass, string targetLayerName)
        {
            List<double> ratioList = new List<double>();
            IFeatureClass targetFeatureClass = GisUtil.getFeatureClass(mapFolder, targetLayerName);
            List<IGeometry> geometryList = new List<IGeometry>();
            for (int i = 0; i < targetFeatureClass.FeatureCount(null); i++)
            {
                geometryList.Add(targetFeatureClass.GetFeature(i).Shape);
            }
            IGeometry geometry = GisUtil.unionAllFeature(geometryList); //e0图层所有的几何图形.
            ITopologicalOperator toOp = geometry as ITopologicalOperator;

            for (int i = 0; i < featureClass.FeatureCount(null); i++)
            {
                IFeature feature = featureClass.GetFeature(i);
                IGeometry srcGeom = feature.ShapeCopy;
                srcGeom.SpatialReference = mapControl.SpatialReference;
                IGeometry intersectedGeom = toOp.Intersect(srcGeom, esriGeometryDimension.esriGeometry2Dimension);
                //测量相交图形的面积, 超过原图形的一半, 有效.
                IArea area = intersectedGeom as IArea;
                IArea srcArea = srcGeom as IArea;
                double ratio = (area.Area / srcArea.Area) * 100;
                ratioList.Add(ratio);
            }
            return ratioList;
        }
开发者ID:wingzhangmaybe,项目名称:CGXM,代码行数:26,代码来源:SiteSelector.cs

示例11: retrieveNodeID

        internal static string retrieveNodeID(IFeatureClass pointFeatureClass, int osmIDPointFieldIndex, int extensionVersion, IPoint pointGeometry)
        {
            string nodeID = string.Empty;

            if (pointGeometry == null)
                return String.Empty;

            if (pointGeometry.IsEmpty)
                return String.Empty;

            if (((IPointIDAware)pointGeometry).PointIDAware == false)
            {
                return nodeID;
            }
            if (extensionVersion == 1)
            {
                nodeID = Convert.ToString(pointGeometry.ID);
            }
            else if (extensionVersion == 2)
            {
                IFeature pointFeature = null;
                try
                {
                    pointFeature = pointFeatureClass.GetFeature(pointGeometry.ID);
                }
                catch { }
                if (pointFeature != null)
                {
                    if (osmIDPointFieldIndex > -1)
                    {
                        nodeID = Convert.ToString(pointFeature.get_Value(osmIDPointFieldIndex));
                    }
                }
                Marshal.ReleaseComObject(pointFeature);
            }
            return nodeID;
        }
开发者ID:hallahan,项目名称:arcgis-osm-editor,代码行数:37,代码来源:OSMToolHelper.cs

示例12: DeleteFeature

    public static void DeleteFeature(IFeatureClass theFC, int OID)
    {
      try
      {
        IFeature theNF = theFC.GetFeature(OID);

        if (theNF != null) { theNF.Delete(); }
      }
      catch (Exception ex) { }
    }
开发者ID:Zekiah,项目名称:ArcGISCompare,代码行数:10,代码来源:GeoDbProcs.cs

示例13: SplitPolyline

        public static List<int> SplitPolyline(int oid, List<IPoint> pts, IFeatureClass fc)
        {
            var f = fc.GetFeature(oid);

            var geo = f.ShapeCopy as IPolyline;
            var ret = new List<int>();

            var lines = SplitPolylineInner(geo, pts);

            if (lines.Count < 2) return ret ;

            var cursor = fc.Insert(true);
            var idIndex = cursor.FindField(IDField);
            var id = GetNewId(fc);
            foreach(var line in lines)
            {
                var buff = fc.CreateFeatureBuffer();
                ret.Add(id);
                buff.set_Value(idIndex, id);
                buff.Shape = line;
                CopyFields(f, buff);
                cursor.InsertFeature(buff);
                cursor.Flush();
                id++;
            }

            Marshal.ReleaseComObject(cursor);
            f.Delete();
            return ret;
        }
开发者ID:LooWooTech,项目名称:Traffic,代码行数:30,代码来源:RoadHelper.cs

示例14: TransformToCrossroadInfo

        private static List<CrossroadInfo> TransformToCrossroadInfo(Dictionary<int, List<IPoint>> dict, IFeatureClass fc)
        {
            var ret = new List<CrossroadInfo>();
            foreach(var pair in dict)
            {
                var f = fc.GetFeature(pair.Key);

                var name = f.get_Value(f.Fields.FindField("NAME")).ToString();
                var no = Convert.ToInt32(f.get_Value(f.Fields.FindField("NO_")));

                foreach(var pt in pair.Value)
                {
                    ret.Add(new CrossroadInfo{
                        Name=name,
                        NO=no,
                        Point=pt,
                        OID=pair.Key
                    });
                }
            }
            return ret;
        }
开发者ID:LooWooTech,项目名称:Traffic,代码行数:22,代码来源:MainForm.cs

示例15: updatePolygon

        private bool updatePolygon(IFeatureClass ftrCls,int oid)
        {
            bool x = false;
            IGeometry geo = ftrCls.GetFeature(oid).ShapeCopy;
            ISpatialFilter spFlt = new SpatialFilterClass();
            spFlt.WhereClause = ftrCls.OIDFieldName + " <> " + oid.ToString();
            spFlt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
            IQueryFilterDefinition2 qryDef2 = (IQueryFilterDefinition2)spFlt;
            qryDef2.PostfixClause = "Order by Shape_Area DESC";
            spFlt.Geometry = geo;
            spFlt.GeometryField = ftrCls.ShapeFieldName;
            spFlt.SearchOrder = esriSearchOrder.esriSearchOrderSpatial;
            IFeatureCursor ftrCur = ftrCls.Search(spFlt, false);
            int shapeAreaIndex = ftrCur.FindField("Shape_Area");
            IFeature ftr = ftrCur.NextFeature();
            while (ftr!=null)
            {
                IGeometry geoMax = ftr.ShapeCopy;
                int beforeCnt = ((IGeometryCollection)geoMax).GeometryCount;
                ITopologicalOperator4 tp = (ITopologicalOperator4)geoMax;
                IGeometry uGeo = tp.Union(geo);
                int afterCnt = ((IGeometryCollection)uGeo).GeometryCount;
                if (beforeCnt >= afterCnt)
                {
                    try
                    {
                        ftr.Shape = uGeo;
                        if (shapeAreaEdit)
                        {
                            ftr.set_Value(shapeAreaIndex, ((IArea)uGeo).Area);
                        }
                        ftr.Store();
                        x = true;
                        return x;
                    }
                    catch (Exception e)
                    {
                        x = false;
                        Console.WriteLine(e.ToString());
                        return x;
                    }

                }
                ftr = ftrCur.NextFeature();
            }
            return x;
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:47,代码来源:landFire.cs


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