void TestContainment(const vector<S2Point>& points,
const vector<S2Polygon*>& polygons) {
MutableS2ShapeIndex index;
for (auto polygon : polygons) {
index.Add(absl::make_unique<S2Polygon::Shape>(polygon));
}
auto query = MakeS2ContainsPointQuery(&index);
for (const auto& point: points) {
for (S2Shape* shape : query.GetContainingShapes(point)) {
S2Polygon* polygon = polygons[shape->id()];
... do something with (point, polygon) ...
}
}
}
From https://s2geometry.io/devguide/s2shapeindex.html:
This code does not compile for several reasons:
GetContainingShapesnow returnsstd::vector<const S2Shape*>id()function inS2Shape(removed in this commit: 84bfd2c)