From c0cb210ddca1901a956cd68e9142b7fb04183248 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Thu, 9 Nov 2017 13:24:43 -0800 Subject: [core] Switch from background to foreground placement - Background placement code now just generates static symbol buffers - Don't render GeometryTiles until their symbols are loaded. This is necessary for the CrossTileSymbolIndex to successfully prevent flicker. - SymbolInstances are transferred to SymbolBucket for use on foreground during collision detection - Symbols are sorted on foreground by sorting their index buffer but leaving vertex buffers intact (only works within one segment) - Vertical glyphs are generated at same time as horizontal glyphs. `reprojectLineLabels` chooses which one to use at render time and hides the other. - Icons are now always represented with a single collision box, even if they're placed along a line (this means their rotation alignment may be wrong, but the approach of representing them with multiple collision boxes wasn't very accurate either). - Generate vertices for new debug collision boxes and collision circles - Only add symbols within tile boundaries (reduces work, avoids double-draw) - Update symbol_projection.cpp to support line label projection calls from CollisionIndex. --- src/mbgl/tile/geometry_tile.hpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/mbgl/tile/geometry_tile.hpp') diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp index a478aad504..3f4b36984b 100644 --- a/src/mbgl/tile/geometry_tile.hpp +++ b/src/mbgl/tile/geometry_tile.hpp @@ -4,12 +4,11 @@ #include #include #include -#include -#include #include #include #include #include +#include #include #include @@ -36,9 +35,9 @@ public: void setError(std::exception_ptr); void setData(std::unique_ptr); - void setPlacementConfig(const PlacementConfig&) override; void setLayers(const std::vector>&) override; - + void setShowCollisionBoxes(const bool showCollisionBoxes) override; + void onGlyphsAvailable(GlyphMap) override; void onImagesAvailable(ImageMap, uint64_t imageCorrelationID) override; @@ -56,7 +55,8 @@ public: const GeometryCoordinates& queryGeometry, const TransformState&, const std::vector& layers, - const RenderedQueryOptions& options) override; + const RenderedQueryOptions& options, + const CollisionIndex& collisionIndex) override; void querySourceFeatures( std::vector& result, @@ -82,16 +82,13 @@ public: class PlacementResult { public: std::unordered_map> symbolBuckets; - std::unique_ptr collisionTile; optional glyphAtlasImage; optional iconAtlasImage; PlacementResult(std::unordered_map> symbolBuckets_, - std::unique_ptr collisionTile_, optional glyphAtlasImage_, optional iconAtlasImage_) : symbolBuckets(std::move(symbolBuckets_)), - collisionTile(std::move(collisionTile_)), glyphAtlasImage(std::move(glyphAtlasImage_)), iconAtlasImage(std::move(iconAtlasImage_)) {} }; @@ -99,7 +96,7 @@ public: void onError(std::exception_ptr, uint64_t correlationID); - float yStretch() const override; + void resetCrossTileIDs() override; protected: const GeometryTileData* getData() { @@ -108,7 +105,6 @@ protected: private: void markObsolete(); - void invokePlacement(); const std::string sourceID; @@ -122,7 +118,6 @@ private: ImageManager& imageManager; uint64_t correlationID = 0; - optional requestedConfig; std::unordered_map> nonSymbolBuckets; std::unique_ptr featureIndex; @@ -132,10 +127,11 @@ private: optional iconAtlasImage; std::unordered_map> symbolBuckets; - std::unique_ptr collisionTile; + std::unordered_map> symbolLayouts; - float lastYStretch; const MapMode mode; + + bool showCollisionBoxes; public: optional glyphAtlasTexture; -- cgit v1.2.1