coordinateconversion.hh 765 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef RADIX_RADIXGEO_COORDINATECONVERSION_HH_
#define RADIX_RADIXGEO_COORDINATECONVERSION_HH_

#include "radixcore/visibility.hh"

#include <sstream>
#include <stdexcept>
namespace radix
{
class RADIX_PUBLIC CoordinateConversion
{
 public:
  static void validate(double latitude, double longitude)
  {
    if (latitude < -90.0 || latitude > 90.0 || longitude < -180.0 ||
        longitude >= 180.0)
    {
      std::ostringstream oss;
      oss << "Invalid coordinate [" << latitude << "," << longitude
          << "].\nLatitude must be [-90.,90.] and longitude must be "
             "[-180,180).";
      throw std::out_of_range(oss.str());
    }
  }

};  // class CoordinateConversion
}  // namespace radix
#endif /** RADIX_RADIXGEO_COORDINATECONVERSION_HH_ */