2001-01-29 04:30:31 +00:00
|
|
|
// teste00.cxx - test the E00 parsing routines and dump some results.
|
2000-11-22 22:17:58 +00:00
|
|
|
|
2001-05-16 12:27:48 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
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 "
|
2001-01-29 04:30:31 +00:00
|
|
|
<< 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;
|
|
|
|
|
2001-01-29 04:30:31 +00:00
|
|
|
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;
|
|
|
|
}
|
2001-01-29 04:30:31 +00:00
|
|
|
|
|
|
|
// end of teste00.cxx
|