/** * Sets a spatial index that the layer should expose to support spatial * queries against this layer. You can set the spatial index to NULL but * this will slow down spatial search operations (a lot). * * @param index * Spatial index to use */ public void setSpatialIndex(SpatialIndex _index) { index = _index; if (index == null && store != null) { index = new SimpleSpatialIndex(store); } }
/** * Tells the feature layer to build or load its spatial index immediately. * Usually the feature layer will do so when needed; this way you can * directly exactly when the potentially long operation will occur. * * @return True if the index load/build succeeded, false if it failed. */ public bool assertSpatialIndex() { if (store != null && index == null) { //ScopedLock<ReentrantMutex> lock( osgGIS::Registry::instance()->getGlobalMutex() ); //TODO osgGIS::notice() << "Initializing spatial index..." << std::flush; index = new RTreeSpatialIndex(store); //if ( index != null ) // osgGIS::notice() << "OK." << std::endl; //else // osgGIS::warn() << "ERROR, failed to load/build index!" << std::endl; } return (index != null); }