diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-05-12 11:51:11 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-05-13 09:01:32 -0700 |
commit | 57fcfabd77a834245e7ae62d4e11439d114eaf71 (patch) | |
tree | c289a849cb2116e544318638de452dc832f56260 /src | |
parent | 58863c3974fa5e41bdf540bc7b85da6f986e60e6 (diff) | |
download | qtlocation-mapboxgl-57fcfabd77a834245e7ae62d4e11439d114eaf71.tar.gz |
[core] Make mapbox::geometry::envelope usable without explicit template arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/geometry/feature_index.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/tile/geometry_tile.hpp | 16 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp index fff2fbd075..d3d523af0a 100644 --- a/src/mbgl/geometry/feature_index.cpp +++ b/src/mbgl/geometry/feature_index.cpp @@ -24,7 +24,7 @@ void FeatureIndex::insert(const GeometryCollection& geometries, const std::string& bucketName) { for (const auto& ring : geometries) { grid.insert(IndexedSubfeature { index, sourceLayerName, bucketName, sortIndex++ }, - mapbox::geometry::envelope<GeometryCoordinates, int16_t>(ring)); + mapbox::geometry::envelope(ring)); } } @@ -59,7 +59,7 @@ void FeatureIndex::query( const GeometryTile& geometryTile, const Style& style) const { - mapbox::geometry::box<int16_t> box = mapbox::geometry::envelope<GeometryCollection, int16_t>(queryGeometry); + mapbox::geometry::box<int16_t> box = mapbox::geometry::envelope(queryGeometry); const float pixelsToTileUnits = util::EXTENT / tileSize / scale; const int16_t additionalRadius = std::min<int16_t>(util::EXTENT, std::ceil(style.getQueryRadius() * pixelsToTileUnits)); diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp index 20efc3c374..4db5d4dbeb 100644 --- a/src/mbgl/tile/geometry_tile.hpp +++ b/src/mbgl/tile/geometry_tile.hpp @@ -28,9 +28,19 @@ enum class FeatureType : uint8_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>; -using GeometryCoordinates = std::vector<GeometryCoordinate>; -using GeometryCollection = std::vector<GeometryCoordinates>; +using GeometryCoordinate = Point<int16_t>; + +class GeometryCoordinates : public std::vector<GeometryCoordinate> { +public: + using coordinate_type = int16_t; + using std::vector<GeometryCoordinate>::vector; +}; + +class GeometryCollection : public std::vector<GeometryCoordinates> { +public: + using coordinate_type = int16_t; + using std::vector<GeometryCoordinates>::vector; +}; class GeometryTileFeature : private util::noncopyable { public: |