summaryrefslogtreecommitdiff
path: root/platform/default
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-13 20:42:48 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-14 12:22:22 +0200
commitdb2e1b2e5fccd74ef8344ff70f04ea4e00b48d6b (patch)
tree38931822dff2458b420a3797c361ff6a8e6011c7 /platform/default
parentd44be9a91bbb9d241eff72aa90beb4b12976c47f (diff)
downloadqtlocation-mapboxgl-db2e1b2e5fccd74ef8344ff70f04ea4e00b48d6b.tar.gz
[core] Add RendererState::{pixelForLatLng,latLngForPixel}
Diffstat (limited to 'platform/default')
-rw-r--r--platform/default/mbgl/gl/headless_frontend.cpp15
-rw-r--r--platform/default/mbgl/gl/headless_frontend.hpp3
2 files changed, 18 insertions, 0 deletions
diff --git a/platform/default/mbgl/gl/headless_frontend.cpp b/platform/default/mbgl/gl/headless_frontend.cpp
index 30def38f71..37b0f91f32 100644
--- a/platform/default/mbgl/gl/headless_frontend.cpp
+++ b/platform/default/mbgl/gl/headless_frontend.cpp
@@ -87,6 +87,21 @@ bool HeadlessFrontend::hasSource(const std::string& id) {
return false;
}
+ScreenCoordinate HeadlessFrontend::pixelForLatLng(const LatLng& coordinate) {
+ if (updateParameters) {
+ return RendererState::pixelForLatLng(*updateParameters, coordinate);
+ }
+
+ return ScreenCoordinate {};
+}
+
+LatLng HeadlessFrontend::latLngForPixel(const ScreenCoordinate& point) {
+ if (updateParameters) {
+ return RendererState::latLngForPixel(*updateParameters, point);
+ }
+
+ return LatLng {};
+}
void HeadlessFrontend::setSize(Size size_) {
if (size != size_) {
diff --git a/platform/default/mbgl/gl/headless_frontend.hpp b/platform/default/mbgl/gl/headless_frontend.hpp
index 45586033b0..18f0cfa537 100644
--- a/platform/default/mbgl/gl/headless_frontend.hpp
+++ b/platform/default/mbgl/gl/headless_frontend.hpp
@@ -39,6 +39,9 @@ public:
bool hasLayer(const std::string&);
bool hasSource(const std::string&);
+ ScreenCoordinate pixelForLatLng(const LatLng&);
+ LatLng latLngForPixel(const ScreenCoordinate&);
+
PremultipliedImage readStillImage();
PremultipliedImage render(Map&);