1
0
Fork 0
terragear/src/Lib/e00/teste00.cxx

61 lines
1.8 KiB
C++
Raw Normal View History

// teste00.cxx - test the E00 parsing routines and dump some results.
2000-11-22 22:17:58 +00:00
2001-03-25 12:07:07 +00:00
#include <simgear/misc/sgstream.hxx>
2000-11-22 22:17:58 +00:00
#include "e00.hxx"
int main (int ac, const char ** av)
{
for (int i = 1; i < ac; i++) {
cerr << "Reading " << av[i] << endl;
2001-03-25 12:07:07 +00:00
sg_gzifstream input(av[i]);
2000-11-22 22:17:58 +00:00
E00 data;
try {
data.readE00(input);
} catch (E00Exception &e) {
cerr << "Reading " << av[i] << " failed with exception "
<< e.getMessage() << endl;
2000-11-22 22:17:58 +00:00
exit(1);
}
cerr << "Read " << av[i] << " successfully" << endl;
cerr << "Read " << data.nPoints() << " point(s)" << endl;
cerr << "Read " << data.nLines() << " line segment(s)" << endl;
cerr << "Read " << data.nPolygons() << " polygon(s)" << endl;
cerr << " (including enclosing polygon)" << endl;
for (int i = 1; i <= data.nInfoFiles(); i++) {
const E00::IFO &ifo = data.getIFO(i);
cout << "IFO file: " << ifo.fileName << endl;
for (int j = 0; j < ifo.numItems; j++) {
cout << " " << ifo.defs[j].itemName << endl;
}
}
// for (int i = 2; i <= data.nPolygons(); i++) {
// const E00::PAL &pal = data.getPAL(i);
// for (int j = 0; j < pal.numArcs; j++) {
// int arcNum = pal.arcs[j].arcNum;
// if (arcNum == 0) {
// cout << endl;
// } else if (arcNum < 0) {
// const E00::ARC &arc = data.getARC(0-arcNum);
// for (int k = arc.numberOfCoordinates - 1; k >= 0; k--) {
// cout << arc.coordinates[k].x << '\t'
// << arc.coordinates[k].y << endl;
// }
// } else {
// const E00::ARC &arc = data.getARC(arcNum);
// for (int k = 0; k < arc.numberOfCoordinates; k++) {
// cout << arc.coordinates[k].x << '\t'
// << arc.coordinates[k].y << endl;
// }
// }
// cout << endl;
// }
// }
2000-11-22 22:17:58 +00:00
}
return 0;
}
// end of teste00.cxx