1 // positioned.cxx - base class for objects which are positioned
3 // Copyright (C) 2008 James Turner
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include "positioned.hxx"
29 #include <algorithm> // for sort
33 #include <boost/algorithm/string/case_conv.hpp>
34 #include <boost/algorithm/string/predicate.hpp>
36 #include <osg/Math> // for osg::isNaN
38 #include <simgear/timing/timestamp.hxx>
39 #include <simgear/props/props.hxx>
40 #include <simgear/debug/logstream.hxx>
41 #include <simgear/structure/exception.hxx>
42 #include <simgear/math/SGGeometry.hxx>
43 #include <simgear/sg_inlines.h>
44 #include <simgear/structure/commands.hxx>
46 #include "PositionedBinding.hxx"
47 #include "Airports/simple.hxx"
48 #include "Main/fg_props.hxx"
50 typedef std::multimap<std::string, FGPositioned*> NamedPositionedIndex;
51 typedef std::pair<NamedPositionedIndex::const_iterator, NamedPositionedIndex::const_iterator> NamedIndexRange;
53 using std::lower_bound;
54 using std::upper_bound;
56 static NamedPositionedIndex global_identIndex;
57 static NamedPositionedIndex global_nameIndex;
59 //////////////////////////////////////////////////////////////////////////////
64 const double LEAF_SIZE = SG_NM_TO_METER * 8.0;
65 const double LEAF_SIZE_SQR = LEAF_SIZE * LEAF_SIZE;
68 * Decorate an object with a double value, and use that value to order
69 * items, for the purpoises of the STL algorithms
75 Ordered(const T& v, double x) :
81 Ordered(const Ordered<T>& a) :
87 Ordered<T>& operator=(const Ordered<T>& a)
94 bool operator<(const Ordered<T>& other) const
96 return _order < other._order;
99 bool operator>(const Ordered<T>& other) const
101 return _order > other._order;
116 typedef Ordered<Node*> OrderedNode;
117 typedef std::greater<OrderedNode> FNPQCompare;
120 * the priority queue is fundamental to our search algorithm. When searching,
121 * we know the front of the queue is the nearest unexpanded node (to the search
122 * location). The default STL pqueue returns the 'largest' item from top(), so
123 * to get the smallest, we need to replace the default Compare functor (less<>)
126 typedef std::priority_queue<OrderedNode, std::vector<OrderedNode>, FNPQCompare> FindNearestPQueue;
128 typedef Ordered<FGPositioned*> OrderedPositioned;
129 typedef std::vector<OrderedPositioned> FindNearestResults;
131 Node* global_spatialOctree = NULL;
134 * Octree node base class, tracks its bounding box and provides various
135 * queries relating to it
140 bool contains(const SGVec3d& aPos) const
142 return intersects(aPos, _box);
145 double distSqrToNearest(const SGVec3d& aPos) const
147 return distSqr(aPos, _box.getClosestPoint(aPos));
150 virtual void insert(FGPositioned* aP) = 0;
152 virtual void visit(const SGVec3d& aPos, double aCutoff,
153 FGPositioned::Filter* aFilter,
154 FindNearestResults& aResults, FindNearestPQueue&) = 0;
156 Node(const SGBoxd &aBox) :
164 class Leaf : public Node
167 Leaf(const SGBoxd& aBox) :
172 const FGPositioned::List& members() const
175 virtual void insert(FGPositioned* aP)
177 _members.push_back(aP);
180 virtual void visit(const SGVec3d& aPos, double aCutoff,
181 FGPositioned::Filter* aFilter,
182 FindNearestResults& aResults, FindNearestPQueue&)
184 int previousResultsSize = aResults.size();
187 for (unsigned int i=0; i<_members.size(); ++i) {
188 FGPositioned* p = _members[i];
189 double d2 = distSqr(aPos, p->cart());
195 if (aFilter->hasTypeRange() && !aFilter->passType(p->type())) {
199 if (!aFilter->pass(p)) {
202 } // of have a filter
205 aResults.push_back(OrderedPositioned(p, d2));
208 if (addedCount == 0) {
212 // keep aResults sorted
213 // sort the new items, usually just one or two items
214 std::sort(aResults.begin() + previousResultsSize, aResults.end());
216 // merge the two sorted ranges together - in linear time
217 std::inplace_merge(aResults.begin(),
218 aResults.begin() + previousResultsSize, aResults.end());
221 FGPositioned::List _members;
224 class Branch : public Node
227 Branch(const SGBoxd& aBox) :
230 memset(children, 0, sizeof(Node*) * 8);
233 virtual void insert(FGPositioned* aP)
235 SGVec3d cart(aP->cart());
236 assert(contains(cart));
239 SGVec3d center(_box.getCenter());
240 // tests must match indices in SGbox::getCorner
241 if (cart.x() < center.x()) {
245 if (cart.y() < center.y()) {
249 if (cart.z() < center.z()) {
253 Node* child = children[childIndex];
254 if (!child) { // lazy building of children
255 SGBoxd cb(boxForChild(childIndex));
256 double d2 = dot(cb.getSize(), cb.getSize());
257 if (d2 < LEAF_SIZE_SQR) {
258 child = new Leaf(cb);
260 child = new Branch(cb);
263 children[childIndex] = child;
269 virtual void visit(const SGVec3d& aPos, double aCutoff,
270 FGPositioned::Filter*,
271 FindNearestResults&, FindNearestPQueue& aQ)
273 for (unsigned int i=0; i<8; ++i) {
278 double d2 = children[i]->distSqrToNearest(aPos);
280 continue; // exceeded cutoff
283 aQ.push(Ordered<Node*>(children[i], d2));
284 } // of child iteration
290 * Return the box for a child touching the specified corner
292 SGBoxd boxForChild(unsigned int aCorner) const
294 SGBoxd r(_box.getCenter());
295 r.expandBy(_box.getCorner(aCorner));
302 void findNearestN(const SGVec3d& aPos, unsigned int aN, double aCutoffM, FGPositioned::Filter* aFilter, FGPositioned::List& aResults)
305 FindNearestPQueue pq;
306 FindNearestResults results;
307 pq.push(Ordered<Node*>(global_spatialOctree, 0));
308 double cut = aCutoffM * aCutoffM;
310 while (!pq.empty()) {
311 if (!results.empty()) {
312 // terminate the search if we have sufficent results, and we are
313 // sure no node still on the queue contains a closer match
314 double furthestResultOrder = results.back().order();
315 if ((results.size() >= aN) && (furthestResultOrder < pq.top().order())) {
320 Node* nd = pq.top().get();
323 nd->visit(aPos, cut, aFilter, results, pq);
324 } // of queue iteration
326 // depending on leaf population, we may have (slighty) more results
328 unsigned int numResults = std::min((unsigned int) results.size(), aN);
330 aResults.resize(numResults);
331 for (unsigned int r=0; r<numResults; ++r) {
332 aResults[r] = results[r].get();
336 void findAllWithinRange(const SGVec3d& aPos, double aRangeM, FGPositioned::Filter* aFilter, FGPositioned::List& aResults)
339 FindNearestPQueue pq;
340 FindNearestResults results;
341 pq.push(Ordered<Node*>(global_spatialOctree, 0));
342 double rng = aRangeM * aRangeM;
344 while (!pq.empty()) {
345 Node* nd = pq.top().get();
348 nd->visit(aPos, rng, aFilter, results, pq);
349 } // of queue iteration
351 unsigned int numResults = results.size();
353 aResults.resize(numResults);
354 for (unsigned int r=0; r<numResults; ++r) {
355 aResults[r] = results[r].get();
359 } // of namespace Octree
361 //////////////////////////////////////////////////////////////////////////////
364 addToIndices(FGPositioned* aPos)
367 if (!aPos->ident().empty()) {
368 std::string u(boost::to_upper_copy(aPos->ident()));
370 global_identIndex.insert(global_identIndex.begin(),
371 std::make_pair(u, aPos));
374 if (!aPos->name().empty()) {
375 std::string u(boost::to_upper_copy(aPos->name()));
377 global_nameIndex.insert(global_nameIndex.begin(),
378 std::make_pair(u, aPos));
381 if (!Octree::global_spatialOctree) {
382 double RADIUS_EARTH_M = 7000 * 1000.0; // 7000km is plenty
383 SGVec3d earthExtent(RADIUS_EARTH_M, RADIUS_EARTH_M, RADIUS_EARTH_M);
384 Octree::global_spatialOctree = new Octree::Branch(SGBox<double>(-earthExtent, earthExtent));
386 Octree::global_spatialOctree->insert(aPos);
390 removeFromIndices(FGPositioned* aPos)
394 if (!aPos->ident().empty()) {
395 std::string u(boost::to_upper_copy(aPos->ident()));
396 NamedPositionedIndex::iterator it = global_identIndex.find(u);
397 while (it != global_identIndex.end() && (it->first == u)) {
398 if (it->second == aPos) {
399 global_identIndex.erase(it);
404 } // of multimap walk
407 if (!aPos->name().empty()) {
408 std::string u(boost::to_upper_copy(aPos->name()));
409 NamedPositionedIndex::iterator it = global_nameIndex.find(u);
410 while (it != global_nameIndex.end() && (it->first == u)) {
411 if (it->second == aPos) {
412 global_nameIndex.erase(it);
417 } // of multimap walk
421 //////////////////////////////////////////////////////////////////////////////
426 bool operator()(FGPositioned* a, FGPositioned* b) const
428 return a->name() < b->name();
432 void findInIndex(NamedPositionedIndex& aIndex, const std::string& aFind, std::vector<FGPositioned*>& aResult)
434 NamedPositionedIndex::const_iterator it = aIndex.begin();
435 NamedPositionedIndex::const_iterator end = aIndex.end();
437 bool haveFilter = !aFind.empty();
439 for (; it != end; ++it) {
440 FGPositioned::Type ty = it->second->type();
441 if ((ty < FGPositioned::AIRPORT) || (ty > FGPositioned::SEAPORT)) {
445 if (haveFilter && it->first.find(aFind) == std::string::npos) {
449 aResult.push_back(it->second);
450 } // of index iteration
454 * A special purpose helper (imported by FGAirport::searchNamesAndIdents) to
455 * implement the AirportList dialog. It's unfortunate that it needs to reside
456 * here, but for now it's least ugly solution.
458 char** searchAirportNamesAndIdents(const std::string& aFilter)
460 // note this is a vector of raw pointers, not smart pointers, because it
461 // may get very large and smart-pointer-atomicity-locking then becomes a
462 // bottleneck for this case.
463 std::vector<FGPositioned*> matches;
464 if (!aFilter.empty()) {
465 std::string filter = boost::to_upper_copy(aFilter);
466 findInIndex(global_identIndex, filter, matches);
467 findInIndex(global_nameIndex, filter, matches);
470 findInIndex(global_identIndex, std::string(), matches);
473 // sort alphabetically on name
474 std::sort(matches.begin(), matches.end(), OrderByName());
476 // convert results to format comptible with puaList
477 unsigned int numMatches = matches.size();
478 char** result = new char*[numMatches + 1];
479 result[numMatches] = NULL; // end-of-list marker
481 // nasty code to avoid excessive string copying and allocations.
482 // We format results as follows (note whitespace!):
483 // ' name-of-airport-chars (ident)'
484 // so the total length is:
485 // 1 + strlen(name) + 4 + strlen(icao) + 1 + 1 (for the null)
486 // which gives a grand total of 7 + name-length + icao-length.
487 // note the ident can be three letters (non-ICAO local strip), four
488 // (default ICAO) or more (extended format ICAO)
489 for (unsigned int i=0; i<numMatches; ++i) {
490 int nameLength = matches[i]->name().size();
491 int icaoLength = matches[i]->ident().size();
492 char* entry = new char[7 + nameLength + icaoLength];
495 memcpy(dst, matches[i]->name().c_str(), nameLength);
501 memcpy(dst, matches[i]->ident().c_str(), icaoLength);
511 static void validateSGGeod(const SGGeod& geod)
513 if (osg::isNaN(geod.getLatitudeDeg()) ||
514 osg::isNaN(geod.getLongitudeDeg()))
516 throw sg_range_exception("position is invalid, NaNs");
520 ///////////////////////////////////////////////////////////////////////////////
523 FGPositioned::Filter::hasTypeRange() const
525 assert(minType() <= maxType());
526 return (minType() != INVALID) && (maxType() != INVALID);
530 FGPositioned::Filter::passType(Type aTy) const
532 assert(hasTypeRange());
533 return (minType() <= aTy) && (maxType() >= aTy);
536 static FGPositioned::List
537 findAll(const NamedPositionedIndex& aIndex,
538 const std::string& aName,
539 FGPositioned::Filter* aFilter,
542 FGPositioned::List result;
547 std::string name = boost::to_upper_copy(aName);
548 NamedPositionedIndex::const_iterator upperBound;
551 upperBound = aIndex.upper_bound(name);
553 std::string upperBoundId = name;
554 upperBoundId[upperBoundId.size()-1]++;
555 upperBound = aIndex.lower_bound(upperBoundId);
558 NamedPositionedIndex::const_iterator it = aIndex.lower_bound(name);
560 for (; it != upperBound; ++it) {
561 FGPositionedRef candidate = it->second;
563 if (aFilter->hasTypeRange() && !aFilter->passType(candidate->type())) {
567 if (!aFilter->pass(candidate)) {
572 result.push_back(candidate);
578 ///////////////////////////////////////////////////////////////////////////////
580 FGPositioned::FGPositioned(Type ty, const std::string& aIdent, const SGGeod& aPos) :
587 void FGPositioned::init(bool aIndexed)
589 SGReferenced::get(this); // hold an owning ref, for the moment
590 mCart = SGVec3d::fromGeod(mPosition);
593 assert(mType != TAXIWAY && mType != PAVEMENT);
598 FGPositioned::~FGPositioned()
600 //std::cout << "destroying:" << mIdent << "/" << nameForType(mType) << std::endl;
601 removeFromIndices(this);
605 FGPositioned::createUserWaypoint(const std::string& aIdent, const SGGeod& aPos)
607 FGPositioned* wpt = new FGPositioned(WAYPOINT, aIdent, aPos);
613 FGPositioned::cart() const
618 FGPositioned::Type FGPositioned::typeFromName(const std::string& aName)
620 if (aName.empty() || (aName == "")) {
629 const NameTypeEntry names[] = {
630 {"airport", AIRPORT},
639 {"tower", FREQ_TOWER},
640 {"ground", FREQ_GROUND},
641 {"approach", FREQ_APP_DEP},
642 {"departure", FREQ_APP_DEP},
644 {"gnd", FREQ_GROUND},
646 {"waypoint", WAYPOINT},
655 std::string lowerName(boost::to_lower_copy(aName));
657 for (const NameTypeEntry* n = names; (n->_name != NULL); ++n) {
658 if (::strcmp(n->_name, lowerName.c_str()) == 0) {
663 SG_LOG(SG_GENERAL, SG_WARN, "FGPositioned::typeFromName: couldn't match:" << aName);
667 const char* FGPositioned::nameForType(Type aTy)
670 case RUNWAY: return "runway";
671 case TAXIWAY: return "taxiway";
672 case PAVEMENT: return "pavement";
673 case PARK_STAND: return "parking stand";
674 case FIX: return "fix";
675 case VOR: return "VOR";
676 case NDB: return "NDB";
677 case ILS: return "ILS";
678 case LOC: return "localiser";
679 case GS: return "glideslope";
680 case OM: return "outer-marker";
681 case MM: return "middle-marker";
682 case IM: return "inner-marker";
683 case AIRPORT: return "airport";
684 case HELIPORT: return "heliport";
685 case SEAPORT: return "seaport";
686 case WAYPOINT: return "waypoint";
687 case DME: return "dme";
688 case TACAN: return "tacan";
689 case FREQ_TOWER: return "tower";
690 case FREQ_ATIS: return "atis";
691 case FREQ_AWOS: return "awos";
692 case FREQ_GROUND: return "ground";
693 case FREQ_CLEARANCE: return "clearance";
694 case FREQ_UNICOM: return "unicom";
695 case FREQ_APP_DEP: return "approach-departure";
701 flightgear::PositionedBinding*
702 FGPositioned::createBinding(SGPropertyNode* node) const
704 return new flightgear::PositionedBinding(this, node);
707 ///////////////////////////////////////////////////////////////////////////////
708 // search / query functions
711 FGPositioned::findClosestWithIdent(const std::string& aIdent, const SGGeod& aPos, Filter* aFilter)
713 validateSGGeod(aPos);
715 FGPositioned::List r(findAll(global_identIndex, aIdent, aFilter, true));
717 return FGPositionedRef();
720 sortByRange(r, aPos);
725 FGPositioned::findWithinRange(const SGGeod& aPos, double aRangeNm, Filter* aFilter)
727 validateSGGeod(aPos);
730 Octree::findAllWithinRange(SGVec3d::fromGeod(aPos),
731 aRangeNm * SG_NM_TO_METER, aFilter, result);
736 FGPositioned::findAllWithIdent(const std::string& aIdent, Filter* aFilter, bool aExact)
738 return findAll(global_identIndex, aIdent, aFilter, aExact);
742 FGPositioned::findAllWithName(const std::string& aName, Filter* aFilter, bool aExact)
744 return findAll(global_nameIndex, aName, aFilter, aExact);
748 FGPositioned::findClosest(const SGGeod& aPos, double aCutoffNm, Filter* aFilter)
750 validateSGGeod(aPos);
752 List l(findClosestN(aPos, 1, aCutoffNm, aFilter));
757 assert(l.size() == 1);
762 FGPositioned::findClosestN(const SGGeod& aPos, unsigned int aN, double aCutoffNm, Filter* aFilter)
764 validateSGGeod(aPos);
767 Octree::findNearestN(SGVec3d::fromGeod(aPos), aN, aCutoffNm * SG_NM_TO_METER, aFilter, result);
772 FGPositioned::findNextWithPartialId(FGPositionedRef aCur, const std::string& aId, Filter* aFilter)
778 std::string id(boost::to_upper_copy(aId));
780 // It is essential to bound our search, to avoid iterating all the way to the end of the database.
781 // Do this by generating a second ID with the final character incremented by 1.
782 // e.g., if the partial ID is "KI", we wish to search "KIxxx" but not "KJ".
783 std::string upperBoundId = id;
784 upperBoundId[upperBoundId.size()-1]++;
785 NamedPositionedIndex::const_iterator upperBound = global_identIndex.lower_bound(upperBoundId);
787 NamedIndexRange range = global_identIndex.equal_range(id);
788 while (range.first != upperBound) {
789 for (; range.first != range.second; ++range.first) {
790 FGPositionedRef candidate = range.first->second;
791 if (aCur == candidate) {
792 aCur = NULL; // found our start point, next match will pass
797 if (aFilter->hasTypeRange() && !aFilter->passType(candidate->type())) {
801 if (!aFilter->pass(candidate)) {
811 // Unable to match the filter with this range - try the next range.
812 range = global_identIndex.equal_range(range.second->first);
815 return NULL; // Reached the end of the valid sequence with no match.
819 FGPositioned::sortByRange(List& aResult, const SGGeod& aPos)
821 validateSGGeod(aPos);
823 SGVec3d cartPos(SGVec3d::fromGeod(aPos));
824 // computer ordering values
825 Octree::FindNearestResults r;
826 List::iterator it = aResult.begin(), lend = aResult.end();
827 for (; it != lend; ++it) {
828 double d2 = distSqr((*it)->cart(), cartPos);
829 r.push_back(Octree::OrderedPositioned(*it, d2));
833 std::sort(r.begin(), r.end());
835 // convert to a plain list
836 unsigned int count = aResult.size();
837 for (unsigned int i=0; i<count; ++i) {
838 aResult[i] = r[i].get();
842 FGPositioned::Filter* createSearchFilter(const SGPropertyNode* arg)
844 string sty(arg->getStringValue("type", "any"));
845 FGPositioned::Type ty = FGPositioned::typeFromName(sty);
846 double minRunwayLenFt = arg->getDoubleValue("min-runway-length-ft", -1.0);
848 if ((ty == FGPositioned::AIRPORT) && (minRunwayLenFt > 0.0)) {
849 return new FGAirport::HardSurfaceFilter(minRunwayLenFt);
850 } else if (ty != FGPositioned::INVALID) {
851 FGPositioned::TypeFilter* tf = new FGPositioned::TypeFilter(ty);
853 for (int t=1; arg->hasChild("type", t); ++t) {
854 sty = arg->getChild("type", t)->getStringValue();
855 tf->addType(FGPositioned::typeFromName(sty));
864 static SGGeod commandSearchPos(const SGPropertyNode* arg)
866 if (arg->hasChild("longitude-deg") && arg->hasChild("latitude-deg")) {
867 return SGGeod::fromDeg(arg->getDoubleValue("longitude-deg"),
868 arg->getDoubleValue("latitude-deg"));
871 // use current viewer/aircraft position
872 return SGGeod::fromDeg(fgGetDouble("/position/longitude-deg"),
873 fgGetDouble("/position/latitude-deg"));
876 void commandClearExisting(const SGPropertyNode* arg)
878 if (arg->getBoolValue("clear", true)) {
879 // delete all existing result children from their parent
880 string resultPath = arg->getStringValue("results");
881 SGPropertyNode* n = fgGetNode(resultPath.c_str(), 0, true);
882 SGPropertyNode* pr = n->getParent();
883 pr->removeChildren(n->getName(), false /* keep=false, i.e delete nodes */);
887 bool commandFindClosest(const SGPropertyNode* arg)
889 int n = arg->getIntValue("max-results", 1);
890 if ((n < 1) || (n > 100)) {
891 SG_LOG(SG_GENERAL, SG_WARN, "commandFindClosest: max-results invalid:" << n);
895 string resultPath = arg->getStringValue("results");
896 if (resultPath.empty()) {
897 SG_LOG(SG_GENERAL, SG_WARN, "commandFindClosest: no results path defined");
901 std::auto_ptr<FGPositioned::Filter> filt(createSearchFilter(arg));
902 // cap search range, since huge ranges will overload everything
903 double cutoff = arg->getDoubleValue("cutoff-nm", 400.0);
904 SG_CLAMP_RANGE(cutoff, 0.0, 1000.0);
906 SGGeod pos = commandSearchPos(arg);
907 commandClearExisting(arg);
909 FGPositioned::List results = FGPositioned::findClosestN(pos, n, cutoff, filt.get());
910 for (unsigned int i=0; i<results.size(); ++i) {
911 SGPropertyNode* resultsNode = fgGetNode(resultPath.c_str(), i, true);
912 flightgear::PositionedBinding::bind(results[i], resultsNode);
918 bool commandFindByIdent(const SGPropertyNode* arg)
920 string resultPath = arg->getStringValue("results");
921 if (resultPath.empty()) {
922 SG_LOG(SG_GENERAL, SG_WARN, "commandFindByIdent: no results path defined");
926 std::auto_ptr<FGPositioned::Filter> filt(createSearchFilter(arg));
927 SGGeod pos = commandSearchPos(arg);
928 commandClearExisting(arg);
930 FGPositioned::List results;
931 bool exact = arg->getBoolValue("exact", true);
932 if (arg->hasChild("name")) {
933 results = FGPositioned::findAllWithName(arg->getStringValue("name"), filt.get(), exact);
934 } else if (arg->hasChild("ident")) {
935 results = FGPositioned::findAllWithIdent(arg->getStringValue("ident"), filt.get(), exact);
937 SG_LOG(SG_GENERAL, SG_WARN, "commandFindByIdent: no search term defined");
941 bool orderByRange = arg->getBoolValue("order-by-distance", true);
943 FGPositioned::sortByRange(results, pos);
946 for (unsigned int i=0; i<results.size(); ++i) {
947 SGPropertyNode* resultsNode = fgGetNode(resultPath.c_str(), i, true);
948 flightgear::PositionedBinding::bind(results[i], resultsNode);
955 FGPositioned::installCommands()
957 SGCommandMgr::instance()->addCommand("find-nearest", commandFindClosest);
958 SGCommandMgr::instance()->addCommand("find-by-ident", commandFindByIdent);
961 FGPositioned::TypeFilter::TypeFilter(Type aTy)
963 types.push_back(aTy);
966 void FGPositioned::TypeFilter::addType(Type aTy)
968 types.push_back(aTy);
972 FGPositioned::TypeFilter::pass(FGPositioned* aPos) const
974 std::vector<Type>::const_iterator it = types.begin(),
976 for (; it != end; ++it) {
977 return aPos->type() == *it;