Index and Filter Class and Function Overview

The main index and filter classes and functions are

AcDbIndexFilterManager Namespace

The AcDbIndexFilterManager namespace is a collection of functions that provides index and filter access and maintenance functionality.

AcDbIndex Class

The AcDbIndex class is the base class for all index objects. AcDbSpatialIndex and AcDbLayerIndex derive from this class.

Keeping the index up to date is achieved through the AcDbIndexFilterManager::updateIndexes() function calls being explicitly invoked (either by an application or AutoCAD).

The AcDbFilteredBlockIterator will serve as the means to visit all the AcDbObjectIds that are “hits” from the query defined by the AcDbFilter passed to its constructor. For example, in the spatial index case, the AcDbSpatialFilter object instance passed to the newIterator() method will define a query region. The AcDbSpatialIndex object, through its newIterator() method, will provide an AcDbSpatialIndexIterator that will return object IDs that correspond to entities that fit within the query volume.

AcDbFilter Class

The AcDbFilter class is meant to define a “query.” It provides the “key” to the AcDbCompositeFilteredBlockIterator, for which the corresponding index is obtained through the indexClass() method.

AcDbFilteredBlockIterator Class

The AcDbFilteredBlockIterator class provides a method to process a “query” on an index. It is used by the AcDbCompositeFilteredBlockIterator.

AcDbCompositeFilteredBlockIterator Class

The AcDbCompositeFilteredBlockIterator class provides the alternate to normal block iteration. By providing the filter list in the init() method, the AcDbCompositeFilteredBlockIterator object looks for corresponding AcDbIndex derived objects through the AcDbFilter::indexClass() method, and creates AcDbFilteredBlockIterator objects. If the matching up-to-date indexClass() objects are not available, it creates an AcDbFilteredBlockIterator through the AcDbFilter::newIterator() method. It then orders the composition of the AcDbFilteredBlockIterator objects based on the AcDbFilteredBlockIterator::estimatedHits() and AcDbFilteredBlockIterator::buffersForComposition() methods. The collection of filters is a conjunction of conditions. This means an object ID is output from the iterator only if the accepts() method of each filter would accept the object ID.