This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Restore AnnotationSource maximum zoom range to 22 #5517
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule .mason
updated
22 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,14 +337,17 @@ RenderData Style::getRenderData(MapDebugOptions debugOptions) const { | |
} | ||
|
||
std::vector<Feature> Style::queryRenderedFeatures(const QueryParameters& parameters) const { | ||
std::vector<Feature> result; | ||
std::unordered_map<std::string, std::vector<Feature>> resultsByLayer; | ||
|
||
for (const auto& source : sources) { | ||
auto sourceResults = source->baseImpl->queryRenderedFeatures(parameters); | ||
std::move(sourceResults.begin(), sourceResults.end(), std::inserter(resultsByLayer, resultsByLayer.begin())); | ||
} | ||
|
||
std::vector<Feature> result; | ||
if (resultsByLayer.empty()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reason as before - this is an early return. |
||
return result; | ||
} | ||
|
||
// Combine all results based on the style layer order. | ||
for (const auto& layer : layers) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include <mbgl/util/grid_index.hpp> | ||
#include <mbgl/geometry/feature_index.hpp> | ||
#include <mbgl/math/minmax.hpp> | ||
|
||
#include <unordered_set> | ||
|
||
|
@@ -28,9 +29,10 @@ void GridIndex<T>::insert(T&& t, const BBox& bbox) { | |
auto cx2 = convertToCellCoord(bbox.max.x); | ||
auto cy2 = convertToCellCoord(bbox.max.y); | ||
|
||
for (int32_t x = cx1; x <= cx2; x++) { | ||
for (int32_t y = cy1; y <= cy2; y++) { | ||
auto cellIndex = d * y + x; | ||
int32_t x, y, cellIndex; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason for this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two things:
|
||
for (x = cx1; x <= cx2; ++x) { | ||
for (y = cy1; y <= cy2; ++y) { | ||
cellIndex = d * y + x; | ||
cells[cellIndex].push_back(uid); | ||
} | ||
} | ||
|
@@ -48,9 +50,10 @@ std::vector<T> GridIndex<T>::query(const BBox& queryBBox) const { | |
auto cx2 = convertToCellCoord(queryBBox.max.x); | ||
auto cy2 = convertToCellCoord(queryBBox.max.y); | ||
|
||
for (int32_t x = cx1; x <= cx2; x++) { | ||
for (int32_t y = cy1; y <= cy2; y++) { | ||
auto cellIndex = d * y + x; | ||
int32_t x, y, cellIndex; | ||
for (x = cx1; x <= cx2; ++x) { | ||
for (y = cy1; y <= cy2; ++y) { | ||
cellIndex = d * y + x; | ||
for (auto uid : cells[cellIndex]) { | ||
if (seenUids.count(uid) == 0) { | ||
seenUids.insert(uid); | ||
|
@@ -75,7 +78,7 @@ std::vector<T> GridIndex<T>::query(const BBox& queryBBox) const { | |
|
||
template <class T> | ||
int32_t GridIndex<T>::convertToCellCoord(int32_t x) const { | ||
return std::max(0.0, std::min(d - 1.0, std::floor(x * scale) + padding)); | ||
return util::max(0.0, util::min(d - 1.0, std::floor(x * scale) + padding)); | ||
} | ||
|
||
template class GridIndex<IndexedSubfeature>; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The algorithm works fine without checking these boundary conditions right? Why increase the amount of code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an early return - avoids unnecessary creation of
queryGeometry
.