Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable property functions for line-width #4773

Merged
merged 10 commits into from
Jun 19, 2017
Merged

Enable property functions for line-width #4773

merged 10 commits into from
Jun 19, 2017

Conversation

lbud
Copy link
Contributor

@lbud lbud commented Jun 1, 2017

Ref #3045

The challenge in implementing data-driven line-width has been that line-dasharray is scaled by line-width, so dasharray calculations require the value of a line's width at floor(zoom). This PR accomplishes data-driven line-width by moving that calculation to the shader and adding an additional, sort of phantom paint attribute that calculates the value of line-width at floor(zoom). This required a bit of special casing in program_configuration but given the existing situation seemed to me the best option. This would nullify #4158. @ansis @jfirebaugh @nickidlugash @anandthakker — does this seem reasonable?

I verified manually with a matrix of
{ line-width: [constant, zoom, property, zoom-and-property] }
x
{ line-dasharray: [none, constant, zoom] }
and added render tests here to the same effect (the naming in the render suite is a bit verbose 💁).

Launch Checklist

@@ -50,6 +50,8 @@ const lineInterface = {
{property: 'line-opacity', multiplier: 10, type: 'Uint8'},
{property: 'line-gap-width', multiplier: 10, type: 'Uint8', name: 'a_gapwidth'},
{property: 'line-offset', multiplier: 1, type: 'Int8'},
{property: 'line-width', multiplier: 10, type: 'Uint8', name: 'a_width'},
{property: 'line-width', multiplier: 10, type: 'Uint8', name: 'a_floorwidth'},
Copy link
Contributor

@ansis ansis Jun 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach looks great!

I wonder if adding a useIntegerZoom: true to the property definition here and using that to making the if (name === 'a_floorwidth') exceptions less exceptional would be good. Or if that would just hide the exception in a bad way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I like that idea

@mollymerp
Copy link
Contributor

@lbud awesome 🕵️‍♀️ !!

@keyofj
Copy link

keyofj commented Jun 2, 2017

Thanks for making this a priority. Dynamic line-width is an important feature.

Copy link
Contributor

@anandthakker anandthakker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach! I don't even think there's a net increase in hackery here: the new special case logic in ProgramConfiguration is offset by the removal of special case handling in LineStyleLayer 🎉

"maxzoom": 14,
"tiles": [
"local://tiles/{z}-{x}-{y}.mvt"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be in favor of simplifying these render tests using some bare-bones GeoJSON, as that'll make em easier to understand/assess.

@lbud
Copy link
Contributor Author

lbud commented Jun 7, 2017

@anandthakker thanks for the suggestion — simplified geojson fixtures in 467ed46

@lbud lbud changed the title [not ready] Enable property functions for line-width Enable property functions for line-width Jun 7, 2017
@lbud lbud changed the title Enable property functions for line-width [not ready] Enable property functions for line-width Jun 8, 2017
@lbud lbud changed the title [not ready] Enable property functions for line-width Enable property functions for line-width Jun 8, 2017
@lbud lbud force-pushed the dds-line-width branch 2 times, most recently from 314aeb9 to 0e447be Compare June 16, 2017 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants