summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-10-27 15:50:02 -0700
committerChris Loer <chris.loer@gmail.com>2017-10-31 10:25:57 -0700
commit29025e7feb3ed16c9eb4a5bfc9143ec39e21460d (patch)
tree72120dddcab7d3c240df252722b9e3cc9754fce2
parent2d78e611cbe366d0e176abfb60194c4de234e2b1 (diff)
downloadqtlocation-mapboxgl-29025e7feb3ed16c9eb4a5bfc9143ec39e21460d.tar.gz
Store tile id in indexedsubfeature
-rw-r--r--src/mbgl/geometry/feature_index.cpp2
-rw-r--r--src/mbgl/geometry/feature_index.hpp7
-rw-r--r--src/mbgl/layout/symbol_layout.cpp10
-rw-r--r--src/mbgl/layout/symbol_layout.hpp5
-rw-r--r--src/mbgl/tile/geometry_tile_worker.cpp2
5 files changed, 17 insertions, 9 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp
index 447fe508e2..648a6d16ba 100644
--- a/src/mbgl/geometry/feature_index.cpp
+++ b/src/mbgl/geometry/feature_index.cpp
@@ -28,7 +28,7 @@ void FeatureIndex::insert(const GeometryCollection& geometries,
for (const auto& ring : geometries) {
// TODO: Templatize grid units so feature index can stick with integers?
auto envelope = mapbox::geometry::envelope(ring);
- grid.insert(IndexedSubfeature { index, sourceLayerName, bucketName, sortIndex++ },
+ grid.insert(IndexedSubfeature { index, sourceLayerName, bucketName, sortIndex++, 0, 0, 0, 0, 0 }, // TODO: FeatureIndex doesn't need to care about tileIDs, make this cleaner
{convertPoint<float>(envelope.min), convertPoint<float>(envelope.max)});
}
}
diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp
index f998ab12b8..a067165fa8 100644
--- a/src/mbgl/geometry/feature_index.hpp
+++ b/src/mbgl/geometry/feature_index.hpp
@@ -2,6 +2,7 @@
#include <mbgl/style/types.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
+#include <mbgl/tile/tile_id.hpp>
#include <mbgl/util/grid_index.hpp>
#include <mbgl/util/feature.hpp>
@@ -15,7 +16,6 @@ class RenderedQueryOptions;
class RenderLayer;
class CollisionIndex;
-class CanonicalTileID;
class IndexedSubfeature {
public:
@@ -24,6 +24,11 @@ public:
std::string sourceLayerName;
std::string bucketName;
size_t sortIndex;
+ uint8_t z;
+ uint32_t x;
+ uint32_t y;
+ uint8_t overscaledZ;
+ int16_t wrap;
};
class FeatureIndex {
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index 26059dcaf9..c18b800c21 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -178,7 +178,8 @@ bool SymbolLayout::hasSymbolInstances() const {
}
void SymbolLayout::prepare(const GlyphMap& glyphMap, const GlyphPositions& glyphPositions,
- const ImageMap& imageMap, const ImagePositions& imagePositions) {
+ const ImageMap& imageMap, const ImagePositions& imagePositions,
+ const OverscaledTileID& tileID) {
const bool textAlongLine = layout.get<TextRotationAlignment>() == AlignmentType::Map &&
layout.get<SymbolPlacement>() == SymbolPlacementType::Line;
@@ -247,7 +248,7 @@ void SymbolLayout::prepare(const GlyphMap& glyphMap, const GlyphPositions& glyph
// if either shapedText or icon position is present, add the feature
if (shapedTextOrientations.first || shapedIcon) {
- addFeature(std::distance(features.begin(), it), feature, shapedTextOrientations, shapedIcon, glyphPositionMap);
+ addFeature(std::distance(features.begin(), it), feature, shapedTextOrientations, shapedIcon, glyphPositionMap, tileID);
}
feature.geometry.clear();
@@ -260,7 +261,8 @@ void SymbolLayout::addFeature(const std::size_t index,
const SymbolFeature& feature,
const std::pair<Shaping, Shaping>& shapedTextOrientations,
optional<PositionedIcon> shapedIcon,
- const GlyphPositionMap& glyphPositionMap) {
+ const GlyphPositionMap& glyphPositionMap,
+ const OverscaledTileID& tileID) {
const float minScale = 0.5f;
const float glyphSize = 24.0f;
@@ -292,7 +294,7 @@ void SymbolLayout::addFeature(const std::size_t index,
: layout.get<SymbolPlacement>();
const float textRepeatDistance = symbolSpacing / 2;
IndexedSubfeature indexedFeature = { feature.index, sourceLayer->getName(), bucketName,
- symbolInstances.size() };
+ symbolInstances.size(), tileID.canonical.z, tileID.canonical.x, tileID.canonical.y, tileID.overscaledZ, tileID.wrap };
auto addSymbolInstance = [&] (const GeometryCoordinates& line, Anchor& anchor) {
// https://github.com/mapbox/vector-tile-spec/tree/master/2.1#41-layers
diff --git a/src/mbgl/layout/symbol_layout.hpp b/src/mbgl/layout/symbol_layout.hpp
index 620a317add..4d63b2487d 100644
--- a/src/mbgl/layout/symbol_layout.hpp
+++ b/src/mbgl/layout/symbol_layout.hpp
@@ -34,7 +34,7 @@ public:
GlyphDependencies&);
void prepare(const GlyphMap&, const GlyphPositions&,
- const ImageMap&, const ImagePositions&);
+ const ImageMap&, const ImagePositions&, const OverscaledTileID&);
std::unique_ptr<SymbolBucket> place(const bool showCollisionBoxes);
@@ -51,7 +51,8 @@ private:
const SymbolFeature&,
const std::pair<Shaping, Shaping>& shapedTextOrientations,
optional<PositionedIcon> shapedIcon,
- const GlyphPositionMap&);
+ const GlyphPositionMap&,
+ const OverscaledTileID&);
bool anchorIsTooClose(const std::u16string& text, const float repeatDistance, const Anchor&);
std::map<std::u16string, std::vector<Anchor>> compareText;
diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp
index 1870307aca..9b9ca5ff1b 100644
--- a/src/mbgl/tile/geometry_tile_worker.cpp
+++ b/src/mbgl/tile/geometry_tile_worker.cpp
@@ -393,7 +393,7 @@ void GeometryTileWorker::attemptPlacement() {
}
symbolLayout->prepare(glyphMap, glyphAtlas.positions,
- imageMap, imageAtlas.positions);
+ imageMap, imageAtlas.positions, id);
}
symbolLayoutsNeedPreparation = false;