summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation/annotation_tile.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/annotation/annotation_tile.hpp')
-rw-r--r--src/mbgl/annotation/annotation_tile.hpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/mbgl/annotation/annotation_tile.hpp b/src/mbgl/annotation/annotation_tile.hpp
index ea4ff5ebd5..68a4d342ac 100644
--- a/src/mbgl/annotation/annotation_tile.hpp
+++ b/src/mbgl/annotation/annotation_tile.hpp
@@ -11,8 +11,7 @@ class TileParameters;
class AnnotationTile : public GeometryTile {
public:
- AnnotationTile(const OverscaledTileID&,
- const TileParameters&);
+ AnnotationTile(const OverscaledTileID&, const TileParameters&);
~AnnotationTile() override;
void setNecessity(Necessity) final;
@@ -21,37 +20,45 @@ private:
AnnotationManager& annotationManager;
};
+class AnnotationTileFeatureData;
+
class AnnotationTileFeature : public GeometryTileFeature {
public:
- AnnotationTileFeature(AnnotationID, FeatureType, GeometryCollection,
- std::unordered_map<std::string, std::string> properties = {{}});
+ AnnotationTileFeature(std::shared_ptr<const AnnotationTileFeatureData>);
+ ~AnnotationTileFeature() override;
- FeatureType getType() const override { return type; }
+ FeatureType getType() const override;
optional<Value> getValue(const std::string&) const override;
- optional<FeatureIdentifier> getID() const override { return { static_cast<uint64_t>(id) }; }
- GeometryCollection getGeometries() const override { return geometries; }
+ optional<FeatureIdentifier> getID() const override;
+ GeometryCollection getGeometries() const override;
- const AnnotationID id;
- const FeatureType type;
- const std::unordered_map<std::string, std::string> properties;
- const GeometryCollection geometries;
+private:
+ std::shared_ptr<const AnnotationTileFeatureData> data;
};
class AnnotationTileLayer : public GeometryTileLayer {
public:
AnnotationTileLayer(std::string);
- std::size_t featureCount() const override { return features.size(); }
+ std::size_t featureCount() const override {
+ return features.size();
+ }
std::unique_ptr<GeometryTileFeature> getFeature(std::size_t i) const override {
return std::make_unique<AnnotationTileFeature>(features.at(i));
}
- std::string getName() const override { return name; };
+ std::string getName() const override {
+ return name;
+ }
- std::vector<AnnotationTileFeature> features;
+ void addFeature(const AnnotationID,
+ FeatureType,
+ GeometryCollection,
+ std::unordered_map<std::string, std::string> properties = { {} });
private:
+ std::vector<std::shared_ptr<const AnnotationTileFeatureData>> features;
std::string name;
};
@@ -59,7 +66,9 @@ class AnnotationTileData : public GeometryTileData {
public:
std::unique_ptr<GeometryTileData> clone() const override;
const GeometryTileLayer* getLayer(const std::string&) const override;
+ AnnotationTileLayer& addLayer(const std::string&);
+private:
std::unordered_map<std::string, AnnotationTileLayer> layers;
};