summaryrefslogtreecommitdiff
path: root/src/positioning
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2019-01-30 20:59:59 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2019-03-11 12:10:54 +0000
commita52dae6a79c1c19ee2391037cfdc6d557381bb88 (patch)
tree0308df23ee4097132a8dc34a05ea326bb9adda58 /src/positioning
parentb1f6028c2aba51b898ce380f7b584ae603a06382 (diff)
downloadqtlocation-a52dae6a79c1c19ee2391037cfdc6d557381bb88.tar.gz
Introduce Qt.labs.location QtLocationLabs singleton type
This singleton is meant to offer tech-preview map-related API. It starts with a mapObjectsAt invokable, that can be used to probe MapObjects at a specific coordinate of a map. Reference implementation for Q*ObjectQSG, based on QGeoShape::contains, included. Change-Id: Ief692eb5a43115ca02d4642c82023d1b2e217400 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/positioning')
-rw-r--r--src/positioning/qlocationutils_p.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/positioning/qlocationutils_p.h b/src/positioning/qlocationutils_p.h
index d9e6524a..e3881f6f 100644
--- a/src/positioning/qlocationutils_p.h
+++ b/src/positioning/qlocationutils_p.h
@@ -229,7 +229,7 @@ public:
return 6371007.2;
}
- inline static double earthMeanDiameter()
+ inline static double earthMeanCircumference()
{
return earthMeanRadius() * 2.0 * M_PI;
}
@@ -256,6 +256,12 @@ public:
return wrapLong(centerLongitude - leftOffset);
}
+ static qreal metersPerPixel(qreal zoomLevel, const QGeoCoordinate &coordinate)
+ {
+ const qreal metersPerTile = earthMeanCircumference() * std::cos(radians(coordinate.latitude())) / std::pow(2, zoomLevel);
+ return metersPerTile / 256.0;
+ }
+
/*
returns the NMEA sentence type.
*/