202 std::string identStart, identEnd, token,
name;
203 double latStart, lonStart, latEnd, lonEnd;
208 sg_gzifstream in( path );
209 if ( !in.is_open() ) {
210 SG_LOG( SG_NAVAID, SG_ALERT,
"Cannot open file: " << path.str() );
218 while ( ! in.eof() ) {
222 if ( token ==
"99" ) {
227 in >> latStart >> lonStart >> identEnd >> latEnd >> lonEnd >> type >> base >> top >>
name;
242 int startIndex = 0, endIndex=0;
268 string startNode, endNode;
270 buffer[
sizeof(buffer)-1] = 0;
271 snprintf(buffer,
sizeof(buffer)-1,
"%s%d%d", identStart.c_str(), (
int) latStart, (
int) lonStart);
275 if (itr == nodesMap.end()) {
276 startIndex = nodes.size();
277 SGGeod startPos(SGGeod::fromDeg(lonStart, latStart));
278 n =
new FGNode(startPos, startIndex, identStart);
279 nodesMap[string(buffer)] = n;
284 startIndex = itr->second->getIndex();
287 snprintf(buffer, 32,
"%s%d%d", identEnd.c_str(), (
int) latEnd, (
int) lonEnd);
290 itr = nodesMap.find(
string(buffer));
291 if (itr == nodesMap.end()) {
292 endIndex = nodes.size();
293 SGGeod endPos(SGGeod::fromDeg(lonEnd, latEnd));
294 n =
new FGNode(endPos, endIndex, identEnd);
295 nodesMap[string(buffer)] = n;
300 endIndex = itr->second->getIndex();
312 segments.push_back(airway);
386 traceStack.push_back(currNode->
getIndex());
387 totalDistance += distance;
396 cerr <<
"Found route : " << totalDistance <<
"" <<
" " << *(traceStack.end()-1) << endl;
397 routes.push_back(
FGAirRoute(traceStack,totalDistance));
398 traceStack.pop_back();
400 maxDistance = totalDistance;
402 if (totalDistance < maxDistance)
403 maxDistance = totalDistance;
405 totalDistance -= distance;
424 if (
i != traceStack.end()-1) {
425 traceStack.pop_back();
426 totalDistance -= distance;
432 if ((totalDistance > maxDistance) && foundRoute)
434 cerr <<
"Stopping rediculously long trace: " << totalDistance << endl;
435 traceStack.pop_back();
436 totalDistance -= distance;
451 trace((*i)->getEnd(), end, depth+1, (*i)->getLength());
464 traceStack.pop_back();
465 totalDistance -= distance;