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

Exclusive and Priority for SceneLayer #2046

Merged
merged 10 commits into from
Mar 30, 2020
Merged

Conversation

tallytalwar
Copy link
Member

@tallytalwar tallytalwar commented Feb 27, 2019

  • Sort SceneLayers such that all exclusive layers come before
    non-exclusive layers and in order of increasing priority

TODO:

  • Add unit test covering priority and exclusive properties.

Resolves #2036

@tallytalwar tallytalwar force-pushed the layer-exclusive-priority branch 2 times, most recently from 6bb0d8a to cfb40ac Compare March 8, 2019 22:44
tallytalwar and others added 2 commits March 9, 2020 02:16
- Sort SceneLayers such that all exclusive layers come before
non-exclusive layers and in order of increasing priority
@matteblair matteblair force-pushed the layer-exclusive-priority branch from cfb40ac to d398335 Compare March 15, 2020 01:19
@matteblair matteblair marked this pull request as ready for review March 23, 2020 00:33
@matteblair
Copy link
Member

After a year in limbo, this PR is finally ready!

This now implements the exclusive and priority parameters for scene layers as described in #2036. I also added tests for this feature and refactored a lot of the surrounding code to simplify logic and improve clarity.

The scene layer sorting in this implementation looks a bit different than that in the Tangram JS implementation (tangrams/tangram#705). This is because we have a different way of traversing the layer tree when evaluating rules for a feature. Basically, when draw rules are being merged we keep the first value that is set for a parameter, unless the new one is from a greater depth. So, for sibling layers to follow the rules of exclusive and priority, we just sort them by exclusivity first, then by priority, and finally by fully-qualified name (in reverse-alphabetical order).

@matteblair
Copy link
Member

This is looking good to go!

The one thing I've found from starting to use this feature is that I frequently encounter layers where every sublayer can or should be exclusive: true. This is common when a set of sublayers categorize features by a single tag like kind. It would be convenient in these cases to have a shorthand like sublayers_exclusive: true to write once on the parent layer in these cases.

@matteblair matteblair merged commit d5cdf97 into master Mar 30, 2020
@matteblair matteblair deleted the layer-exclusive-priority branch March 30, 2020 07:27
@tallytalwar
Copy link
Member Author

Sorry COVID-19 situation means I rarely get cycles to check tangram notifications. This looks good to me and thanks a lot @matteblair for continuing this work from where I left off!

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.

More layer matching control with priority and exclusive
2 participants