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

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

Closed

Description

@ansis

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 Function ⇢ ZoomFunction.
  • 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.

Activity

  1. added
    Core
    on Apr 27, 2016
  2. added
    GL JS parity
    on Jun 10, 2016
  3. changed the title [-]port data driven styling from -js[/-] [+]Port data-driven styling (property functions) from GL JS[/+] on Aug 12, 2016
  4. added this to the ios-v3.5.0 milestone on Nov 20, 2016
  5. nitrag commented on Feb 2, 2017

    @nitrag
    Contributor

    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

  6. boundsj commented on Feb 2, 2017

    @boundsj
    Contributor

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CoreGL JS parityfeature

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions