fix symbol collision detection in perspective view

This commit is contained in:
Ansis Brammanis
2015-08-14 19:00:21 +03:00
parent 494489f9a0
commit bc92c2de39
12 changed files with 33 additions and 24 deletions

View File

@@ -16,6 +16,7 @@ VectorTileData::VectorTileData(const TileID& id_,
Style& style_,
const SourceInfo& source_,
float angle,
float pitch,
bool collisionDebug)
: TileData(id_),
worker(style_.workers),
@@ -27,7 +28,7 @@ VectorTileData::VectorTileData(const TileID& id_,
state,
std::make_unique<CollisionTile>(id_.z, 4096,
source_.tile_size * id.overscaling,
angle, collisionDebug)),
angle, pitch, collisionDebug)),
source(source_),
lastAngle(angle),
currentAngle(angle) {
@@ -98,11 +99,14 @@ Bucket* VectorTileData::getBucket(const StyleLayer& layer) {
return tileWorker.getBucket(layer);
}
void VectorTileData::redoPlacement(float angle, bool collisionDebug) {
if (angle == currentAngle && collisionDebug == currentCollisionDebug)
void VectorTileData::redoPlacement(float angle, float pitch, bool collisionDebug) {
if (angle == currentAngle &&
pitch == currentPitch &&
collisionDebug == currentCollisionDebug)
return;
lastAngle = angle;
lastPitch = pitch;
lastCollisionDebug = collisionDebug;
if (state != State::parsed || redoingPlacement)
@@ -110,9 +114,10 @@ void VectorTileData::redoPlacement(float angle, bool collisionDebug) {
redoingPlacement = true;
currentAngle = angle;
currentPitch = pitch;
currentCollisionDebug = collisionDebug;
workRequest = worker.redoPlacement(tileWorker, angle, collisionDebug, [this] {
workRequest = worker.redoPlacement(tileWorker, angle, pitch, collisionDebug, [this] {
for (const auto& layer : tileWorker.layers) {
auto bucket = getBucket(*layer);
if (bucket) {
@@ -120,7 +125,7 @@ void VectorTileData::redoPlacement(float angle, bool collisionDebug) {
}
}
redoingPlacement = false;
redoPlacement(lastAngle, lastCollisionDebug);
redoPlacement(lastAngle, lastPitch, lastCollisionDebug);
});
}