diff options
author | Sean Harmer <sean.harmer.qnx@kdab.com> | 2012-08-27 19:53:50 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-28 05:09:43 +0200 |
commit | dac48f0417f818ef4e1ef8ba81be64def5154067 (patch) | |
tree | daa1acd7c67b7d4c3716f53b49939f12db6ca431 /src | |
parent | 64a5278704db4103018c73901c2f949c9df3afac (diff) | |
download | qtlocation-dac48f0417f818ef4e1ef8ba81be64def5154067.tar.gz |
Fix compilation on QNX
including <cmath> declares the standard maths functions in the std
namespace not the global namespace.
Change-Id: I293cba5ed166b4f122bb34bca5c1d508e2dda259
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/poly2tri/common/shapes.h | 2 | ||||
-rw-r--r-- | src/3rdparty/poly2tri/sweep/sweep.cpp | 1 | ||||
-rw-r--r-- | src/imports/location/qdeclarativegeomapquickitem.cpp | 2 | ||||
-rw-r--r-- | src/location/maps/qgeocameratiles.cpp | 10 | ||||
-rw-r--r-- | src/location/maps/qgeomapscene.cpp | 4 | ||||
-rw-r--r-- | src/location/maps/qgeoprojection.cpp | 4 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmapdata.cpp | 4 |
7 files changed, 14 insertions, 13 deletions
diff --git a/src/3rdparty/poly2tri/common/shapes.h b/src/3rdparty/poly2tri/common/shapes.h index 6d3f48cd..f147955a 100644 --- a/src/3rdparty/poly2tri/common/shapes.h +++ b/src/3rdparty/poly2tri/common/shapes.h @@ -105,7 +105,7 @@ struct Point { /// Get the length of this point (the norm). float Length() const { - return sqrt(x * x + y * y); + return std::sqrt(x * x + y * y); } /// Convert this point into a unit point. Returns the Length. diff --git a/src/3rdparty/poly2tri/sweep/sweep.cpp b/src/3rdparty/poly2tri/sweep/sweep.cpp index dd36d706..4df63038 100644 --- a/src/3rdparty/poly2tri/sweep/sweep.cpp +++ b/src/3rdparty/poly2tri/sweep/sweep.cpp @@ -28,6 +28,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <stddef.h> #include <stdexcept> #include "sweep.h" #include "sweep_context.h" diff --git a/src/imports/location/qdeclarativegeomapquickitem.cpp b/src/imports/location/qdeclarativegeomapquickitem.cpp index 51a379c4..e5b97bc2 100644 --- a/src/imports/location/qdeclarativegeomapquickitem.cpp +++ b/src/imports/location/qdeclarativegeomapquickitem.cpp @@ -386,7 +386,7 @@ qreal QDeclarativeGeoMapQuickItem::scaleFactor() qreal scale = 1.0; // use 1+x to avoid fuzzy compare against zero if (!qFuzzyCompare(1.0 + zoomLevel_, 1.0)) - scale = pow(0.5, zoomLevel_ - map()->cameraData().zoomLevel()); + scale = std::pow(0.5, zoomLevel_ - map()->cameraData().zoomLevel()); return scale; } diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp index 6ee6593f..8ec71932 100644 --- a/src/location/maps/qgeocameratiles.cpp +++ b/src/location/maps/qgeocameratiles.cpp @@ -145,7 +145,7 @@ void QGeoCameraTiles::findPrefetchTiles() d->tiles_.clear(); // qDebug() << "prefetch called"; - int zoom = static_cast<int>(floor(d->camera_.zoomLevel())); + int zoom = static_cast<int>(std::floor(d->camera_.zoomLevel())); d->intZoomLevel_ = zoom; d->sideLength_ = 1 << d->intZoomLevel_; d->updateGeometry(PREFETCH_FRUSTUM_SCALE); @@ -205,7 +205,7 @@ void QGeoCameraTiles::setCamera(const QGeoCameraData &camera) return; d->camera_ = camera; - d->intZoomLevel_ = static_cast<int>(floor(d->camera_.zoomLevel())); + d->intZoomLevel_ = static_cast<int>(std::floor(d->camera_.zoomLevel())); d->sideLength_ = 1 << d->intZoomLevel_; d->tiles_.clear(); @@ -337,7 +337,7 @@ Frustum QGeoCameraTilesPrivate::frustum(double fieldOfViewGradient) const double f = qMin(screenSize_.width(), screenSize_.height()) / (1.0 * tileSize_); - double z = pow(2.0, camera_.zoomLevel() - intZoomLevel_); + double z = std::pow(2.0, camera_.zoomLevel() - intZoomLevel_); double altitude = f / (2.0 * z); QDoubleVector3D eye = center; @@ -772,7 +772,7 @@ QSet<QGeoTileSpec> QGeoCameraTilesPrivate::tilesFromPolygon(const Polygon &polyg double x2 = polygon.at(i2).get(0); bool xFixed = qFuzzyCompare(x1, x2); - bool xIntegral = qFuzzyCompare(x1, floor(x1)) || qFuzzyCompare(x1 + 1.0, floor(x1 + 1.0)); + bool xIntegral = qFuzzyCompare(x1, std::floor(x1)) || qFuzzyCompare(x1 + 1.0, std::floor(x1 + 1.0)); QList<QPair<double, int> > xIntersects = tileIntersections(x1, @@ -784,7 +784,7 @@ QSet<QGeoTileSpec> QGeoCameraTilesPrivate::tilesFromPolygon(const Polygon &polyg double y2 = polygon.at(i2).get(1); bool yFixed = qFuzzyCompare(y1, y2); - bool yIntegral = qFuzzyCompare(y1, floor(y1)) || qFuzzyCompare(y1 + 1.0, floor(y1 + 1.0)); + bool yIntegral = qFuzzyCompare(y1, std::floor(y1)) || qFuzzyCompare(y1 + 1.0, std::floor(y1 + 1.0)); QList<QPair<double, int> > yIntersects = tileIntersections(y1, diff --git a/src/location/maps/qgeomapscene.cpp b/src/location/maps/qgeomapscene.cpp index bd56df09..0c3772c4 100644 --- a/src/location/maps/qgeomapscene.cpp +++ b/src/location/maps/qgeomapscene.cpp @@ -174,7 +174,7 @@ void QGeoMapScene::setCameraData(const QGeoCameraData &cameraData) { Q_D(QGeoMapScene); d->cameraData_ = cameraData; - d->intZoomLevel_ = static_cast<int>(floor(d->cameraData_.zoomLevel())); + d->intZoomLevel_ = static_cast<int>(std::floor(d->cameraData_.zoomLevel())); float delta = cameraData.zoomLevel() - d->intZoomLevel_; if (qAbs(delta) < 0.05) { d->linearScaling_ = false; @@ -619,7 +619,7 @@ void QGeoMapScenePrivate::setupCamera() double f = 1.0 * qMin(screenSize_.width(), screenSize_.height()); // fraction of zoom level - double z = pow(2.0, cameraData_.zoomLevel() - intZoomLevel_); + double z = std::pow(2.0, cameraData_.zoomLevel() - intZoomLevel_); // calculate altitdue that allows the visible map tiles // to fit in the screen correctly (note that a larger f will cause diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp index 66e15bbb..cae10500 100644 --- a/src/location/maps/qgeoprojection.cpp +++ b/src/location/maps/qgeoprojection.cpp @@ -59,7 +59,7 @@ QDoubleVector2D QGeoProjection::coordToMercator(const QGeoCoordinate &coord) double lon = coord.longitude() / 360.0 + 0.5; double lat = coord.latitude(); - lat = 0.5 - (log(tan((pi / 4.0) + (pi / 2.0) * lat / 180.0)) / pi) / 2.0; + lat = 0.5 - (std::log(std::tan((pi / 4.0) + (pi / 2.0) * lat / 180.0)) / pi) / 2.0; lat = qMax(0.0, lat); lat = qMin(1.0, lat); @@ -91,7 +91,7 @@ QGeoCoordinate QGeoProjection::mercatorToCoord(const QDoubleVector2D &mercator) else if (fy == 1.0) lat = -90.0; else - lat = (180.0 / pi) * (2.0 * atan(exp(pi * (1.0 - 2.0 * fy))) - (pi / 2.0)); + lat = (180.0 / pi) * (2.0 * std::atan(std::exp(pi * (1.0 - 2.0 * fy))) - (pi / 2.0)); double lng; if (fx >= 0) { diff --git a/src/location/maps/qgeotiledmapdata.cpp b/src/location/maps/qgeotiledmapdata.cpp index 11fced11..4be67d16 100644 --- a/src/location/maps/qgeotiledmapdata.cpp +++ b/src/location/maps/qgeotiledmapdata.cpp @@ -236,7 +236,7 @@ QGeoTiledMapDataPrivate::QGeoTiledMapDataPrivate(QGeoTiledMapData *parent, QGeoT mapScene_(new QGeoMapScene()), tileRequests_(new QGeoTileRequestManager(parent)) { - cameraTiles_->setMaximumZoomLevel(static_cast<int>(ceil(engine->cameraCapabilities().maximumZoomLevel()))); + cameraTiles_->setMaximumZoomLevel(static_cast<int>(std::ceil(engine->cameraCapabilities().maximumZoomLevel()))); cameraTiles_->setTileSize(engine->tileSize().width()); cameraTiles_->setPluginString(map_->pluginString()); @@ -292,7 +292,7 @@ void QGeoTiledMapDataPrivate::changeCameraData(const QGeoCameraData &oldCameraDa // This is so that when we turn off bilinear scaling, we're // snapped to the exact pixel size of the tiles QGeoCameraData cam = map_->cameraData(); - int izl = static_cast<int>(floor(cam.zoomLevel())); + int izl = static_cast<int>(std::floor(cam.zoomLevel())); float delta = cam.zoomLevel() - izl; if (delta > 0.5) { izl++; |