[core] Make mapbox::geometry::envelope usable without explicit template arguments

This commit is contained in:
John Firebaugh
2016-05-12 11:51:11 -07:00
parent 58863c3974
commit 57fcfabd77
2 changed files with 15 additions and 5 deletions

View File

@@ -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));

View File

@@ -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: