summaryrefslogtreecommitdiff
path: root/platform/node
diff options
context:
space:
mode:
authorSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-06 14:30:23 +0200
committerSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-08 17:36:40 +0200
commit744d92e7636ffcba7aea7a302315326b1098d8dc (patch)
tree11df789f9b6dc0913b3d95f1debbfd87c9225a6a /platform/node
parentc6598fc5da063f9b60204639cd619647cbbc89da (diff)
downloadqtlocation-mapboxgl-744d92e7636ffcba7aea7a302315326b1098d8dc.tar.gz
[core] consolidate Axonometric rendering API
Instead of having individual APIs for setting axonometric and skew options, create ProjectionMode struct that holds all the relevant options for Axonometric rendering and introduce setter/getter on the Map for those options.
Diffstat (limited to 'platform/node')
-rw-r--r--platform/node/src/node_map.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 068fc57a5c..533399a47c 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -3,6 +3,7 @@
#include "node_feature.hpp"
#include "node_conversion.hpp"
+#include <mbgl/map/projection_mode.hpp>
#include <mbgl/util/exception.hpp>
#include <mbgl/renderer/renderer.hpp>
#include <mbgl/gl/headless_frontend.hpp>
@@ -446,17 +447,12 @@ void NodeMap::startRender(NodeMap::RenderOptions options) {
camera.bearing = options.bearing;
camera.pitch = options.pitch;
- if (map->getAxonometric() != options.axonometric) {
- map->setAxonometric(options.axonometric);
- }
-
- if (map->getXSkew() != options.xSkew) {
- map->setXSkew(options.xSkew);
- }
+ auto projectionOptions = mbgl::ProjectionMode()
+ .withAxonometric(options.axonometric)
+ .withXSkew(options.xSkew)
+ .withYSkew(options.ySkew);
- if (map->getYSkew() != options.ySkew) {
- map->setYSkew(options.ySkew);
- }
+ map->setProjectionMode(projectionOptions);
map->renderStill(camera, options.debugOptions, [this](const std::exception_ptr eptr) {
if (eptr) {
@@ -1035,7 +1031,8 @@ void NodeMap::SetAxonometric(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}
try {
- nodeMap->map->setAxonometric(info[0]->BooleanValue());
+ nodeMap->map->setProjectionMode(mbgl::ProjectionMode()
+ .withAxonometric(info[0]->BooleanValue()));
} catch (const std::exception &ex) {
return Nan::ThrowError(ex.what());
}
@@ -1052,7 +1049,8 @@ void NodeMap::SetXSkew(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}
try {
- nodeMap->map->setXSkew(info[0]->NumberValue());
+ nodeMap->map->setProjectionMode(mbgl::ProjectionMode()
+ .withXSkew(info[0]->NumberValue()));
} catch (const std::exception &ex) {
return Nan::ThrowError(ex.what());
}
@@ -1069,7 +1067,8 @@ void NodeMap::SetYSkew(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}
try {
- nodeMap->map->setYSkew(info[0]->NumberValue());
+ nodeMap->map->setProjectionMode(mbgl::ProjectionMode()
+ .withYSkew(info[0]->NumberValue()));
} catch (const std::exception &ex) {
return Nan::ThrowError(ex.what());
}