summaryrefslogtreecommitdiff
path: root/src/mbgl/layout/symbol_instance.cpp
blob: fafcc7c15d1f12d45c39bd2ee0c0ebb9e9911bb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <mbgl/layout/symbol_instance.hpp>
#include <mbgl/style/layers/symbol_layer_properties.hpp>

namespace mbgl {

using namespace style;

SymbolInstance::SymbolInstance(Anchor& anchor, const GeometryCoordinates& line,
        const Shaping& shapedText, const PositionedIcon& shapedIcon,
        const SymbolLayoutProperties::Evaluated& layout, const bool addToBuffers, const uint32_t index_,
        const float textBoxScale, const float textPadding, const SymbolPlacementType textPlacement,
        const float iconBoxScale, const float iconPadding, const SymbolPlacementType iconPlacement,
        const GlyphPositions& face, const IndexedSubfeature& indexedFeature) :
    point(anchor.point),
    index(index_),
    hasText(shapedText),
    hasIcon(shapedIcon),

    // Create the quads used for rendering the glyphs.
    glyphQuads(addToBuffers && shapedText ?
            getGlyphQuads(anchor, shapedText, textBoxScale, line, layout, textPlacement, face) :
            SymbolQuads()),

    // Create the quad used for rendering the icon.
    iconQuads(addToBuffers && shapedIcon ?
            getIconQuads(anchor, shapedIcon, line, layout, iconPlacement, shapedText) :
            SymbolQuads()),

    // Create the collision features that will be used to check whether this symbol instance can be placed
    textCollisionFeature(line, anchor, shapedText, textBoxScale, textPadding, textPlacement, indexedFeature),
    iconCollisionFeature(line, anchor, shapedIcon, iconBoxScale, iconPadding, iconPlacement, indexedFeature)
    {}

} // namespace mbgl