diff --git a/src/Navaids/NavDataCache.cxx b/src/Navaids/NavDataCache.cxx index 24de0fbd3..17937f926 100644 --- a/src/Navaids/NavDataCache.cxx +++ b/src/Navaids/NavDataCache.cxx @@ -1350,6 +1350,14 @@ void NavDataCache::updatePosition(PositionedID item, const SGGeod &pos) sqlite3_bind_double(d->setAirportPos, 3, pos.getLatitudeDeg()); sqlite3_bind_double(d->setAirportPos, 4, pos.getElevationM()); +// bug 905; the octree leaf may change here, but the leaf may already be +// loaded, and caching its children. (Either the old or new leaf!). Worse, +// we may be called here as a result of loading one of those leaf's children. +// instead of dealing with all those possibilites, such as modifying +// the in-memory leaf's STL child container, we simply leave the runtime +// structures alone. This is fine providing items do no move very far, since +// all the spatial searches ultimately use the items' real cartesian position, +// which was updated above. Octree::Leaf* octreeLeaf = Octree::global_spatialOctree->findLeafForPos(cartPos); sqlite3_bind_int64(d->setAirportPos, 5, octreeLeaf->guid()); diff --git a/src/Navaids/NavDataCache.hxx b/src/Navaids/NavDataCache.hxx index 01cc20bdd..069ffa907 100644 --- a/src/Navaids/NavDataCache.hxx +++ b/src/Navaids/NavDataCache.hxx @@ -139,8 +139,6 @@ public: /** * Modify the position of an existing item. - * Use with care, since loaded instances will not be updated (at present - - * this behaviour could in theorey be improved) */ void updatePosition(PositionedID item, const SGGeod &pos); diff --git a/src/Navaids/PositionedOctree.cxx b/src/Navaids/PositionedOctree.cxx index 479ee99c8..4f342a824 100644 --- a/src/Navaids/PositionedOctree.cxx +++ b/src/Navaids/PositionedOctree.cxx @@ -67,22 +67,6 @@ void Leaf::visit(const SGVec3d& aPos, double aCutoff, for (; it != end; ++it) { FGPositioned* p = cache->loadById(it->second); - if (!intersects(_box, p->cart())) { - // see http://code.google.com/p/flightgear-bugs/issues/detail?id=905 - - SG_LOG(SG_GENERAL, SG_WARN, "XXXXXXXXX bad spatial index for " << it->second - << "; " << p->ident() << " of type " << - FGPositioned::nameForType(p->type())); - SG_LOG(SG_GENERAL, SG_WARN, "\tgeodetic location:" << p->geod()); - SG_LOG(SG_GENERAL, SG_WARN, "\tcartesian location:" << p->cart()); - - SG_LOG(SG_GENERAL, SG_WARN, "leaf box:" << - _box.getMin() << " x " << _box.getMax()); - - throw sg_exception("Bad spatial index data"); - } - - double d = dist(aPos, p->cart()); if (d > aCutoff) { continue;