#pragma once #include #include #include #include #include #include #include #include #include #include namespace mbgl { class BucketParameters; class Anchor; class RenderLayer; class PlacedSymbol; namespace style { class Filter; } // namespace style class SymbolLayout final : public Layout { public: SymbolLayout(const BucketParameters&, const std::vector&, std::unique_ptr, ImageDependencies&, GlyphDependencies&); ~SymbolLayout() final = default; void prepareSymbols(const GlyphMap&, const GlyphPositions&, const ImageMap&, const ImagePositions&) override; void createBucket(const ImagePositions&, std::unique_ptr&, std::unordered_map>&, const bool firstLoad, const bool showCollisionBoxes) override; bool hasSymbolInstances() const override; bool hasDependencies() const override; std::map layerPaintProperties; const std::string bucketLeaderID; std::vector symbolInstances; private: void addFeature(const size_t, const SymbolFeature&, const std::pair& shapedTextOrientations, optional shapedIcon, const GlyphPositions&); bool anchorIsTooClose(const std::u16string& text, const float repeatDistance, const Anchor&); std::map> compareText; void addToDebugBuffers(SymbolBucket&); // Adds placed items to the buffer. size_t addSymbol(SymbolBucket::Buffer&, const Range sizeData, const SymbolQuad&, const Anchor& labelAnchor, PlacedSymbol& placedSymbol); // Adds symbol quads to bucket and returns formatted section index of last // added quad. std::size_t addSymbolGlyphQuads(SymbolBucket&, SymbolInstance&, const SymbolFeature&, WritingModeType, optional& placedIndex, const SymbolQuads&, optional lastAddedSection = nullopt); void updatePaintPropertiesForSection(SymbolBucket&, const SymbolFeature&, std::size_t sectionIndex); // Stores the layer so that we can hold on to GeometryTileFeature instances in SymbolFeature, // which may reference data from this object. const std::unique_ptr sourceLayer; const float overscaling; const float zoom; const MapMode mode; const float pixelRatio; style::SymbolLayoutProperties::PossiblyEvaluated layout; const uint32_t tileSize; const float tilePixelRatio; bool sdfIcons = false; bool iconsNeedLinear = false; style::TextSize::UnevaluatedType textSize; style::IconSize::UnevaluatedType iconSize; std::vector features; BiDi bidi; // Consider moving this up to geometry tile worker to reduce reinstantiation costs; use of BiDi/ubiditransform object must be constrained to one thread }; } // namespace mbgl