[core] TilePyramind uses TransformState::getScale()

This commit is contained in:
Mikhail Pozdnyakov
2019-06-10 19:04:07 +03:00
parent 1edebf0035
commit 6583204e69
3 changed files with 5 additions and 1 deletions

View File

@@ -54,6 +54,9 @@ public:
uint8_t getIntegerZoom() const;
double getZoomFraction() const;
// Scale
double getScale() const { return scale; }
// Bounds
void setLatLngBounds(LatLngBounds);
LatLngBounds getLatLngBounds() const;

View File

@@ -28,6 +28,7 @@ void RenderTileSource::upload(gfx::UploadPass& parameters) {
void RenderTileSource::prepare(const SourcePrepareParameters& parameters) {
renderTiles.clear();
renderTiles.reserve(tilePyramid.getRenderedTiles().size());
for (auto& entry : tilePyramid.getRenderedTiles()) {
renderTiles.emplace_back(entry.first, entry.second);
renderTiles.back().prepare(parameters);

View File

@@ -314,7 +314,7 @@ std::unordered_map<std::string, std::vector<Feature>> TilePyramid::queryRendered
const UnwrappedTileID& id = entry.first;
Tile& tile = entry.second;
const float scale = std::pow(2, transformState.getZoom() - id.canonical.z);
const float scale = transformState.getScale() / (1 << id.canonical.z); // equivalent to std::pow(2, transformState.getZoom() - id.canonical.z);
auto queryPadding = maxPitchScaleFactor * tile.getQueryPadding(layers) * util::EXTENT / util::tileSize / scale;
GeometryCoordinate tileSpaceBoundsMin = TileCoordinate::toGeometryCoordinate(id, box.min);