#pragma once #include #include #include #include #include #include #include #include #include #include namespace mbgl { class GeometryTileLayer; class CollisionTile; class SpriteAtlas; class GlyphAtlas; class SymbolBucket; class Anchor; namespace style { class BucketParameters; class Filter; class Layer; } // namespace style class SymbolLayout { public: SymbolLayout(const style::BucketParameters&, const std::vector&, const GeometryTileLayer&, SpriteAtlas&); bool canPrepare(GlyphAtlas&); void prepare(uintptr_t tileUID, GlyphAtlas&); std::unique_ptr place(CollisionTile&); bool hasSymbolInstances() const; enum State { Pending, // Waiting for the necessary glyphs or icons to be available. Prepared, // The potential positions of text and icons have been determined. Placed // The final positions have been determined, taking into account prior layers. }; State state = Pending; std::map> layerPaintProperties; private: void addFeature(const size_t, const SymbolFeature&, const std::pair& shapedTextOrientations, const PositionedIcon& shapedIcon, const GlyphPositions& face); bool anchorIsTooClose(const std::u16string& text, const float repeatDistance, const Anchor&); std::map> compareText; void addToDebugBuffers(CollisionTile&, SymbolBucket&); // Adds placed items to the buffer. template void addSymbol(Buffer&, const SymbolQuad&, float scale, const bool keepUpright, const style::SymbolPlacementType, const float placementAngle, WritingModeType writingModes); const std::string sourceLayerName; const std::string bucketName; const float overscaling; const float zoom; const MapMode mode; style::SymbolLayoutProperties::Evaluated layout; float textMaxSize; SpriteAtlas& spriteAtlas; const uint32_t tileSize; const float tilePixelRatio; bool sdfIcons = false; bool iconsNeedLinear = false; GlyphRangeSet ranges; std::vector symbolInstances; 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