Create layers based on a list of features. #590
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if you want to use a feature, you need to know what renderers in works in and manually check if those renderers are available on the current platform. If the renderer isn't available, we fall back to the null renderer, which is only useful for the tile layers.
With this change, you can ask for a new layer based on the features you want. If there are any renderers available that support all of the listed features, that renderer will be used. Furthermore, there is now an inherent preference in renderers in the order vgl -> canvas -> d3 -> null, so we'll fall back to a better renderer than the null renderer in many instances.
Features can have capabilities. For instance, the quad feature is only fully implemented in the vgl renderer. Image quads are mostly implemented in the d3 and canvas renderers (when the quad is a parallelogram). Color quads are implemented in the d3 renderer. If you ask for a layer that supports {features: ['quad']}, you could get any of the vgl, d3, or canvas renderers (based on the support of that renderer). If you ask for {features: ['quad.clr']}, you will only get either the vgl or d3 renderer. If you ask for {features: ['quad.img-full']}, only vgl will do.
Many examples have been updated to use this. This means that some examples will now work on more platforms (since they would only work if you have vgl, but now will work in other cases).