]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/PositionedOctree.cxx
commradio: improvements for atis speech
[flightgear.git] / src / Navaids / PositionedOctree.cxx
index 781fee8f220c17999b96aa4e6ce90da00f4bd75f..ae6ee5ec4b042e805c769749115572f70c7a6db5 100644 (file)
@@ -113,7 +113,21 @@ void Leaf::loadChildren()
   
   childrenLoaded = true;
 }
-  
+    
+void Leaf::addPolyLine(PolyLineRef aLine)
+{
+    lines.push_back(aLine);
+}
+
+void Leaf::visitForLines(const SGVec3d& aPos, double aCutoff,
+                           PolyLineList& aLines,
+                           FindLinesDeque& aQ) const
+{
+    aLines.insert(aLines.end(), lines.begin(), lines.end());
+}
+    
+///////////////////////////////////////////////////////////////////////////////
+    
 Branch::Branch(const SGBoxd& aBox, int64_t aIdent) :
   Node(aBox, aIdent),
   childrenLoaded(false)
@@ -139,6 +153,24 @@ void Branch::visit(const SGVec3d& aPos, double aCutoff,
     aQ.push(Ordered<Node*>(children[i], d));
   } // of child iteration
 }
+    
+void Branch::visitForLines(const SGVec3d& aPos, double aCutoff,
+                           PolyLineList& aLines,
+                           FindLinesDeque& aQ) const
+{
+    for (unsigned int i=0; i<8; ++i) {
+        if (!children[i]) {
+            continue;
+        }
+        
+        double d = children[i]->distToNearest(aPos);
+        if (d > aCutoff) {
+            continue; // exceeded cutoff
+        }
+        
+        aQ.push_back(children[i]);
+    } // of child iteration
+}
 
 Node* Branch::childForPos(const SGVec3d& aCart) const
 {
@@ -223,7 +255,7 @@ int Branch::childMask() const
   return result;
 }
 
-bool findNearestN(const SGVec3d& aPos, unsigned int aN, double aCutoffM, 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)
 {
   aResults.clear();
   FindNearestPQueue pq;
@@ -264,7 +296,7 @@ bool findNearestN(const SGVec3d& aPos, unsigned int aN, double aCutoffM, FGPosit
   return !pq.empty();
 }
 
-bool findAllWithinRange(const SGVec3d& aPos, double aRangeM, FGPositioned::Filter* aFilter, FGPositioned::List& aResults, int aCutoffMsec)
+bool findAllWithinRange(const SGVec3d& aPos, double aRangeM, FGPositioned::Filter* aFilter, FGPositionedList& aResults, int aCutoffMsec)
 {
   aResults.clear();
   FindNearestPQueue pq;