diff options
author | Anand Thakker <github@anandthakker.net> | 2018-03-16 10:33:14 -0400 |
---|---|---|
committer | Anand Thakker <github@anandthakker.net> | 2018-03-16 10:35:13 -0400 |
commit | 20aabaf0532e727b27a54ab4ccb648f487cd1050 (patch) | |
tree | cfe7e146caed8c1f2b82b40fb08e07960811e727 | |
parent | 11d506f8034c02103bc33e06ae8913be7908a877 (diff) | |
download | qtlocation-mapboxgl-upstream/temp-expose-geometrytilefeature.tar.gz |
[TEMPORARY] Expose GeometryTileFeature in public APIupstream/temp-expose-geometrytilefeature
This is a temporary patch to unblock development downstream. The
way we're actually planning to do this will be a bit more involved:
https://github.com/mapbox/mapbox-gl-native/issues/11430
-rw-r--r-- | include/mbgl/util/geometry.hpp | 37 | ||||
-rw-r--r-- | src/mbgl/tile/geometry_tile_data.hpp | 34 |
2 files changed, 37 insertions, 34 deletions
diff --git a/include/mbgl/util/geometry.hpp b/include/mbgl/util/geometry.hpp index a28c59a47d..7057c9bb3d 100644 --- a/include/mbgl/util/geometry.hpp +++ b/include/mbgl/util/geometry.hpp @@ -3,6 +3,8 @@ #include <mapbox/geometry/geometry.hpp> #include <mapbox/geometry/point_arithmetic.hpp> #include <mapbox/geometry/for_each_point.hpp> +#include <mbgl/util/feature.hpp> +#include <mbgl/util/optional.hpp> namespace mbgl { @@ -37,6 +39,41 @@ using LinearRing = mapbox::geometry::linear_ring<T>; template <class T> using Geometry = mapbox::geometry::geometry<T>; + +// Normalized vector tile coordinates. +// Each geometry coordinate represents a point in a bidimensional space, +// varying from -V...0...+V, where V is the maximum extent applicable. +using GeometryCoordinate = Point<int16_t>; + +class GeometryCoordinates : public std::vector<GeometryCoordinate> { +public: + using coordinate_type = int16_t; + + GeometryCoordinates() = default; + GeometryCoordinates(const std::vector<GeometryCoordinate>& v) + : std::vector<GeometryCoordinate>(v) {} + GeometryCoordinates(std::vector<GeometryCoordinate>&& v) + : std::vector<GeometryCoordinate>(std::move(v)) {} + + using std::vector<GeometryCoordinate>::vector; +}; + +class GeometryCollection : public std::vector<GeometryCoordinates> { +public: + using coordinate_type = int16_t; + using std::vector<GeometryCoordinates>::vector; +}; + +class GeometryTileFeature { +public: + virtual ~GeometryTileFeature() = default; + virtual FeatureType getType() const = 0; + virtual optional<Value> getValue(const std::string& key) const = 0; + virtual PropertyMap getProperties() const { return PropertyMap(); } + virtual optional<FeatureIdentifier> getID() const { return {}; } + virtual GeometryCollection getGeometries() const = 0; +}; + template <class S, class T> Point<S> convertPoint(const Point<T>& p) { return Point<S>(p.x, p.y); diff --git a/src/mbgl/tile/geometry_tile_data.hpp b/src/mbgl/tile/geometry_tile_data.hpp index 449d8cab28..5974264fec 100644 --- a/src/mbgl/tile/geometry_tile_data.hpp +++ b/src/mbgl/tile/geometry_tile_data.hpp @@ -13,40 +13,6 @@ namespace mbgl { class CanonicalTileID; -// Normalized vector tile coordinates. -// Each geometry coordinate represents a point in a bidimensional space, -// varying from -V...0...+V, where V is the maximum extent applicable. -using GeometryCoordinate = Point<int16_t>; - -class GeometryCoordinates : public std::vector<GeometryCoordinate> { -public: - using coordinate_type = int16_t; - - GeometryCoordinates() = default; - GeometryCoordinates(const std::vector<GeometryCoordinate>& v) - : std::vector<GeometryCoordinate>(v) {} - GeometryCoordinates(std::vector<GeometryCoordinate>&& v) - : std::vector<GeometryCoordinate>(std::move(v)) {} - - using std::vector<GeometryCoordinate>::vector; -}; - -class GeometryCollection : public std::vector<GeometryCoordinates> { -public: - using coordinate_type = int16_t; - using std::vector<GeometryCoordinates>::vector; -}; - -class GeometryTileFeature { -public: - virtual ~GeometryTileFeature() = default; - virtual FeatureType getType() const = 0; - virtual optional<Value> getValue(const std::string& key) const = 0; - virtual PropertyMap getProperties() const { return PropertyMap(); } - virtual optional<FeatureIdentifier> getID() const { return {}; } - virtual GeometryCollection getGeometries() const = 0; -}; - class GeometryTileLayer { public: virtual ~GeometryTileLayer() = default; |