summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llmr/geometry/glyph_atlas.hpp2
-rw-r--r--include/llmr/map/tile_parser.hpp1
-rw-r--r--include/llmr/map/vector_tile.hpp30
-rw-r--r--include/llmr/text/glyph.hpp2
-rw-r--r--proto/vector_tile.proto44
-rw-r--r--src/map/vector_tile.cpp119
6 files changed, 0 insertions, 198 deletions
diff --git a/include/llmr/geometry/glyph_atlas.hpp b/include/llmr/geometry/glyph_atlas.hpp
index 5bcd573f56..0aada6a733 100644
--- a/include/llmr/geometry/glyph_atlas.hpp
+++ b/include/llmr/geometry/glyph_atlas.hpp
@@ -12,8 +12,6 @@
namespace llmr {
-class VectorTileGlyph;
-
class GlyphAtlas {
public:
diff --git a/include/llmr/map/tile_parser.hpp b/include/llmr/map/tile_parser.hpp
index 5785c29b3a..84bb65e121 100644
--- a/include/llmr/map/tile_parser.hpp
+++ b/include/llmr/map/tile_parser.hpp
@@ -42,7 +42,6 @@ private:
GlyphAtlas& glyphAtlas;
GlyphStore &glyphStore;
SpriteAtlas &spriteAtlas;
- Faces faces;
Placement placement;
};
diff --git a/include/llmr/map/vector_tile.hpp b/include/llmr/map/vector_tile.hpp
index f57c5d3504..1e809556e5 100644
--- a/include/llmr/map/vector_tile.hpp
+++ b/include/llmr/map/vector_tile.hpp
@@ -83,38 +83,9 @@ public:
uint32_t extent = 4096;
std::vector<std::string> keys;
std::vector<Value> values;
- std::vector<std::string> faces;
std::map<std::string, std::map<Value, Shaping>> shaping;
};
-class VectorTileGlyph {
-public:
- VectorTileGlyph();
- VectorTileGlyph(pbf data);
-
- uint32_t id = 0;
-
- // A signed distance field of the glyph with a border of 3 pixels.
- std::string bitmap;
-
- // Glyph metrics
- GlyphMetrics metrics;
-};
-
-std::ostream& operator<<(std::ostream&, const VectorTileGlyph& glyph);
-
-class VectorTileFace {
-public:
- VectorTileFace(pbf data);
-
- std::string name;
- std::string family;
- std::string style;
- std::vector<VectorTileGlyph> glyphs;
-};
-
-std::ostream& operator<<(std::ostream&, const VectorTileFace& face);
-
class VectorTile {
public:
VectorTile();
@@ -122,7 +93,6 @@ public:
VectorTile& operator=(VectorTile&& other);
std::map<std::string, const VectorTileLayer> layers;
- std::map<std::string, const VectorTileFace> faces;
};
diff --git a/include/llmr/text/glyph.hpp b/include/llmr/text/glyph.hpp
index e6138e712e..8f9024a90b 100644
--- a/include/llmr/text/glyph.hpp
+++ b/include/llmr/text/glyph.hpp
@@ -43,8 +43,6 @@ struct Glyph {
};
typedef std::map<uint32_t, Glyph> GlyphPositions;
-typedef std::map<std::string, GlyphPositions> Faces;
-typedef std::vector<const GlyphPositions *> IndexedFaces;
class GlyphPlacement {
public:
diff --git a/proto/vector_tile.proto b/proto/vector_tile.proto
index e982c1a018..ea482adb26 100644
--- a/proto/vector_tile.proto
+++ b/proto/vector_tile.proto
@@ -75,43 +75,6 @@ message feature {
optional uint32 vertex_count = 6;
}
-// Stores a glyph with metrics and optional SDF bitmap information.
-message glyph {
- required uint32 id = 1;
-
- // A signed distance field of the glyph with a border of 3 pixels.
- optional bytes bitmap = 2;
-
- // Glyph metrics.
- required uint32 width = 3;
- required uint32 height = 4;
- required sint32 left = 5;
- required sint32 top = 6;
- required uint32 advance = 7;
-}
-
-// Stores font face information and a list of glyphs.
-message face {
- required string family = 1;
- required string style = 2;
- repeated glyph glyphs = 5;
-}
-
-// Stores the shaping information for the label with a given text
-message label {
- // The original value ID this shaping information is for.
- required uint32 text = 1;
-
- // References the index of the font stack in the layer's fontstack array.
- required uint32 stack = 2;
-
- // Parallel arrays of face ID, glyph ID and position.
- repeated uint32 faces = 3 [packed = true];
- repeated uint32 glyphs = 4 [packed = true];
- repeated uint32 x = 5 [packed = true];
- repeated uint32 y = 6 [packed = true];
-}
-
message layer {
// Any compliant implementation must first read the version
// number encoded in this message and choose the correct
@@ -136,18 +99,11 @@ message layer {
// Total vertex count in this layer.
optional uint32 vertex_count = 6;
- // Shaping information for labels contained in this tile.
- repeated string faces = 7;
- repeated label labels = 8;
- repeated string stacks = 9;
-
extensions 16 to max;
}
message tile {
repeated layer layers = 3;
- repeated face faces = 4;
-
extensions 16 to 8191;
}
diff --git a/src/map/vector_tile.cpp b/src/map/vector_tile.cpp
index 248e947122..f0f5a85cdf 100644
--- a/src/map/vector_tile.cpp
+++ b/src/map/vector_tile.cpp
@@ -70,9 +70,6 @@ VectorTile::VectorTile(pbf tile) {
if (tile.tag == 3) { // layer
VectorTileLayer layer(tile.message());
layers.emplace(layer.name, std::forward<VectorTileLayer>(layer));
- } else if (tile.tag == 4) { // face
- VectorTileFace face(tile.message());
- faces.emplace(face.name, std::forward<VectorTileFace>(face));
} else {
tile.skip();
}
@@ -86,100 +83,8 @@ VectorTile& VectorTile::operator=(VectorTile && other) {
return *this;
}
-VectorTileFace::VectorTileFace(pbf face) {
- while (face.next()) {
- if (face.tag == 1) { // family
- family = face.string();
- } else if (face.tag == 2) { // style
- style = face.string();
- } else if (face.tag == 5) { // glyphs
- glyphs.emplace_back(face.message());
- } else {
- face.skip();
- }
- }
- name = family + " " + style;
-}
-
-
-std::ostream& llmr::operator<<(std::ostream& os, const VectorTileFace& face) {
- os << "Face: " << face.name << std::endl;
- for (const VectorTileGlyph& glyph : face.glyphs) {
- os << " - " << glyph;
- }
- return os;
-}
-
-
-// -1 overflows to maximum value
-VectorTileGlyph::VectorTileGlyph() {}
-
-VectorTileGlyph::VectorTileGlyph(pbf glyph) {
- while (glyph.next()) {
- if (glyph.tag == 1) { // id
- id = glyph.varint();
- } else if (glyph.tag == 2) { // bitmap
- bitmap = glyph.string();
- } else if (glyph.tag == 3) { // width
- metrics.width = glyph.varint();
- } else if (glyph.tag == 4) { // height
- metrics.height = glyph.varint();
- } else if (glyph.tag == 5) { // left
- metrics.left = glyph.svarint();
- } else if (glyph.tag == 6) { // top
- metrics.top = glyph.svarint();
- } else if (glyph.tag == 7) { // advance
- metrics.advance = glyph.varint();
- } else {
- glyph.skip();
- }
- }
-}
-
-std::ostream& llmr::operator<<(std::ostream& os, const VectorTileGlyph& glyph) {
- os << "Glyph " << glyph.id << ": " << glyph.metrics.width << "x" << glyph.metrics.height <<
- " (" << glyph.metrics.left << "/" << glyph.metrics.top << ") +" << glyph.metrics.advance << std::endl;
- return os;
-}
-
-class VectorTileLabel {
-public:
- VectorTileLabel(pbf data);
-
- uint32_t text = 0;
- uint32_t stack = 0;
- std::vector<GlyphPlacement> placements;
-};
-
-VectorTileLabel::VectorTileLabel(pbf label) {
- pbf faces, glyphs, x, y;
-
- while (label.next()) {
- if (label.tag == 1) { // text
- text = label.varint();
- } else if (label.tag == 2) { // stack
- stack = label.varint();
- } else if (label.tag == 3) { // faces
- faces = label.message();
- } else if (label.tag == 4) { // glyphs
- glyphs = label.message();
- } else if (label.tag == 5) { // x
- x = label.message();
- } else if (label.tag == 6) { // y
- y = label.message();
- } else {
- label.skip();
- }
- }
-
- while (faces && glyphs && x && y) {
- placements.emplace_back(faces.varint(), glyphs.varint(), x.varint(), y.varint());
- }
-}
-
VectorTileLayer::VectorTileLayer(pbf layer) : data(layer) {
std::vector<std::string> stacks;
- std::vector<VectorTileLabel> labels;
while (layer.next()) {
if (layer.tag == 1) { // name
@@ -190,34 +95,10 @@ VectorTileLayer::VectorTileLayer(pbf layer) : data(layer) {
values.emplace_back(std::move(parseValue(layer.message())));
} else if (layer.tag == 5) { // extent
extent = layer.varint();
- } else if (layer.tag == 7) { // faces
- faces.emplace_back(layer.string());
- } else if (layer.tag == 8) { // labels
- labels.emplace_back(layer.message());
- } else if (layer.tag == 9) { // stacks
- stacks.emplace_back(layer.string());
} else {
layer.skip();
}
}
-
- // Build index of [stack][text] => shaping information
- for (VectorTileLabel& label : labels) {
- if (values.size() <= label.text || stacks.size() <= label.stack) {
- // The indices are out of range. Skip this label.
- continue;
- }
-
- const Value& text = values[label.text];
- const std::string& stack = stacks[label.stack];
-
- shaping[stack][text].swap(label.placements);
- }
-}
-
-std::ostream& llmr::operator<<(std::ostream& os, const GlyphPlacement& placement) {
- os << "Glyph " << placement.face << "/" << placement.glyph << ": " << placement.x << "/" << placement.y << std::endl;
- return os;
}
FilteredVectorTileLayer::FilteredVectorTileLayer(const VectorTileLayer& layer, const BucketDescription& bucket_desc)