flightgear::PolyLineList lines;
flightgear::SHPParser::parsePolyLines(path, aType, lines, areClosed);
- flightgear::PolyLineList::iterator it;
- for (it=lines.begin(); it != lines.end(); ++it) {
- (*it)->addToSpatialIndex();
- }
+ flightgear::PolyLine::bulkAddToSpatialIndex(lines);
}
void loadNaturalEarthData()
#include <boost/foreach.hpp>
#include <simgear/math/sg_geodesy.hxx>
+#include <simgear/structure/exception.hxx>
#include <Navaids/PositionedOctree.hxx>
return new PolyLine(aTy, aRawPoints);
}
+void PolyLine::bulkAddToSpatialIndex(const PolyLineList &lines)
+{
+ NavDataCache::Transaction txn( NavDataCache::instance());
+ flightgear::PolyLineList::const_iterator it;
+ for (it=lines.begin(); it != lines.end(); ++it) {
+ (*it)->addToSpatialIndex();
+ }
+ txn.commit();
+}
+
void PolyLine::addToSpatialIndex() const
{
Octree::Node* node = Octree::global_spatialOctree->findNodeForBox(cartesianBox());
static PolyLineRef create(Type aTy, const SGGeodVec& aRawPoints);
+ static void bulkAddToSpatialIndex(const PolyLineList& lines);
+
/**
* retrieve all the lines within a range of a search point.
* lines are returned if any point is near the search location.