Commit Graph

1683 Commits

Author SHA1 Message Date
John Firebaugh
94f011895c [core] Make Image safer
Provide Image::copy, which handles copying rectangles from a source to a destination, with thorough bounds checking.

Also fixes an indexing error in SpriteAtlas, where the top row of pixels in a wrapped image was copied from the wrong source row.
2017-02-14 12:29:01 -06:00
Jason Wray
4c311a0091 [core] Expose Map::setZoom with anchor parameter 2017-02-13 18:35:04 -05:00
John Firebaugh
a1a639120d [core] Introduce dedicated filter types for $type and $id special cases (#7971)
* [core] Introduce dedicated filter types for $type and $id special cases

* [ios, macos] Special-case $id, $type in predicates

Also support $id ≟ nil.
2017-02-09 14:18:57 -08:00
John Firebaugh
b6e5edc268 [core] Restore support for *-transition properties 2017-02-09 15:08:51 -06:00
John Firebaugh
f35ca0d9df [core, ios, macos] Refactor composite stop types and conversions 2017-02-09 11:16:26 -06:00
Thiago Marcos P. Santos
e6659242bc [core] Do not consider error'ed responses fresh
It has the unwanted side effect of not retrying anymore in case
of error.
2017-02-07 12:17:40 +01:00
Jesse Bounds
22b3834caa [ios, macos] Add support for data-driven property functions 2017-02-02 09:44:42 -08:00
Ivo van Dongen
8a5bff8ee6 [core] default value support in categorical function conversion 2017-02-02 09:44:42 -08:00
John Firebaugh
141e995806 [core] Add support for data-driven styling 2017-02-02 09:44:42 -08:00
Konstantin Käfer
62ea1f2185 [core] remove trailing whitespace, add trailing newlines, add space after // 2017-01-27 11:44:16 +01:00
Konstantin Käfer
46fe0df2a2 [core] add clone() call to Image objects 2017-01-26 15:26:55 +01:00
Thiago Marcos P. Santos
375e31891d [core] Include what you use 2017-01-20 20:24:11 +01:00
Thiago Marcos P. Santos
cbf28083e6 [Qt] Use Qt's OpenGL header 2017-01-20 16:08:04 +01:00
Minh Nguyễn
7ef2843e6a Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.7 2017-01-16 11:38:35 -08:00
John Firebaugh
0c0064c050 [core] Get rid of user-specified refs 2017-01-04 17:38:33 -08:00
John Firebaugh
59803d3025 [core] Use PropertyMap typedef 2017-01-04 17:38:33 -08:00
John Firebaugh
4d6c5b2d3b [core] Remove constexpr from Color
GCC can't cope with it.
2017-01-04 12:10:27 -08:00
John Firebaugh
83309fd369 [core] Filter operator== 2017-01-04 08:52:41 -08:00
Ansis Brammanis
38b5cb0c77 [core, ios] replace altitude with fov
ported from -js: eb6c6596c6a7a61363d30356674e0002153b1d19

`altitude` was a terribly-named variable that was used to indirectly
control the fov. This should eliminate some confusion.

`altitude` was equivalent to `cameraToCenterDistance / height`
2016-12-21 15:46:36 -08:00
Minh Nguyễn
117c8ed1d1 [core] Added URL accessor for tile sources 2016-12-20 21:05:40 -08:00
Minh Nguyễn
a6b1773a44 Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.5-master
Also reran make style-code and manually discarded anything related to fill extrusion layers.
2016-12-20 12:41:40 -08:00
Ivo van Dongen
18730d598d [core] use raii to guard backend deactivation 2016-12-13 10:03:05 -08:00
Ivo van Dongen
c76a933514 [core] use raii to guard backend deactivation 2016-12-12 09:05:23 -05:00
John Firebaugh
3b2a4216a2 [core] Implement circle-stroke properties
Also includes stubs for fill-extrusion layer, because most of the code was auto-generated.
2016-12-09 09:35:21 -08:00
Minh Nguyễn
a39f53df22 [ios, macos] Migrate MGLCustomStyleLayerAdditions to style layer API (#7250)
* [ios, macos] Replaced custom style layer API with MGLOpenGLStyleLayer

Replaced the custom style layer API on MGLMapView with an equally unsupported MGLOpenGLStyleLayer API that nonetheless is consistent with the broader runtime styling API and is compatible with macOS.

Fixed an unrecognized selector crash when wrapping a layer of unrecognized type coming from mbgl.

* [macos] Added lime green layer demo to macosapp

Reprised the demo removed from iosapp in #5091.

* [ios, macos] Rationalized MGLOpenGLStyleLayer API

MGLStyle now strongly references any MGLOpenGLStyleLayer object that’s added to it, in order to prevent pointers from going stale and make it easy for layer drawing code to get more information about the map view. Replaced the MGLOpenGLStyleLayer callback blocks with overridable instance methods. Added internal documentation for each method. Subclassed MGLOpenGLStyleLayer as LimeGreenStyleLayer inside macosapp.

Consolidated -addToMapView: into -addToMapView:belowLayer: to ensure that MGLRedundantLayerException gets raised even if the layer is being inserted rather than added to the bottom of the stack.

* [core] Clarified that rendering happens on the main thread

* [ios, macos] Fixed removing and re-adding MGLOpenGLStyleLayer

Don’t allow index-based layer removal to circumvent -removeFromMapView:, which MGLOpenGLStyleLayer relies on to synchronize the style’s array of MGLOpenGLStyleLayers. When obtaining an MGLOpenGLStyleLayer, get the instance already added to the style instead of creating a new one to wrap the underlying CustomLayer.
2016-12-07 00:01:11 -08:00
John Firebaugh
05b0dcd0f8 [core] Move evaluation algorithm to Function 2016-12-06 15:05:45 -08:00
John Firebaugh
0adf830b9a [core] Inline friend equality operators 2016-12-06 15:05:45 -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
Minh Nguyễn
3503c0e767 Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.4-master 2016-12-03 15:36:42 -08:00
John Firebaugh
7d16824fda [core] Functions must have at least one stop
This is already enforced by the style validator in mapbox-gl-style-spec. Enforce it here too.
2016-12-01 09:00:06 -08:00
John Firebaugh
3d2d57cd30 [core] Assert valid range for color components 2016-11-29 06:52:24 -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
4577c56745 [core] remove unused umbrella header in favor of individual includes 2016-11-22 20:58:51 +01:00
Konstantin Käfer
e76de05402 [build] move logging to util 2016-11-22 20:58:51 +01:00
Konstantin Käfer
117863f111 [build] move headless rendering files to platform/default 2016-11-22 20:58:51 +01:00
Konstantin Käfer
3bc79e316e [build] move default ThreadPool implementation to platform/default 2016-11-22 20:58:51 +01:00
Konstantin Käfer
67ed3ae3eb [build] move GLFW-related files to platform/glfw 2016-11-22 20:58:51 +01:00
Konstantin Käfer
9353fcbf4c [build] move default_styles to platform/default 2016-11-22 20:58:51 +01:00
Konstantin Käfer
a71868fc8d [build] move Reachability to platform/darwin 2016-11-22 20:58:51 +01:00
John Firebaugh
38fcbe21d4 [core] Convert style properties to a tuple-based approach
This converts the style property classes (CirclePaintProperties and so on) to the same tuple-based approach as gl::Attribute and gl::Uniform. The approach is outlined in https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md.

The main advantage of this approach is it allows writing algorithms that work on sets of style properties, without resorting to code generation or manually repetitive code. This lets us iterate on approaches to data-driven properties more easily.

Another advantage is that the cascading, unevaluated, and evaluated states of a set of properties exist as independent structures, instead of individual properties holding their own state. This is a more functional approach that makes data flow clearer and reduces state.
2016-11-17 15:13:38 -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
Bruno de Oliveira Abinader
5dcf7ca18e [linux] Added OSMesa headless backend 2016-11-13 16:10:36 -08:00
Jesse Bounds
edf40bb6d9 [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-11 14:40:04 -08:00
John Firebaugh
66bdbc3b96 [core] Introduce gl::Program template 2016-11-08 08:09:29 -08:00
Bruno de Oliveira Abinader
687ee1e1c9 [build] Remove unused gl/implementation.hpp 2016-11-08 18:02:38 +02:00
Bruno de Oliveira Abinader
d0ac12309b [core] Refactor HeadlessBackend 2016-11-08 18:02:38 +02:00
Bruno de Oliveira Abinader
297c303e88 [core] Refactor HeadlessDisplay 2016-11-08 18:02:38 +02:00
Bruno de Oliveira Abinader
e66cc2e583 [linux] Added OSMesa headless backend 2016-11-04 18:43:08 +02:00
Konstantin Käfer
358701f475 [core] add ability to upload alpha-only textures + images 2016-11-01 18:41:52 +01:00
Bruno de Oliveira Abinader
38f536049a [core] Moved util::log2 to its own header
- Added util::{MIN,MAX}_ZOOM_F to avoid consecutive conversions from
double to float
- Move util::log2 to its own header (part of mbgl/math)
2016-10-31 16:53:07 +02:00