summaryrefslogtreecommitdiff
path: root/include/mbgl/text/collision.hpp
blob: 8911b3b4c669501ca30fb08221b019d43fec715e (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
#ifndef MBGL_TEXT_COLLISION
#define MBGL_TEXT_COLLISION

#include <mbgl/text/types.hpp>

namespace mbgl {

class Collision {

public:
    Collision(float zoom, float tileExtent, float tileSize, float placementDepth = 1);
    ~Collision();

    PlacementProperty place(const GlyphBoxes &boxes, const CollisionAnchor &anchor,
                            float minPlacementScale, float maxPlacementScale, float padding,
                            bool horizontal, bool allowOverlap, bool ignorePlacement);
    float getPlacementScale(const GlyphBoxes &glyphs, float minPlacementScale,
                            float maxPlacementScale, float pad);
    PlacementRange getPlacementRange(const GlyphBoxes &glyphs,
                                     float placementScale, bool horizontal);
    void insert(const GlyphBoxes &glyphs, const CollisionAnchor &anchor,
                float placementScale, const PlacementRange &placementRange,
                bool horizontal, float padding);

private:
    void *hTree;
    void *cTree;
    const float tilePixelRatio;
    const float zoom;
    const float maxPlacementScale;
};
}

#endif