summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry/feature_index.hpp
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2016-04-28 18:00:39 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-04-29 12:00:24 -0700
commit700180a0fecc030ecb8b72e9f9ce1b4bb798b45c (patch)
treec3a3f75628d29596ed21d190a7a07cbb3e06ccad /src/mbgl/geometry/feature_index.hpp
parent61d14089e0dd742719328fd74c693bcae6274a4b (diff)
downloadqtlocation-mapboxgl-700180a0fecc030ecb8b72e9f9ce1b4bb798b45c.tar.gz
[core] use a GridIndex for queryRenderedFeatures
Diffstat (limited to 'src/mbgl/geometry/feature_index.hpp')
-rw-r--r--src/mbgl/geometry/feature_index.hpp33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp
index dc64ea9cee..0b520a841a 100644
--- a/src/mbgl/geometry/feature_index.hpp
+++ b/src/mbgl/geometry/feature_index.hpp
@@ -2,30 +2,12 @@
#define MBGL_GEOMETRY_FEATURE_INDEX
#include <mbgl/tile/geometry_tile.hpp>
+#include <mbgl/util/grid_index.hpp>
#include <vector>
#include <string>
#include <unordered_map>
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wshadow"
-#ifdef __clang__
-#pragma GCC diagnostic ignored "-Wunknown-pragmas"
-#endif
-#pragma GCC diagnostic ignored "-Wpragmas"
-#pragma GCC diagnostic ignored "-Wdeprecated-register"
-#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
-#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#include <boost/geometry.hpp>
-#include <boost/geometry/geometries/point.hpp>
-#include <boost/geometry/geometries/box.hpp>
-#include <boost/geometry/index/rtree.hpp>
-#pragma GCC diagnostic pop
-
namespace mbgl {
class Style;
@@ -40,20 +22,11 @@ class IndexedSubfeature {
size_t sortIndex;
};
-namespace bg = boost::geometry;
-namespace bgm = bg::model;
-namespace bgi = bg::index;
-typedef bgm::point<float, 2, bg::cs::cartesian> TreePoint;
-typedef bgm::box<TreePoint> TreeBox;
-typedef std::pair<TreeBox, IndexedSubfeature> FeatureTreeBox;
-typedef bgi::rtree<FeatureTreeBox, bgi::linear<16, 4>> FeatureTree;
-
class FeatureIndex {
public:
FeatureIndex();
void insert(const GeometryCollection&, std::size_t index, const std::string& sourceLayerName, const std::string& bucketName);
- void loadTree();
void query(
std::unordered_map<std::string, std::vector<std::string>>& result,
@@ -89,8 +62,8 @@ class FeatureIndex {
const float pixelsToTileUnits) const;
std::unique_ptr<CollisionTile> collisionTile;
- std::vector<FeatureTreeBox> treeBoxes;
- FeatureTree tree;
+ GridIndex<IndexedSubfeature> grid;
+ unsigned int sortIndex = 0;
std::unordered_map<std::string,std::vector<std::string>> bucketLayerIDs;