#include #include #include #include #include "JDetector/JTripod.hh" #include "JDetector/JDetector.hh" #include "JDetector/JDetectorToolkit.hh" #include "JSupport/JMeta.hh" #include "Jeep/JContainer.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * Auxiliary application to apply tilt angles to seabed. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; typedef JContainer< vector > tripods_container; string detectorFile; string tripodsFile; double Tx; double Ty; int debug; try { JParser<> zap("Auxiliary application to apply tilt angles to seabed."); zap['a'] = make_field(detectorFile, "detector file."); zap['T'] = make_field(tripodsFile, "tripods file."); zap['x'] = make_field(Tx, "tilt angle x-z [rad]"); zap['y'] = make_field(Ty, "tilt angle y-z [rad]"); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } tripods_container tripods; try { tripods.load(tripodsFile.c_str()); } catch(const exception& error) { FATAL(error.what() << endl); } JDetector detector; try { load(detectorFile, detector); } catch(const exception& error) { FATAL(error.what() << endl); } JUTMPosition pos = detector.getUTMPosition(); if (!tripods.empty()) { pos = JUTMPosition(0.0, 0.0, 0.0); for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) { pos += i->getUTMPosition(); } pos /= tripods.size(); } detector.comment.add(JMeta(argc, argv)); for (JDetector::iterator i = detector.begin(); i != detector.end(); ++i) { const double dz = Tx * (i->getX() + detector.getX() - pos.getX()) + Ty * (i->getY() + detector.getY() - pos.getY()); *i += JPosition3D(0.0, 0.0, dz); } store(detectorFile, detector); tripods.comment.add(JMeta(argc, argv)); for (tripods_container::iterator i = tripods.begin(); i != tripods.end(); ++i) { const double dz = Tx * (i->getX() - pos.getX()) + Ty * (i->getY() - pos.getY()); *i += JUTMPosition(0.0, 0.0, dz); } tripods.store(tripodsFile.c_str()); return 0; }