Clean up/prepare for porting NasalPositioned to cppbind
This commit is contained in:
parent
6bf47cd248
commit
45e3b7e2d1
28 changed files with 387 additions and 266 deletions
|
@ -196,7 +196,7 @@ bool FGAIEscort::getGroundElev(SGGeod inpos) {
|
|||
_ht_agl_ft = inpos.getElevationFt() - height_m * SG_METER_TO_FEET;
|
||||
|
||||
if (material) {
|
||||
const vector<string>& names = material->get_names();
|
||||
const std::vector<std::string>& names = material->get_names();
|
||||
|
||||
_solid = material->get_solid();
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ private:
|
|||
int mRangeNM;
|
||||
int mFreqKhz;
|
||||
PositionedID mAirport;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
} // of namespace flightgear
|
||||
|
||||
#endif // of FG_ATC_COMM_STATION_HXX
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
//class FGATCController;
|
||||
|
||||
|
||||
typedef vector<FGATCController*> AtcVec;
|
||||
typedef vector<FGATCController*>::iterator AtcVecIterator;
|
||||
typedef std::vector<FGATCController*> AtcVec;
|
||||
typedef std::vector<FGATCController*>::iterator AtcVecIterator;
|
||||
|
||||
class FGATCManager : public SGSubsystem
|
||||
{
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
#ifndef _TRAFFIC_CONTROL_HXX_
|
||||
#define _TRAFFIC_CONTROL_HXX_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <Airports/airports_fwd.hxx>
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
|
@ -37,15 +35,26 @@
|
|||
#include <simgear/structure/SGReferenced.hxx>
|
||||
#include <simgear/structure/SGSharedPtr.hxx>
|
||||
|
||||
class FGAIAircraft;
|
||||
typedef std::vector<FGAIAircraft*> AircraftVec;
|
||||
typedef std::vector<FGAIAircraft*>::iterator AircraftVecIterator;
|
||||
|
||||
class FGAIFlightPlan;
|
||||
typedef std::vector<FGAIFlightPlan*> FlightPlanVec;
|
||||
typedef std::vector<FGAIFlightPlan*>::iterator FlightPlanVecIterator;
|
||||
typedef std::map<std::string, FlightPlanVec> FlightPlanVecMap;
|
||||
|
||||
class FGTrafficRecord;
|
||||
typedef std::list<FGTrafficRecord> TrafficVector;
|
||||
typedef std::list<FGTrafficRecord>::iterator TrafficVectorIterator;
|
||||
|
||||
class ActiveRunway;
|
||||
typedef std::vector<ActiveRunway> ActiveRunwayVec;
|
||||
typedef std::vector<ActiveRunway>::iterator ActiveRunwayVecIterator;
|
||||
|
||||
typedef std::vector<int> intVec;
|
||||
typedef std::vector<int>::iterator intVecIterator;
|
||||
|
||||
|
||||
class FGAIFlightPlan; // forward reference
|
||||
class FGGroundNetwork; // forward reference
|
||||
class FGAIAircraft; // forward reference
|
||||
class FGAirportDynamics;
|
||||
|
||||
/**************************************************************************************
|
||||
* class FGATCInstruction
|
||||
* like class FGATC Controller, this class definition should go into its own file
|
||||
|
@ -306,15 +315,6 @@ public:
|
|||
int getPriority() const { return priority; };
|
||||
};
|
||||
|
||||
typedef std::list<FGTrafficRecord> TrafficVector;
|
||||
typedef std::list<FGTrafficRecord>::iterator TrafficVectorIterator;
|
||||
|
||||
typedef std::vector<time_t> TimeVector;
|
||||
typedef std::vector<time_t>::iterator TimeVectorIterator;
|
||||
|
||||
typedef std::vector<FGAIAircraft*> AircraftVec;
|
||||
typedef std::vector<FGAIAircraft*>::iterator AircraftVecIterator;
|
||||
|
||||
/***********************************************************************
|
||||
* Active runway, a utility class to keep track of which aircraft has
|
||||
* clearance for a given runway.
|
||||
|
@ -368,9 +368,6 @@ public:
|
|||
void printDepartureCue();
|
||||
};
|
||||
|
||||
typedef std::vector<ActiveRunway> ActiveRunwayVec;
|
||||
typedef std::vector<ActiveRunway>::iterator ActiveRunwayVecIterator;
|
||||
|
||||
/**
|
||||
* class FGATCController
|
||||
* NOTE: this class serves as an abstraction layer for all sorts of ATC controllers.
|
||||
|
|
|
@ -711,10 +711,10 @@ void FGATIS::genFacilityInfo(void)
|
|||
|
||||
// Note that at this point, multi-word facility names
|
||||
// will sometimes contain hyphens, not spaces.
|
||||
vector<string> name_words;
|
||||
std::vector<std::string> name_words;
|
||||
boost::split(name_words, name, boost::is_any_of(" -"));
|
||||
|
||||
for (vector<string>::const_iterator wordp = name_words.begin();
|
||||
for( std::vector<string>::const_iterator wordp = name_words.begin();
|
||||
wordp != name_words.end(); wordp++) {
|
||||
string word(*wordp);
|
||||
// Remap some abbreviations that occur in apt.dat, to
|
||||
|
|
|
@ -18,6 +18,7 @@ set(SOURCES
|
|||
)
|
||||
|
||||
set(HEADERS
|
||||
airports_fwd.hxx
|
||||
apt_loader.hxx
|
||||
dynamicloader.hxx
|
||||
dynamics.hxx
|
||||
|
|
|
@ -58,15 +58,18 @@ using std::pair;
|
|||
|
||||
using namespace flightgear;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* FGAirport
|
||||
***************************************************************************/
|
||||
|
||||
AirportCache FGAirport::airportCache;
|
||||
|
||||
FGAirport::FGAirport(PositionedID aGuid, const string &id, const SGGeod& location,
|
||||
const string &name, bool has_metar, Type aType) :
|
||||
FGAirport::FGAirport( PositionedID aGuid,
|
||||
const std::string &id,
|
||||
const SGGeod& location,
|
||||
const std::string &name,
|
||||
bool has_metar,
|
||||
Type aType ):
|
||||
FGPositioned(aGuid, aType, id, location),
|
||||
_name(name),
|
||||
_has_metar(has_metar),
|
||||
|
@ -126,45 +129,83 @@ FGAirportDynamics * FGAirport::getDynamics()
|
|||
return _dynamics;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned int FGAirport::numRunways() const
|
||||
{
|
||||
loadRunways();
|
||||
return mRunways.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned int FGAirport::numHelipads() const
|
||||
{
|
||||
loadHelipads();
|
||||
return mHelipads.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGRunway* FGAirport::getRunwayByIndex(unsigned int aIndex) const
|
||||
{
|
||||
loadRunways();
|
||||
|
||||
assert(aIndex >= 0 && aIndex < mRunways.size());
|
||||
return (FGRunway*) flightgear::NavDataCache::instance()->loadById(mRunways[aIndex]);
|
||||
return loadById<FGRunway>(mRunways, aIndex);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGHelipad* FGAirport::getHelipadByIndex(unsigned int aIndex) const
|
||||
{
|
||||
loadHelipads();
|
||||
|
||||
assert(aIndex >= 0 && aIndex < mHelipads.size());
|
||||
return (FGHelipad*) flightgear::NavDataCache::instance()->loadById(mHelipads[aIndex]);
|
||||
return loadById<FGHelipad>(mHelipads, aIndex);
|
||||
}
|
||||
|
||||
bool FGAirport::hasRunwayWithIdent(const string& aIdent) const
|
||||
//------------------------------------------------------------------------------
|
||||
FGRunwayMap FGAirport::getRunwayMap() const
|
||||
{
|
||||
loadRunways();
|
||||
FGRunwayMap map;
|
||||
|
||||
double minLengthFt = fgGetDouble("/sim/navdb/min-runway-length-ft");
|
||||
|
||||
BOOST_FOREACH(PositionedID id, mRunways)
|
||||
{
|
||||
FGRunway* rwy = loadById<FGRunway>(id);
|
||||
|
||||
// ignore unusably short runways
|
||||
// TODO other methods don't check this...
|
||||
if( rwy->lengthFt() >= minLengthFt )
|
||||
map[ rwy->ident() ] = rwy;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGHelipadMap FGAirport::getHelipadMap() const
|
||||
{
|
||||
loadHelipads();
|
||||
FGHelipadMap map;
|
||||
|
||||
BOOST_FOREACH(PositionedID id, mHelipads)
|
||||
{
|
||||
FGHelipad* rwy = loadById<FGHelipad>(id);
|
||||
map[ rwy->ident() ] = rwy;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool FGAirport::hasRunwayWithIdent(const std::string& aIdent) const
|
||||
{
|
||||
return flightgear::NavDataCache::instance()->airportItemWithIdent(guid(), FGPositioned::RUNWAY, aIdent) != 0;
|
||||
}
|
||||
|
||||
bool FGAirport::hasHelipadWithIdent(const string& aIdent) const
|
||||
bool FGAirport::hasHelipadWithIdent(const std::string& aIdent) const
|
||||
{
|
||||
return flightgear::NavDataCache::instance()->airportItemWithIdent(guid(), FGPositioned::HELIPAD, aIdent) != 0;
|
||||
}
|
||||
|
||||
FGRunway* FGAirport::getRunwayByIdent(const string& aIdent) const
|
||||
//------------------------------------------------------------------------------
|
||||
FGRunway* FGAirport::getRunwayByIdent(const std::string& aIdent) const
|
||||
{
|
||||
PositionedID id = flightgear::NavDataCache::instance()->airportItemWithIdent(guid(), FGPositioned::RUNWAY, aIdent);
|
||||
if (id == 0) {
|
||||
|
@ -172,10 +213,11 @@ FGRunway* FGAirport::getRunwayByIdent(const string& aIdent) const
|
|||
throw sg_range_exception("unknown runway " + aIdent + " at airport:" + ident(), "FGAirport::getRunwayByIdent");
|
||||
}
|
||||
|
||||
return (FGRunway*) flightgear::NavDataCache::instance()->loadById(id);
|
||||
return loadById<FGRunway>(id);
|
||||
}
|
||||
|
||||
FGHelipad* FGAirport::getHelipadByIdent(const string& aIdent) const
|
||||
//------------------------------------------------------------------------------
|
||||
FGHelipad* FGAirport::getHelipadByIdent(const std::string& aIdent) const
|
||||
{
|
||||
PositionedID id = flightgear::NavDataCache::instance()->airportItemWithIdent(guid(), FGPositioned::HELIPAD, aIdent);
|
||||
if (id == 0) {
|
||||
|
@ -183,10 +225,10 @@ FGHelipad* FGAirport::getHelipadByIdent(const string& aIdent) const
|
|||
throw sg_range_exception("unknown helipad " + aIdent + " at airport:" + ident(), "FGAirport::getRunwayByIdent");
|
||||
}
|
||||
|
||||
return (FGHelipad*) flightgear::NavDataCache::instance()->loadById(id);
|
||||
return loadById<FGHelipad>(id);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGRunway* FGAirport::findBestRunwayForHeading(double aHeading) const
|
||||
{
|
||||
loadRunways();
|
||||
|
@ -201,7 +243,7 @@ FGRunway* FGAirport::findBestRunwayForHeading(double aHeading) const
|
|||
double deviationWeight = param->getDoubleValue("deviation-weight", 1);
|
||||
|
||||
BOOST_FOREACH(PositionedID id, mRunways) {
|
||||
FGRunway* rwy = (FGRunway*) flightgear::NavDataCache::instance()->loadById(id);
|
||||
FGRunway* rwy = loadById<FGRunway>(id);
|
||||
double good = rwy->score(lengthWeight, widthWeight, surfaceWeight);
|
||||
double dev = aHeading - rwy->headingDeg();
|
||||
SG_NORMALIZE_RANGE(dev, -180.0, 180.0);
|
||||
|
@ -217,6 +259,7 @@ FGRunway* FGAirport::findBestRunwayForHeading(double aHeading) const
|
|||
return result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGRunway* FGAirport::findBestRunwayForPos(const SGGeod& aPos) const
|
||||
{
|
||||
loadRunways();
|
||||
|
@ -225,7 +268,7 @@ FGRunway* FGAirport::findBestRunwayForPos(const SGGeod& aPos) const
|
|||
double currentLowestDev = 180.0;
|
||||
|
||||
BOOST_FOREACH(PositionedID id, mRunways) {
|
||||
FGRunway* rwy = (FGRunway*) flightgear::NavDataCache::instance()->loadById(id);
|
||||
FGRunway* rwy = loadById<FGRunway>(id);
|
||||
|
||||
double inboundCourse = SGGeodesy::courseDeg(aPos, rwy->end());
|
||||
double dev = inboundCourse - rwy->headingDeg();
|
||||
|
@ -242,12 +285,13 @@ FGRunway* FGAirport::findBestRunwayForPos(const SGGeod& aPos) const
|
|||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool FGAirport::hasHardRunwayOfLengthFt(double aLengthFt) const
|
||||
{
|
||||
loadRunways();
|
||||
|
||||
BOOST_FOREACH(PositionedID id, mRunways) {
|
||||
FGRunway* rwy = (FGRunway*) flightgear::NavDataCache::instance()->loadById(id);
|
||||
FGRunway* rwy = loadById<FGRunway>(id);
|
||||
if (rwy->isHardSurface() && (rwy->lengthFt() >= aLengthFt)) {
|
||||
return true; // we're done!
|
||||
}
|
||||
|
@ -256,6 +300,7 @@ bool FGAirport::hasHardRunwayOfLengthFt(double aLengthFt) const
|
|||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGRunwayList FGAirport::getRunwaysWithoutReciprocals() const
|
||||
{
|
||||
loadRunways();
|
||||
|
@ -263,7 +308,7 @@ FGRunwayList FGAirport::getRunwaysWithoutReciprocals() const
|
|||
FGRunwayList r;
|
||||
|
||||
BOOST_FOREACH(PositionedID id, mRunways) {
|
||||
FGRunway* rwy = (FGRunway*) flightgear::NavDataCache::instance()->loadById(id);
|
||||
FGRunway* rwy = loadById<FGRunway>(id);
|
||||
FGRunway* recip = rwy->reciprocalRunway();
|
||||
if (recip) {
|
||||
FGRunwayList::iterator it = std::find(r.begin(), r.end(), recip);
|
||||
|
@ -278,33 +323,49 @@ FGRunwayList FGAirport::getRunwaysWithoutReciprocals() const
|
|||
return r;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned int FGAirport::numTaxiways() const
|
||||
{
|
||||
loadTaxiways();
|
||||
return mTaxiways.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGTaxiway* FGAirport::getTaxiwayByIndex(unsigned int aIndex) const
|
||||
{
|
||||
loadTaxiways();
|
||||
|
||||
assert(aIndex >= 0 && aIndex < mTaxiways.size());
|
||||
return (FGTaxiway*) flightgear::NavDataCache::instance()->loadById(mTaxiways[aIndex]);
|
||||
return loadById<FGTaxiway>(mTaxiways, aIndex);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGTaxiwayList FGAirport::getTaxiways() const
|
||||
{
|
||||
loadTaxiways();
|
||||
return loadAllById<FGTaxiway>(mTaxiways);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned int FGAirport::numPavements() const
|
||||
{
|
||||
loadTaxiways();
|
||||
return mPavements.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGPavement* FGAirport::getPavementByIndex(unsigned int aIndex) const
|
||||
{
|
||||
loadTaxiways();
|
||||
assert(aIndex >= 0 && aIndex < mPavements.size());
|
||||
return (FGPavement*) flightgear::NavDataCache::instance()->loadById(mPavements[aIndex]);
|
||||
return loadById<FGPavement>(mPavements, aIndex);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGPavementList FGAirport::getPavements() const
|
||||
{
|
||||
loadTaxiways();
|
||||
return loadAllById<FGPavement>(mPavements);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGRunway* FGAirport::getActiveRunwayForUsage() const
|
||||
{
|
||||
FGEnvironmentMgr* envMgr = (FGEnvironmentMgr *) globals->get_subsystem("environment");
|
||||
|
@ -383,7 +444,7 @@ char** FGAirport::searchNamesAndIdents(const std::string& aFilter)
|
|||
}
|
||||
|
||||
// find basic airport location info from airport database
|
||||
const FGAirport *fgFindAirportID( const string& id)
|
||||
const FGAirport *fgFindAirportID( const std::string& id)
|
||||
{
|
||||
if ( id.empty() ) {
|
||||
return NULL;
|
||||
|
@ -482,7 +543,7 @@ void FGAirport::readThresholdData(SGPropertyNode* aRoot)
|
|||
void FGAirport::processThreshold(SGPropertyNode* aThreshold)
|
||||
{
|
||||
// first, let's identify the current runway
|
||||
string rwyIdent(aThreshold->getStringValue("rwy"));
|
||||
std::string rwyIdent(aThreshold->getStringValue("rwy"));
|
||||
NavDataCache* cache = NavDataCache::instance();
|
||||
PositionedID id = cache->airportItemWithIdent(guid(), FGPositioned::RUNWAY, rwyIdent);
|
||||
if (id == 0) {
|
||||
|
@ -642,18 +703,21 @@ void FGAirport::addApproach(Approach* aApp)
|
|||
mApproaches.push_back(aApp);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned int FGAirport::numSIDs() const
|
||||
{
|
||||
loadProcedures();
|
||||
return mSIDs.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
flightgear::SID* FGAirport::getSIDByIndex(unsigned int aIndex) const
|
||||
{
|
||||
loadProcedures();
|
||||
return mSIDs[aIndex];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
flightgear::SID* FGAirport::findSIDWithIdent(const std::string& aIdent) const
|
||||
{
|
||||
loadProcedures();
|
||||
|
@ -666,18 +730,28 @@ flightgear::SID* FGAirport::findSIDWithIdent(const std::string& aIdent) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
flightgear::SIDList FGAirport::getSIDs() const
|
||||
{
|
||||
loadProcedures();
|
||||
return flightgear::SIDList(mSIDs.begin(), mSIDs.end());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned int FGAirport::numSTARs() const
|
||||
{
|
||||
loadProcedures();
|
||||
return mSTARs.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
STAR* FGAirport::getSTARByIndex(unsigned int aIndex) const
|
||||
{
|
||||
loadProcedures();
|
||||
return mSTARs[aIndex];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
STAR* FGAirport::findSTARWithIdent(const std::string& aIdent) const
|
||||
{
|
||||
loadProcedures();
|
||||
|
@ -690,18 +764,27 @@ STAR* FGAirport::findSTARWithIdent(const std::string& aIdent) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
STARList FGAirport::getSTARs() const
|
||||
{
|
||||
loadProcedures();
|
||||
return STARList(mSTARs.begin(), mSTARs.end());
|
||||
}
|
||||
|
||||
unsigned int FGAirport::numApproaches() const
|
||||
{
|
||||
loadProcedures();
|
||||
return mApproaches.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Approach* FGAirport::getApproachByIndex(unsigned int aIndex) const
|
||||
{
|
||||
loadProcedures();
|
||||
return mApproaches[aIndex];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Approach* FGAirport::findApproachWithIdent(const std::string& aIdent) const
|
||||
{
|
||||
loadProcedures();
|
||||
|
@ -714,6 +797,22 @@ Approach* FGAirport::findApproachWithIdent(const std::string& aIdent) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ApproachList FGAirport::getApproaches(ProcedureType type) const
|
||||
{
|
||||
loadProcedures();
|
||||
if( type == PROCEDURE_INVALID )
|
||||
return ApproachList(mApproaches.begin(), mApproaches.end());
|
||||
|
||||
ApproachList ret;
|
||||
for(size_t i = 0; i < mApproaches.size(); ++i)
|
||||
{
|
||||
if( mApproaches[i]->type() == type )
|
||||
ret.push_back(mApproaches[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CommStationList
|
||||
FGAirport::commStations() const
|
||||
{
|
||||
|
@ -742,7 +841,7 @@ FGAirport::commStationsOfType(FGPositioned::Type aTy) const
|
|||
}
|
||||
|
||||
// get airport elevation
|
||||
double fgGetAirportElev( const string& id )
|
||||
double fgGetAirportElev( const std::string& id )
|
||||
{
|
||||
const FGAirport *a=fgFindAirportID( id);
|
||||
if (a) {
|
||||
|
@ -754,7 +853,7 @@ double fgGetAirportElev( const string& id )
|
|||
|
||||
|
||||
// get airport position
|
||||
SGGeod fgGetAirportPos( const string& id )
|
||||
SGGeod fgGetAirportPos( const std::string& id )
|
||||
{
|
||||
const FGAirport *a = fgFindAirportID( id);
|
||||
|
||||
|
|
|
@ -34,33 +34,10 @@
|
|||
#include <map>
|
||||
|
||||
#include <Navaids/positioned.hxx>
|
||||
#include <Airports/runways.hxx>
|
||||
|
||||
// forward decls
|
||||
class FGAirportDynamics;
|
||||
class FGRunway;
|
||||
class FGHelipad;
|
||||
class FGTaxiway;
|
||||
class FGPavement;
|
||||
class SGPropertyNode;
|
||||
class FGAirport;
|
||||
|
||||
namespace flightgear {
|
||||
class SID;
|
||||
class STAR;
|
||||
class Approach;
|
||||
class Waypt;
|
||||
class CommStation;
|
||||
|
||||
typedef SGSharedPtr<Waypt> WayptRef;
|
||||
typedef std::vector<WayptRef> WayptVec;
|
||||
|
||||
typedef std::vector<CommStation*> CommStationList;
|
||||
typedef std::map<std::string, FGAirport*> AirportCache;
|
||||
}
|
||||
|
||||
typedef std::vector<FGRunway*> FGRunwayList;
|
||||
#include <Navaids/procedure.hxx>
|
||||
|
||||
#include "airports_fwd.hxx"
|
||||
#include "runways.hxx"
|
||||
|
||||
/***************************************************************************************
|
||||
*
|
||||
|
@ -108,6 +85,8 @@ public:
|
|||
unsigned int numHelipads() const;
|
||||
FGRunway* getRunwayByIndex(unsigned int aIndex) const;
|
||||
FGHelipad* 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;
|
||||
|
@ -145,9 +124,11 @@ public:
|
|||
|
||||
unsigned int numTaxiways() const;
|
||||
FGTaxiway* getTaxiwayByIndex(unsigned int aIndex) const;
|
||||
FGTaxiwayList getTaxiways() const;
|
||||
|
||||
unsigned int numPavements() const;
|
||||
FGPavement* getPavementByIndex(unsigned int aIndex) const;
|
||||
FGPavementList getPavements() const;
|
||||
|
||||
class AirportFilter : public Filter
|
||||
{
|
||||
|
@ -203,14 +184,20 @@ public:
|
|||
unsigned int numSIDs() const;
|
||||
flightgear::SID* getSIDByIndex(unsigned int aIndex) const;
|
||||
flightgear::SID* findSIDWithIdent(const std::string& aIdent) const;
|
||||
flightgear::SIDList getSIDs() const;
|
||||
|
||||
unsigned int numSTARs() const;
|
||||
flightgear::STAR* getSTARByIndex(unsigned int aIndex) const;
|
||||
flightgear::STAR* findSTARWithIdent(const std::string& aIdent) const;
|
||||
flightgear::STARList getSTARs() const;
|
||||
|
||||
unsigned int numApproaches() const;
|
||||
flightgear::Approach* getApproachByIndex(unsigned int aIndex) const;
|
||||
flightgear::Approach* findApproachWithIdent(const std::string& aIdent) const;
|
||||
flightgear::ApproachList getApproaches
|
||||
(
|
||||
flightgear::ProcedureType type = flightgear::PROCEDURE_INVALID
|
||||
) const;
|
||||
|
||||
/**
|
||||
* Syntactic wrapper around FGPositioned::findClosest - find the closest
|
||||
|
|
98
src/Airports/airports_fwd.hxx
Normal file
98
src/Airports/airports_fwd.hxx
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* airports_fwd.hxx
|
||||
*
|
||||
* Created on: 04.03.2013
|
||||
* Author: tom
|
||||
*/
|
||||
|
||||
#ifndef AIRPORTS_FWD_HXX_
|
||||
#define AIRPORTS_FWD_HXX_
|
||||
|
||||
#include <simgear/structure/SGSharedPtr.hxx>
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// forward decls
|
||||
class FGAirport;
|
||||
class FGAirportDynamics;
|
||||
class FGRunway;
|
||||
class FGHelipad;
|
||||
class FGTaxiway;
|
||||
class FGPavement;
|
||||
|
||||
class FGNavRecord;
|
||||
|
||||
class Block;
|
||||
class FGTaxiNode;
|
||||
class FGParking;
|
||||
class FGTaxiSegment;
|
||||
class FGTaxiRoute;
|
||||
class FGGroundNetwork;
|
||||
|
||||
class RunwayList;
|
||||
class RunwayGroup;
|
||||
class FGRunwayPreference;
|
||||
|
||||
class FGSidStar;
|
||||
|
||||
class SGPropertyNode;
|
||||
|
||||
namespace flightgear {
|
||||
class SID;
|
||||
class STAR;
|
||||
class Approach;
|
||||
class Waypt;
|
||||
class CommStation;
|
||||
|
||||
typedef std::vector<flightgear::SID*> SIDList;
|
||||
typedef std::vector<STAR*> STARList;
|
||||
typedef std::vector<Approach*> ApproachList;
|
||||
|
||||
typedef SGSharedPtr<Waypt> WayptRef;
|
||||
typedef std::vector<WayptRef> WayptVec;
|
||||
|
||||
typedef SGSharedPtr<CommStation> CommStationRef;
|
||||
typedef std::vector<CommStation*> CommStationList;
|
||||
typedef std::map<std::string, FGAirport*> AirportCache;
|
||||
}
|
||||
|
||||
typedef std::vector<FGRunway*> FGRunwayList;
|
||||
typedef std::map<std::string, FGRunway*> FGRunwayMap;
|
||||
typedef std::map<std::string, FGHelipad*> FGHelipadMap;
|
||||
|
||||
typedef std::vector<FGTaxiway*> FGTaxiwayList;
|
||||
typedef std::vector<FGPavement*> FGPavementList;
|
||||
|
||||
typedef std::vector<FGTaxiSegment*> FGTaxiSegmentVector;
|
||||
typedef FGTaxiSegmentVector::iterator FGTaxiSegmentVectorIterator;
|
||||
|
||||
typedef SGSharedPtr<FGTaxiNode> FGTaxiNodeRef;
|
||||
typedef std::vector<FGTaxiNodeRef> FGTaxiNodeVector;
|
||||
typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator;
|
||||
typedef std::map<int, FGTaxiNodeRef> IndexTaxiNodeMap;
|
||||
|
||||
typedef std::vector<Block> BlockList;
|
||||
typedef BlockList::iterator BlockListIterator;
|
||||
|
||||
typedef std::vector<time_t> TimeVector;
|
||||
typedef std::vector<time_t>::iterator TimeVectorIterator;
|
||||
|
||||
typedef std::vector<FGTaxiRoute> TaxiRouteVector;
|
||||
typedef std::vector<FGTaxiRoute>::iterator TaxiRouteVectorIterator;
|
||||
|
||||
typedef std::vector<FGParking*> FGParkingVec;
|
||||
typedef FGParkingVec::iterator FGParkingVecIterator;
|
||||
typedef FGParkingVec::const_iterator FGParkingVecConstIterator;
|
||||
|
||||
typedef std::vector<RunwayList> RunwayListVec;
|
||||
typedef std::vector<RunwayList>::iterator RunwayListVectorIterator;
|
||||
typedef std::vector<RunwayList>::const_iterator RunwayListVecConstIterator;
|
||||
|
||||
typedef std::vector<RunwayGroup> PreferenceList;
|
||||
typedef std::vector<RunwayGroup>::iterator PreferenceListIterator;
|
||||
typedef std::vector<RunwayGroup>::const_iterator PreferenceListConstIterator;
|
||||
|
||||
#endif /* AIRPORTS_FWD_HXX_ */
|
|
@ -25,14 +25,11 @@
|
|||
#include <set>
|
||||
|
||||
#include <ATC/trafficcontrol.hxx>
|
||||
#include "airports_fwd.hxx"
|
||||
#include "parking.hxx"
|
||||
#include "groundnetwork.hxx"
|
||||
#include "runwayprefs.hxx"
|
||||
|
||||
// forward decls
|
||||
class FGAirport;
|
||||
class FGEnvironment;
|
||||
|
||||
class ParkingAssignment
|
||||
{
|
||||
public:
|
||||
|
@ -125,7 +122,10 @@ public:
|
|||
FGAirport* parent() const
|
||||
{ return _ap; }
|
||||
|
||||
void getActiveRunway(const string& trafficType, int action, string& runway, double heading);
|
||||
void getActiveRunway( const std::string& trafficType,
|
||||
int action,
|
||||
std::string& runway,
|
||||
double heading );
|
||||
|
||||
/**
|
||||
* retrieve an available parking by GateID, or -1 if no suitable
|
||||
|
|
|
@ -41,8 +41,4 @@ public:
|
|||
bool getIsOnRunway() const { return isOnRunway; };
|
||||
};
|
||||
|
||||
typedef SGSharedPtr<FGTaxiNode> FGTaxiNode_ptr;
|
||||
typedef std::vector<FGTaxiNode_ptr> FGTaxiNodeVector;
|
||||
typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -394,7 +394,7 @@ public:
|
|||
{}
|
||||
|
||||
double score;
|
||||
FGTaxiNode_ptr previousNode;
|
||||
FGTaxiNodeRef previousNode;
|
||||
};
|
||||
|
||||
FGTaxiRoute FGGroundNetwork::findShortestRoute(PositionedID start, PositionedID end,
|
||||
|
|
|
@ -27,26 +27,11 @@
|
|||
#include <simgear/compiler.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include "gnnode.hxx"
|
||||
#include "parking.hxx"
|
||||
#include <ATC/trafficcontrol.hxx>
|
||||
|
||||
|
||||
class Block;
|
||||
class FGRunway;
|
||||
class FGTaxiSegment; // forward reference
|
||||
class FGAIFlightPlan; // forward reference
|
||||
class FGAirport; // forward reference
|
||||
|
||||
typedef std::vector<FGTaxiSegment*> FGTaxiSegmentVector;
|
||||
typedef FGTaxiSegmentVector::iterator FGTaxiSegmentVectorIterator;
|
||||
|
||||
typedef std::map<int, FGTaxiNode_ptr> IndexTaxiNodeMap;
|
||||
|
||||
class Block
|
||||
{
|
||||
private:
|
||||
|
@ -63,9 +48,6 @@ public:
|
|||
bool operator< (const Block &other) const { return blocktime < other.blocktime; };
|
||||
};
|
||||
|
||||
typedef std::vector<Block> BlockList;
|
||||
typedef BlockList::iterator BlockListIterator;
|
||||
|
||||
/***************************************************************************************
|
||||
* class FGTaxiSegment
|
||||
**************************************************************************************/
|
||||
|
@ -119,14 +101,6 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
typedef std::vector<int> intVec;
|
||||
typedef std::vector<int>::iterator intVecIterator;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* class FGTaxiRoute
|
||||
**************************************************************************************/
|
||||
|
@ -181,9 +155,6 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
typedef std::vector<FGTaxiRoute> TaxiRouteVector;
|
||||
typedef std::vector<FGTaxiRoute>::iterator TaxiRouteVectorIterator;
|
||||
|
||||
/**************************************************************************************
|
||||
* class FGGroundNetWork
|
||||
*************************************************************************************/
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <simgear/sg_inlines.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory> // for std::auto_ptr
|
||||
|
||||
#include "gnnode.hxx"
|
||||
|
@ -79,8 +78,4 @@ public:
|
|||
return radius < other.radius; };
|
||||
};
|
||||
|
||||
typedef std::vector<FGParking*> FGParkingVec;
|
||||
typedef FGParkingVec::iterator FGParkingVecIterator;
|
||||
typedef FGParkingVec::const_iterator FGParkingVecConstIterator;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -90,7 +90,7 @@ ScheduleTime & ScheduleTime::operator=(const ScheduleTime & other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
string ScheduleTime::getName(time_t dayStart)
|
||||
std::string ScheduleTime::getName(time_t dayStart)
|
||||
{
|
||||
if ((start.size() != end.size())
|
||||
|| (start.size() != scheduleNames.size())) {
|
||||
|
@ -109,7 +109,7 @@ string ScheduleTime::getName(time_t dayStart)
|
|||
//couldn't find one so return 0;
|
||||
//cerr << "Returning 0 " << endl;
|
||||
}
|
||||
return string("");
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -136,15 +136,15 @@ RunwayList & RunwayList::operator=(const RunwayList & other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
void RunwayList::set(const string & tp, const string & lst)
|
||||
void RunwayList::set(const std::string & tp, const std::string & lst)
|
||||
{
|
||||
//weekday = atoi(timeCopy.substr(0,1).c_str());
|
||||
// timeOffsetInDays = weekday - currTimeDate->getGmt()->tm_wday;
|
||||
// timeCopy = timeCopy.substr(2,timeCopy.length());
|
||||
type = tp;
|
||||
string rwys = lst;
|
||||
string rwy;
|
||||
while (rwys.find(",") != string::npos) {
|
||||
std::string rwys = lst;
|
||||
std::string rwy;
|
||||
while (rwys.find(",") != std::string::npos) {
|
||||
rwy = rwys.substr(0, rwys.find(",", 0));
|
||||
//cerr << "adding runway [" << rwy << "] to the list " << endl;
|
||||
preferredRunways.push_back(rwy);
|
||||
|
@ -206,7 +206,7 @@ void RunwayGroup::setActive(const FGAirport * airport,
|
|||
double hdgDiff;
|
||||
double crossWind;
|
||||
double tailWind;
|
||||
string name;
|
||||
std::string name;
|
||||
//stringVec names;
|
||||
int bestMatch = 0, bestChoice = 0;
|
||||
|
||||
|
@ -229,7 +229,7 @@ void RunwayGroup::setActive(const FGAirport * airport,
|
|||
validSelection = true;
|
||||
|
||||
for (int j = 0; j < activeRwys; j++) {
|
||||
string ident(rwyList[j].getRwyList(i));
|
||||
std::string ident(rwyList[j].getRwyList(i));
|
||||
if (!airport->hasRunwayWithIdent(ident)) {
|
||||
SG_LOG(SG_GENERAL, SG_WARN,
|
||||
"no such runway:" << ident << " at " <<
|
||||
|
@ -290,9 +290,9 @@ void RunwayGroup::setActive(const FGAirport * airport,
|
|||
choice[0] = 0;
|
||||
choice[1] = 0;
|
||||
for (int i = activeRwys - 1; i; i--) {
|
||||
if (rwyList[i].getType() == string("landing"))
|
||||
if (rwyList[i].getType() == std::string("landing"))
|
||||
choice[0] = i;
|
||||
if (rwyList[i].getType() == string("takeoff"))
|
||||
if (rwyList[i].getType() == std::string("takeoff"))
|
||||
choice[1] = i;
|
||||
}
|
||||
//cerr << "Choosing " << choice[0] << " for landing and " << choice[1] << "for takeoff" << endl;
|
||||
|
@ -327,7 +327,7 @@ void RunwayGroup::setActive(const FGAirport * airport,
|
|||
nrActive = 0;
|
||||
}
|
||||
|
||||
void RunwayGroup::getActive(int i, string & name, string & type)
|
||||
void RunwayGroup::getActive(int i, std::string & name, std::string & type)
|
||||
{
|
||||
if (i == -1) {
|
||||
return;
|
||||
|
@ -394,7 +394,7 @@ ScheduleTime *FGRunwayPreference::getSchedule(const char *trafficType)
|
|||
return 0;
|
||||
}
|
||||
|
||||
RunwayGroup *FGRunwayPreference::getGroup(const string & groupName)
|
||||
RunwayGroup *FGRunwayPreference::getGroup(const std::string & groupName)
|
||||
{
|
||||
PreferenceListIterator i = preferences.begin();
|
||||
if (preferences.begin() == preferences.end())
|
||||
|
@ -407,7 +407,7 @@ RunwayGroup *FGRunwayPreference::getGroup(const string & groupName)
|
|||
return 0;
|
||||
}
|
||||
|
||||
string FGRunwayPreference::getId()
|
||||
std::string FGRunwayPreference::getId()
|
||||
{
|
||||
return _ap->getId();
|
||||
};
|
||||
|
|
|
@ -24,23 +24,18 @@
|
|||
#ifndef _RUNWAYPREFS_HXX_
|
||||
#define _RUNWAYPREFS_HXX_
|
||||
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "airports_fwd.hxx"
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <time.h>
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
typedef std::vector<time_t> timeVec;
|
||||
typedef std::vector<time_t>::const_iterator timeVecConstIterator;
|
||||
|
||||
typedef vector<time_t> timeVec;
|
||||
typedef vector<time_t>::const_iterator timeVecConstIterator;
|
||||
typedef std::vector<std::string> stringVec;
|
||||
typedef std::vector<std::string>::iterator stringVecIterator;
|
||||
typedef std::vector<std::string>::const_iterator stringVecConstIterator;
|
||||
|
||||
typedef vector<string> stringVec;
|
||||
typedef vector<string>::iterator stringVecIterator;
|
||||
typedef vector<string>::const_iterator stringVecConstIterator;
|
||||
|
||||
class FGAirport;
|
||||
|
||||
/***************************************************************************/
|
||||
class ScheduleTime {
|
||||
|
@ -54,12 +49,12 @@ public:
|
|||
ScheduleTime() : tailWind(0), crssWind(0) {};
|
||||
ScheduleTime(const ScheduleTime &other);
|
||||
ScheduleTime &operator= (const ScheduleTime &other);
|
||||
string getName(time_t dayStart);
|
||||
std::string getName(time_t dayStart);
|
||||
|
||||
void clear();
|
||||
void addStartTime(time_t time) { start.push_back(time); };
|
||||
void addEndTime (time_t time) { end. push_back(time); };
|
||||
void addScheduleName(const string& sched) { scheduleNames.push_back(sched); };
|
||||
void addScheduleName(const std::string& sched) { scheduleNames.push_back(sched); };
|
||||
void setTailWind(double wnd) { tailWind = wnd; };
|
||||
void setCrossWind(double wnd) { tailWind = wnd; };
|
||||
|
||||
|
@ -73,32 +68,27 @@ public:
|
|||
class RunwayList
|
||||
{
|
||||
private:
|
||||
string type;
|
||||
std::string type;
|
||||
stringVec preferredRunways;
|
||||
public:
|
||||
RunwayList() {};
|
||||
RunwayList(const RunwayList &other);
|
||||
RunwayList& operator= (const RunwayList &other);
|
||||
|
||||
void set(const string&, const string&);
|
||||
void set(const std::string&, const std::string&);
|
||||
void clear();
|
||||
|
||||
string getType() { return type; };
|
||||
std::string getType() { return type; };
|
||||
stringVec *getRwyList() { return &preferredRunways; };
|
||||
string getRwyList(int j) { return preferredRunways[j]; };
|
||||
std::string getRwyList(int j) { return preferredRunways[j]; };
|
||||
};
|
||||
|
||||
typedef vector<RunwayList> RunwayListVec;
|
||||
typedef vector<RunwayList>::iterator RunwayListVectorIterator;
|
||||
typedef vector<RunwayList>::const_iterator RunwayListVecConstIterator;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
class RunwayGroup
|
||||
{
|
||||
private:
|
||||
string name;
|
||||
std::string name;
|
||||
RunwayListVec rwyList;
|
||||
int active;
|
||||
//stringVec runwayNames;
|
||||
|
@ -110,22 +100,18 @@ public:
|
|||
RunwayGroup(const RunwayGroup &other);
|
||||
RunwayGroup &operator= (const RunwayGroup &other);
|
||||
|
||||
void setName(const string& nm) { name = nm; };
|
||||
void setName(const std::string& nm) { name = nm; };
|
||||
void add(const RunwayList& list) { rwyList.push_back(list);};
|
||||
void setActive(const FGAirport* airport, double windSpeed, double windHeading, double maxTail, double maxCross, stringVec *curr);
|
||||
|
||||
int getNrActiveRunways() { return nrActive;};
|
||||
void getActive(int i, string& name, string& type);
|
||||
void getActive(int i, std::string& name, std::string& type);
|
||||
|
||||
string getName() { return name; };
|
||||
std::string getName() { return name; };
|
||||
void clear() { rwyList.clear(); };
|
||||
//void add(string, string);
|
||||
};
|
||||
|
||||
typedef vector<RunwayGroup> PreferenceList;
|
||||
typedef vector<RunwayGroup>::iterator PreferenceListIterator;
|
||||
typedef vector<RunwayGroup>::const_iterator PreferenceListConstIterator;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
class FGRunwayPreference {
|
||||
|
@ -148,9 +134,9 @@ public:
|
|||
FGRunwayPreference & operator= (const FGRunwayPreference &other);
|
||||
|
||||
ScheduleTime *getSchedule(const char *trafficType);
|
||||
RunwayGroup *getGroup(const string& groupName);
|
||||
RunwayGroup *getGroup(const std::string& groupName);
|
||||
|
||||
string getId();
|
||||
std::string getId();
|
||||
|
||||
bool available() { return initialized; };
|
||||
void setInitialized(bool state) { initialized = state; };
|
||||
|
|
|
@ -130,12 +130,12 @@ void FGRunway::setReciprocalRunway(PositionedID other)
|
|||
|
||||
FGAirport* FGRunway::airport() const
|
||||
{
|
||||
return (FGAirport*) flightgear::NavDataCache::instance()->loadById(_airport);
|
||||
return loadById<FGAirport>(_airport);
|
||||
}
|
||||
|
||||
FGRunway* FGRunway::reciprocalRunway() const
|
||||
{
|
||||
return (FGRunway*) flightgear::NavDataCache::instance()->loadById(_reciprocal);
|
||||
return loadById<FGRunway>(_reciprocal);
|
||||
}
|
||||
|
||||
FGNavRecord* FGRunway::ILS() const
|
||||
|
@ -144,7 +144,7 @@ FGNavRecord* FGRunway::ILS() const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return (FGNavRecord*) flightgear::NavDataCache::instance()->loadById(_ils);
|
||||
return loadById<FGNavRecord>(_ils);
|
||||
}
|
||||
|
||||
FGNavRecord* FGRunway::glideslope() const
|
||||
|
@ -158,10 +158,10 @@ FGNavRecord* FGRunway::glideslope() const
|
|||
return (FGNavRecord*) cache->loadById(gsId);
|
||||
}
|
||||
|
||||
std::vector<flightgear::SID*> FGRunway::getSIDs() const
|
||||
flightgear::SIDList FGRunway::getSIDs() const
|
||||
{
|
||||
FGAirport* apt = airport();
|
||||
std::vector<flightgear::SID*> result;
|
||||
flightgear::SIDList result;
|
||||
for (unsigned int i=0; i<apt->numSIDs(); ++i) {
|
||||
flightgear::SID* s = apt->getSIDByIndex(i);
|
||||
if (s->isForRunway(this)) {
|
||||
|
@ -172,10 +172,10 @@ std::vector<flightgear::SID*> FGRunway::getSIDs() const
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<flightgear::STAR*> FGRunway::getSTARs() const
|
||||
flightgear::STARList FGRunway::getSTARs() const
|
||||
{
|
||||
FGAirport* apt = airport();
|
||||
std::vector<flightgear::STAR*> result;
|
||||
flightgear::STARList result;
|
||||
for (unsigned int i=0; i<apt->numSTARs(); ++i) {
|
||||
flightgear::STAR* s = apt->getSTARByIndex(i);
|
||||
if (s->isForRunway(this)) {
|
||||
|
@ -186,13 +186,17 @@ std::vector<flightgear::STAR*> FGRunway::getSTARs() const
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<flightgear::Approach*> FGRunway::getApproaches() const
|
||||
flightgear::ApproachList
|
||||
FGRunway::getApproaches(flightgear::ProcedureType type) const
|
||||
{
|
||||
FGAirport* apt = airport();
|
||||
std::vector<flightgear::Approach*> result;
|
||||
for (unsigned int i=0; i<apt->numApproaches(); ++i) {
|
||||
flightgear::ApproachList result;
|
||||
for (unsigned int i=0; i<apt->numApproaches(); ++i)
|
||||
{
|
||||
flightgear::Approach* s = apt->getApproachByIndex(i);
|
||||
if (s->runway() == this) {
|
||||
if( s->runway() == this
|
||||
&& (type == flightgear::PROCEDURE_INVALID || type == s->type()) )
|
||||
{
|
||||
result.push_back(s);
|
||||
}
|
||||
} // of approaches at the airport iteration
|
||||
|
|
|
@ -26,18 +26,9 @@
|
|||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <Airports/runwaybase.hxx>
|
||||
|
||||
// forward decls
|
||||
class FGAirport;
|
||||
class FGNavRecord;
|
||||
class SGPropertyNode;
|
||||
|
||||
namespace flightgear {
|
||||
class SID;
|
||||
class STAR;
|
||||
class Approach;
|
||||
}
|
||||
#include <Navaids/procedure.hxx>
|
||||
#include "runwaybase.hxx"
|
||||
#include "airports_fwd.hxx"
|
||||
|
||||
class FGRunway : public FGRunwayBase
|
||||
{
|
||||
|
@ -113,15 +104,18 @@ public:
|
|||
/**
|
||||
* Get SIDs (DPs) associated with this runway
|
||||
*/
|
||||
std::vector<flightgear::SID*> getSIDs() const;
|
||||
flightgear::SIDList getSIDs() const;
|
||||
|
||||
/**
|
||||
* Get STARs associared with this runway
|
||||
*/
|
||||
std::vector<flightgear::STAR*> getSTARs() const;
|
||||
flightgear::STARList getSTARs() const;
|
||||
|
||||
|
||||
std::vector<flightgear::Approach*> getApproaches() const;
|
||||
flightgear::ApproachList getApproaches
|
||||
(
|
||||
flightgear::ProcedureType type = flightgear::PROCEDURE_INVALID
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -28,11 +28,9 @@
|
|||
#include <simgear/props/props.hxx>
|
||||
#include <simgear/props/props_io.hxx>
|
||||
|
||||
|
||||
|
||||
#include <AIModel/AIFlightPlan.hxx>
|
||||
#include <Airports/airport.hxx>
|
||||
|
||||
|
||||
#include "sidstar.hxx"
|
||||
|
||||
using std::cerr;
|
||||
|
@ -119,4 +117,4 @@ FGAIFlightPlan *FGSidStar::getBest(string activeRunway, double heading)
|
|||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,29 +23,13 @@
|
|||
#ifndef _SIDSTAR_HXX_
|
||||
#define _SIDSTAR_HXX_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "airports_fwd.hxx"
|
||||
#include <ATC/trafficcontrol.hxx>
|
||||
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
#include <simgear/xml/easyxml.hxx>
|
||||
|
||||
#include <ATC/trafficcontrol.hxx>
|
||||
#include <AIModel/AIFlightPlan.hxx>
|
||||
#include "parking.hxx"
|
||||
#include "groundnetwork.hxx"
|
||||
#include "runwayprefs.hxx"
|
||||
|
||||
|
||||
class FGAirport;
|
||||
|
||||
typedef std::vector<FGAIFlightPlan*> FlightPlanVec;
|
||||
typedef std::vector<FGAIFlightPlan*>::iterator FlightPlanVecIterator;
|
||||
|
||||
typedef std::map < std::string, FlightPlanVec > FlightPlanVecMap;
|
||||
|
||||
|
||||
class FGSidStar
|
||||
class FGSidStar
|
||||
{
|
||||
private:
|
||||
std::string id;
|
||||
|
@ -61,6 +45,4 @@ class FGSidStar
|
|||
FGAIFlightPlan *getBest(std::string activeRunway, double heading);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
#ifndef _XML_LOADER_HXX_
|
||||
#define _XML_LOADER_HXX_
|
||||
|
||||
class FGAirportDynamics;
|
||||
class FGRunwayPreference;
|
||||
class FGSidStar;
|
||||
#include "airports_fwd.hxx"
|
||||
|
||||
class XMLVisitor; // ffrom easyxml.hxx
|
||||
|
||||
|
|
|
@ -326,6 +326,12 @@ void FGPositioned::modifyPosition(const SGGeod& newPos)
|
|||
const_cast<SGVec3d&>(mCart) = SGVec3d::fromGeod(newPos);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
FGPositioned* FGPositioned::loadByIdImpl(PositionedID id)
|
||||
{
|
||||
return flightgear::NavDataCache::instance()->loadById(id);
|
||||
}
|
||||
|
||||
FGPositioned::TypeFilter::TypeFilter(Type aTy) :
|
||||
mMinType(aTy),
|
||||
mMaxType(aTy)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef FG_POSITIONED_HXX
|
||||
#define FG_POSITIONED_HXX
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
|
@ -128,6 +129,9 @@ public:
|
|||
double elevation() const
|
||||
{ return mPosition.getElevationFt(); }
|
||||
|
||||
double elevationM() const
|
||||
{ return mPosition.getElevationM(); }
|
||||
|
||||
/**
|
||||
* Predicate class to support custom filtering of FGPositioned queries
|
||||
* Default implementation of this passes any FGPositioned instance.
|
||||
|
@ -243,7 +247,33 @@ protected:
|
|||
FGPositioned(PositionedID aGuid, Type ty, const std::string& aIdent, const SGGeod& aPos);
|
||||
|
||||
void modifyPosition(const SGGeod& newPos);
|
||||
|
||||
|
||||
static FGPositioned* loadByIdImpl(PositionedID id);
|
||||
|
||||
template<class T>
|
||||
static T* loadById(PositionedID id)
|
||||
{
|
||||
return static_cast<T*>( loadByIdImpl(id) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static T* loadById(const PositionedIDVec& id_vec, size_t index)
|
||||
{
|
||||
assert(index >= 0 && index < id_vec.size());
|
||||
return loadById<T>(id_vec[index]);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static std::vector<T*> loadAllById(const PositionedIDVec& id_vec)
|
||||
{
|
||||
std::vector<T*> vec(id_vec.size());
|
||||
|
||||
for(size_t i = 0; i < id_vec.size(); ++i)
|
||||
vec[i] = loadById<T>(id_vec[i]);
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
const PositionedID mGuid;
|
||||
const SGGeod mPosition;
|
||||
const SGVec3d mCart;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <simgear/structure/exception.hxx>
|
||||
|
||||
#include <Airports/runways.hxx>
|
||||
#include <Navaids/waypoint.hxx>
|
||||
|
||||
using std::string;
|
||||
|
|
|
@ -23,9 +23,8 @@
|
|||
#include <set>
|
||||
|
||||
#include <simgear/math/sg_types.hxx> // for string_list
|
||||
|
||||
#include <Airports/airports_fwd.hxx>
|
||||
#include <Navaids/route.hxx>
|
||||
#include <Airports/runways.hxx>
|
||||
|
||||
typedef SGSharedPtr<FGRunway> FGRunwayRef;
|
||||
|
||||
|
|
|
@ -164,16 +164,16 @@ naRef f_groupGetElementById(sc::Group& group, const nasal::CallContext& ctx)
|
|||
);
|
||||
}
|
||||
|
||||
naRef f_eventGetTarget(naContext c, sc::Event& event)
|
||||
naRef to_nasal_helper(naContext c, const sc::ElementWeakPtr& el)
|
||||
{
|
||||
return NasalElement::create(c, event.getTarget().lock());
|
||||
return NasalElement::create(c, el.lock());
|
||||
}
|
||||
|
||||
naRef initNasalCanvas(naRef globals, naContext c, naRef gcSave)
|
||||
{
|
||||
NasalEvent::init("canvas.Event")
|
||||
.member("type", &sc::Event::getTypeString)
|
||||
.member("target", &f_eventGetTarget)
|
||||
.member("target", &sc::Event::getTarget)
|
||||
.method("stopPropagation", &sc::Event::stopPropagation);
|
||||
NasalMouseEvent::init("canvas.MouseEvent")
|
||||
.bases<NasalEvent>()
|
||||
|
|
|
@ -462,7 +462,7 @@ static const char* wayptGhostGetMember(naContext c, void* g, naRef field, naRef*
|
|||
|
||||
static RouteRestriction routeRestrictionFromString(const char* s)
|
||||
{
|
||||
string u(s);
|
||||
std::string u(s);
|
||||
boost::to_lower(u);
|
||||
if (u == "computed") return RESTRICT_COMPUTED;
|
||||
if (u == "at") return RESTRICT_AT;
|
||||
|
@ -728,7 +728,7 @@ static const char* procedureGhostGetMember(naContext c, void* g, naRef field, na
|
|||
|
||||
ArrivalDeparture* ad = static_cast<ArrivalDeparture*>(proc);
|
||||
*out = naNewVector(c);
|
||||
BOOST_FOREACH(string id, ad->transitionIdents()) {
|
||||
BOOST_FOREACH(std::string id, ad->transitionIdents()) {
|
||||
naVec_append(*out, stringToNasal(c, id));
|
||||
}
|
||||
} else {
|
||||
|
@ -1112,7 +1112,7 @@ static naRef f_findAirportsByICAO(naContext c, naRef me, int argc, naRef* args)
|
|||
}
|
||||
|
||||
int argOffset = 0;
|
||||
string prefix(naStr_data(args[argOffset++]));
|
||||
std::string prefix(naStr_data(args[argOffset++]));
|
||||
AirportInfoFilter filter; // defaults to airports only
|
||||
if (argOffset < argc) {
|
||||
filter.fromArg(args[argOffset++]);
|
||||
|
@ -1213,26 +1213,6 @@ static naRef f_airport_runwaysWithoutReciprocals(naContext c, naRef me, int argc
|
|||
return runways;
|
||||
}
|
||||
|
||||
static naRef f_airport_taxiway(naContext c, naRef me, int argc, naRef* args)
|
||||
{
|
||||
FGAirport* apt = airportGhost(me);
|
||||
if (!apt) {
|
||||
naRuntimeError(c, "airport.taxiway called on non-airport object");
|
||||
}
|
||||
|
||||
if ((argc < 1) || !naIsString(args[0])) {
|
||||
naRuntimeError(c, "airport.taxiway expects a taxiway ident argument");
|
||||
}
|
||||
|
||||
naRef taxiways = naNewVector(c);
|
||||
|
||||
for (unsigned int i = 0; i < apt->numTaxiways(); i++) {
|
||||
naVec_append(taxiways, ghostForTaxiway(c, apt->getTaxiwayByIndex(i)));
|
||||
}
|
||||
|
||||
return taxiways;
|
||||
}
|
||||
|
||||
static naRef f_airport_sids(naContext c, naRef me, int argc, naRef* args)
|
||||
{
|
||||
FGAirport* apt = airportGhost(me);
|
||||
|
@ -1417,7 +1397,7 @@ static naRef f_airport_getSid(naContext c, naRef me, int argc, naRef* args)
|
|||
naRuntimeError(c, "airport.getSid passed invalid argument");
|
||||
}
|
||||
|
||||
string ident = naStr_data(args[0]);
|
||||
std::string ident = naStr_data(args[0]);
|
||||
return ghostForProcedure(c, apt->findSIDWithIdent(ident));
|
||||
}
|
||||
|
||||
|
@ -1432,7 +1412,7 @@ static naRef f_airport_getStar(naContext c, naRef me, int argc, naRef* args)
|
|||
naRuntimeError(c, "airport.getStar passed invalid argument");
|
||||
}
|
||||
|
||||
string ident = naStr_data(args[0]);
|
||||
std::string ident = naStr_data(args[0]);
|
||||
return ghostForProcedure(c, apt->findSTARWithIdent(ident));
|
||||
}
|
||||
|
||||
|
@ -1447,7 +1427,7 @@ static naRef f_airport_getApproach(naContext c, naRef me, int argc, naRef* args)
|
|||
naRuntimeError(c, "airport.getIAP passed invalid argument");
|
||||
}
|
||||
|
||||
string ident = naStr_data(args[0]);
|
||||
std::string ident = naStr_data(args[0]);
|
||||
return ghostForProcedure(c, apt->findApproachWithIdent(ident));
|
||||
}
|
||||
|
||||
|
@ -1621,7 +1601,7 @@ static naRef f_findNavaidsByIdent(naContext c, naRef me, int argc, naRef* args)
|
|||
}
|
||||
|
||||
FGPositioned::Type type = FGPositioned::INVALID;
|
||||
string ident = naStr_data(args[argOffset++]);
|
||||
std::string ident = naStr_data(args[argOffset++]);
|
||||
if (argOffset < argc) {
|
||||
type = FGPositioned::typeFromName(naStr_data(args[argOffset]));
|
||||
}
|
||||
|
@ -1647,7 +1627,7 @@ static naRef f_findFixesByIdent(naContext c, naRef me, int argc, naRef* args)
|
|||
naRuntimeError(c, "findFixesByIdent expectes ident string as arg %d", argOffset);
|
||||
}
|
||||
|
||||
string ident(naStr_data(args[argOffset]));
|
||||
std::string ident(naStr_data(args[argOffset]));
|
||||
naRef r = naNewVector(c);
|
||||
|
||||
FGPositioned::TypeFilter filter(FGPositioned::FIX);
|
||||
|
@ -1954,7 +1934,7 @@ static naRef f_createWP(naContext c, naRef me, int argc, naRef* args)
|
|||
naRuntimeError(c, "createWP: no identifier supplied");
|
||||
}
|
||||
|
||||
string ident = naStr_data(args[argOffset++]);
|
||||
std::string ident = naStr_data(args[argOffset++]);
|
||||
WayptRef wpt = new BasicWaypt(pos, ident, NULL);
|
||||
|
||||
// set waypt flags - approach, departure, pseudo, etc
|
||||
|
@ -2430,7 +2410,6 @@ naRef initNasalPositioned(naRef globals, naContext c, naRef gcSave)
|
|||
hashset(c, airportPrototype, "runway", naNewFunc(c, naNewCCode(c, f_airport_runway)));
|
||||
hashset(c, airportPrototype, "runwaysWithoutReciprocals", naNewFunc(c, naNewCCode(c, f_airport_runwaysWithoutReciprocals)));
|
||||
hashset(c, airportPrototype, "helipad", naNewFunc(c, naNewCCode(c, f_airport_runway)));
|
||||
hashset(c, airportPrototype, "taxiway", naNewFunc(c, naNewCCode(c, f_airport_taxiway)));
|
||||
hashset(c, airportPrototype, "tower", naNewFunc(c, naNewCCode(c, f_airport_tower)));
|
||||
hashset(c, airportPrototype, "comms", naNewFunc(c, naNewCCode(c, f_airport_comms)));
|
||||
hashset(c, airportPrototype, "sids", naNewFunc(c, naNewCCode(c, f_airport_sids)));
|
||||
|
|
|
@ -140,8 +140,8 @@ class FGAISchedule
|
|||
|
||||
};
|
||||
|
||||
typedef vector<FGAISchedule*> ScheduleVector;
|
||||
typedef vector<FGAISchedule*>::iterator ScheduleVectorIterator;
|
||||
typedef std::vector<FGAISchedule*> ScheduleVector;
|
||||
typedef std::vector<FGAISchedule*>::iterator ScheduleVectorIterator;
|
||||
|
||||
bool compareSchedules(FGAISchedule*a, FGAISchedule*b);
|
||||
|
||||
|
|
Loading…
Reference in a new issue