示例#1
0
        public void Dispose()
        {
            if (_cursor != null)
            {
                _cursor.Dispose();
                _cursor = null;

                if (!_released)
                {
                    FeatureCache.RemoveFeatureCollection(_cfCollection);
                }
            }
        }
示例#2
0
        private IFeatureCursor GetFeatures(Guid guid, IQueryFilter filter)
        {
            ICachedFeatureCollection collection = FeatureCache.GetUsableFeatureCollection(guid, filter);

            if (collection != null)
            {
                return(collection.FeatureCursor(filter));
            }
            else
            {
                FeatureCache.RemoveFeatureCollection(guid);

                collection = FeatureCache.CreateCachedFeatureCollection(guid, filter);
                return(new CachingFeatureCursor(collection, this.FeatureCursor(filter)));
            }
        }
示例#3
0
        virtual public ISelectionSet Select(IQueryFilter filter)
        {
            FeatureCache.RemoveFeatureCollection(_selectionGUID);
            if (this.IDFieldName != String.Empty && this.FindField(this.IDFieldName) != null)
            {
                filter.SubFields = this.IDFieldName;

                filter.AddField(this.ShapeFieldName);
                filter.AddField(this.IDFieldName);
                using (IFeatureCursor cursor = this.GetFeatures(_selectionGUID, filter))
                {
                    if (cursor != null)
                    {
                        IFeature feat;

                        IDSelectionSet selSet = new IDSelectionSet();
                        while ((feat = cursor.NextFeature) != null)
                        {
                            selSet.AddID(feat.OID);
                        }
                        return(selSet);
                    }
                }
            }
            else
            {
                int count = 0;
                using (IFeatureCursor cursor = this.GetFeatures(_selectionGUID, filter))
                {
                    if (cursor == null)
                    {
                        return(null);
                    }

                    IFeature feature;
                    while ((feature = cursor.NextFeature) != null)
                    {
                        count++;
                    }
                }
                return(new QueryFilteredSelectionSet(filter, count));
            }
            return(null);
        }
示例#4
0
        public IFeatureCursor GetSelectedFeatures(IDisplay display)
        {
            ICachedFeatureCollection collection = FeatureCache.GetCachedFeatureCollection(this._selectionGUID);

            if (collection == null)
            {
                return(null);
            }

            if (display != null)
            {
                SpatialFilter filter = new SpatialFilter();
                filter.SpatialRelation        = spatialRelation.SpatialRelationMapEnvelopeIntersects;
                filter.Geometry               = display.Envelope;
                filter.FilterSpatialReference = display.SpatialReference;

                return(collection.FeatureCursor(filter));
            }
            else
            {
                return(collection.FeatureCursor());
            }
        }
示例#5
0
        async public Task <IFeature> NextFeature()
        {
            if (_cursor == null)
            {
                return(null);
            }

            IFeature feature = await _cursor.NextFeature();

            if (_cfCollection != null)
            {
                if (feature != null)
                {
                    _cfCollection.AddFeature(feature);
                }
                else
                {
                    FeatureCache.ReleaseCachedFeatureCollection(_cfCollection);
                    _released = true;
                }
            }
            return(feature);
        }