本文整理汇总了C++中LineString::emplace_back方法的典型用法代码示例。如果您正苦于以下问题:C++ LineString::emplace_back方法的具体用法?C++ LineString::emplace_back怎么用?C++ LineString::emplace_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineString
的用法示例。
在下文中一共展示了LineString::emplace_back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::unordered_map<uint32_t, std::vector<IndexedSubfeature>> CollisionIndex::queryRenderedSymbols(const ScreenLineString& queryGeometry) const {
std::unordered_map<uint32_t, std::vector<IndexedSubfeature>> result;
if (queryGeometry.empty() || (collisionGrid.empty() && ignoredGrid.empty())) {
return result;
}
LineString<float> gridQuery;
for (const auto& point : queryGeometry) {
gridQuery.emplace_back(point.x + viewportPadding, point.y + viewportPadding);
}
auto envelope = mapbox::geometry::envelope(gridQuery);
using QueryResult = std::pair<IndexedSubfeature, GridIndex<IndexedSubfeature>::BBox>;
std::vector<QueryResult> features = collisionGrid.queryWithBoxes(envelope);
std::vector<QueryResult> ignoredFeatures = ignoredGrid.queryWithBoxes(envelope);
features.insert(features.end(), ignoredFeatures.begin(), ignoredFeatures.end());
std::unordered_map<uint32_t, std::unordered_set<size_t>> seenBuckets;
for (auto& queryResult : features) {
auto& feature = queryResult.first;
auto& bbox = queryResult.second;
// Skip already seen features.
auto& seenFeatures = seenBuckets[feature.bucketInstanceId];
if (seenFeatures.find(feature.index) != seenFeatures.end())
continue;
if (!polygonIntersectsBox(gridQuery, bbox)) {
continue;
}
seenFeatures.insert(feature.index);
result[feature.bucketInstanceId].push_back(feature);
}
return result;
}