diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2015-08-18 08:47:08 -0400 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2015-08-24 18:41:51 -0400 |
commit | 14dee43a713d7155073630687a5ba6975d70f62b (patch) | |
tree | 61985ba9ac0751ed745f2e488d384175bcd4ec86 | |
parent | 9e68e49c896ff857c0c0bcf5281a74ab3b12cd13 (diff) | |
download | qtlocation-mapboxgl-14dee43a713d7155073630687a5ba6975d70f62b.tar.gz |
add map.setPitch(pitch) and map.getPitch()
-rw-r--r-- | include/mbgl/map/map.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/map/map.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/map/transform.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/map/transform.hpp | 4 |
4 files changed, 29 insertions, 0 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index ebd79620d6..bd8847d420 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -123,6 +123,10 @@ public: double getBearing() const; void resetNorth(); + // Pitch + void setPitch(double pitch); + double getPitch() const; + // Size uint16_t getWidth() const; uint16_t getHeight() const; diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 9bfb048419..e70972a13f 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -269,6 +269,18 @@ void Map::resetNorth() { } +#pragma mark - Pitch + +void Map::setPitch(double pitch) { + transform->setPitch(std::min(pitch, 60.0) * M_PI / 180); + update(Update::Repaint); +} + +double Map::getPitch() const { + return transform->getPitch() / M_PI * 180; +} + + #pragma mark - Projection void Map::getWorldBoundsMeters(ProjectedMeters& sw, ProjectedMeters& ne) const { diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index ea8775dbcb..7ccc2ad4cc 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -347,6 +347,15 @@ double Transform::getAngle() const { return state.angle; } +#pragma mark - Pitch + +void Transform::setPitch(double pitch) { + state.pitch = pitch; +} + +double Transform::getPitch() const { + return state.pitch; +} #pragma mark - Transition diff --git a/src/mbgl/map/transform.hpp b/src/mbgl/map/transform.hpp index 57dc8c4534..5d5a72d6d3 100644 --- a/src/mbgl/map/transform.hpp +++ b/src/mbgl/map/transform.hpp @@ -41,6 +41,10 @@ public: void setAngle(double angle, double cx, double cy); double getAngle() const; + // Pitch + void setPitch(double pitch); + double getPitch() const; + // Transitions Update updateTransitions(const TimePoint& now); void cancelTransitions(); |