summaryrefslogtreecommitdiff
path: root/src/mbgl/map/vector_tile.hpp
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2015-03-02 16:30:22 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-03-09 11:57:31 -0700
commit831264d5305b5352b7e8d419d29750119a5a2cf9 (patch)
tree1712d1f5139762ca285c821aa4825d2d904936f5 /src/mbgl/map/vector_tile.hpp
parent7d06e62363a298320d01b6fee23ae6c6394914d7 (diff)
downloadqtlocation-mapboxgl-831264d5305b5352b7e8d419d29750119a5a2cf9.tar.gz
refs #928: 90% of way to genericizing VectorTile
Diffstat (limited to 'src/mbgl/map/vector_tile.hpp')
-rw-r--r--src/mbgl/map/vector_tile.hpp93
1 files changed, 22 insertions, 71 deletions
diff --git a/src/mbgl/map/vector_tile.hpp b/src/mbgl/map/vector_tile.hpp
index 2d02ba3a0b..bfa9e086ab 100644
--- a/src/mbgl/map/vector_tile.hpp
+++ b/src/mbgl/map/vector_tile.hpp
@@ -1,118 +1,69 @@
#ifndef MBGL_MAP_VECTOR_TILE
#define MBGL_MAP_VECTOR_TILE
+#include <mbgl/map/geometry_tile.hpp>
#include <mbgl/style/filter_expression.hpp>
-#include <mbgl/style/value.hpp>
-#include <mbgl/text/glyph.hpp>
#include <mbgl/util/pbf.hpp>
-#include <mbgl/util/optional.hpp>
-
-#include <cstdint>
-#include <iosfwd>
-#include <map>
-#include <string>
-#include <unordered_map>
-#include <vector>
namespace mbgl {
class VectorTileLayer;
-enum class FeatureType {
- Unknown = 0,
- Point = 1,
- LineString = 2,
- Polygon = 3
-};
-
-std::ostream& operator<<(std::ostream&, const FeatureType& type);
-
-class VectorTileFeature {
+class VectorTileFeature : public GeometryTileFeature<pbf> {
public:
- VectorTileFeature(pbf feature, const VectorTileLayer& layer);
+ VectorTileFeature(pbf, const VectorTileLayer&);
- uint64_t id = 0;
- FeatureType type = FeatureType::Unknown;
- std::map<std::string, Value> properties;
- pbf geometry;
+private:
+ const pbf feature_pbf;
};
-std::ostream& operator<<(std::ostream&, const VectorTileFeature& feature);
-
+std::ostream& operator<<(std::ostream&, const GeometryTileFeature<pbf>&);
-class VectorTileTagExtractor {
+class VectorTileTagExtractor : public GeometryTileTagExtractor<pbf> {
public:
- VectorTileTagExtractor(const VectorTileLayer &layer);
+ VectorTileTagExtractor(const VectorTileLayer&);
- void setTags(const pbf &pbf);
+ void setTags(const pbf&);
mapbox::util::optional<Value> getValue(const std::string &key) const;
- void setType(FeatureType type);
- FeatureType getType() const;
private:
- const VectorTileLayer &layer_;
- pbf tags_;
- FeatureType type_ = FeatureType::Unknown;
+ pbf tags_pbf;
};
-/*
- * Allows iterating over the features of a VectorTileLayer using a
- * BucketDescription as filter. Only features matching the descriptions will
- * be returned (as pbf).
- */
-class FilteredVectorTileLayer {
+class FilteredVectorTileLayer : public GeometryFilteredTileLayer<pbf> {
public:
- class iterator {
+ class iterator : public GeometryFilteredTileLayer<pbf>::iterator {
public:
- iterator(const FilteredVectorTileLayer& filter, const pbf& data);
+ iterator(const FilteredVectorTileLayer&, const pbf&);
void operator++();
bool operator!=(const iterator& other) const;
const pbf& operator*() const;
private:
- const FilteredVectorTileLayer& parent;
- bool valid = false;
- pbf feature;
- pbf data;
+ pbf feature_pbf;
+ pbf data_pbf;
};
public:
- FilteredVectorTileLayer(const VectorTileLayer& layer, const FilterExpression &filterExpression);
+ FilteredVectorTileLayer(const VectorTileLayer&, const FilterExpression&);
iterator begin() const;
iterator end() const;
-
-private:
- const VectorTileLayer& layer;
- const FilterExpression& filterExpression;
};
-std::ostream& operator<<(std::ostream&, const PositionedGlyph& placement);
+class VectorTileLayer : public GeometryTileLayer {
+public:
+ VectorTileLayer(pbf);
-class VectorTileLayer {
public:
- VectorTileLayer(pbf data);
-
- const pbf data;
- std::string name;
- uint32_t extent = 4096;
- std::vector<std::string> keys;
- std::unordered_map<std::string, uint32_t> key_index;
- std::vector<Value> values;
- std::map<std::string, std::map<Value, Shaping>> shaping;
+ const pbf layer_pbf;
};
-class VectorTile {
+class VectorTile : public GeometryTile {
public:
- VectorTile();
- VectorTile(pbf data);
- VectorTile& operator=(VectorTile&& other);
-
- std::map<std::string, const VectorTileLayer> layers;
+ VectorTile(pbf);
};
-
-
}
#endif