From 31f0f47195ae7d4a6f96b1c64cd39e1268fdfc8d Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Thu, 9 Nov 2017 13:24:25 -0800 Subject: [core] Add CrossTileSymbolIndex. This class is responsible for tracking which symbols are "the same" between tiles at different zoom levels, so that symbol opacities (fade animations) can be copied smoothly between tiles. --- src/mbgl/text/cross_tile_symbol_index.hpp | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/mbgl/text/cross_tile_symbol_index.hpp (limited to 'src/mbgl/text/cross_tile_symbol_index.hpp') diff --git a/src/mbgl/text/cross_tile_symbol_index.hpp b/src/mbgl/text/cross_tile_symbol_index.hpp new file mode 100644 index 0000000000..0b8c5c4780 --- /dev/null +++ b/src/mbgl/text/cross_tile_symbol_index.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace mbgl { + +class SymbolInstance; +class RenderSymbolLayer; +class SymbolBucket; + +class IndexEntry { + Point anchorPoint; + +}; + +class IndexedSymbolInstance { + public: + IndexedSymbolInstance(uint32_t crossTileID_, Point coord_) + : crossTileID(crossTileID_), coord(coord_) {}; + uint32_t crossTileID; + Point coord; +}; + +class TileLayerIndex { + public: + TileLayerIndex(OverscaledTileID coord, std::vector&, uint32_t bucketInstanceId); + + Point getScaledCoordinates(SymbolInstance&, const OverscaledTileID&); + void findMatches(std::vector&, const OverscaledTileID&); + + OverscaledTileID coord; + uint32_t bucketInstanceId; + std::map> indexedSymbolInstances; +}; + +class CrossTileSymbolLayerIndex { + public: + CrossTileSymbolLayerIndex(); + void addBucket(const OverscaledTileID&, SymbolBucket&); + bool removeStaleBuckets(const std::unordered_set& currentIDs); + private: + std::map> indexes; + uint32_t maxBucketInstanceId = 0; + static uint32_t maxCrossTileID; +}; + +class CrossTileSymbolIndex { + public: + CrossTileSymbolIndex(); + + bool addLayer(RenderSymbolLayer&); + + void reset(); + private: + std::map layerIndexes; +}; + +} // namespace mbgl -- cgit v1.2.1