James Turner: Cleanup of AI traffic route generation code.
This commit is contained in:
parent
c604514754
commit
632d89d6e7
6 changed files with 304 additions and 772 deletions
|
@ -126,7 +126,6 @@ private:
|
||||||
|
|
||||||
void createPushBack(bool, FGAirport*, double, double, double, const string&, const string&, const string&);
|
void createPushBack(bool, FGAirport*, double, double, double, const string&, const string&, const string&);
|
||||||
void createPushBackFallBack(bool, FGAirport*, double, double, double, const string&, const string&, const string&);
|
void createPushBackFallBack(bool, FGAirport*, double, double, double, const string&, const string&, const string&);
|
||||||
void createTaxi(bool, int, FGAirport *, double, double, double, const string&, const string&, const string&);
|
|
||||||
void createTakeOff(bool, FGAirport *, double, const string&);
|
void createTakeOff(bool, FGAirport *, double, const string&);
|
||||||
void createClimb(bool, FGAirport *, double, double, const string&);
|
void createClimb(bool, FGAirport *, double, double, const string&);
|
||||||
void createCruise(bool, FGAirport*, FGAirport*, double, double, double, double, const string&);
|
void createCruise(bool, FGAirport*, FGAirport*, double, double, double, double, const string&);
|
||||||
|
@ -136,6 +135,15 @@ private:
|
||||||
void deleteWaypoints();
|
void deleteWaypoints();
|
||||||
void resetWaypoints();
|
void resetWaypoints();
|
||||||
|
|
||||||
|
void createLandingTaxi(FGAirport *apt, double radius, const string& fltType, const string& acType, const string& airline);
|
||||||
|
void createDefaultLandingTaxi(FGAirport* aAirport);
|
||||||
|
void createDefaultTakeoffTaxi(FGAirport* aAirport, FGRunway* aRunway);
|
||||||
|
void createTakeoffTaxi(bool firstFlight, FGAirport *apt, double radius, const string& fltType, const string& acType, const string& airline);
|
||||||
|
|
||||||
|
waypoint* createOnGround(const std::string& aName, const SGGeod& aPos, double aElev, double aSpeed);
|
||||||
|
waypoint* createInAir(const std::string& aName, const SGGeod& aPos, double aElev, double aSpeed);
|
||||||
|
waypoint* cloneWithPos(waypoint* aWpt, const std::string& aName, const SGGeod& aPos);
|
||||||
|
|
||||||
string getRunwayClassFromTrafficType(string fltType);
|
string getRunwayClassFromTrafficType(string fltType);
|
||||||
|
|
||||||
//void createCruiseFallback(bool, FGAirport*, FGAirport*, double, double, double, double);
|
//void createCruiseFallback(bool, FGAirport*, FGAirport*, double, double, double, double);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -276,7 +276,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
|
||||||
// {
|
// {
|
||||||
// cerr << "Creating cruise to EHAM " << latitude << " " << longitude << endl;
|
// cerr << "Creating cruise to EHAM " << latitude << " " << longitude << endl;
|
||||||
// }
|
// }
|
||||||
heading = rwy->headingDeg();
|
heading = rwy._heading;
|
||||||
azimuth = heading + 180.0;
|
azimuth = heading + 180.0;
|
||||||
while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
|
while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
|
||||||
|
|
||||||
|
@ -315,52 +315,16 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
|
||||||
double longitude, double speed,
|
double longitude, double speed,
|
||||||
double alt, const string& fltType)
|
double alt, const string& fltType)
|
||||||
{
|
{
|
||||||
double wind_speed;
|
|
||||||
double wind_heading;
|
|
||||||
double heading;
|
|
||||||
double lat, lon, az;
|
|
||||||
double lat2, lon2, az2;
|
|
||||||
double azimuth;
|
|
||||||
waypoint *wpt;
|
waypoint *wpt;
|
||||||
|
wpt = createInAir("Cruise", SGGeod::fromDeg(longitude, latitude), alt, speed);
|
||||||
wpt = new waypoint;
|
|
||||||
wpt->name = "Cruise"; //wpt_node->getStringValue("name", "END");
|
|
||||||
wpt->latitude = latitude;
|
|
||||||
wpt->longitude = longitude;
|
|
||||||
wpt->altitude = alt;
|
|
||||||
wpt->speed = speed;
|
|
||||||
wpt->crossat = -10000;
|
|
||||||
wpt->gear_down = false;
|
|
||||||
wpt->flaps_down= false;
|
|
||||||
wpt->finished = false;
|
|
||||||
wpt->on_ground = false;
|
|
||||||
wpt->routeIndex = 0;
|
|
||||||
waypoints.push_back(wpt);
|
waypoints.push_back(wpt);
|
||||||
|
|
||||||
|
|
||||||
string rwyClass = getRunwayClassFromTrafficType(fltType);
|
string rwyClass = getRunwayClassFromTrafficType(fltType);
|
||||||
arr->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway);
|
arr->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway);
|
||||||
rwy = arr->getRunwayByIdent(activeRunway);
|
rwy = arr->getRunwayByIdent(activeRunway);
|
||||||
|
// begin descent 110km out
|
||||||
|
SGGeod beginDescentPoint = rwy->pointOnCenterline(-110000);
|
||||||
|
|
||||||
heading = rwy->headingDeg();
|
wpt = createInAir("BOD", beginDescentPoint, alt, speed);
|
||||||
azimuth = heading + 180.0;
|
|
||||||
while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
|
|
||||||
|
|
||||||
|
|
||||||
geo_direct_wgs_84 ( 0, rwy->latitude(), rwy->longitude(), azimuth,
|
|
||||||
110000,
|
|
||||||
&lat2, &lon2, &az2 );
|
|
||||||
wpt = new waypoint;
|
|
||||||
wpt->name = "BOD";
|
|
||||||
wpt->latitude = lat2;
|
|
||||||
wpt->longitude = lon2;
|
|
||||||
wpt->altitude = alt;
|
|
||||||
wpt->speed = speed;
|
|
||||||
wpt->crossat = alt;
|
|
||||||
wpt->gear_down = false;
|
|
||||||
wpt->flaps_down= false;
|
|
||||||
wpt->finished = false;
|
|
||||||
wpt->on_ground = false;
|
|
||||||
wpt->routeIndex = 0;
|
|
||||||
waypoints.push_back(wpt);
|
waypoints.push_back(wpt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
#include <simgear/math/sg_geodesy.hxx>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
@ -107,6 +109,8 @@ FGTaxiNode &operator =(const FGTaxiNode &other)
|
||||||
double getLatitude() { return lat;};
|
double getLatitude() { return lat;};
|
||||||
double getLongitude(){ return lon;};
|
double getLongitude(){ return lon;};
|
||||||
|
|
||||||
|
SGGeod geod() const { return SGGeod::fromDeg(lon, lat); }
|
||||||
|
|
||||||
int getIndex() { return index; };
|
int getIndex() { return index; };
|
||||||
int getHoldPointType() { return holdType; };
|
int getHoldPointType() { return holdType; };
|
||||||
bool getIsOnRunway() { return isOnRunway; };
|
bool getIsOnRunway() { return isOnRunway; };
|
||||||
|
|
|
@ -312,7 +312,10 @@ void FGGroundNetwork::init()
|
||||||
//exit(1);
|
//exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FGGroundNetwork::findNearestNode(const SGGeod& aGeod)
|
||||||
|
{
|
||||||
|
return findNearestNode(aGeod.getLatitudeDeg(), aGeod.getLongitudeDeg());
|
||||||
|
}
|
||||||
|
|
||||||
int FGGroundNetwork::findNearestNode(double lat, double lon)
|
int FGGroundNetwork::findNearestNode(double lat, double lon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -253,7 +253,10 @@ public:
|
||||||
void init();
|
void init();
|
||||||
bool exists() { return hasNetwork; };
|
bool exists() { return hasNetwork; };
|
||||||
void setTowerController(FGTowerController *twrCtrlr) { towerController = twrCtrlr; };
|
void setTowerController(FGTowerController *twrCtrlr) { towerController = twrCtrlr; };
|
||||||
|
|
||||||
int findNearestNode(double lat, double lon);
|
int findNearestNode(double lat, double lon);
|
||||||
|
int findNearestNode(const SGGeod& aGeod);
|
||||||
|
|
||||||
FGTaxiNode *findNode(int idx);
|
FGTaxiNode *findNode(int idx);
|
||||||
FGTaxiSegment *findSegment(int idx);
|
FGTaxiSegment *findSegment(int idx);
|
||||||
FGTaxiRoute findShortestRoute(int start, int end, bool fullSearch=true);
|
FGTaxiRoute findShortestRoute(int start, int end, bool fullSearch=true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue