const string & acType,
const string & airline)
{
-
+ int route;
// If this function is called during initialization,
// make sure we obtain a valid gate ID first
// and place the model at the location of the gate.
// but make sure we always keep two active waypoints
// to prevent a segmentation fault
for (int i = 0; i < nrWaypointsToSkip - 3; i++) {
- taxiRoute.next(&node);
+ taxiRoute.next(&node, &route);
}
gate.release(); // free up our gate as required
} else {
if (taxiRoute.size() > 1) {
- taxiRoute.next(&node); // chop off the first waypoint, because that is already the last of the pushback route
+ taxiRoute.next(&node, &route); // chop off the first waypoint, because that is already the last of the pushback route
}
}
// push each node on the taxi route as a waypoint
- // int route;
+
//cerr << "Building taxi route" << endl;
// Note that the line wpt->setRouteIndex was commented out by revision [afcdbd] 2012-01-01,
// which breaks the rendering functions.
// These can probably be generated on the fly however.
- while (taxiRoute.next(&node)) {
+ while (taxiRoute.next(&node, &route)) {
char buffer[10];
snprintf(buffer, 10, "%lld", (long long int) node);
FGTaxiNode *tn =
FGAIWaypoint *wpt =
createOnGround(ac, buffer, tn->geod(), apt->getElevation(),
ac->getPerformance()->vTaxi());
- // TODO: find an alternative way to pass route information to the waypoint.
- //wpt->setRouteIndex(route);
+ wpt->setRouteIndex(route);
//cerr << "Nodes left " << taxiRoute->nodesLeft() << " ";
if (taxiRoute.nodesLeft() == 1) {
// Note that we actually have hold points in the ground network, but this is just an initial test.
const string & acType,
const string & airline)
{
+ int route;
gate = apt->getDynamics()->getAvailableParking(radius, fltType,
acType, airline);
// those are created by createParking()
// int route;
for (int i = 0; i < size - 2; i++) {
- taxiRoute.next(&node);
+ taxiRoute.next(&node, &route);
char buffer[10];
snprintf(buffer, 10, "%lld", (long long int) node);
FGTaxiNode *tn = gn->findNode(node);
FGAIWaypoint *wpt =
createOnGround(ac, buffer, tn->geod(), apt->getElevation(),
ac->getPerformance()->vTaxi());
- //TODO: find an alternative way to pass route information to the waypoint.
- //wpt->setRouteIndex(route);
+
+ wpt->setRouteIndex(route);
pushBackWaypoint(wpt);
}
return true;
double vTaxi = ac->getPerformance()->vTaxi();
double vTaxiBackward = vTaxi * (-2.0/3.0);
double vTaxiReduced = vTaxi * (2.0/3.0);
+
// Active runway can be conditionally set by ATC, so at the start of a new flight, this
// must be reset.
activeRunway.clear();
}
route.first();
- PositionedID node, previous= 0;
+ PositionedID node;
+ int rte;
- while (route.next(&node))
+ while (route.next(&node, &rte))
{
char buffer[10];
snprintf (buffer, 10, "%lld", (long long int) node);
FGTaxiNode *tn = groundNet->findNode(node);
FGAIWaypoint *wpt = createOnGround(ac, string(buffer), tn->geod(), dep->getElevation(), vTaxiBackward);
-
+
+ /*
if (previous) {
FGTaxiSegment* segment = groundNet->findSegment(previous, node);
wpt->setRouteIndex(segment->getIndex());
// not on the route yet, make up a unique segment ID
int x = (int) tn->guid();
wpt->setRouteIndex(x);
- }
-
+ }*/
+
+ wpt->setRouteIndex(rte);
pushBackWaypoint(wpt);
- previous = node;
+ //previous = node;
}
// some special considerations for the last point:
waypoints.back()->setName(string("PushBackPoint"));
/***************************************************************************
* FGTaxiRoute
**************************************************************************/
-bool FGTaxiRoute::next(PositionedID *nde)
+bool FGTaxiRoute::next(PositionedID *nde, int *rte)
{
+ if (nodes.size() != (routes.size()) + 1) {
+ SG_LOG(SG_GENERAL, SG_ALERT, "ALERT: Misconfigured TaxiRoute : " << nodes.size() << " " << routes.size());
+ throw sg_range_exception("Misconfigured taxi route");
+ }
if (currNode == nodes.end())
return false;
-
*nde = *(currNode);
-
+ if (currNode != nodes.begin()) {
+ *rte = *(currRoute);
+ currRoute++;
+ } else {
+ // Handle special case for the first node.
+ *rte = -1 * *(currRoute);
+ }
currNode++;
return true;
};
segment->setIndex(index++);
if (segment->oppositeDirection) {
- continue; // already establish
+ continue; // already established
}
FGTaxiSegment* opp = findSegment(segment->endNode, segment->startNode);
// assemble route from backtrace information
PositionedIDVec nodes;
+ intVec routes;
FGTaxiNode *bt = lastNode;
+
while (searchData[bt].previousNode != 0) {
nodes.push_back(bt->guid());
+ FGTaxiSegment *segment = findSegment(searchData[bt].previousNode->guid(), bt->guid());
+ int idx = segment->getIndex();
+ routes.push_back(idx);
bt = searchData[bt].previousNode;
+
}
nodes.push_back(start);
reverse(nodes.begin(), nodes.end());
- return FGTaxiRoute(nodes, searchData[lastNode].score, 0);
+ reverse(routes.begin(), routes.end());
+ return FGTaxiRoute(nodes, routes, searchData[lastNode].score, 0);
}
/* ATC Related Functions */
{
private:
PositionedIDVec nodes;
+ intVec routes;
double distance;
PositionedIDVec::iterator currNode;
+ intVec::iterator currRoute;
public:
FGTaxiRoute() {
distance = 0;
currNode = nodes.begin();
+ currRoute = routes.begin();
};
- FGTaxiRoute(const PositionedIDVec& nds, double dist, int dpth) {
+ FGTaxiRoute(const PositionedIDVec& nds, intVec rts, double dist, int dpth) {
nodes = nds;
+ routes = rts;
distance = dist;
currNode = nodes.begin();
+ currRoute = routes.begin();
};
FGTaxiRoute& operator= (const FGTaxiRoute &other) {
nodes = other.nodes;
+ routes = other.routes;
distance = other.distance;
currNode = nodes.begin();
+ currRoute = routes.begin();
return *this;
};
FGTaxiRoute(const FGTaxiRoute& copy) :
nodes(copy.nodes),
+ routes(copy.routes),
distance(copy.distance),
- currNode(nodes.begin())
+ currNode(nodes.begin()),
+ currRoute(routes.begin())
{};
bool operator< (const FGTaxiRoute &other) const {
bool empty () {
return nodes.empty();
};
- bool next(PositionedID *nde);
+ bool next(PositionedID *nde, int *rte);
void first() {
currNode = nodes.begin();
+ currRoute = routes.begin();
};
int size() {
return nodes.size();