Commit Graph

13 Commits

Author SHA1 Message Date
Minh Nguyễn
fb5b8d34f2 Reimplement style values atop NSExpression (#10726)
* [ios, macos] Import headers, not implementation files

* [core] Added accessors for various expression parameters

Added missing parameter accessors to various expression operator classes, as well as a method on InterpolatorBase and Step that enumerates the stops and their values.

* [ios, macos] Silenced warning in test of error condition

* [ios, macos] Made MGLSphericalPosition boxable

* [ios, macos] Implemented array enumeration during conversion

* [ios, macos] Temporarily ignore heatmap layer type

* [ios, macos] Migrated MGLSymbolStyleLayer.text to NSExpression

MGLSymbolStyleLayer.text is now of type NSExpression instead of MGLStyleValue, as a first step toward migrating the entire layer API from style values to expressions.

Implemented conversions from NSExpression to JSON arrays and vice versa. The most common NSExpression functions are now converted into style expressions, but not all of the most common style expression operators are supported yet.

* [ios, macos] Implemented string coercion

* [ios, macos] Color literals

* [ios, macos] Null constant expressions

* [ios, macos] Convert dictionary literals

* [ios, macos] Interpolation expressions

* [ios, macos] to-boolean, to-number, get from object

* [ios, macos] Variable expressions

Implemented custom expression functions for assigning and referring to variables within the context of an expression. Variables are assigned via a “context dictionary” and applied to an subexpression that is given as another argument to the same expression. Also implemented built-in variable expressions for zoom level and heatmap density.

* [ios, macos] Convert colors, offsets, padding in expressions to JSON objects

* [ios, macos] Expression-based style property getters

Implemented a conversion from mbgl::style::PropertyValues to Objective-C JSON objects, which are then converted to NSExpressions.

* [ios, macos] Consolidated property value–expression conversion in MGLStyleValueTransformer

* [ios, macos] Predicate and expression guide

Extracted documentation about predicates from a documentation comment in MGLVectorStyleLayer.h to a new jazzy guide. Added details about NSExpression support as well. Began updating the “For Style Authors” guide to reflect the transition from style values to expressions.

* [ios, macos] Updated style authoring guide

Updated the Information for Style Authors guide to discuss expressions instead of style functions. Included a table mapping style specification expression operators to NSExpression syntaxes.

* [ios, macos] Migrated codegen templates to expressions

* [ios, macos] Applied expression changes via codegen

Ran make darwin-style-code.

* [macos] Migrated macosapp to expressions

* [ios, macos] Updated style function guide

This guide needs to be thoroughly rewritten, but for now the example code has been migrated to expressions.

* [ios, macos] Eviscerated style function tests

* [ios, macos] Updated changelogs

* [ios] Migrated iosapp to expressions

* [ios, macos] Exposed JSON conversion methods publicly

* [ios, macos] Removed MGLStyleValue, MGLStyleFunction
2018-01-24 00:04:02 -08:00
John Firebaugh
76ed5079a5 [core, ios, macos, android] Add data-driven-styling support for text-font 2018-01-10 15:31:12 -08:00
Anand Thakker
f648cfeef6 Implement Expressions (#9439)
Ports https://github.com/mapbox/mapbox-gl-js/pull/4777 (and its several follow-ups)
2017-11-08 12:34:02 -05:00
Bruno de Oliveira Abinader
f1ac757bd2 [core] GCC 4.9 does not fully support custom variable templates 2017-07-12 20:42:29 +03:00
Lauren Budorick
87a70c4793 [core] Enable property functions for line-width (#9250) 2017-06-19 14:27:43 -07:00
John Firebaugh
e361bcf668 [core] Fix composite function approximation for non-integer stops 2017-06-16 12:46:12 -07:00
Anand Thakker
f59eb822e1 Fix undefined memory access in getCoveringRanges() (#9227)
* Add simple unit tests for SymbolSizeBinder

* Fix bug in symbol size uniform value calculation

For camera functions we were setting the zoom levels in "covering ranges" to
`[(zoom stop <= tile zoom), (zoom stop >= 1 + tile zoom)]`, but then evaluating
the function at `[tile_zoom, tile_zoom + 1]`.

* Check for it != end() before accessing it->first
2017-06-09 06:28:14 -04:00
John Firebaugh
3c23faf65a [core] More complete fix for composite function interpolation edge case
b5b4549 / #8613 handled the edge case for layout properties, but not paint properties. Move the check for a degenerate range to interpolationFactor in order to handle both correctly.
2017-04-20 16:11:57 -07:00
Anand Thakker
b5b4549b6d Fix edge case in composite function interpolation (#8613)
This fixes a bug where, for a zoom value greater than that of the highest zoom
stop, composite function interpolation would return nan. (Blocking a render
test over in #8593)

* Add failing tests for composite function edge case

The failing cases here are:
 - Should interpolate before the first stop
 - Should interpolate past the last stop

* Fix edge case in composite function interpolation

* Hold functions constant outside stop-defined domain
2017-04-03 12:25:36 -04:00
John Firebaugh
0be8309446 [core] Avoid public geometry_tile_data.hpp include 2017-03-28 13:53:19 +02:00
John Firebaugh
f35ca0d9df [core, ios, macos] Refactor composite stop types and conversions 2017-02-09 11:16:26 -06: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