/* * constructor: make an SAOWCS object from the FITS header string * and the length of the header string. */ SAOWCS::SAOWCS(const char* header, int headerLength) : WCSRep(), wcs_(NULL), equinox_(0.0), ra_(0.0), dec_(0.0), width_(0.0), height_(0.0), xSecPix_(0.0), ySecPix_(0.0) { equinoxStr_[0] = '\0'; if (header && headerLength) { // The wcssubs/hget routines depend on a static variable being set by hlength()... // (The header string is probably not null terminated, since mmap'ed) hlength((char*)header, headerLength); wcs_ = wcsninit(header, headerLength); if (isWcs()) { // get image center and dimensions wcsfull(wcs_, &ra_, &dec_, &width_, &height_); xSecPix_ = width_*3600./pixWidth(); ySecPix_ = height_*3600./pixHeight(); // set the equinox value and string setEquinox(); } } }
/* init the wcs struct and create a new info record */ int initwcs(char *s, int n){ struct WorldCoor *wcs; if( n > 0 ){ wcs = wcsninit(s, n); } else { wcs = wcsinit(s); } if( wcs ){ wcsoutinit(wcs, getradecsys(wcs)); } return newinfo(wcs); }