summaryrefslogtreecommitdiff
path: root/src/mbgl/util/get_geometries.cpp
blob: 5961af21502320d7512cabd6028831cb790feb4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <mbgl/util/get_geometries.hpp>
#include <mbgl/util/constants.hpp>

#include <cmath>

namespace mbgl {

GeometryCollection getGeometries(const GeometryTileFeature& feature) {
    const float scale = float(util::EXTENT) / feature.getExtent();
    GeometryCollection geometryCollection = feature.getGeometries();
    for (auto& line : geometryCollection) {
        for (auto& point : line) {
            point.x = ::round(point.x * scale);
            point.y = ::round(point.y * scale);
        }
    }
    return geometryCollection;
}

} // namespace mbgl