summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-03-12 15:27:20 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-03-14 11:36:10 +0100
commitd9589573bc9b437b55ee27f4746627a427aedb69 (patch)
treead94dfba2aa96c5306040ad91ca801865a64d6d4 /include
parentdf56f9fbcefa28295992c99096ebc82d3543194f (diff)
downloadqtlocation-mapboxgl-d9589573bc9b437b55ee27f4746627a427aedb69.tar.gz
extract label shaping
Diffstat (limited to 'include')
-rw-r--r--include/llmr/map/tile_data.hpp1
-rw-r--r--include/llmr/renderer/text_bucket.hpp12
-rw-r--r--include/llmr/style/bucket_description.hpp3
-rw-r--r--include/llmr/style/class_description.hpp1
-rw-r--r--include/llmr/style/properties.hpp8
-rw-r--r--include/llmr/style/style.hpp1
-rw-r--r--include/llmr/style/style_parser.hpp1
7 files changed, 25 insertions, 2 deletions
diff --git a/include/llmr/map/tile_data.hpp b/include/llmr/map/tile_data.hpp
index f9ad8b3a4e..1402cb0745 100644
--- a/include/llmr/map/tile_data.hpp
+++ b/include/llmr/map/tile_data.hpp
@@ -90,7 +90,6 @@ public:
std::shared_ptr<TriangleElementsBuffer> triangleElementsBuffer;
std::shared_ptr<LineElementsBuffer> lineElementsBuffer;
std::shared_ptr<PointElementsBuffer> pointElementsBuffer;
- std::shared_ptr<TextElementsBuffer> textElementsBuffer;
// Holds the buckets of this tile.
// They contain the location offsets in the buffers stored above
diff --git a/include/llmr/renderer/text_bucket.hpp b/include/llmr/renderer/text_bucket.hpp
index 60b0668a11..5a19ebeda7 100644
--- a/include/llmr/renderer/text_bucket.hpp
+++ b/include/llmr/renderer/text_bucket.hpp
@@ -6,6 +6,7 @@
#include <llmr/geometry/vao.hpp>
#include <llmr/geometry/elements_buffer.hpp>
#include <memory>
+#include <map>
#include <vector>
namespace llmr {
@@ -14,6 +15,9 @@ class Style;
class TextVertexBuffer;
class TriangleElementsBuffer;
class TextShader;
+class VectorTileFeature;
+class VectorTileFace;
+class VectorTilePlacement;
struct Coordinate;
struct pbf;
@@ -26,7 +30,13 @@ public:
virtual void render(Painter& painter, const std::string& layer_name, const Tile::ID& id);
- void addGeometry(pbf& data);
+ void addFeature(const VectorTileFeature& feature,
+ const std::vector<const VectorTileFace *>& faces,
+ const std::map<Value, std::vector<VectorTilePlacement>>& shaping);
+
+ void addLabel(const std::vector<Coordinate>& line,
+ const std::vector<const VectorTileFace *>& faces,
+ const std::vector<VectorTilePlacement>& placements);
bool empty() const;
diff --git a/include/llmr/style/bucket_description.hpp b/include/llmr/style/bucket_description.hpp
index c935d50613..0a750e113e 100644
--- a/include/llmr/style/bucket_description.hpp
+++ b/include/llmr/style/bucket_description.hpp
@@ -35,6 +35,7 @@ inline BucketType bucketType(const std::string& type) {
if (type == "fill") return BucketType::Fill;
else if (type == "line") return BucketType::Line;
else if (type == "point") return BucketType::Point;
+ else if (type == "text") return BucketType::Text;
else return BucketType::None;
}
@@ -58,6 +59,7 @@ public:
CapType cap = CapType::None;
JoinType join = JoinType::None;
std::string font;
+ std::string text_field;
float font_size = 0.0f;
float miter_limit = 2.0f;
float round_limit = 1.0f;
@@ -65,6 +67,7 @@ public:
class BucketDescription {
public:
+ BucketType feature_type = BucketType::None;
BucketType type = BucketType::None;
// Specify what data to pull into this bucket
diff --git a/include/llmr/style/class_description.hpp b/include/llmr/style/class_description.hpp
index efb46fd39b..e98aee0c56 100644
--- a/include/llmr/style/class_description.hpp
+++ b/include/llmr/style/class_description.hpp
@@ -14,6 +14,7 @@ public:
std::map<std::string, FillClass> fill;
std::map<std::string, LineClass> line;
std::map<std::string, PointClass> point;
+ std::map<std::string, TextClass> text;
};
diff --git a/include/llmr/style/properties.hpp b/include/llmr/style/properties.hpp
index de7b3404b7..f3bc1054cd 100644
--- a/include/llmr/style/properties.hpp
+++ b/include/llmr/style/properties.hpp
@@ -112,6 +112,14 @@ struct FillProperties {
std::string image;
};
+struct TextClass {
+ Color color = {{ 1, 1, 1, 1 }};
+};
+
+struct TextProperties {
+ Color color = {{ 1, 1, 1, 1 }};
+};
+
struct BackgroundClass {
Color color = {{ 1, 1, 1, 1 }};
};
diff --git a/include/llmr/style/style.hpp b/include/llmr/style/style.hpp
index 1b57521f85..2323228b03 100644
--- a/include/llmr/style/style.hpp
+++ b/include/llmr/style/style.hpp
@@ -56,6 +56,7 @@ public:
std::map<std::string, FillProperties> fills;
std::map<std::string, LineProperties> lines;
std::map<std::string, PointProperties> points;
+ std::map<std::string, TextProperties> texts;
} computed;
};
diff --git a/include/llmr/style/style_parser.hpp b/include/llmr/style/style_parser.hpp
index 3c53037aa1..93cd373b6c 100644
--- a/include/llmr/style/style_parser.hpp
+++ b/include/llmr/style/style_parser.hpp
@@ -23,6 +23,7 @@ private:
FillClass parseFillClass(JSVal value);
LineClass parseLineClass(JSVal value);
PointClass parsePointClass(JSVal value);
+ TextClass parseTextClass(JSVal value);
BackgroundClass parseBackgroundClass(JSVal value);
bool parseBoolean(JSVal value);