summaryrefslogtreecommitdiff
path: root/platform/default/mbgl/tile/default_tile_feature.hpp
blob: 9183fd583a4c193fac64c6fa6b10d7fd3f7030ba (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
35
36
37
38
39
40
41
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/util/feature.hpp>

namespace mbgl {

class DefaultTileFeature : public GeometryTileFeature {
public:
    DefaultTileFeature(PropertyMap properties_)
        : properties(std::move(properties_)) {
    }

    DefaultTileFeature(FeatureIdentifier id_, FeatureType type_, GeometryCollection geometry_, PropertyMap properties_)
        : properties(std::move(properties_)),
          id(std::move(id_)),
          type(type_),
          geometry(std::move(geometry_)) {
    }

    PropertyMap properties;
    FeatureIdentifier id;
    FeatureType type = FeatureType::Point;
    GeometryCollection geometry;

    FeatureType getType() const override {
        return type;
    }

    FeatureIdentifier getID() const override {
        return id;
    }

    optional<Value> getValue(const std::string& key) const override {
        return properties.count(key) ? properties.at(key) : optional<Value>();
    }

    GeometryCollection getGeometries() const override {
        return geometry;
    }
};

} // namespace mbgl