1 | // License: GPL. For details, see Readme.txt file.
|
---|
2 | package org.openstreetmap.gui.jmapviewer.tilesources;
|
---|
3 |
|
---|
4 | import java.awt.Image;
|
---|
5 |
|
---|
6 | import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Abstract class for OSM Tile sources
|
---|
10 | */
|
---|
11 | public abstract class AbstractOsmTileSource extends TMSTileSource {
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * The OSM attribution. Must be always in line with
|
---|
15 | * <a href="https://www.openstreetmap.org/copyright/en">https://www.openstreetmap.org/copyright/en</a>
|
---|
16 | */
|
---|
17 | public static final String DEFAULT_OSM_ATTRIBUTION = "\u00a9 OpenStreetMap contributors";
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Constructs a new OSM tile source
|
---|
21 | * @param name Source name as displayed in GUI
|
---|
22 | * @param baseUrl Source URL
|
---|
23 | * @param id unique id for the tile source; contains only characters that
|
---|
24 | * are safe for file names; can be null
|
---|
25 | */
|
---|
26 | public AbstractOsmTileSource(String name, String baseUrl, String id) {
|
---|
27 | super(new TileSourceInfo(name, baseUrl, id));
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public int getMaxZoom() {
|
---|
32 | return 19;
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public boolean requiresAttribution() {
|
---|
37 | return true;
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public String getAttributionText(int zoom, ICoordinate topLeft, ICoordinate botRight) {
|
---|
42 | return DEFAULT_OSM_ATTRIBUTION;
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public String getAttributionLinkURL() {
|
---|
47 | return "https://openstreetmap.org/";
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public Image getAttributionImage() {
|
---|
52 | return null;
|
---|
53 | }
|
---|
54 |
|
---|
55 | @Override
|
---|
56 | public String getAttributionImageURL() {
|
---|
57 | return null;
|
---|
58 | }
|
---|
59 |
|
---|
60 | @Override
|
---|
61 | public String getTermsOfUseText() {
|
---|
62 | return null;
|
---|
63 | }
|
---|
64 |
|
---|
65 | @Override
|
---|
66 | public String getTermsOfUseURL() {
|
---|
67 | return "https://www.openstreetmap.org/copyright";
|
---|
68 | }
|
---|
69 | }
|
---|