-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better and faster labeling #1079
Merged
Merged
Conversation
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
The general idea is to generate fewer, separate boxes used for placement and only generate glyphs for rendering after features have been placed. This commit breaks lots of things.
like highway shields
Conflicts: js/data/create_bucket.js js/source/vector_tile_source.js js/source/worker.js js/source/worker_tile.js js/symbol/collision.js
For overscaled tiles, line label interpolation now places labels in the same places it placed them in the parent tile, so that when you zoom the labels don't shift.
Keep upright
https://github.com/mapbox/bboxify-labels/ at e432c592f25c2a89bc87861adabd02a2a3575729
Start another redoPlacement request only when the previous one has finished.
Conflicts: js/data/symbol_bucket.js js/render/painter.js js/source/vector_tile_source.js js/source/worker.js js/source/worker_tile.js js/style/style.js js/symbol/glyph_source.js shaders/icon.vertex.glsl shaders/sdf.vertex.glsl
See the comment in the commit for more details.
Labels should mostly not overlap in perspective view. The problem is that the angle from the camera to the surface is different at the lower edge compared to the upper edge. This means that labels near the upper edge cover a larger area than at the bottom edge, even after they have been scaled for size. The only way to really fix this is to redo placement when panning in the y direction. The current implementation seems like it might be ok, so let's try this for a while and see how it works.
Otherwise minScale is sometimes NaN and then GlyphVertexBuffer.add can't be optimized ("optimized too many times" warning).
I've been following all your commits here so nothing left to review now. AMAZING. Can't wait to see this merged. |
This was referenced Mar 11, 2015
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Labeling is now faster and denser. Especially for rotated map views.
before / after for rotated view
We made it faster by using a different representation of labels for collisions than for rendering. For collisions we now represent a label as a series of boxes spacing along the line. Unlike the rendered glyphs, they do not slide along the line and a single box does not represent a single glyph. It's less precise, but way faster. Separating the collision representation from the rendering representation also made the code a lot cleaner.
Making it faster means we can redo placement frequently. We redo placement whenever you rotate the map, which fixes density issues related to rotation.
The new collision debug view, enabled with
map.collisionDebug = true
, has been very useful:Other improvements:
text-max-angle
now checks the total anchor within a window the size of a glyph, instead of at individual anglesI also started using types like
SymbolQuad
andPositionedGlyph
instead of just{ ... }
, and renaming things that had multiple meanings (like "glyph")./source/*
for redoing placement on rotation?test-suite pr: mapbox/mapbox-gl-test-suite#18