summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation/annotation_tile.hpp
blob: a4d1e668020f6b1f55baa384bd12ca763b884daf (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once

#include <mbgl/annotation/annotation.hpp>
#include <mbgl/tile/geometry_tile.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>

namespace mbgl {

class AnnotationManager;
class TileParameters;

class AnnotationTile : public GeometryTile {
public:
    AnnotationTile(const OverscaledTileID&, const TileParameters&);
    ~AnnotationTile() override;

private:
    AnnotationManager& annotationManager;
};

class AnnotationTileFeatureData;

class AnnotationTileFeature : public GeometryTileFeature {
public:
    AnnotationTileFeature(std::shared_ptr<const AnnotationTileFeatureData>);
    ~AnnotationTileFeature() override;

    FeatureType getType() const override;
    optional<Value> getValue(const std::string&) const override;
    optional<FeatureIdentifier> getID() const override;
    GeometryCollection getGeometries() const override;

private:
    std::shared_ptr<const AnnotationTileFeatureData> data;
};

class AnnotationTileLayerData;

class AnnotationTileLayer : public GeometryTileLayer {
public:
    AnnotationTileLayer(std::shared_ptr<AnnotationTileLayerData>);

    std::size_t featureCount() const override;
    std::unique_ptr<GeometryTileFeature> getFeature(std::size_t i) const override;
    std::string getName() const override;

    void addFeature(const AnnotationID,
                    FeatureType,
                    GeometryCollection,
                    std::unordered_map<std::string, std::string> properties = { {} });

private:
    std::shared_ptr<AnnotationTileLayerData> layer;
};

class AnnotationTileData : public GeometryTileData {
public:
    std::unique_ptr<GeometryTileData> clone() const override;
    std::unique_ptr<GeometryTileLayer> getLayer(const std::string&) const override;

    std::unique_ptr<AnnotationTileLayer> addLayer(const std::string&);

private:
    std::unordered_map<std::string, std::shared_ptr<AnnotationTileLayerData>> layers;
};

} // namespace mbgl