Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Process IFeatureCursor results many times without re-applying query/filter

$
0
0
I have a spatial filter performing as I want it to, returning me an IFeatureCursor object that I can loop through. I want to be able to loop through the IFeatureCursor object more than once without re-applying the filter, the spatial filtering can take some time to apply in large data sets. Is there a method available for this, like 'IFeature.FirstFeature()' rather than having to re-apply the filter and start wiith 'IFeature.NextFeature()' again? Code below.

Thanks

Rob

Code:

Dictionary<int, Dictionary<int, string>> FIDs = new Dictionary<int, Dictionary<int, string>>();
while ((pFeat = pFeatCursor.NextFeature()) != null)
{
        int thisFID = (int)pFeat.Value[fidIdx];
        FIDs.Add(thisFID, new Dictionary<int, string>());


        ISpatialFilter SPF = new SpatialFilter();
        SPF.SpatialRel = esriSpatialRelEnum.esriSpatialRelWithin;
        SPF.Geometry = pFeat.ShapeCopy;


        IFeatureCursor IFC2 = resultFeatLay.Search(SPF, false);
        IFeature IF2;

        int theCount = 1;
        while ((IF2 = IFC2.NextFeature()) != null)
        {
                FIDs[thisFID].Add((int)IF2.Value[fidIdx], (string)IF2.Value[splitIdx]);
                theCount += 1;
        }

        //THIS IS MY ATTEMPT AT STARTING THE LOOP AGAIN, TO NO AVAIL
        while ((IF2 = IFC2.NextFeature()) != null)
        {
                string stophere = "";
        }

}


Viewing all articles
Browse latest Browse all 1374

Trending Articles