Commit Graph

82 Commits

Author SHA1 Message Date
Chris Loer
661b4e0558 [core] Port global symbol query from GL JS:
- Symbol querying is now global instead of per-tile
 - Symbols that bleed over tile boundaries no longer missed in queries
 - Symbol results now sorted based on rendering order (ie overlapping symbols change their sort order when a bearing change causes their render order to change)
 - Placement::retainedQueryData now responsible for maintaining symbol querying data for buckets that may no longer be in the TilePyramid.
2018-05-22 14:12:02 -04:00
Lucas Wojciechowski
a4e2c1af1f [core] Convert "legacy" filters directly into expressions (#11610)
Ports the specialized filter-* expressions from GL JS, adding them to src/mbgl/style/expression/compound_expression.cpp
2018-05-10 12:37:14 -07:00
Chris Loer
a2399a57a2 [core] Make FeatureIndex own GeometryTileData.
Prevents querying a FeatureIndex built against a separate set of data, which can lead to invalid index exceptions.
The GeometryTileWorker 'data' member can still change independently of the data in the feature index, at the time 'setData' is called. The GeometryTileWorker maintains ownership of its local data (which may be used to re-parse) and clones the data for use by the FeatureIndex in the foreground.
2018-04-02 10:39:22 -07:00
Chris Loer
11961d5c31 [core] Consolidate GeometryTile symbol/nonSymbolBuckets
Conversion to one-phase tile loading removed any need to track them separately.
2018-04-02 10:39:22 -07:00
Chris Loer
7f42e3970e [core] Convert GeometryTileWorker to "one-phase" loading
Modest simplification refactoring (issue #10457).
Also, fixes issue #11538, which was caused in part by a hole in the vestigial two-phase loading.
2018-04-02 10:39:22 -07:00
Chris Loer
e5a3a7a451 [core] Fix potential race condition crash in symbol querying..
Second half of fix for issue #11538.

If a global placement took place between the time a tile's non-symbol layout updated and the time new symbol buckets arrived, the tile's new FeatureIndex would be committed, but the global CollisionIndex would be generated against the old symbolBuckets. The mismatch could cause the CollisionIndex to contain indices that didn't exist in the new FeatureIndex, and attempting to access them would generate an out-of-bounds exception.
2018-03-29 09:04:23 -07:00
Chris Loer
f9b6d5f09c [core] Fix potential race condition crash in symbol querying..
First half of fix for issue #11538.

Testing `if (pendingData)` didn't work if there _was_ a data update, but the update was "the data for this tile is now null". In that case, the tile's FeatureIndex would be updated, but the tile's data member would remain unchanged.

In the case of a tile's data being deleted, the matching FeatureIndex would have an empty set of bucketLayerIDs, but the _old_ data would still be in place for querying, and the symbolBuckets might not be updated yet (pending onPlacement). In this case `bucketLayerIDs.at(indexedFeature.bucketName)` could throw an out-of-range exception.
2018-03-29 09:04:23 -07:00
Lucas Wojciechowski
8a3deab733 [core] Add expression filter support (#11251)
* WIP

* WIP

* WIP

* Remove Filter::operator()(const Feature&)

* WIP

* WIP

* WIP

* WIP

* Hook up expression filter evaluator

* Replace `shared_ptr` with &reference

* Fill in implementation of `void operator()(const ExpressionFilter&)`

* Fix failing tests

* Switch back to a shared_ptr per chat with @anandthakker

* Fix benchmark compilation

* Shot in the dark to fix CI

* Shot in the dark to fix CI (part 2)

* Shot in the dark to fix CI (part 3)

* In src/mbgl/style/conversion/filter.cpp, add a port of isExpressionFilter and use it to decide in Converter<Filter>::operator() whether to parse the incoming JSON as an ExpressionFilter or one of the legacy filter types

* Remove bool Filter::operator()(const GeometryTileFeature&) const

*  Ensure the map zoom is passed into filtering operations wherever applicable

* Add expression filter tests

* Addressed PR feedback

* Implement `NSPredicate *operator()(mbgl::style::ExpressionFilter filter)`

* Fix formatting& nit
2018-03-09 11:12:14 +01:00
Chris Loer
fa57224791 [core] GeometryTileData needs to be updated in lockstep with FeatureIndex 2018-01-18 14:36:22 -08:00
Chris Loer
656a6373b9 [core] Synchronize state of CollisionIndex and FeatureIndexes.
Fixes issue #10778, in which mismatch between FeatureIndex and CollisionIndex could lead to inconsistent results or even invalid array access.
2018-01-18 14:36:22 -08:00
Ansis Brammanis
feab36a9fb [core] port minor collision changes from -js (#10764) 2018-01-08 12:57:03 -05:00
Chris Loer
25cfb5863c [core] Symbol cross-fading.
Hold onto tiles after they've been removed from the render tree long enough to run a fade animation on their symbols.
2017-11-17 10:05:15 -08:00
Chris Loer
5bdee52e5c [core] Cleanup in response to review comments 2017-11-17 10:05:15 -08:00
Chris Loer
c0cb210ddc [core] Switch from background to foreground placement
- Background placement code now just generates static symbol buffers
 - Don't render GeometryTiles until their symbols are loaded. This is necessary for the CrossTileSymbolIndex to successfully prevent flicker.
 - SymbolInstances are transferred to SymbolBucket for use on foreground during collision detection
 - Symbols are sorted on foreground by sorting their index buffer but leaving vertex buffers intact (only works within one segment)
 - Vertical glyphs are generated at same time as horizontal glyphs. `reprojectLineLabels` chooses which one to use at render time and hides the other.
 - Icons are now always represented with a single collision box, even if they're placed along a line (this means their rotation alignment may be wrong, but the approach of representing them with multiple collision boxes wasn't very accurate either).
 - Generate vertices for new debug collision boxes and collision circles
 - Only add symbols within tile boundaries (reduces work, avoids double-draw)
 - Update symbol_projection.cpp to support line label projection calls from CollisionIndex.
2017-11-17 10:05:15 -08:00
Ivo van Dongen
e18da38faa [core] remove throttling from geometry tile
- This doesn't work for asynchronous rendering -  see https://github.com/mapbox/mapbox-gl-native/pull/9611
2017-09-22 23:33:56 +03:00
Konstantin Käfer
f659aa4eda [core] make sure tiles are not treated as complete until all worker operations completed
Previously, when we started a worker operation that eventually throws an exception (e.g. due to the tile not being parseable), and then enqueue another worker operation while the first one is processing, we treated the worker as idle once the first operation's error callback fired, even though the second operation was still in progress. Due to our use of coalescing, I was unable to come up with a reliable test since we'd need to reproduce the behavior described above, which is timing dependent.
2017-09-21 12:20:54 +02:00
Konstantin Käfer
1a684c1f48 [core] keep tiles renderable even if a subsequent error occurs
Since 9a9408e811, we marked tiles as non-renderable if an error occured. This lead to situations where a tile was loaded + parsed successfully, then a revalidation attempt occured (e.g. because the resource was stale) which failed. In this case, we used to mark the tile as non-renderable although we could've used the perfectly parsed (stale) resource.
2017-09-21 12:20:54 +02:00
Bruno de Oliveira Abinader
fe8cbc78d3 [core] Added GeometryTileWorker-owned image correlation ID 2017-08-25 23:41:52 +03:00
Bruno de Oliveira Abinader
f3fc9b2b92 [core] Don't throttle placement in still mode 2017-08-25 23:41:52 +03:00
John Firebaugh
d26559bb28 [core] Avoid GeometryTile dependency in FeatureIndex 2017-08-24 13:06:23 -07:00
John Firebaugh
e706ed4b2e [core] Avoid RenderStyle dependency in query code 2017-08-24 13:06:23 -07:00
Ivo van Dongen
551f8baf5a [core] remove dependencies on RunLoop 2017-08-09 12:08:21 +03:00
Ivo van Dongen
3832f8d0d8 [core] renderer interface 2017-07-18 10:45:12 +02:00
Bruno de Oliveira Abinader
3afbfa2de7 [core] GCC 4.9 shadow member warnings 2017-07-12 20:42:29 +03:00
Chris Loer
a0e37fe35b [core] Hold on to tile yStretch value for rendering old symbolBuckets while waiting for new ones. 2017-07-11 09:10:24 -07:00
Chris Loer
59df3a90f4 [core] Improved label pitch-scaling: approximate collision box shapes based on tile distance from camera. 2017-07-11 09:10:22 -07:00
John Firebaugh
3270440f23 [core] Per-tile glyph/icon atlases 2017-06-13 10:18:43 -07:00
John Firebaugh
0b68731207 [core] Per-bucket icon atlases 2017-06-13 10:18:43 -07:00
John Firebaugh
92252849c1 [core] Per-bucket glyph atlases 2017-06-13 10:18:43 -07:00
John Firebaugh
f5d3b850bf [core] Merge RenderLayer::uploadBuckets into RenderSource::startRender 2017-06-13 10:18:43 -07:00
John Firebaugh
74af076d40 [core] Split RenderStyle from Style 2017-06-05 19:38:08 -07:00
John Firebaugh
591af0021b [core] Refactor RenderSource updates
* Eliminate updateBatch in favor of diffing layers and detecting changes to properties upon which layout depends.
* Replace RenderSource::{update,remove,invalidate,reload}Tiles with a single update method
* Replace TilePyramid::{update,remove,invalidate,reload}Tiles with a single update method
* Remove Style& dependency TODO from GeometryTile and TileParameters
2017-06-05 19:38:08 -07:00
John Firebaugh
32589c271c [core] Thread Style parameter through queryRenderedFeatures 2017-06-05 19:38:08 -07:00
John Firebaugh
aa216d0025 [core] Don't use a separate SpriteAtlas for annotation images
Instead, just add them to the Style as needed. Includes changes from #8905 and takes care to avoid regressing #3817.
2017-05-26 11:21:56 -07:00
John Firebaugh
1759603e12 [core] Simplify and fix sprite atlas coordinate calculations
* Always return image metrics exclusive of padding
* Work with integer coordinates whenever possible
* Eliminate redundant SpriteAtlasElement members
* Fix asymmetric re-padding in getIconQuad when pixelRatio != 1
* Add explanatory comments
2017-05-23 12:59:27 -07:00
Chris Loer
77b24bc0d3 [core] Throttle tiles to redo symbol placement at most once every 300ms.
Fixes issue #8435 and prepares for pitch-scaling changes in issue #8967.
2017-05-17 16:25:06 -07:00
Asheem Mamoowala
84e39611a0 [core] Move renderer/* files into sub-folders (#8983)
Move renderer/* files into sub-folders
2017-05-12 17:07:48 -07:00
John Firebaugh
c2a5894f2d [core] Immutable Impls 2017-05-12 11:26:27 -07:00
Bruno de Oliveira Abinader
5d89f6cd92 [core] Avoid calling virtual GeometryTile::cancel() on dtor
warning: Call to virtual function during destruction will not dispatch
to derived class [clang-analyzer-optin.cplusplus.VirtualCall]
2017-05-12 18:07:36 +03:00
John Firebaugh
89f1ffc6d2 [core] UpdateParameters ⇢ TileParameters 2017-05-04 07:29:08 -07:00
John Firebaugh
d5f4d0f05f [core] Move render-related sources out of style directory/namespace
Moves the following to the renderer directory and out of the style namespace:

* CascadeParameters
* PropertyEvaluationParameters
* UpdateParameters
* PropertyEvaluator
* DataDrivenPropertyEvaluator
* CrossFadedPropertyEvaluator
* PaintPropertyBinder
* PaintProperyStatistics
* PossiblyEvaluatedPropertyValue
* TransitioningLight
* EvaluatedLight
2017-05-03 08:30:17 -07:00
John Firebaugh
c2b00378b7 [all] Push querySourceFeatures back out to Map
Once Source and RendererSource are split, Source will no longer have access to tiles.
2017-05-02 08:45:09 -07:00
John Firebaugh
1c42daa152 [core] Tweak handling of annotation special case SpriteAtlas
* Simplify SymbolLayout; it never needs to care about more than one SpriteAtlas.
* Move the reference from SymbolLayer::Impl to SymbolBucket. This is a prerequisite for making layer Impls immutable.
2017-04-26 16:29:44 -07:00
Ivo van Dongen
3c175adf30 [core] split off render layers 2017-04-25 17:23:54 -07:00
Konstantin Käfer
9a9408e811 [core] Render parent raster tiles when ideal tile can't be loaded 2017-04-20 09:38:18 +02:00
Ivo van Dongen
7ddca3b611 [core] account for property functions in query rendered features 2017-04-19 17:21:28 -07:00
Ivo van Dongen
d752235ec7 [core] make Tile::getBucket const 2017-04-19 17:21:28 -07:00
John Firebaugh
a50d7a331b [core] Replace GlyphRangeSet in onGlyphsAvailable with optionals in the map
GlyphRangeSet isn't keyed by FontStack, so using it to indicate that a particular range was loaded could have produced false positives.
2017-04-14 15:39:31 -07:00
Chris Loer
5cdf838a38 [core] De-mutex GlyphAtlas and SpriteAtlas
- Expose glyph and icon information to workers via message interface.
 - Glyph/SpriteAtlas track which tiles have outstanding requests
    and send messages to them when glyphs/icons become available.
 - Remove obsolete "updateSymbolDependentTiles" pathway
 - Symbol preparation for a tile now depends on all glyphs becoming
    available before it can start.
 - Start tracking individual icons needed for a tile, although we don't
    do anything with the information yet.
 - Introduce typedef for GlyphID
2017-04-04 11:33:12 -07:00
Ivo van Dongen
b3ffeceb9e [core] check null data in query source features 2017-03-28 21:31:35 +03:00