Rev | Line | |
---|
[15456] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
| 2 | package org.openstreetmap.josm.data.imagery;
|
---|
| 3 |
|
---|
| 4 | import org.openstreetmap.gui.jmapviewer.JMapViewer;
|
---|
| 5 | import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource;
|
---|
| 6 | import org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo;
|
---|
| 7 | import org.openstreetmap.josm.gui.layer.TMSLayer;
|
---|
| 8 |
|
---|
| 9 | /**
|
---|
| 10 | * JOSM wrapper class that uses min/max zoom settings from imagery settings instead of JMapViewer defaults
|
---|
[15460] | 11 | * @since 15456
|
---|
[15456] | 12 | */
|
---|
| 13 | public class JosmTemplatedTMSTileSource extends TemplatedTMSTileSource {
|
---|
| 14 |
|
---|
| 15 | /**
|
---|
| 16 | * Creates TMS tilesource based on tilesource info
|
---|
[15460] | 17 | * @param info tile source info
|
---|
[15456] | 18 | */
|
---|
| 19 | public JosmTemplatedTMSTileSource(TileSourceInfo info) {
|
---|
| 20 | super(info);
|
---|
[18766] | 21 | if (info instanceof ImageryInfo) {
|
---|
| 22 | getHeaders().putAll(((ImageryInfo) info).getCustomHttpHeaders());
|
---|
| 23 | }
|
---|
[15456] | 24 | }
|
---|
| 25 |
|
---|
| 26 | @Override
|
---|
| 27 | public int getMinZoom() {
|
---|
| 28 | return (minZoom == 0) ? TMSLayer.PROP_MIN_ZOOM_LVL.get() : minZoom;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | // return no more, than JMapViewer supports
|
---|
| 32 | @Override
|
---|
| 33 | public int getMaxZoom() {
|
---|
| 34 | return Math.min((maxZoom == 0) ? TMSLayer.PROP_MAX_ZOOM_LVL.get() : maxZoom, JMapViewer.MAX_ZOOM);
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.