static inline Quantum<casacore::Vector<double> > convert_angle( double x, const std::string &xunits, double y, const std::string &yunits,
#include <display/ds9/ds9context.h>
#include <display/region/RegionCreator.h>
#include <measures/Measures/MeasConvert.h>
#include <measures/Measures/MCDirection.h>
#include <display/region/Region.qo.h>
using namespace casacore;
double degToRad(double d) {
double r = M_PI * d / 180.;
while (r >= 2*M_PI) r -= 2*M_PI;
while (r < 0) r += 2*M_PI;
double radToDeg(double r) {
double d = 180. * r / M_PI;
while(d >= 360) d -= 360.;
double dmsToDegree(int sign, int degree, int min, double sec) {
return double(sign) * (abs(degree) + (min/60.) + (sec/60./60.));
double parseSEXStr(const char* d) {
int degree = atoi(strtok(ptr,":"));
int minute = atoi(strtok(NULL,":"));
float sec = atof(strtok(NULL,":"));
sign = degree>0 ? 1 : -1;
sign = d[0] == '-' ? -1 : 1;
return dmsToDegree(sign,abs(degree),minute,sec);
double parseHMSStr(const char* str) {
int hour = atoi(strtok(ptr,"h"));
int minute = atoi(strtok(NULL,"m"));
float second = atof(strtok(NULL,"s"));
sign = str[0] == '-' ? -1 : 1;
return dmsToDegree(sign,abs(hour),minute,second)/24.*360.;
double parseDMSStr(const char* str) {
int degree = atoi(strtok(ptr,"d"));
int minute = atoi(strtok(NULL,"m"));
float sec = atof(strtok(NULL,"s"));