1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#pragma once
#include <mbgl/style/types.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/util/grid_index.hpp>
#include <mbgl/util/feature.hpp>
#include <vector>
#include <string>
#include <unordered_map>
namespace mbgl {
class RenderedQueryOptions;
class RenderLayer;
class CollisionTile;
class CanonicalTileID;
class IndexedSubfeature {
public:
IndexedSubfeature() = delete;
std::size_t index;
std::string sourceLayerName;
std::string bucketName;
size_t sortIndex;
};
class FeatureIndex {
public:
FeatureIndex();
void insert(const GeometryCollection&, std::size_t index, const std::string& sourceLayerName, const std::string& bucketName);
void query(
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCoordinates& queryGeometry,
const float bearing,
const double tileSize,
const double scale,
const RenderedQueryOptions& options,
const GeometryTileData&,
const CanonicalTileID&,
const std::vector<const RenderLayer*>&,
const CollisionTile*,
const float additionalQueryRadius) const;
static optional<GeometryCoordinates> translateQueryGeometry(
const GeometryCoordinates& queryGeometry,
const std::array<float, 2>& translate,
const style::TranslateAnchorType,
const float bearing,
const float pixelsToTileUnits);
void setBucketLayerIDs(const std::string& bucketName, const std::vector<std::string>& layerIDs);
private:
void addFeature(
std::unordered_map<std::string, std::vector<Feature>>& result,
const IndexedSubfeature&,
const GeometryCoordinates& queryGeometry,
const RenderedQueryOptions& options,
const GeometryTileData&,
const CanonicalTileID&,
const std::vector<const RenderLayer*>&,
const float bearing,
const float pixelsToTileUnits) const;
GridIndex<IndexedSubfeature> grid;
unsigned int sortIndex = 0;
std::unordered_map<std::string, std::vector<std::string>> bucketLayerIDs;
};
} // namespace mbgl
|