]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/PositionedOctree.hxx
NasalPositioned-cppbind additions.
[flightgear.git] / src / Navaids / PositionedOctree.hxx
index db1a774e4f28e1a8a3618bbfa400b9877bee5a11..167f37a0d719ec94e6522bc0df4bf5a2ddab7fed 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <Navaids/positioned.hxx>
 #include <Navaids/NavDataCache.hxx>
+#include <Navaids/PolyLine.hxx>
 
 namespace flightgear
 {
@@ -112,6 +113,10 @@ namespace Octree
   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;
@@ -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<FGPositioned::Type, PositionedID> 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);
-  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