FlightGear next
FGAirport Class Reference

#include <airport.hxx>

Inherits FGPositioned.

Classes

class  AirportFilter
 
struct  FindBestRunwayForHeadingParams
 
class  HardSurfaceFilter
 
class  PortsFilter
 Filter which passes heliports and seaports in addition to airports. More...
 
class  TypeRunwayFilter
 Filter which passes specified port type and in case of airport checks if a runway larger the /sim/navdb/min-runway-length-ft exists. More...
 

Public Member Functions

 FGAirport (PositionedID aGuid, const std::string &id, const SGGeod &location, const std::string &name, bool has_metar, Type aType, SGPath sceneryPath=SGPath())
 
 ~FGAirport ()
 
SGPath sceneryPath () const
 
const std::string & getId () const
 
const std::string & getName () const
 
std::string toString () const
 
double getLongitude () const
 
double getLatitude () const
 
double getElevation () const
 
bool getMetar () const
 
bool isAirport () const
 
bool isSeaport () const
 
bool isHeliport () const
 
bool isClosed () const
 is the airport closed (disused)?
 
virtual const std::string & name () const
 Return the name of this positioned.
 
void validateILSData ()
 reload the ILS data from XML if required.
 
bool hasTower () const
 
SGGeod getTowerLocation () const
 
void setMetar (bool value)
 
FGRunwayRef getActiveRunwayForUsage () const
 
FGAirportDynamicsRef getDynamics () const
 
FGGroundNetworkgroundNetwork () const
 
unsigned int numRunways () const
 
unsigned int numHelipads () const
 
FGRunwayRef getRunwayByIndex (unsigned int aIndex) const
 
FGHelipadRef getHelipadByIndex (unsigned int aIndex) const
 
FGRunwayMap getRunwayMap () const
 
FGHelipadMap getHelipadMap () const
 
bool hasRunwayWithIdent (const std::string &aIdent) const
 
bool hasHelipadWithIdent (const std::string &aIdent) const
 
FGRunwayRef getRunwayByIdent (const std::string &aIdent) const
 
FGHelipadRef getHelipadByIdent (const std::string &aIdent) const
 
FGRunwayRef findBestRunwayForHeading (double aHeading, struct FindBestRunwayForHeadingParams *parms=NULL) const
 
FGRunwayRef findBestRunwayForPos (const SGGeod &aPos) const
 return the most likely target runway based on a position.
 
FGRunwayList getRunwaysWithoutReciprocals () const
 Retrieve all runways at the airport, but excluding the reciprocal runways.
 
FGRunwayList getRunways () const
 Retrieve all runways at the airport.
 
std::string findAPTRunwayForNewName (const std::string &newIdent) const
 
bool hasHardRunwayOfLengthFt (double aLengthFt) const
 Useful predicate for FMS/GPS/NAV displays and similar - check if this airport has a hard-surfaced runway of at least the specified length.
 
FGRunwayRef longestRunway () const
 
unsigned int numTaxiways () const
 
FGTaxiwayRef getTaxiwayByIndex (unsigned int aIndex) const
 
FGTaxiwayList getTaxiways () const
 
unsigned int numPavements () const
 
FGPavementRef getPavementByIndex (unsigned int aIndex) const
 
FGPavementList getPavements () const
 
void addPavement (FGPavementRef pavement)
 
unsigned int numBoundary () const
 
FGPavementRef getBoundaryIndex (unsigned int aIndex) const
 
FGPavementList getBoundary () const
 
void addBoundary (FGPavementRef boundary)
 
unsigned int numLineFeatures () const
 
FGPavementList getLineFeatures () const
 
void addLineFeature (FGPavementRef linefeature)
 
void setProcedures (const std::vector< flightgear::SID * > &aSids, const std::vector< flightgear::STAR * > &aStars, const std::vector< flightgear::Approach * > &aApproaches)
 
void addSID (flightgear::SID *aSid)
 
void addSTAR (flightgear::STAR *aStar)
 
void addApproach (flightgear::Approach *aApp)
 
unsigned int numSIDs () const
 
flightgear::SIDgetSIDByIndex (unsigned int aIndex) const
 
flightgear::SIDfindSIDWithIdent (const std::string &aIdent) const
 
flightgear::SIDList getSIDs () const
 
flightgear::TransitionselectSIDByEnrouteTransition (FGPositioned *enroute) const
 
flightgear::TransitionselectSIDByTransition (const FGRunway *runway, const std::string &aIdent) const
 
unsigned int numSTARs () const
 
flightgear::STARgetSTARByIndex (unsigned int aIndex) const
 
flightgear::STARfindSTARWithIdent (const std::string &aIdent) const
 
flightgear::STARList getSTARs () const
 
flightgear::TransitionselectSTARByEnrouteTransition (FGPositioned *enroute) const
 
flightgear::TransitionselectSTARByTransition (const FGRunway *runway, const std::string &aIdent) const
 
unsigned int numApproaches () const
 
flightgear::ApproachgetApproachByIndex (unsigned int aIndex) const
 
flightgear::ApproachfindApproachWithIdent (const std::string &aIdent) const
 
flightgear::ApproachList getApproaches (flightgear::ProcedureType type=flightgear::PROCEDURE_INVALID) const
 
flightgear::CommStationList commStationsOfType (FGPositioned::Type aTy) const
 
flightgear::CommStationList commStations () const
 
void testSuiteInjectGroundnetXML (const SGPath &path)
 
void testSuiteInjectProceduresXML (const SGPath &path)
 
- Public Member Functions inherited from FGPositioned
virtual ~FGPositioned ()
 
Type type () const
 
const char * typeString () const
 
const std::string & ident () const
 
virtual const SGGeod & geod () const
 
PositionedID guid () const
 
virtual const SGVec3d & cart () const
 The cartesian position associated with this object.
 
double latitude () const
 
double longitude () const
 
double elevation () const
 
double elevationM () const
 

Static Public Member Functions

static bool isType (FGPositioned::Type ty)
 
static FGAirportRef findClosest (const SGGeod &aPos, double aCuttofNm, Filter *filter=NULL)
 Syntactic wrapper around FGPositioned::findClosest - find the closest match for filter, and return it cast to FGAirport.
 
static FGAirportRef getByIdent (const std::string &aIdent)
 Helper to look up an FGAirport instance by unique ident.
 
static FGAirportRef findByIdent (const std::string &aIdent)
 Helper to look up an FGAirport instance by unique ident.
 
static char ** searchNamesAndIdents (const std::string &aFilter)
 Specialised helper to implement the AirportList dialog.
 
static void sortBySize (FGPositionedList &)
 Sort an FGPositionedList of airports by size (number of runways + length) this is meant to prioritise more important airports.
 
static void clearAirportsCache ()
 
- Static Public Member Functions inherited from FGPositioned
static bool isAirportType (FGPositioned *pos)
 
static bool isRunwayType (FGPositioned *pos)
 
static bool isNavaidType (FGPositioned *pos)
 
static FGPositionedList findWithinRange (const SGGeod &aPos, double aRangeNm, Filter *aFilter)
 
static FGPositionedList findWithinRangePartial (const SGGeod &aPos, double aRangeNm, Filter *aFilter, bool &aPartial)
 
static FGPositionedRef findClosestWithIdent (const std::string &aIdent, const SGGeod &aPos, Filter *aFilter=NULL)
 
static FGPositionedRef findFirstWithIdent (const std::string &aIdent, Filter *aFilter)
 
static FGPositionedList findAllWithIdent (const std::string &aIdent, Filter *aFilter=NULL, bool aExact=true)
 Find all items with the specified ident.
 
static FGPositionedList findAllWithName (const std::string &aName, Filter *aFilter=NULL, bool aExact=true)
 As above, but searches names instead of idents.
 
static void sortByRange (FGPositionedList &, const SGGeod &aPos)
 Sort an FGPositionedList by distance from a position.
 
static FGPositionedRef findClosest (const SGGeod &aPos, double aCutoffNm, Filter *aFilter=NULL)
 Find the closest item to a position, which pass the specified filter A cutoff range in NM must be specified, to constrain the search acceptably.
 
static FGPositionedList findClosestN (const SGGeod &aPos, unsigned int aN, double aCutoffNm, Filter *aFilter=NULL)
 Find the closest N items to a position, which pass the specified filter A cutoff range in NM must be specified, to constrain the search acceptably.
 
static FGPositionedList findClosestNPartial (const SGGeod &aPos, unsigned int aN, double aCutoffNm, Filter *aFilter, bool &aPartial)
 Same as above, but with a time-bound in msec too.
 
template<class T>
static SGSharedPtr< T > loadById (PositionedID id)
 
template<class T>
static SGSharedPtr< T > loadById (const PositionedIDVec &id_vec, size_t index)
 
template<class T>
static std::vector< SGSharedPtr< T > > loadAllById (const PositionedIDVec &id_vec)
 
static Type typeFromName (const std::string &aName)
 Map a candidate type string to a real type.
 
static const char * nameForType (Type aTy)
 Map a type to a human-readable string.
 
static FGPositionedRef createWaypoint (FGPositioned::Type aType, const std::string &aIdent, const SGGeod &aPos, bool isTemporary=false, const std::string &aName={})
 
static bool deleteWaypoint (FGPositionedRef aWpt)
 

Additional Inherited Members

- Public Types inherited from FGPositioned
enum  Type {
  INVALID = 0 , AIRPORT , HELIPORT , SEAPORT ,
  RUNWAY , HELIPAD , TAXIWAY , PAVEMENT ,
  WAYPOINT , FIX , NDB , VOR ,
  ILS , LOC , GS , OM ,
  MM , IM , DME , TACAN ,
  MOBILE_TACAN , OBSTACLE , TOWER , FREQ_GROUND ,
  FREQ_TOWER , FREQ_ATIS , FREQ_AWOS , FREQ_APP_DEP ,
  FREQ_ENROUTE , FREQ_CLEARANCE , FREQ_UNICOM , PARKING ,
  TAXI_NODE , COUNTRY , CITY , TOWN ,
  VILLAGE , VISUAL_REPORTING_POINT , LAST_POI_TYPE , LAST_TYPE
}
 
- Protected Member Functions inherited from FGPositioned
 FGPositioned (PositionedID aGuid, Type ty, const std::string &aIdent, const SGGeod &aPos)
 
void modifyPosition (const SGGeod &newPos)
 
void invalidatePosition ()
 
- Static Protected Member Functions inherited from FGPositioned
static FGPositionedRef loadByIdImpl (PositionedID id)
 
- Protected Attributes inherited from FGPositioned
const PositionedID mGuid
 
const Type mType
 
const std::string mIdent
 

Detailed Description

Definition at line 31 of file airport.hxx.

Constructor & Destructor Documentation

◆ FGAirport()

FGAirport::FGAirport ( PositionedID aGuid,
const std::string & id,
const SGGeod & location,
const std::string & name,
bool has_metar,
Type aType,
SGPath sceneryPath = SGPath() )

Definition at line 53 of file airport.cxx.

◆ ~FGAirport()

FGAirport::~FGAirport ( )

Definition at line 77 of file airport.cxx.

Member Function Documentation

◆ addApproach()

void FGAirport::addApproach ( flightgear::Approach * aApp)

Definition at line 867 of file airport.cxx.

◆ addBoundary()

void FGAirport::addBoundary ( FGPavementRef boundary)

Definition at line 379 of file airport.cxx.

◆ addLineFeature()

void FGAirport::addLineFeature ( FGPavementRef linefeature)

Definition at line 396 of file airport.cxx.

◆ addPavement()

void FGAirport::addPavement ( FGPavementRef pavement)

Definition at line 362 of file airport.cxx.

◆ addSID()

void FGAirport::addSID ( flightgear::SID * aSid)

Definition at line 857 of file airport.cxx.

◆ addSTAR()

void FGAirport::addSTAR ( flightgear::STAR * aStar)

Definition at line 862 of file airport.cxx.

◆ clearAirportsCache()

void FGAirport::clearAirportsCache ( )
static

Definition at line 483 of file airport.cxx.

◆ commStations()

CommStationList FGAirport::commStations ( ) const

Definition at line 983 of file airport.cxx.

◆ commStationsOfType()

CommStationList FGAirport::commStationsOfType ( FGPositioned::Type aTy) const

Definition at line 997 of file airport.cxx.

◆ findApproachWithIdent()

Approach * FGAirport::findApproachWithIdent ( const std::string & aIdent) const

Definition at line 954 of file airport.cxx.

◆ findAPTRunwayForNewName()

std::string FGAirport::findAPTRunwayForNewName ( const std::string & newIdent) const

Definition at line 783 of file airport.cxx.

◆ findBestRunwayForHeading()

FGRunwayRef FGAirport::findBestRunwayForHeading ( double aHeading,
struct FindBestRunwayForHeadingParams * parms = NULL ) const

Definition at line 211 of file airport.cxx.

◆ findBestRunwayForPos()

FGRunwayRef FGAirport::findBestRunwayForPos ( const SGGeod & aPos) const

return the most likely target runway based on a position.

Specifically, return the runway for which the course from aPos to the runway end, mostly closely matches the runway heading. This is a good approximation of which runway the position is on or aiming towards.

Definition at line 248 of file airport.cxx.

◆ findByIdent()

FGAirportRef FGAirport::findByIdent ( const std::string & aIdent)
static

Helper to look up an FGAirport instance by unique ident.

Returns NULL if the airport could not be found.

Definition at line 489 of file airport.cxx.

◆ findClosest()

FGAirportRef FGAirport::findClosest ( const SGGeod & aPos,
double aCuttofNm,
Filter * filter = NULL )
static

Syntactic wrapper around FGPositioned::findClosest - find the closest match for filter, and return it cast to FGAirport.

The default filter passes airports, but not seaports or heliports

Definition at line 425 of file airport.cxx.

◆ findSIDWithIdent()

flightgear::SID * FGAirport::findSIDWithIdent ( const std::string & aIdent) const

Definition at line 887 of file airport.cxx.

◆ findSTARWithIdent()

STAR * FGAirport::findSTARWithIdent ( const std::string & aIdent) const

Definition at line 921 of file airport.cxx.

◆ getActiveRunwayForUsage()

FGRunwayRef FGAirport::getActiveRunwayForUsage ( ) const

Definition at line 402 of file airport.cxx.

◆ getApproachByIndex()

Approach * FGAirport::getApproachByIndex ( unsigned int aIndex) const

Definition at line 947 of file airport.cxx.

◆ getApproaches()

ApproachList FGAirport::getApproaches ( flightgear::ProcedureType type = flightgear::PROCEDURE_INVALID) const

Definition at line 967 of file airport.cxx.

◆ getBoundary()

FGPavementList FGAirport::getBoundary ( ) const

Definition at line 374 of file airport.cxx.

◆ getBoundaryIndex()

FGPavementRef FGAirport::getBoundaryIndex ( unsigned int aIndex) const

◆ getByIdent()

FGAirportRef FGAirport::getByIdent ( const std::string & aIdent)
static

Helper to look up an FGAirport instance by unique ident.

Throws an exception if the airport could not be found - so callers can assume the result is non-NULL.

Definition at line 509 of file airport.cxx.

◆ getDynamics()

FGAirportDynamicsRef FGAirport::getDynamics ( ) const

Definition at line 1048 of file airport.cxx.

◆ getElevation()

double FGAirport::getElevation ( ) const
inline

Definition at line 61 of file airport.hxx.

◆ getHelipadByIdent()

FGHelipadRef FGAirport::getHelipadByIdent ( const std::string & aIdent) const

Definition at line 199 of file airport.cxx.

◆ getHelipadByIndex()

FGHelipadRef FGAirport::getHelipadByIndex ( unsigned int aIndex) const

Definition at line 123 of file airport.cxx.

◆ getHelipadMap()

FGHelipadMap FGAirport::getHelipadMap ( ) const

Definition at line 148 of file airport.cxx.

◆ getId()

const std::string & FGAirport::getId ( ) const
inline

Definition at line 53 of file airport.hxx.

◆ getLatitude()

double FGAirport::getLatitude ( ) const
inline

Definition at line 59 of file airport.hxx.

◆ getLineFeatures()

FGPavementList FGAirport::getLineFeatures ( ) const

Definition at line 391 of file airport.cxx.

◆ getLongitude()

double FGAirport::getLongitude ( ) const
inline

Definition at line 57 of file airport.hxx.

◆ getMetar()

bool FGAirport::getMetar ( ) const
inline

Definition at line 62 of file airport.hxx.

◆ getName()

const std::string & FGAirport::getName ( ) const
inline

Definition at line 54 of file airport.hxx.

◆ getPavementByIndex()

FGPavementRef FGAirport::getPavementByIndex ( unsigned int aIndex) const

◆ getPavements()

FGPavementList FGAirport::getPavements ( ) const

Definition at line 357 of file airport.cxx.

◆ getRunwayByIdent()

FGRunwayRef FGAirport::getRunwayByIdent ( const std::string & aIdent) const

Definition at line 182 of file airport.cxx.

◆ getRunwayByIndex()

FGRunwayRef FGAirport::getRunwayByIndex ( unsigned int aIndex) const

Definition at line 116 of file airport.cxx.

◆ getRunwayMap()

FGRunwayMap FGAirport::getRunwayMap ( ) const

Definition at line 130 of file airport.cxx.

◆ getRunways()

FGRunwayList FGAirport::getRunways ( ) const

Retrieve all runways at the airport.

Definition at line 300 of file airport.cxx.

◆ getRunwaysWithoutReciprocals()

FGRunwayList FGAirport::getRunwaysWithoutReciprocals ( ) const

Retrieve all runways at the airport, but excluding the reciprocal runways.

For example at KSFO this might return 1L, 1R, 28L and 28R, but would not then include 19L/R or 10L/R.

Exactly which runways you get, is undefined (i.e, dont assumes it's runways with heading < 180 degrees) - it depends on order in apt.dat.

This is useful for code that wants to process each piece of tarmac at an airport once, not twice - eg mapping and nav-display code.

Definition at line 308 of file airport.cxx.

◆ getSIDByIndex()

flightgear::SID * FGAirport::getSIDByIndex ( unsigned int aIndex) const

Definition at line 880 of file airport.cxx.

◆ getSIDs()

flightgear::SIDList FGAirport::getSIDs ( ) const

Definition at line 900 of file airport.cxx.

◆ getSTARByIndex()

STAR * FGAirport::getSTARByIndex ( unsigned int aIndex) const

Definition at line 914 of file airport.cxx.

◆ getSTARs()

STARList FGAirport::getSTARs ( ) const

Definition at line 934 of file airport.cxx.

◆ getTaxiwayByIndex()

FGTaxiwayRef FGAirport::getTaxiwayByIndex ( unsigned int aIndex) const

Definition at line 337 of file airport.cxx.

◆ getTaxiways()

FGTaxiwayList FGAirport::getTaxiways ( ) const

Definition at line 344 of file airport.cxx.

◆ getTowerLocation()

SGGeod FGAirport::getTowerLocation ( ) const

Definition at line 696 of file airport.cxx.

◆ groundNetwork()

FGGroundNetwork * FGAirport::groundNetwork ( ) const

Definition at line 1053 of file airport.cxx.

◆ hasHardRunwayOfLengthFt()

bool FGAirport::hasHardRunwayOfLengthFt ( double aLengthFt) const

Useful predicate for FMS/GPS/NAV displays and similar - check if this airport has a hard-surfaced runway of at least the specified length.

Definition at line 272 of file airport.cxx.

◆ hasHelipadWithIdent()

bool FGAirport::hasHelipadWithIdent ( const std::string & aIdent) const

Definition at line 175 of file airport.cxx.

◆ hasRunwayWithIdent()

bool FGAirport::hasRunwayWithIdent ( const std::string & aIdent) const

Definition at line 162 of file airport.cxx.

◆ hasTower()

bool FGAirport::hasTower ( ) const

Definition at line 819 of file airport.cxx.

◆ isAirport()

bool FGAirport::isAirport ( ) const

Definition at line 81 of file airport.cxx.

◆ isClosed()

bool FGAirport::isClosed ( ) const
inline

is the airport closed (disused)?

note at present we look for an [x] in the name, ideally the database would explicitly include this

Definition at line 70 of file airport.hxx.

◆ isHeliport()

bool FGAirport::isHeliport ( ) const

Definition at line 91 of file airport.cxx.

◆ isSeaport()

bool FGAirport::isSeaport ( ) const

Definition at line 86 of file airport.cxx.

◆ isType()

static bool FGAirport::isType ( FGPositioned::Type ty)
inlinestatic

Definition at line 45 of file airport.hxx.

◆ longestRunway()

FGRunwayRef FGAirport::longestRunway ( ) const

Definition at line 285 of file airport.cxx.

◆ name()

virtual const std::string & FGAirport::name ( ) const
inlinevirtual

Return the name of this positioned.

By default this is the same as the ident, but for many derived classes it's more meaningful - the aiport or navaid name, for example.

Reimplemented from FGPositioned.

Definition at line 75 of file airport.hxx.

◆ numApproaches()

unsigned int FGAirport::numApproaches ( ) const

Definition at line 940 of file airport.cxx.

◆ numBoundary()

unsigned int FGAirport::numBoundary ( ) const

Definition at line 368 of file airport.cxx.

◆ numHelipads()

unsigned int FGAirport::numHelipads ( ) const

Definition at line 109 of file airport.cxx.

◆ numLineFeatures()

unsigned int FGAirport::numLineFeatures ( ) const

Definition at line 385 of file airport.cxx.

◆ numPavements()

unsigned int FGAirport::numPavements ( ) const

Definition at line 351 of file airport.cxx.

◆ numRunways()

unsigned int FGAirport::numRunways ( ) const

Definition at line 102 of file airport.cxx.

◆ numSIDs()

unsigned int FGAirport::numSIDs ( ) const

Definition at line 873 of file airport.cxx.

◆ numSTARs()

unsigned int FGAirport::numSTARs ( ) const

Definition at line 907 of file airport.cxx.

◆ numTaxiways()

unsigned int FGAirport::numTaxiways ( ) const

Definition at line 330 of file airport.cxx.

◆ sceneryPath()

SGPath FGAirport::sceneryPath ( ) const

Definition at line 96 of file airport.cxx.

◆ searchNamesAndIdents()

char ** FGAirport::searchNamesAndIdents ( const std::string & aFilter)
static

Specialised helper to implement the AirportList dialog.

Performs a case-insensitive search on airport names and ICAO codes, and returns matches in a format suitable for use by a puaList.

Definition at line 517 of file airport.cxx.

◆ selectSIDByEnrouteTransition()

flightgear::Transition * FGAirport::selectSIDByEnrouteTransition ( FGPositioned * enroute) const

Definition at line 1064 of file airport.cxx.

◆ selectSIDByTransition()

Transition * FGAirport::selectSIDByTransition ( const FGRunway * runway,
const std::string & aIdent ) const

Definition at line 1076 of file airport.cxx.

◆ selectSTARByEnrouteTransition()

flightgear::Transition * FGAirport::selectSTARByEnrouteTransition ( FGPositioned * enroute) const

Definition at line 1091 of file airport.cxx.

◆ selectSTARByTransition()

Transition * FGAirport::selectSTARByTransition ( const FGRunway * runway,
const std::string & aIdent ) const

Definition at line 1103 of file airport.cxx.

◆ setMetar()

void FGAirport::setMetar ( bool value)
inline

Definition at line 89 of file airport.hxx.

◆ setProcedures()

void FGAirport::setProcedures ( const std::vector< flightgear::SID * > & aSids,
const std::vector< flightgear::STAR * > & aStars,
const std::vector< flightgear::Approach * > & aApproaches )

◆ sortBySize()

void FGAirport::sortBySize ( FGPositionedList & airportList)
static

Sort an FGPositionedList of airports by size (number of runways + length) this is meant to prioritise more important airports.

Definition at line 1035 of file airport.cxx.

◆ testSuiteInjectGroundnetXML()

void FGAirport::testSuiteInjectGroundnetXML ( const SGPath & path)

◆ testSuiteInjectProceduresXML()

void FGAirport::testSuiteInjectProceduresXML ( const SGPath & path)

◆ toString()

std::string FGAirport::toString ( ) const
inline

Definition at line 55 of file airport.hxx.

◆ validateILSData()

void FGAirport::validateILSData ( )

reload the ILS data from XML if required.

Definition at line 795 of file airport.cxx.


The documentation for this class was generated from the following files: