Named exports from ol/source/OSM

This commit is contained in:
Tim Schaub
2018-02-25 08:23:05 -07:00
parent 33d91f1b89
commit 42cf5f8511
4 changed files with 21 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ import LineString from '../src/ol/geom/LineString.js';
import Point from '../src/ol/geom/Point.js';
import TileLayer from '../src/ol/layer/Tile.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import OSM from '../src/ol/source/OSM.js';
import OSM, {ATTRIBUTION} from '../src/ol/source/OSM.js';
import VectorSource from '../src/ol/source/Vector.js';
import CircleStyle from '../src/ol/style/Circle.js';
import Fill from '../src/ol/style/Fill.js';
@@ -86,7 +86,7 @@ const map = new Map({
source: new OSM({
attributions: [
'All maps © <a href="https://www.opencyclemap.org/">OpenCycleMap</a>',
OSM.ATTRIBUTION
ATTRIBUTION
],
url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' +
'?apikey=0e6fc415256d4fbb9b5166a718591d71'

View File

@@ -2,14 +2,14 @@ import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
import OSM, {ATTRIBUTION} from '../src/ol/source/OSM.js';
const openCycleMapLayer = new TileLayer({
source: new OSM({
attributions: [
'All maps © <a href="https://www.opencyclemap.org/">OpenCycleMap</a>',
OSM.ATTRIBUTION
ATTRIBUTION
],
url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' +
'?apikey=0e6fc415256d4fbb9b5166a718591d71'
@@ -20,7 +20,7 @@ const openSeaMapLayer = new TileLayer({
source: new OSM({
attributions: [
'All maps © <a href="http://www.openseamap.org/">OpenSeaMap</a>',
OSM.ATTRIBUTION
ATTRIBUTION
],
opaque: false,
url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'

View File

@@ -4,6 +4,19 @@
import {inherits} from '../index.js';
import XYZ from '../source/XYZ.js';
/**
* The attribution containing a link to the OpenStreetMap Copyright and License
* page.
* @const
* @type {string}
* @api
*/
export const ATTRIBUTION = '&copy; ' +
'<a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
'contributors.';
/**
* @classdesc
* Layer source for the OpenStreetMap tile server.
@@ -21,7 +34,7 @@ const OSM = function(opt_options) {
if (options.attributions !== undefined) {
attributions = options.attributions;
} else {
attributions = [OSM.ATTRIBUTION];
attributions = [ATTRIBUTION];
}
const crossOrigin = options.crossOrigin !== undefined ?
@@ -46,15 +59,4 @@ const OSM = function(opt_options) {
inherits(OSM, XYZ);
/**
* The attribution containing a link to the OpenStreetMap Copyright and License
* page.
* @const
* @type {string}
* @api
*/
OSM.ATTRIBUTION = '&copy; ' +
'<a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
'contributors.';
export default OSM;

View File

@@ -2,7 +2,7 @@
* @module ol/source/Stamen
*/
import {inherits} from '../index.js';
import OSM from '../source/OSM.js';
import {ATTRIBUTION as OSM_ATTRIBUTION} from '../source/OSM.js';
import XYZ from '../source/XYZ.js';
@@ -14,7 +14,7 @@ const ATTRIBUTIONS = [
'Map tiles by <a href="https://stamen.com/">Stamen Design</a>, ' +
'under <a href="https://creativecommons.org/licenses/by/3.0/">CC BY' +
' 3.0</a>.',
OSM.ATTRIBUTION
OSM_ATTRIBUTION
];