don't use certain STL functions
some functions defined in <cmath>, as well as std::to_string aren't available on GNU's STL for some platforms, e.g. Android
This commit is contained in:
@@ -33,16 +33,16 @@ public:
|
||||
|
||||
static inline double getMetersPerPixelAtLatitude(const double lat, const double zoom) {
|
||||
const double mapPixelWidthAtZoom = std::pow(2.0, zoom) * util::tileSize;
|
||||
const double constrainedLatitude = std::fmin(std::fmax(lat, -util::LATITUDE_MAX), util::LATITUDE_MAX);
|
||||
const double constrainedLatitude = ::fmin(::fmax(lat, -util::LATITUDE_MAX), util::LATITUDE_MAX);
|
||||
|
||||
return std::cos(constrainedLatitude * util::DEG2RAD) * util::M2PI * util::EARTH_RADIUS_M / mapPixelWidthAtZoom;
|
||||
}
|
||||
|
||||
static inline const ProjectedMeters projectedMetersForLatLng(const LatLng latLng) {
|
||||
const double constrainedLatitude = std::fmin(std::fmax(latLng.latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
|
||||
const double constrainedLatitude = ::fmin(::fmax(latLng.latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
|
||||
|
||||
const double m = 1 - 1e-15;
|
||||
const double f = std::fmin(std::fmax(std::sin(util::DEG2RAD * constrainedLatitude), -m), m);
|
||||
const double f = ::fmin(::fmax(std::sin(util::DEG2RAD * constrainedLatitude), -m), m);
|
||||
|
||||
const double easting = util::EARTH_RADIUS_M * latLng.longitude * util::DEG2RAD;
|
||||
const double northing = 0.5 * util::EARTH_RADIUS_M * std::log((1 + f) / (1 - f));
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
double latitude = (2 * std::atan(std::exp(projectedMeters.northing / util::EARTH_RADIUS_M)) - (M_PI / 2)) * util::RAD2DEG;
|
||||
double longitude = projectedMeters.easting * util::RAD2DEG / util::EARTH_RADIUS_M;
|
||||
|
||||
latitude = std::fmin(std::fmax(latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
|
||||
latitude = ::fmin(::fmax(latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
|
||||
|
||||
return LatLng(latitude, longitude);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user