public void Dispose() { if (_cursor != null) { _cursor.Dispose(); _cursor = null; if (!_released) { FeatureCache.RemoveFeatureCollection(_cfCollection); } } }
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))); } }
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); }
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()); } }
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); }