X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2FPositionedOctree.hxx;h=167f37a0d719ec94e6522bc0df4bf5a2ddab7fed;hb=9575783491783bfdb6f6dcbfa59ba750a3cf0da6;hp=747ce985b5aa6944c4843a38845c760b9bf2c9e3;hpb=1e8cdd58297d5cde5cd80a20174b2122d98d1626;p=flightgear.git diff --git a/src/Navaids/PositionedOctree.hxx b/src/Navaids/PositionedOctree.hxx index 747ce985b..167f37a0d 100644 --- a/src/Navaids/PositionedOctree.hxx +++ b/src/Navaids/PositionedOctree.hxx @@ -37,6 +37,7 @@ #include #include +#include namespace flightgear { @@ -112,6 +113,10 @@ namespace Octree typedef Ordered OrderedPositioned; typedef std::vector FindNearestResults; + // for extracting lines, we don't care about distance ordering, since + // we're always grabbing all the lines in an area + typedef std::deque FindLinesDeque; + extern Node* global_spatialOctree; class Leaf; @@ -144,6 +149,10 @@ namespace Octree FindNearestResults& aResults, FindNearestPQueue&) = 0; virtual Leaf* findLeafForPos(const SGVec3d& aPos) const = 0; + + virtual void visitForLines(const SGVec3d& aPos, double aCutoff, + PolyLineList& aLines, + FindLinesDeque& aQ) const = 0; protected: Node(const SGBoxd &aBox, int64_t aIdent) : _ident(aIdent), @@ -170,12 +179,20 @@ namespace Octree } void insertChild(FGPositioned::Type ty, PositionedID id); + + void addPolyLine(PolyLineRef); + + virtual void visitForLines(const SGVec3d& aPos, double aCutoff, + PolyLineList& aLines, + FindLinesDeque& aQ) const; private: bool childrenLoaded; typedef std::multimap ChildMap; ChildMap children; - + + PolyLineList lines; + void loadChildren(); }; @@ -195,6 +212,10 @@ namespace Octree } int childMask() const; + + virtual void visitForLines(const SGVec3d& aPos, double aCutoff, + PolyLineList& aLines, + FindLinesDeque& aQ) const; private: Node* childForPos(const SGVec3d& aCart) const; Node* childAtIndex(int childIndex) const; @@ -215,8 +236,8 @@ namespace Octree mutable bool childrenLoaded; }; - void findNearestN(const SGVec3d& aPos, unsigned int aN, double aCutoffM, FGPositioned::Filter* aFilter, FGPositioned::List& aResults); - bool findAllWithinRange(const SGVec3d& aPos, double aRangeM, FGPositioned::Filter* aFilter, FGPositioned::List& aResults, int aCutoffMsec); + bool findNearestN(const SGVec3d& aPos, unsigned int aN, double aCutoffM, FGPositioned::Filter* aFilter, FGPositionedList& aResults, int aCutoffMsec); + bool findAllWithinRange(const SGVec3d& aPos, double aRangeM, FGPositioned::Filter* aFilter, FGPositionedList& aResults, int aCutoffMsec); } // of namespace Octree