Commit Graph

2794 Commits

Author SHA1 Message Date
Ivo van Dongen
b221b6c5fb [core] Swap order of Style::recalculate and Style::relayout
Style::relayout uses source.baseImpl->loaded, a flag which is updated by Style::recalculate. So recalculate first, then relayout.
2016-12-13 12:56:08 -08:00
Ivo van Dongen
bb6973ae90 [core] guard against duplicate layer ids 2016-12-13 10:03:05 -08:00
Ivo van Dongen
18730d598d [core] use raii to guard backend deactivation 2016-12-13 10:03:05 -08:00
Roman Blum
1045934d5e [core, ios, macos] Add image accessor to MGLStyle (#7096)
* [core] Add interface to get image from sprite atlas

* [tests] Add tests for Map::getImage

* [ios, macos] WIP: get MGLImage for name from style

* [ios, macos] Fixed -imageForName:

Convert from sprite images to platform images using the existing encodePNG() function, which is also used for printing. Allow -imageForName: to return nil without an assertion failure. Added a basic test.
2016-12-05 17:16:13 -08:00
Ivo van Dongen
2c4e7ae70f [core] guard against duplicate source id’s 2016-12-02 11:25:30 -08:00
Minh Nguyễn
850b70ff91 [core, ios, macos] Added layers and sources properties to MGLStyle
Added new layers and sources properties to MGLStyle that contain all the style’s layers and sources, respectively. These properties are KVC-compliant with all the mutable to-many methods. Layers are ordered from topmost to bottommost, for consistency with Cocoa APIs where front/first means top and back/last means bottom.

Also added storage for mbgl::style::Source in MGLSource proper for wrapping AnnotationSource. Until the style finishes loading, its name property is set to nil.

Fixes #6003.
2016-11-28 15:45:37 -08:00
Konstantin Käfer
8fa078c086 [core] cache raster tiles 2016-11-22 08:32:02 -08:00
Konstantin Käfer
f968ede11b [core] don't run symbol placement more often than necessary 2016-11-14 10:33:21 -08:00
Jesse Bounds
96a7a4402e [core] Return source and layer ownership (#7014)
When a source or layer is removed transfer ownership back to the
caller so it can (optionally) take it. Preserve the behavior that 
removing a CustomLayer triggers deinitialization.  Deinitialize all 
custom layers when a style is destroyed in case those layers are not 
explicitly removed.
2016-11-13 19:56:29 -08:00
Ivo van Dongen
13a118e3bd [core] symbol layer - recalculate style on icon/text size changes 2016-11-13 16:53:11 -08:00
Bruno de Oliveira Abinader
b7818f2019 [core] Fix render tile ordering when querying sources 2016-11-13 16:10:36 -08:00
John Firebaugh
870d432f34 [core] Separate pathway for notifying workers of new images/glyphs 2016-11-13 15:32:00 -08:00
John Firebaugh
9edda03157 [core] Ensure correct GL context in Map::onLowMemory() 2016-11-09 14:36:44 -08:00
Konstantin Käfer
a4d259c33f [core] move gl::Context to Backend and refactor View 2016-10-25 13:52:36 -07:00
Konstantin Käfer
5cc390d694 [core] separate Backend from View for headless rendering 2016-10-25 13:52:36 -07:00
Ivo van Dongen
b14e83ea40 [core] geojson source - cancel any pending request when setting geojson explicitly 2016-10-25 16:11:36 +02:00
Ivo van Dongen
6277dca898 [core] geojson source - clear cache when json content is set 2016-10-25 16:11:36 +02:00
Ivo van Dongen
068e78a2e7 [core] geojson source - reset req on setURL 2016-10-25 12:47:35 +02:00
Bruno de Oliveira Abinader
e55065e62a [core] Reuse last placement data in CollisionTile::queryRenderedFeatures
To obtain precise results, we:
1. Round scale value to obtain same results from symbol shader.
2. Generate a boost geometry polygon to check if it intersects()
   against all feature boxes.
3. Check if current scale is within each feature's minimum and maximum
   placement scales.
4. De-scale feature boxes when intersecting to account for the
   fractional zoom scaling.
2016-10-25 08:12:31 +03:00
Bruno de Oliveira Abinader
fc6344c546 [core] Added util::polygonIntersectsPolygon 2016-10-25 08:12:31 +03:00
Bruno de Oliveira Abinader
679bfbfb32 [core] Simplify CollisionTile::findPlacementScale
Improve findPlacementScale semantics by moving the check if the
placement scale result is bigger than minimum scale out of the function
scope.
2016-10-25 08:12:31 +03:00
Bruno de Oliveira Abinader
846e57de58 [core] Avoid duplicating edges for CollisionTile
Make 'edges' static to avoid every instance of CollisionTile having its
own copy of it.
2016-10-25 08:12:31 +03:00
Bruno de Oliveira Abinader
8743f11345 [core] Cleanup function signatures in CollisionTile
- Prefer pass-by-value for primitive types.
- Use floating point precision for yStretch to match receiving type.
2016-10-25 08:12:31 +03:00
Ivo van Dongen
e31a2c1c11 [core] fixup formatting 2016-10-21 10:05:00 -07:00
Mike Morris
7bbd49c72c [core] extract weak_ptr mailbox->receive into Mailbox::maybeReceive 2016-10-20 14:39:11 -04:00
Mike Morris
817c26111a [core] [node] pass thread pool impl to Map constructor
Updates mbgl::Map constructor usage everywhere

Adds NodeThreadPool implementation using AsyncQueue to call
Nan::AsyncQueueWorker from main thread
2016-10-20 14:37:36 -04:00
Ivo van Dongen
ab63a9494f [core] reload geojson source on url change 2016-10-20 16:18:08 +03:00
Bruno de Oliveira Abinader
c50577d039 [core] Fix SymbolAnnotation coordinate system conversions 2016-10-19 08:11:41 +03:00
Bruno de Oliveira Abinader
ef62b78fce [core] TileCoordinate::fromLatLng no longer depens on TransformState 2016-10-19 08:11:41 +03:00
Bruno de Oliveira Abinader
2188d68b6c [core] Move TransformState::{un,}project() to Projection 2016-10-19 08:11:41 +03:00
Bruno de Oliveira Abinader
f01a829dc9 [core] Move TransformState::worldSize() to Projection 2016-10-19 08:11:41 +03:00
Bruno de Oliveira Abinader
3a12dd2d4f [core] Skip redundant spherical mercator variable updates in {ease,fly}To 2016-10-19 08:11:41 +03:00
Bruno de Oliveira Abinader
19d3c5ca25 [core] Cleanup SymbolLayout
Reuse reverse rotation matrix from CollisionTile when populating the
collision boxes.
2016-10-13 07:39:25 +03:00
Bruno de Oliveira Abinader
a6d0e21472 [core] Disable stencil test when rendering collision boxes 2016-10-12 19:01:08 +03:00
Bruno de Oliveira Abinader
436a22efe9 [core] Skip duplicated IDs when querying point annotations 2016-10-12 18:58:22 +03:00
Bruno de Oliveira Abinader
36b3ba56b6 [core] Improve Source::Impl readability 2016-10-11 19:36:21 +03:00
Bruno de Oliveira Abinader
7b907b6d1c [core] Use TilePoint in Source::Impl::queryRenderedFeatures 2016-10-11 19:36:21 +03:00
Bruno de Oliveira Abinader
623a124e01 [core] Use query geometry from FeatureIndex into CollisionTile::queryRenderedSymbols 2016-10-11 12:10:32 +03:00
John Firebaugh
38e78e25df [core] No need for feature querying to support multipolygons 2016-10-11 10:54:58 +03:00
Bruno de Oliveira Abinader
efc1bff65f [core] Ignore placement for symbol annotations 2016-10-11 09:55:32 +03:00
Bruno de Oliveira Abinader
22b7436acf [core] Skip placement scale for features that ignore placement 2016-10-11 09:55:32 +03:00
John Firebaugh
5891c7028d Update mapbox-gl-shaders to 98a56d 2016-10-10 12:46:52 -07:00
Bruno de Oliveira Abinader
3b8b68d028 [core] Fix Map::setLatLng behavior
We were erroneously assigning a value to optional<ScreenCoordinate>
(null island), causing it to be a valid anchor for Transform::easeTo.
2016-10-07 17:23:17 +03:00
John Firebaugh
21d7ee11e1 [core] Rationalize shader names
{layer type}{subtype}Shader
2016-10-06 14:47:58 -07:00
John Firebaugh
f438bb68b0 [core] Adhere to vertices/vertexBuffer naming convention 2016-10-05 10:52:19 -07:00
John Firebaugh
da4527cd3a [core] TextureRectVertex ⇢ SymbolVertex 2016-10-05 10:52:19 -07:00
John Firebaugh
9cf57e7142 [core] Make ElementGroup safer
Template on shader types, rather than count. This allows the compiler to enforce using the correct VAO for the shader and PaintMode. This fixes OverdrawMode with circle layers.

While here, avoid using unique_ptrs for groups. Instead, ensure ElementGroup is movable.
2016-10-05 10:52:19 -07:00
John Firebaugh
e4310aa874 [core] Improve attribute binding API 2016-10-05 10:52:19 -07:00
John Firebaugh
b9b8657d43 [core] Put VertexArrayObject in gl namespace 2016-10-05 10:52:19 -07:00
John Firebaugh
73334ac8fa [core] Move shader and uniform to gl directory 2016-10-05 10:52:19 -07:00