From 5b43e8a31e79c5c1320d3e0c6902ca722ec23b93 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Thu, 10 Mar 2016 11:14:59 +0100 Subject: [PATCH] Use simple forms to create attributions in examples --- examples/flight-animation.js | 6 ++---- examples/igc.js | 5 +---- examples/localized-openstreetmap.js | 10 ++-------- examples/mapbox-vector-tiles-advanced.js | 8 +++----- examples/mapbox-vector-tiles.js | 8 +++----- examples/reprojection.js | 14 ++++---------- examples/static-image.js | 6 +----- examples/vector-esri-edit.js | 8 ++------ examples/vector-esri.js | 9 ++------- examples/wms-custom-proj.js | 16 ++++------------ examples/wms-image-custom-proj.js | 16 ++++------------ examples/wms-no-proj.js | 16 ++++------------ examples/wmts-dimensions.js | 10 +++------- examples/wmts.js | 9 ++------- examples/xyz-esri-4326-512.js | 2 +- examples/xyz-esri.js | 2 +- examples/xyz-retina.js | 9 ++------- 17 files changed, 41 insertions(+), 113 deletions(-) diff --git a/examples/flight-animation.js b/examples/flight-animation.js index 552172bb8b..d6c5fd5a56 100644 --- a/examples/flight-animation.js +++ b/examples/flight-animation.js @@ -76,10 +76,8 @@ var animateFlights = function(event) { flightsSource = new ol.source.Vector({ wrapX: false, - attributions: [new ol.Attribution({ - html: 'Flight data by ' + - 'OpenFlights,' - })], + attributions: 'Flight data by ' + + 'OpenFlights,', loader: function() { var url = 'data/openflights/flights.json'; fetch(url).then(function(response) { diff --git a/examples/igc.js b/examples/igc.js index 521b0923ee..fabe56dad5 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -86,10 +86,7 @@ var map = new ol.Map({ new ol.layer.Tile({ source: new ol.source.OSM({ attributions: [ - new ol.Attribution({ - html: 'All maps © ' + - 'OpenCycleMap' - }), + 'All maps © OpenCycleMap', ol.source.OSM.ATTRIBUTION ], url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png' diff --git a/examples/localized-openstreetmap.js b/examples/localized-openstreetmap.js index f02b27a019..e57397357d 100644 --- a/examples/localized-openstreetmap.js +++ b/examples/localized-openstreetmap.js @@ -9,10 +9,7 @@ goog.require('ol.source.OSM'); var openCycleMapLayer = new ol.layer.Tile({ source: new ol.source.OSM({ attributions: [ - new ol.Attribution({ - html: 'All maps © ' + - 'OpenCycleMap' - }), + 'All maps © OpenCycleMap', ol.source.OSM.ATTRIBUTION ], url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png' @@ -22,10 +19,7 @@ var openCycleMapLayer = new ol.layer.Tile({ var openSeaMapLayer = new ol.layer.Tile({ source: new ol.source.OSM({ attributions: [ - new ol.Attribution({ - html: 'All maps © ' + - 'OpenSeaMap' - }), + 'All maps © OpenSeaMap', ol.source.OSM.ATTRIBUTION ], opaque: false, diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index aaa0736fcc..4bda0c39c9 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -45,11 +45,9 @@ var map = new ol.Map({ new ol.layer.VectorTile({ preload: Infinity, source: new ol.source.VectorTile({ - attributions: [new ol.Attribution({ - html: '© Mapbox ' + - '© ' + - 'OpenStreetMap contributors' - })], + attributions: '© Mapbox ' + + '© ' + + 'OpenStreetMap contributors', format: new ol.format.MVT(), tileGrid: new ol.tilegrid.TileGrid({ extent: ol.proj.get('EPSG:3857').getExtent(), diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index 783e2462af..ed3688bd4e 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -17,11 +17,9 @@ var map = new ol.Map({ layers: [ new ol.layer.VectorTile({ source: new ol.source.VectorTile({ - attributions: [new ol.Attribution({ - html: '© Mapbox ' + - '© ' + - 'OpenStreetMap contributors' - })], + attributions: '© Mapbox ' + + '© ' + + 'OpenStreetMap contributors', format: new ol.format.MVT(), tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}), tilePixelRatio: 16, diff --git a/examples/reprojection.js b/examples/reprojection.js index 1e6a9f5881..e8aaca6fde 100644 --- a/examples/reprojection.js +++ b/examples/reprojection.js @@ -81,12 +81,8 @@ layers['wms4326'] = new ol.layer.Tile({ layers['wms21781'] = new ol.layer.Tile({ source: new ol.source.TileWMS({ - attributions: [new ol.Attribution({ - html: '© ' + - '' + - 'Pixelmap 1:1000000 / geo.admin.ch' - })], + attributions: '© Pixelmap 1:1000000 / geo.admin.ch', crossOrigin: 'anonymous', params: { 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale', @@ -120,10 +116,8 @@ layers['grandcanyon'] = new ol.layer.Tile({ crossOrigin: '', tilePixelRatio: 2, maxZoom: 15, - attributions: [new ol.Attribution({ - html: 'Tiles © USGS, rendered with ' + - 'MapTiler' - })] + attributions: 'Tiles © USGS, rendered with ' + + 'MapTiler' }) }); diff --git a/examples/static-image.js b/examples/static-image.js index 41bbc77bab..b14da703cb 100644 --- a/examples/static-image.js +++ b/examples/static-image.js @@ -21,11 +21,7 @@ var map = new ol.Map({ layers: [ new ol.layer.Image({ source: new ol.source.ImageStatic({ - attributions: [ - new ol.Attribution({ - html: '© xkcd' - }) - ], + attributions: '© xkcd', url: 'http://imgs.xkcd.com/comics/online_communities.png', projection: projection, imageExtent: extent diff --git a/examples/vector-esri-edit.js b/examples/vector-esri-edit.js index 184ff5f85e..da05168994 100644 --- a/examples/vector-esri-edit.js +++ b/examples/vector-esri-edit.js @@ -53,14 +53,10 @@ var vector = new ol.layer.Vector({ source: vectorSource }); -var attribution = new ol.Attribution({ - html: 'Tiles © ArcGIS' -}); - var raster = new ol.layer.Tile({ source: new ol.source.XYZ({ - attributions: [attribution], + attributions: 'Tiles © ArcGIS', url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' + 'World_Topo_Map/MapServer/tile/{z}/{y}/{x}' }) diff --git a/examples/vector-esri.js b/examples/vector-esri.js index 9875f67aa5..480d0bf729 100644 --- a/examples/vector-esri.js +++ b/examples/vector-esri.js @@ -95,15 +95,10 @@ var vector = new ol.layer.Vector({ } }); - -var attribution = new ol.Attribution({ - html: 'Tiles © ArcGIS' -}); - var raster = new ol.layer.Tile({ source: new ol.source.XYZ({ - attributions: [attribution], + attributions: 'Tiles © ArcGIS', url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' + 'World_Topo_Map/MapServer/tile/{z}/{y}/{x}' }) diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index d01fdcd0ed..8ce9d94b4a 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -48,12 +48,8 @@ var layers = [ source: new ol.source.TileWMS({ url: 'http://wms.geo.admin.ch/', crossOrigin: 'anonymous', - attributions: [new ol.Attribution({ - html: '© ' + - '' + - 'Pixelmap 1:1000000 / geo.admin.ch' - })], + attributions: '© Pixelmap 1:1000000 / geo.admin.ch', params: { 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale', 'FORMAT': 'image/jpeg' @@ -66,12 +62,8 @@ var layers = [ source: new ol.source.TileWMS({ url: 'http://wms.geo.admin.ch/', crossOrigin: 'anonymous', - attributions: [new ol.Attribution({ - html: '© ' + - '' + - 'National parks / geo.admin.ch' - })], + attributions: '© National parks / geo.admin.ch', params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, serverType: 'mapserver' }) diff --git a/examples/wms-image-custom-proj.js b/examples/wms-image-custom-proj.js index de5a33df6a..7a24533753 100644 --- a/examples/wms-image-custom-proj.js +++ b/examples/wms-image-custom-proj.js @@ -36,12 +36,8 @@ var layers = [ source: new ol.source.ImageWMS({ url: 'http://wms.geo.admin.ch/', crossOrigin: 'anonymous', - attributions: [new ol.Attribution({ - html: '© ' + - '' + - 'Pixelmap 1:1000000 / geo.admin.ch' - })], + attributions: '© Pixelmap 1:1000000 / geo.admin.ch', params: { 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale', 'FORMAT': 'image/jpeg' @@ -54,12 +50,8 @@ var layers = [ source: new ol.source.ImageWMS({ url: 'http://wms.geo.admin.ch/', crossOrigin: 'anonymous', - attributions: [new ol.Attribution({ - html: '© ' + - '' + - 'National parks / geo.admin.ch' - })], + attributions: '© National parks / geo.admin.ch', params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, serverType: /** @type {ol.source.wms.ServerType} */ ('mapserver') }) diff --git a/examples/wms-no-proj.js b/examples/wms-no-proj.js index f9d9702fa9..e1652306a5 100644 --- a/examples/wms-no-proj.js +++ b/examples/wms-no-proj.js @@ -11,12 +11,8 @@ goog.require('ol.source.TileWMS'); var layers = [ new ol.layer.Tile({ source: new ol.source.TileWMS({ - attributions: [new ol.Attribution({ - html: '© ' + - '' + - 'Pixelmap 1:1000000 / geo.admin.ch' - })], + attributions: '© Pixelmap 1:1000000 / geo.admin.ch', crossOrigin: 'anonymous', params: { 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale', @@ -27,12 +23,8 @@ var layers = [ }), new ol.layer.Image({ source: new ol.source.ImageWMS({ - attributions: [new ol.Attribution({ - html: '© ' + - '' + - 'National parks / geo.admin.ch' - })], + attributions: '© National parks / geo.admin.ch', crossOrigin: 'anonymous', params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, serverType: 'mapserver', diff --git a/examples/wmts-dimensions.js b/examples/wmts-dimensions.js index 9f5a62b711..2efe20835f 100644 --- a/examples/wmts-dimensions.js +++ b/examples/wmts-dimensions.js @@ -33,13 +33,9 @@ var wmtsSource = new ol.source.WMTS({ format: 'image/png', matrixSet: 'EPSG:3857', attributions: [ - new ol.Attribution({ - html: 'SCALGO' - }), - new ol.Attribution({ - html: 'CGIAR-CSI SRTM' - }) + 'SCALGO', + 'CGIAR-CSI SRTM' ], tileGrid: tileGrid, style: 'default', diff --git a/examples/wmts.js b/examples/wmts.js index 0b3d2bd456..0dedcff9fa 100644 --- a/examples/wmts.js +++ b/examples/wmts.js @@ -21,12 +21,6 @@ for (var z = 0; z < 14; ++z) { matrixIds[z] = z; } -var attribution = new ol.Attribution({ - html: 'Tiles © ArcGIS' -}); - - var map = new ol.Map({ layers: [ new ol.layer.Tile({ @@ -36,7 +30,8 @@ var map = new ol.Map({ new ol.layer.Tile({ opacity: 0.7, source: new ol.source.WMTS({ - attributions: [attribution], + attributions: 'Tiles © ArcGIS', url: 'http://services.arcgisonline.com/arcgis/rest/' + 'services/Demographics/USA_Population_Density/MapServer/WMTS/', layer: '0', diff --git a/examples/xyz-esri-4326-512.js b/examples/xyz-esri-4326-512.js index 7c76e54f5f..15c8ab0056 100644 --- a/examples/xyz-esri-4326-512.js +++ b/examples/xyz-esri-4326-512.js @@ -6,7 +6,7 @@ goog.require('ol.proj'); goog.require('ol.source.XYZ'); var attribution = new ol.Attribution({ - html: 'Copyright:© 2013 ESRI, i-cubed, GeoEye' + html: 'Copyright:© 2013 ESRI, i-cubed, GeoEye' }); var projection = ol.proj.get('EPSG:4326'); diff --git a/examples/xyz-esri.js b/examples/xyz-esri.js index f4dbae1a78..168f12ad65 100644 --- a/examples/xyz-esri.js +++ b/examples/xyz-esri.js @@ -7,7 +7,7 @@ goog.require('ol.source.XYZ'); var attribution = new ol.Attribution({ - html: 'Tiles © ArcGIS' }); diff --git a/examples/xyz-retina.js b/examples/xyz-retina.js index 1eecdfebe0..f5e6c46871 100644 --- a/examples/xyz-retina.js +++ b/examples/xyz-retina.js @@ -6,12 +6,6 @@ goog.require('ol.proj'); goog.require('ol.source.OSM'); goog.require('ol.source.XYZ'); - -var attribution = new ol.Attribution({ - html: 'Tiles © USGS, rendered with ' + - 'MapTiler' -}); - var mapMinZoom = 1; var mapMaxZoom = 15; var mapExtent = [-112.261791, 35.983744, -112.113981, 36.132062]; @@ -25,7 +19,8 @@ var map = new ol.Map({ new ol.layer.Tile({ extent: ol.proj.transformExtent(mapExtent, 'EPSG:4326', 'EPSG:3857'), source: new ol.source.XYZ({ - attributions: [attribution], + attributions: 'Tiles © USGS, rendered with ' + + 'MapTiler', url: 'http://tileserver.maptiler.com/grandcanyon@2x/{z}/{x}/{y}.png', tilePixelRatio: 2, // THIS IS IMPORTANT minZoom: mapMinZoom,