summaryrefslogtreecommitdiff
path: root/src/mbgl/text/collision_tile.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-10-26 15:45:32 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-10-26 16:44:55 +0100
commit75dec6ffac6f3e79e5a173cd8a3f98d374ed1c09 (patch)
treedd3e2752cfe2c1ea741ac1b97d38e5e4bc4aa008 /src/mbgl/text/collision_tile.hpp
parentc0c554e36fd43bfe57ef13fe60f9cd50b5c018fd (diff)
downloadqtlocation-mapboxgl-75dec6ffac6f3e79e5a173cd8a3f98d374ed1c09.tar.gz
[core] always reparse with the freshest possible placement config
Fixes an issue where updates to stale tiles would remove labels altogether until the map was rotated.
Diffstat (limited to 'src/mbgl/text/collision_tile.hpp')
-rw-r--r--src/mbgl/text/collision_tile.hpp38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/mbgl/text/collision_tile.hpp b/src/mbgl/text/collision_tile.hpp
index 3fd1b0a4c8..edd5eb61a0 100644
--- a/src/mbgl/text/collision_tile.hpp
+++ b/src/mbgl/text/collision_tile.hpp
@@ -2,6 +2,7 @@
#define MBGL_TEXT_COLLISION_TILE
#include <mbgl/text/collision_feature.hpp>
+#include <mbgl/text/placement_config.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
@@ -24,39 +25,34 @@
namespace mbgl {
- namespace bg = boost::geometry;
- namespace bgm = bg::model;
- namespace bgi = bg::index;
- typedef bgm::point<float, 2, bg::cs::cartesian> CollisionPoint;
- typedef bgm::box<CollisionPoint> Box;
- typedef std::pair<Box, CollisionBox> CollisionTreeBox;
- typedef bgi::rtree<CollisionTreeBox, bgi::linear<16,4>> Tree;
+namespace bg = boost::geometry;
+namespace bgm = bg::model;
+namespace bgi = bg::index;
+typedef bgm::point<float, 2, bg::cs::cartesian> CollisionPoint;
+typedef bgm::box<CollisionPoint> Box;
+typedef std::pair<Box, CollisionBox> CollisionTreeBox;
+typedef bgi::rtree<CollisionTreeBox, bgi::linear<16, 4>> Tree;
class CollisionTile {
+public:
+ explicit CollisionTile(PlacementConfig);
- public:
- explicit CollisionTile(float angle_, float pitch_, bool debug_);
+ float placeFeature(const CollisionFeature& feature);
+ void insertFeature(CollisionFeature& feature, const float minPlacementScale);
- float placeFeature(const CollisionFeature &feature);
- void insertFeature(CollisionFeature &feature, const float minPlacementScale);
-
- bool getDebug() { return debug; }
-
- const float angle = 0;
+ const PlacementConfig config;
const float minScale = 0.5f;
const float maxScale = 2.0f;
float yStretch;
- private:
-
- Box getTreeBox(const vec2<float> &anchor, const CollisionBox &box);
+private:
+ Box getTreeBox(const vec2<float>& anchor, const CollisionBox& box);
Tree tree;
std::array<float, 4> rotationMatrix;
- bool debug;
-
};
-}
+
+} // namespace mbgl
#endif