#include <Navaids/positioned.hxx>
#include <Navaids/NavDataCache.hxx>
+#include <Navaids/PolyLine.hxx>
namespace flightgear
{
typedef Ordered<FGPositioned*> OrderedPositioned;
typedef std::vector<OrderedPositioned> 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<Node*> FindLinesDeque;
+
extern Node* global_spatialOctree;
class Leaf;
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;
+ virtual ~Node() {}
protected:
Node(const SGBoxd &aBox, int64_t aIdent) :
_ident(aIdent),
}
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<FGPositioned::Type, PositionedID> ChildMap;
ChildMap children;
-
+
+ PolyLineList lines;
+
void loadChildren();
};
}
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;
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