summaryrefslogtreecommitdiff
path: root/include/mbgl/map/transform_state.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-07-16 18:53:56 -0700
committerKonstantin Käfer <mail@kkaefer.com>2014-07-16 18:53:56 -0700
commit4ea281c750c5afcc68f2832bb42d98a1cbce6735 (patch)
tree60bc7d3ccba2c54859e2e023997cc027cc67aea7 /include/mbgl/map/transform_state.hpp
parentc1a64dc5fa73b54cc5de77629781dfc74302a1e7 (diff)
downloadqtlocation-mapboxgl-4ea281c750c5afcc68f2832bb42d98a1cbce6735.tar.gz
rename llmr => mbgl
Diffstat (limited to 'include/mbgl/map/transform_state.hpp')
-rw-r--r--include/mbgl/map/transform_state.hpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/include/mbgl/map/transform_state.hpp b/include/mbgl/map/transform_state.hpp
new file mode 100644
index 0000000000..85dd2eb87d
--- /dev/null
+++ b/include/mbgl/map/transform_state.hpp
@@ -0,0 +1,69 @@
+#ifndef MBGL_MAP_TRANSFORM_STATE
+#define MBGL_MAP_TRANSFORM_STATE
+
+#include <mbgl/util/mat4.hpp>
+#include <mbgl/map/tile.hpp>
+
+#include <cstdint>
+
+namespace mbgl {
+
+class Transform;
+
+class TransformState {
+ friend class Transform;
+
+public:
+ // Matrix
+ void matrixFor(mat4& matrix, const Tile::ID& id) const;
+ box cornersToBox(uint32_t z) const;
+
+ // Dimensions
+ bool hasSize() const;
+ uint16_t getWidth() const;
+ uint16_t getHeight() const;
+ uint16_t getFramebufferWidth() const;
+ uint16_t getFramebufferHeight() const;
+ const std::array<uint16_t, 2> getFramebufferDimensions() const;
+ float getPixelRatio() const;
+
+ // Zoom
+ float getNormalizedZoom() const;
+ int32_t getIntegerZoom() const;
+ double getZoom() const;
+ double getScale() const;
+
+ // Rotation
+ float getAngle() const;
+
+ // Changing
+ bool isChanging() const;
+
+private:
+ double pixel_x() const;
+ double pixel_y() const;
+
+private:
+ // logical dimensions
+ uint16_t width = 0, height = 0;
+
+ // physical (framebuffer) dimensions
+ std::array<uint16_t, 2> framebuffer = {{ 0, 0 }};
+
+ // map scale factor
+ float pixelRatio = 0;
+
+ // animation state
+ bool rotating = false;
+ bool scaling = false;
+ bool panning = false;
+
+ // map position
+ double x = 0, y = 0;
+ double angle = 0;
+ double scale = std::numeric_limits<double>::infinity();
+};
+
+}
+
+#endif