35 #include "boost/algorithm/string.hpp" 36 #include "boost/format.hpp" 65 Dms(
int const d,
int const m,
double const s,
bool const isSouth =
false) {
66 sign = (d < 0 || isSouth) ? -1 : 1;
73 double deg0 = deg00.asAngularUnits(unit);
75 sign = (deg0 >= 0) ? 1 : -1;
78 sec = ((absVal -
deg) * 60.0 -
min) * 60.0;
95 if ((60.00 - dms.sec) < 0.005) {
101 if (dms.deg == 360) {
108 std::string s = (boost::format(fmt) % dms.deg % dms.min % dms.sec).str();
127 if (dms.
find(
":") == std::string::npos) {
129 (boost::format(
"String is not in xx:mm:ss format: %s") % dms).str());
132 boost::split(elements, dms, boost::is_any_of(
":"));
133 if (elements.
size() != 3) {
135 (boost::format(
"Could not parse string as xx:mm:ss format: %s") % dms).str());
137 int const deg = abs(atoi(elements[0].c_str()));
138 int const min = atoi(elements[1].c_str());
139 double const sec = atof(elements[2].c_str());
141 geom::Angle ang = (deg + min / 60.0 + sec / 3600.0) * unit;
142 if ((elements[0].c_str())[0] ==
'-') {
lsst::afw::geom::Angle Angle
lsst::afw::geom::Angle dmsStringToAngle(std::string const dms)
Convert a dd:mm:ss string to Angle.
AngleUnit constexpr degrees
constant with units of degrees
A class used to convert scalar POD types such as double to Angle.
A class representing an angle.
A base class for image defects.
std::string angleToDmsString(lsst::afw::geom::Angle const deg)
Convert an angle to a string with form dd:mm:ss.
AngleUnit constexpr hours
constant with units of hours
std::string angleToHmsString(lsst::afw::geom::Angle const deg)
a function to convert decimal degrees to a string with form hh:mm:ss.s
#define LSST_EXCEPT(type,...)
lsst::afw::geom::Angle hmsStringToAngle(std::string const hms)
Convert a hh:mm:ss string to Angle.