Commit Graph

96 Commits

Author SHA1 Message Date
Ansis Brammanis
4f18d5fa92 [core] sort symbols using symbol-sort-key before placement (#16023)
fix #15964
partially port mapbox/mapbox-gl-js#9054
2020-02-11 11:24:14 -05:00
Mikhail Pozdnyakov
1f5c6beb64 [tile mode] Improvements in symbol placement on tile borders
This change fixes the following problems:
1) Before this change, when multiple symbols were grouped close to the
tile borders, different tiles could place different symbols, because each
tile arbitrary assigned feature ids, and these ids defined the placement
order being applied. This caused artifacts at the tile boundaries.

With this change, in tile mode the placement order of two symbols crossing
a tile border is defined by their anchor `y` values. It means that the
symbols are being placed the same order across all the tiles.

2) Before this change, the engine did not place with priority the symbols
crossing the borders between two neighboring tiles. Now it does, and it
improves a lot symbol placement stability in the tile map mode.
2020-02-03 21:26:35 +02:00
Mikhail Pozdnyakov
951b90c778 [tile mode] Fix variable symbols placement
This commit allows the variable symbols to cross the tile border only
if their anchor is the first anchor from the `text-variable-anchor` list.
2020-01-27 17:51:07 +02:00
Mikhail Pozdnyakov
a9d04d7b1a [core] Do not index and place the off-screen symbols for overscaled tiles
For overscaled tiles the viewport might be showing only a small part of the
tile, so we filter out the off-screen symbols to improve the performance.
2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
4dac2f61c2 [core] Simplify Placement::addLayer() 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
5a4568b2ac [core] Avoid repeated calculations in symbol placement 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
f70cadf2e0 [core] Cache showCollisionBoxes in Placement 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
769a822fec [core] Pass UpdateParameters to Placement constructor 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
5af128f205 [core] Pass placement commit parameters in constructor 2020-01-22 14:30:26 +02:00
Konstantin Käfer
4b171cccf1 [core] getGlyphQuad -> getGlyphQuads 2020-01-15 15:02:11 +02:00
Mikhail Pozdnyakov
0379615388 [core] Introduce CollisionIndex::getProjectedCollisionBoundaries()
In order to remove the repeated code.
2020-01-08 12:43:26 +02:00
Mikhail Pozdnyakov
141e4e7935 [core] Introduce CollisionBoundaries and use it in CollisionIndex 2020-01-08 12:43:26 +02:00
Mikhail Pozdnyakov
cf2946c8ff [core] Use only the first variable anchor for the symbols intersecting tile borders
Do not try the following variable anchors, if the first variable anchor placement failed.
2020-01-08 12:43:26 +02:00
Mikhail Pozdnyakov
c25fbe9a94 [core] Performance fix for placement in tile mode 2020-01-08 12:43:26 +02:00
Mikhail Pozdnyakov
2040d4d6f5 [core] In tile mode, place labels from tile borders first 2020-01-08 12:43:26 +02:00
Mikhail Pozdnyakov
7e5dc5608a [core] Pre-defined variable anchor at tile borders
In tile mode, stick to the first variable anchor if the label intersects tile borders.
2020-01-08 12:43:26 +02:00
Mikhail Pozdnyakov
2125548a6e [core] Consolidate more logic in calculateVariableLayoutOffset() 2020-01-08 12:43:26 +02:00
Mikhail Pozdnyakov
1829fb5e40 [core] Placement::commit() handles absence of previuos placement 2019-12-09 17:32:49 +02:00
Mikhail Pozdnyakov
ffd378c68e [core] Simplify placement code path for still and tile modes 2019-12-09 17:32:49 +02:00
Ansis Brammanis
cdee5b8249 [core] increase padding in CollisionIndex for MapMode::Tile (#15880)
* [core] fix cutoff cross-tile labels in MapMode::Tile

Increase the CollisionIndex's padding so that more of a tile's data gets
considered when checking for collisions. This should fix clipped
variable placement text labels.
2019-12-06 18:11:25 -05:00
Ansis Brammanis
4fb75ba32c [core] avoid edges for labels that use text-variable-anchors
to prevent clipped labels in rendered image tiles.
2019-10-24 15:39:10 +03:00
Ansis Brammanis
99feb9bb30 [core] fix collisions with icon-text-fit and variable placement (#15828)
port 61a61a1982cb8c637d467f91da5b0817a61a9de6
2019-10-22 20:30:55 -04:00
Mikhail Pozdnyakov
097cf5fc39 [core] Clang format fix 2019-09-19 14:51:32 +03:00
Mikhail Pozdnyakov
f04efb69c0 [core] Immutable/Mutable pattern for Placement 2019-09-19 14:51:32 +03:00
Mikhail Pozdnyakov
870f306f68 [core] Update buckets in Renderer 2019-09-19 14:51:32 +03:00
Mikhail Pozdnyakov
f997ae00ae [core] Fix Placement constness
Update buckets methods do not mutate placement, placement methods do not mutate buckets.
2019-09-19 14:51:32 +03:00
Mikhail Pozdnyakov
0d9e4afd20 [core] Coalesce buckets updates from several tiles 2019-09-13 13:45:48 +03:00
Mikhail Pozdnyakov
f9c15f708e [core] Fix placement for updated buckets
Buckets update initiates new placement, so that
newly added symbols are placed and shown immediately.
2019-09-13 13:45:48 +03:00
Mikhail Pozdnyakov
3b5a43c722 [core] Enable text-offset with variable label placement
Port of https://github.com/mapbox/mapbox-gl-js/pull/8642
2019-09-03 11:45:17 +03:00
zmiao
6ef2710e5c [core] fix collisionBox alignment when Icon/text translation is enabled (#15467)
* add initial fix

* fix bug for collision circle

* refind code structure

* fix indentation

* update test

* refind code structure

* Add changelog

* Add comment for boolean
2019-08-30 08:24:03 +03:00
zmiao
c770c23262 [core] fix mixed sdf + non-sdf icon rendering in one layer (#15456)
* [core] fix icon symbol rendring when sdf and non-sdf icon in the same symbol layer

* fix build error

* fix typo

* revert renderableSegment change

* simplify codes

* fix build error

* refine sdf icon flag

* [core] fix mixed sdf + non-sdf icon rendering in one layer

* remove iconstatus getter in stymbol bucket

* fix review findings

* provide bitwise operator for SymbolContent enum

* use MBGL_MBGL_CONSTEXPR

* add one missing update for sdfIcon

* make renderer symbol type as enum
2019-08-26 21:54:59 +03:00
Ansis Brammanis
888d2b06ec speed up fading when zooming even more
And a linear adjustment seems to make more sense.
2019-08-20 13:34:22 +03:00
Ansis Brammanis
7d9b54a573 [core] make symbols fade out faster while zooming out
Zooming outcan make symbols overlap quickly. The area previously covered
by the viewport is covered by a lot of colliding labels while the
surrounding area has no labels. This difference produces an unwanted
effect.

This reduces that effect by:
- reducing the fade duration while zooming out
- doing placement more frequently while zooming out
2019-08-20 13:34:22 +03:00
Alexander Shalamov
9ba700fd47 [core] Fix combination of icon-text-fit with text-variable-anchors and text-writing-mode 2019-08-20 12:31:02 +03:00
Alexander Shalamov
cd129612c1 [core] Clear collision text boxes between symbol placement iterations 2019-08-14 13:54:53 +03:00
Mikhail Pozdnyakov
f660e1be2d [core] Enable variable placement with allowed text overlap 2019-08-13 15:20:46 +03:00
Mikhail Pozdnyakov
ead7132548 [core] Simplifications to variable text placement code path 2019-08-13 15:20:46 +03:00
Alexander Shalamov
9aa529576f [core] Implement support for "text-writing-mode" layout property 2019-08-13 13:32:56 +03:00
Mikhail Pozdnyakov
c763c262c8 [core] Remove ProjectedCollisionBox from CollisionBox
- Minus 20 bytes from CollisionBox size.
- Fix constness at Placement::placeBucket
2019-08-05 16:13:26 +03:00
Mikhail Pozdnyakov
65d2f7ed6a [core] Introduce ProjectedCollisionBox type
ProjectedCollisionBox encapsulates geometry of the projected
collision box, it is using union and thus provides memory save
- 12 bytes per collision box instance.
2019-08-05 16:13:26 +03:00
Mikhail Pozdnyakov
cafecd3f6f [core] Introduce VertexVector::extend() and use it in placement code. 2019-07-23 16:55:25 +03:00
Alexander Shalamov
ac74fc6d00 [core] Release quad data after vertex buffers are created 2019-07-23 15:43:27 +03:00
Mikhail Pozdnyakov
e582a329ef [core] SymbolBacket creates collision buffers optionally
sizeof(SymbolBucket) : 1024 -> 704
2019-07-22 12:23:39 +03:00
Mikhail Pozdnyakov
11bfe23981 [core] Symbol bucket uses shared layout
sizeof(SymbolBucket): 2296 -> 1024
2019-07-22 12:23:39 +03:00
Mikhail Pozdnyakov
8574b8b726 [core] Favor previous anchor only when still in the text-variable-anchor options
Port of https://github.com/mapbox/mapbox-gl-js/pull/8473
2019-07-17 14:52:47 +03:00
Mikhail Pozdnyakov
d570834975 [core] Remove orchestration methods from RenderTile 2019-07-04 16:56:43 +03:00
Mikhail Pozdnyakov
b242883587 [core] Use fresh transform state for bucket vertices update in placement
The transform state cached in placement might get stale and cannot be used for bucket vertices updates.
2019-06-03 17:03:57 +03:00
Mikhail Pozdnyakov
a44b7f1e5d [core] Avoid unneeded update of symbol dynamic vertex buffer 2019-06-03 17:03:57 +03:00
Mikhail Pozdnyakov
43966f1611 [core] Placement::placeLayerBucket() -> placeBucket() 2019-05-28 16:16:42 +03:00
Mikhail Pozdnyakov
054645042a [core] Encapsulate symbol bucket placement code in Placement::placeLayerBucket() 2019-05-28 16:16:42 +03:00