X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2FPositionedOctree.hxx;h=167f37a0d719ec94e6522bc0df4bf5a2ddab7fed;hb=487546c848ad5559760b4de4aa36f19b9b8627a7;hp=7cb25ce425566abaa46239f1a7e935311d9685ca;hpb=9b900e94304b95337e2731946525cde4ef377da9;p=flightgear.git diff --git a/src/Navaids/PositionedOctree.hxx b/src/Navaids/PositionedOctree.hxx index 7cb25ce42..167f37a0d 100644 --- a/src/Navaids/PositionedOctree.hxx +++ b/src/Navaids/PositionedOctree.hxx @@ -30,12 +30,14 @@ #include #include #include +#include // SimGear #include #include #include +#include namespace flightgear { @@ -111,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; @@ -143,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), @@ -169,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(); }; @@ -194,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; @@ -214,8 +236,8 @@ namespace Octree mutable bool childrenLoaded; }; - void findNearestN(const SGVec3d& aPos, unsigned int aN, double aCutoffM, FGPositioned::Filter* aFilter, FGPositioned::List& aResults); - void findAllWithinRange(const SGVec3d& aPos, double aRangeM, FGPositioned::Filter* aFilter, FGPositioned::List& aResults); + 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