source: osm/applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractOsmTileSource.java@ 32025

Last change on this file since 32025 was 32025, checked in by wiktorn, 9 years ago

Refactor structure of TMS based classes.

Move OsmMercator initialization to TMSTileSource and switch all TMS
based TileSource so they extend TMSTileSource.

Now WMTSTileSource will not create OsmMercator object that it will not
use anyhow.

AbstractTMSTileSource could be named now AbstractTileBasedTileSource,
but I did not the name change, to maintain history.

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see Readme.txt file.
2package org.openstreetmap.gui.jmapviewer.tilesources;
3
4import java.awt.Image;
5
6import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
7
8/**
9 * Abstract class for OSM Tile sources
10 */
11public 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}
Note: See TracBrowser for help on using the repository browser.