Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Port data-driven styling (property functions) from GL JS #4860

Closed
10 tasks done
ansis opened this issue Apr 27, 2016 · 2 comments
Closed
10 tasks done

Port data-driven styling (property functions) from GL JS #4860

ansis opened this issue Apr 27, 2016 · 2 comments
Assignees
Labels
Core The cross-platform C++ core, aka mbgl feature GL JS parity For feature parity with Mapbox GL JS
Milestone

Comments

@ansis
Copy link
Contributor

ansis commented Apr 27, 2016

Port data-driven styling from GL JS (see mapbox/mapbox-gl-js#1626). DDS is currently exposed as property functions in the style specification.

Master list of what's needed. Not necessarily in implementation order.

  • Refactor existing LayoutProperty and PaintProperty classes such that unevaluated and evaluated properties live in separate structures (in progress, @jfirebaugh).
  • gl::Drawable/gl::Context need support for multiple vertex buffers.
  • Rename FunctionZoomFunction.
  • Add PropertyFunction and ZoomPropertyFunction. Add evaluators for them.
  • Add PropertyFunction and ZoomPropertyFunction as variant types for PropertyValue.
    • Might need to split PropertyValue into one variant for properties that are known to be feature-constant (undefined, constant, or zoom function) and one for properties that are data-driven (property function or zoom property function).
  • Paint properties can no longer be fully evaluated by Style. Instead, pass cascaded paint properties into the bucket. Bucket figures out which are feature constant and which are data-driven, producing a ProgramConfiguration (or PaintConfiguration?). In the ProgramConfiguration:
    • constant properties have a ZoomFunction which will be evaluated by the main thread and the result bound to a uniform
    • data-driven properties have a vertex buffer
  • Decision: for feature-constant properties, should we use glDisableVertexAttribArray/glVertexAttrib* or dynamically-generated shader uniforms?
  • Decision: single "interleaved" vertex buffer for all data-driven paint properties of a layer (requires implementing a custom vector type with runtime-sized elements), or one vertex buffer per data-driven property (can keep using std::vector).
  • Changing a paint property needs to do a worker round trip (if changing to or from data-driven property or updating a data-driven property), or update the PaintConfiguration for each bucket in place (if not).
  • Implement support in SDK bindings.
@1ec5 1ec5 added feature Core The cross-platform C++ core, aka mbgl labels Apr 27, 2016
@brunoabinader brunoabinader added the GL JS parity For feature parity with Mapbox GL JS label Jun 10, 2016
@1ec5 1ec5 changed the title port data driven styling from -js Port data-driven styling (property functions) from GL JS Aug 12, 2016
@brunoabinader brunoabinader self-assigned this Aug 25, 2016
@1ec5 1ec5 mentioned this issue Oct 19, 2016
@1ec5 1ec5 added this to the ios-v3.5.0 milestone Nov 20, 2016
@nitrag
Copy link
Contributor

nitrag commented Feb 2, 2017

Awesome!

So this will this allow MGLShapeSource parsing (mapbox built-in) to dynamically style a MGLPolyline based on feature.properties.line-color from the geojson source?

https://www.mapbox.com/mapbox-gl-js/style-spec/#paint-line-color

@boundsj
Copy link
Contributor

boundsj commented Feb 2, 2017

Yes @nitrag. Platform specific documentation for iOS and macOS is still being worked on in #7924 but you can check out the examples in the tests and the test app today.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl feature GL JS parity For feature parity with Mapbox GL JS
Projects
None yet
Development

No branches or pull requests

5 participants