diff --git a/gpxsee.pro b/gpxsee.pro index b25edcca..168c3c79 100644 --- a/gpxsee.pro +++ b/gpxsee.pro @@ -69,7 +69,7 @@ HEADERS += src/config.h \ src/map/projection.h \ src/map/ellipsoid.h \ src/map/datum.h \ - src/map/mercator.h \ + src/map/webmercator.h \ src/map/transversemercator.h \ src/map/latlon.h \ src/map/utm.h \ @@ -185,7 +185,7 @@ SOURCES += src/main.cpp \ src/map/matrix.cpp \ src/map/ellipsoid.cpp \ src/map/datum.cpp \ - src/map/mercator.cpp \ + src/map/webmercator.cpp \ src/map/transversemercator.cpp \ src/map/utm.cpp \ src/map/lambertconic.cpp \ diff --git a/src/map/mercator.h b/src/map/mercator.h deleted file mode 100644 index 7661d4bf..00000000 --- a/src/map/mercator.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MERCATOR_H -#define MERCATOR_H - -#include "ct.h" - -class Mercator : public CT -{ -public: - virtual CT *clone() const {return new Mercator(*this);} - - virtual PointD ll2xy(const Coordinates &c) const; - virtual Coordinates xy2ll(const PointD &p) const; -}; - -#endif // MERCATOR_H diff --git a/src/map/projection.cpp b/src/map/projection.cpp index 6bacee8b..c60b58f9 100644 --- a/src/map/projection.cpp +++ b/src/map/projection.cpp @@ -1,5 +1,5 @@ #include "datum.h" -#include "mercator.h" +#include "webmercator.h" #include "transversemercator.h" #include "lambertconic.h" #include "albersequal.h" @@ -37,7 +37,7 @@ Projection::Projection(const PCS *pcs) : _gcs(pcs->gcs()), _units(pcs->units()), switch (pcs->method().id()) { case 1024: case 9841: - _ct = new Mercator(); + _ct = new WebMercator(); break; case 9801: case 9815: // Oblique mercator aproximation using LCC1 diff --git a/src/map/mercator.cpp b/src/map/webmercator.cpp similarity index 69% rename from src/map/mercator.cpp rename to src/map/webmercator.cpp index 9adef775..b06139ca 100644 --- a/src/map/mercator.cpp +++ b/src/map/webmercator.cpp @@ -1,15 +1,15 @@ #include #include "common/coordinates.h" #include "common/wgs84.h" -#include "mercator.h" +#include "webmercator.h" -PointD Mercator::ll2xy(const Coordinates &c) const +PointD WebMercator::ll2xy(const Coordinates &c) const { return PointD(deg2rad(c.lon()) * WGS84_RADIUS, log(tan(M_PI/4.0 + deg2rad(c.lat())/2.0)) * WGS84_RADIUS); } -Coordinates Mercator::xy2ll(const PointD &p) const +Coordinates WebMercator::xy2ll(const PointD &p) const { return Coordinates(rad2deg(p.x() / WGS84_RADIUS), rad2deg(2 * atan(exp(p.y() / WGS84_RADIUS)) - M_PI/2)); diff --git a/src/map/webmercator.h b/src/map/webmercator.h new file mode 100644 index 00000000..3231bc77 --- /dev/null +++ b/src/map/webmercator.h @@ -0,0 +1,15 @@ +#ifndef WEBMERCATOR_H +#define WEBMERCATOR_H + +#include "ct.h" + +class WebMercator : public CT +{ +public: + virtual CT *clone() const {return new WebMercator(*this);} + + virtual PointD ll2xy(const Coordinates &c) const; + virtual Coordinates xy2ll(const PointD &p) const; +}; + +#endif // WEBMERCATOR_H