summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-14 12:37:43 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-18 14:43:31 +0300
commitddecdeca9493ac1caaae2301eb822bdbf2f75ff9 (patch)
tree26cd99a5fac3f78f97b0b380c5523f9e022a4f72 /include/mbgl/util
parent092da9c956de9d623c6f22d073ebb7dcb2f5a23f (diff)
downloadqtlocation-mapboxgl-ddecdeca9493ac1caaae2301eb822bdbf2f75ff9.tar.gz
[core] Move ProjectedMeters to projection.hpp
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/geo.hpp28
-rw-r--r--include/mbgl/util/projection.hpp29
2 files changed, 28 insertions, 29 deletions
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp
index 5f5f8bb33b..6d725b102b 100644
--- a/include/mbgl/util/geo.hpp
+++ b/include/mbgl/util/geo.hpp
@@ -79,34 +79,6 @@ public:
}
};
-class ProjectedMeters {
-private:
- double _northing; // Distance measured northwards.
- double _easting; // Distance measured eastwards.
-
-public:
- ProjectedMeters(double n_ = 0, double e_ = 0)
- : _northing(n_), _easting(e_) {
- if (std::isnan(_northing)) {
- throw std::domain_error("northing must not be NaN");
- }
- if (std::isnan(_easting)) {
- throw std::domain_error("easting must not be NaN");
- }
- }
-
- double northing() const { return _northing; }
- double easting() const { return _easting; }
-
- friend bool operator==(const ProjectedMeters& a, const ProjectedMeters& b) {
- return a._northing == b._northing && a._easting == b._easting;
- }
-
- friend bool operator!=(const ProjectedMeters& a, const ProjectedMeters& b) {
- return !(a == b);
- }
-};
-
class LatLngBounds {
public:
// Return a bounds covering the entire (unwrapped) world.
diff --git a/include/mbgl/util/projection.hpp b/include/mbgl/util/projection.hpp
index ed34261b18..3cc1146513 100644
--- a/include/mbgl/util/projection.hpp
+++ b/include/mbgl/util/projection.hpp
@@ -5,9 +5,36 @@
#include <mbgl/util/geometry.hpp>
#include <mbgl/math/clamp.hpp>
-
namespace mbgl {
+class ProjectedMeters {
+private:
+ double _northing; // Distance measured northwards.
+ double _easting; // Distance measured eastwards.
+
+public:
+ ProjectedMeters(double n_ = 0, double e_ = 0)
+ : _northing(n_), _easting(e_) {
+ if (std::isnan(_northing)) {
+ throw std::domain_error("northing must not be NaN");
+ }
+ if (std::isnan(_easting)) {
+ throw std::domain_error("easting must not be NaN");
+ }
+ }
+
+ double northing() const { return _northing; }
+ double easting() const { return _easting; }
+
+ friend bool operator==(const ProjectedMeters& a, const ProjectedMeters& b) {
+ return a._northing == b._northing && a._easting == b._easting;
+ }
+
+ friend bool operator!=(const ProjectedMeters& a, const ProjectedMeters& b) {
+ return !(a == b);
+ }
+};
+
// Spherical Mercator projection
// http://docs.openlayers.org/library/spherical_mercator.html
class Projection {