Skip to content

Enable property functions for line-width - #4773

Merged
lbud merged 10 commits into
masterfrom
dds-line-width
Jun 19, 2017
Merged

lbud merged 10 commits into
masterfrom
dds-line-width

Conversation

@lbud

@lbud lbud commented Jun 1, 2017 •

Copy link
Copy Markdown
Contributor

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

Comment thread src/data/bucket/line_bucket.js Outdated
{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'},

@ansis ansis Jun 2, 2017 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

@lbud awesome 🕵️‍♀️ !!

@keyofj

keyofj commented Jun 2, 2017

Copy link
Copy Markdown

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

@anandthakker anandthakker left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

lbud commented Jun 7, 2017

Copy link
Copy Markdown
Contributor Author

@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 force-pushed the dds-line-width branch from 467ed46 to 87a37e9 Compare June 8, 2017 00:32
@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
@lbud
lbud force-pushed the dds-line-width branch from 0e447be to e73cd9e Compare June 19, 2017 19:57
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