diff --git a/data-access/engine/src/common/include/ast4vl.hpp b/data-access/engine/src/common/include/ast4vl.hpp index 95d714e3d9089127c2edc0fec2fccf5d0307656d..9961cb59def444b9c377061507b99dcab7084db2 100644 --- a/data-access/engine/src/common/include/ast4vl.hpp +++ b/data-access/engine/src/common/include/ast4vl.hpp @@ -56,5 +56,8 @@ std::vector<Bounds> calc_bounds(std::string header, std::string skysys_str, std: std::vector<uint_bounds> calc_overlap(const std::string header, const coordinates coord, int& ov_code); +int header_modif_coordsys(const std::string& skysys_str, const std::string& specsys_str, + const std::string& pathname); + #endif diff --git a/data-access/engine/src/common/src/ast4vl.cpp b/data-access/engine/src/common/src/ast4vl.cpp index c43683500b180186b555288f6329e96fa3bfdf92..51583361f97070ebbd096e47bb7b55568267081f 100644 --- a/data-access/engine/src/common/src/ast4vl.cpp +++ b/data-access/engine/src/common/src/ast4vl.cpp @@ -6,6 +6,8 @@ #include "math.h" // round() needed #include "cutout_ostream.hpp" // coordinates needed +#include "fitsfiles.hpp" // header_modif_coordsys needs this + #include <ostream> //#include <vector> @@ -170,3 +172,42 @@ std::vector<uint_bounds> calc_overlap(const std::string header, const coordinate } + + + + +void write_previous2(string header, string filename) +{ + std::ofstream out(filename); + out << header; +} + +int header_modif_coordsys(const string& skysys_str, const string& specsys_str, const string& pathname) +{ + LOG_trace(__func__); + + int maxHdu = 1;//FIXME INT_MAX; // read all HDU's + + std::vector<fitsfiles::Hdu> allHdus = + fitsfiles::fname2hdrstr(pathname, maxHdu); + + for(unsigned int i=0; i<allHdus.size(); i++) + { + cerr << "HDU#" << i << endl; + + fitsfiles::Hdu hd = allHdus.at(i); + + write_previous2(hd.m_header, "backup.fitshdu"+ to_string(i) +"header.orig"); + ast::frameset frm_set(hd.m_header); + frm_set.set_skysystem(skysys_str); + if(frm_set.has_specframe()) + frm_set.set_specsystem(specsys_str); + + //frm_set.write(cout, hd.m_header); + frm_set.write2(pathname, i+1); + } + + return 0; +} + + diff --git a/data-access/engine/src/common/include/ast_frameset.hpp b/data-access/engine/src/common/src/ast_frameset.hpp similarity index 100% rename from data-access/engine/src/common/include/ast_frameset.hpp rename to data-access/engine/src/common/src/ast_frameset.hpp diff --git a/data-access/engine/src/common/include/fits_header.hpp b/data-access/engine/src/common/src/fits_header.hpp similarity index 100% rename from data-access/engine/src/common/include/fits_header.hpp rename to data-access/engine/src/common/src/fits_header.hpp diff --git a/data-access/engine/src/vlkb/src/ast.cpp b/data-access/engine/src/vlkb/src/ast.cpp index 578a35101ebc1970c7876eb3b7b827c9cb073b22..562afb25d2ebce068ebcec6db8e9cf1ab4c7d690 100644 --- a/data-access/engine/src/vlkb/src/ast.cpp +++ b/data-access/engine/src/vlkb/src/ast.cpp @@ -11,9 +11,6 @@ #include "io.hpp" #include "my_assert.hpp" -#include "ast_frameset.hpp" // FIXME temporarily was moved common/src -> common/include - - #include <iostream> #include <climits> // INT_MAX needed #include <sstream> @@ -130,35 +127,6 @@ int header_backup(const string& pathname, bool backup) } -int header_modif_coordsys(const string& skysys_str, const string& specsys_str, const string& pathname) -{ - LOG_trace(__func__); - - int maxHdu = 1;//FIXME INT_MAX; // read all HDU's - - std::vector<fitsfiles::Hdu> allHdus = - fitsfiles::fname2hdrstr(pathname, maxHdu); - - for(unsigned int i=0; i<allHdus.size(); i++) - { - cerr << "HDU#" << i << endl; - - fitsfiles::Hdu hd = allHdus.at(i); - - write_previous(hd.m_header, "backup.fitshdu"+ to_string(i) +"header.orig"); - ast::frameset frm_set(hd.m_header); - frm_set.set_skysystem(skysys_str); - if(frm_set.has_specframe()) - frm_set.set_specsystem(specsys_str); - - //frm_set.write(cout, hd.m_header); - frm_set.write2(pathname, i+1); - } - - return 0; -} - - //--------------------------------------------------------------------- diff --git a/data-access/engine/src/vlkb/src/ast.hpp b/data-access/engine/src/vlkb/src/ast.hpp index c6f417bccc403370353613f2818c428bfc270c90..1ac379a3fac49e03b8214661fd235bbf8f16b738 100644 --- a/data-access/engine/src/vlkb/src/ast.hpp +++ b/data-access/engine/src/vlkb/src/ast.hpp @@ -9,7 +9,6 @@ int vlkb_skyvertices(const std::string& pathname, const std::string& skysys_str); int vlkb_listbounds(const std::string& skysys_str, const std::string& specsys_str, const std::string& pathname); int header_backup(const std::string& pathname, bool backup = false); -int header_modif_coordsys(const std::string& skysys_str, const std::string& specsys_str, const std::string& pathname); int vlkb_overlap(const std::string& pathname, const std::string& region, std::vector<uint_bounds>& bnds); #endif