#pragma once #include #include #include #include #include #include namespace mbgl { class Anchor; class IndexedSubfeature; struct ShapedTextOrientations { Shaping horizontal; Shaping vertical; // The following are used with variable text placement on. Shaping& right = horizontal; Shaping center; Shaping left; bool singleLine = false; }; struct SymbolInstanceSharedData { SymbolInstanceSharedData(GeometryCoordinates line, const ShapedTextOrientations& shapedTextOrientations, const optional& shapedIcon, const optional& verticallyShapedIcon, const style::SymbolLayoutProperties::Evaluated& layout, const style::SymbolPlacementType textPlacement, const std::array& textOffset, const GlyphPositions& positions, bool allowVerticalPlacement); bool empty() const; GeometryCoordinates line; // Note: When singleLine == true, only `rightJustifiedGlyphQuads` is populated. SymbolQuads rightJustifiedGlyphQuads; SymbolQuads centerJustifiedGlyphQuads; SymbolQuads leftJustifiedGlyphQuads; SymbolQuads verticalGlyphQuads; optional iconQuad; optional verticalIconQuad; }; enum class SymbolContent : uint8_t { None = 0, Text = 1 << 0, IconRGBA = 1 << 1, IconSDF = 1 << 2 }; MBGL_CONSTEXPR SymbolContent operator|(SymbolContent a, SymbolContent b) { return SymbolContent(mbgl::underlying_type(a) | mbgl::underlying_type(b)); } MBGL_CONSTEXPR SymbolContent& operator|=(SymbolContent& a, SymbolContent b) { return (a = a | b); } MBGL_CONSTEXPR SymbolContent operator&(SymbolContent a, SymbolContent b) { return SymbolContent(mbgl::underlying_type(a) & mbgl::underlying_type(b)); } class SymbolInstance { public: SymbolInstance(Anchor& anchor_, std::shared_ptr sharedData, const ShapedTextOrientations& shapedTextOrientations, const optional& shapedIcon, const optional& verticallyShapedIcon, const float textBoxScale, const float textPadding, const style::SymbolPlacementType textPlacement, const std::array& textOffset, const float iconBoxScale, const float iconPadding, const std::array& iconOffset, const IndexedSubfeature& indexedFeature, const std::size_t layoutFeatureIndex, const std::size_t dataFeatureIndex, std::u16string key, const float overscaling, const float iconRotation, const float textRotation, float radialTextOffset, bool allowVerticalPlacement, const SymbolContent iconType = SymbolContent::None); optional getDefaultHorizontalPlacedTextIndex() const; const GeometryCoordinates& line() const; const SymbolQuads& rightJustifiedGlyphQuads() const; const SymbolQuads& leftJustifiedGlyphQuads() const; const SymbolQuads& centerJustifiedGlyphQuads() const; const SymbolQuads& verticalGlyphQuads() const; bool hasText() const; bool hasIcon() const; bool hasSdfIcon() const; const optional& iconQuad() const; const optional& verticalIconQuad() const; void releaseSharedData(); private: std::shared_ptr sharedData; public: Anchor anchor; SymbolContent symbolContent; std::size_t rightJustifiedGlyphQuadsSize; std::size_t centerJustifiedGlyphQuadsSize; std::size_t leftJustifiedGlyphQuadsSize; std::size_t verticalGlyphQuadsSize; CollisionFeature textCollisionFeature; CollisionFeature iconCollisionFeature; optional verticalTextCollisionFeature = nullopt; optional verticalIconCollisionFeature = nullopt; WritingModeType writingModes; std::size_t layoutFeatureIndex; // Index into the set of features included at layout time std::size_t dataFeatureIndex; // Index into the underlying tile data feature set std::array textOffset; std::array iconOffset; std::u16string key; bool isDuplicate; optional placedRightTextIndex; optional placedCenterTextIndex; optional placedLeftTextIndex; optional placedVerticalTextIndex; optional placedIconIndex; optional placedVerticalIconIndex; float textBoxScale; float radialTextOffset; bool singleLine; uint32_t crossTileID = 0; }; } // namespace mbgl