1
0
Fork 0

fgelev: Work on stdin/stdout like the previous one did.

Instead of working on arguments work on stdin and stdout.
Note that this version still does not page out.
This commit is contained in:
Mathias Froehlich 2012-08-24 21:20:44 +02:00
parent e3ad3d3a07
commit 70ef3c416d

View file

@ -303,18 +303,14 @@ main(int argc, char** argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
// now handle all the position pairs while (std::cin.good()) {
for(int i = 1; i < arguments.argc(); ++i) { std::string id;
if (arguments.isOption(i)) std::cin >> id;
continue;
std::istringstream ss(arguments[i]);
double lon, lat; double lon, lat;
char sep; std::cin >> lon >> lat;
ss >> lon >> sep >> lat; if (std::cin.fail())
if (ss.fail()) {
return EXIT_FAILURE; return EXIT_FAILURE;
} std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
SGVec3d start = SGVec3d::fromGeod(SGGeod::fromDegM(lon, lat, 10000)); SGVec3d start = SGVec3d::fromGeod(SGGeod::fromDegM(lon, lat, 10000));
SGVec3d end = SGVec3d::fromGeod(SGGeod::fromDegM(lon, lat, -1000)); SGVec3d end = SGVec3d::fromGeod(SGGeod::fromDegM(lon, lat, -1000));
@ -322,7 +318,7 @@ main(int argc, char** argv)
intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT); intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
loadedModel->accept(intersectVisitor); loadedModel->accept(intersectVisitor);
std::cout << arguments[i] << ": "; std::cout << id << ": ";
if (!intersectVisitor.getHaveHit()) { if (!intersectVisitor.getHaveHit()) {
std::cout << "-1000" << std::endl; std::cout << "-1000" << std::endl;
} else { } else {