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

Improve and simplify Mercator layers management #847

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ComBatVision
Copy link

Description of the Changes

Refactor MercatorTiledImageLayer to include all general initialization, such as: sector, zero level delta, display name, image size, detectBlankImages and mapSizeForLevel calculation into parent constructor. This makes child layers avoiding unnecessary copy-paste code.
Added first level offset parameter which allows to skip several top levels to avoid displaying one tile over whole globe.
Added alternative way of determining tile URL by overriding getImageSourceUrl function. This allows to create additional online layers by setting several parameters in constructor and overriding one function with URL builder instead of separate URL builder creation.

Why Should This Be In Core?

This feature simplify adding new typical online layers such as Google, OSM, OTM. Wiki, etc by only specifying core parameters without unnecessary copy-paste of the same logic.
This approach already implemented in Java and will be implemented in Android.

Benefits

Simple Mercator online sources creation.

Potential Drawbacks

Less flexibility of constructor.

Inheritance of displayName and pickEnabled reviewed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant