crossOrigin defaults to null

This commit is contained in:
Éric Lemoine
2013-03-20 19:24:32 +01:00
parent 7038ac0c81
commit 7949cdaa82
17 changed files with 18 additions and 8 deletions

View File

@@ -13,7 +13,6 @@ var layers = [
new ol.layer.TileLayer({ new ol.layer.TileLayer({
source: new ol.source.TiledWMS({ source: new ol.source.TiledWMS({
url: 'http://vmap0.tiles.osgeo.org/wms/vmap0', url: 'http://vmap0.tiles.osgeo.org/wms/vmap0',
crossOrigin: null,
params: { params: {
'VERSION': '1.1.1', 'VERSION': '1.1.1',
'LAYERS': 'basic', 'LAYERS': 'basic',

View File

@@ -15,7 +15,8 @@ var map = new ol.Map({
}), }),
new ol.layer.TileLayer({ new ol.layer.TileLayer({
source: new ol.source.TileJSON({ source: new ol.source.TileJSON({
uri: 'http://api.tiles.mapbox.com/v3/mapbox.va-quake-aug.jsonp' uri: 'http://api.tiles.mapbox.com/v3/mapbox.va-quake-aug.jsonp',
crossOrigin: 'anonymous'
}) })
}) })
], ],

View File

@@ -10,7 +10,8 @@ var map = new ol.Map({
layers: [ layers: [
new ol.layer.TileLayer({ new ol.layer.TileLayer({
source: new ol.source.TileJSON({ source: new ol.source.TileJSON({
uri: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp' uri: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp',
crossOrigin: 'anonymous'
}) })
}) })
], ],

View File

@@ -22,6 +22,7 @@ var layers = [
new ol.layer.TileLayer({ new ol.layer.TileLayer({
source: new ol.source.TiledWMS({ source: new ol.source.TiledWMS({
url: 'http://wms.geo.admin.ch/', url: 'http://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
attributions: [new ol.Attribution( attributions: [new ol.Attribution(
'© ' + '© ' +
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' + '<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
@@ -36,6 +37,7 @@ var layers = [
new ol.layer.TileLayer({ new ol.layer.TileLayer({
source: new ol.source.TiledWMS({ source: new ol.source.TiledWMS({
url: 'http://wms.geo.admin.ch/', url: 'http://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
attributions: [new ol.Attribution( attributions: [new ol.Attribution(
'&copy; ' + '&copy; ' +
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' + '<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +

View File

@@ -19,6 +19,7 @@ var layers = [
new ol.layer.ImageLayer({ new ol.layer.ImageLayer({
source: new ol.source.SingleImageWMS({ source: new ol.source.SingleImageWMS({
url: 'http://wms.geo.admin.ch/', url: 'http://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
attributions: [new ol.Attribution( attributions: [new ol.Attribution(
'&copy; ' + '&copy; ' +
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' + '<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
@@ -33,6 +34,7 @@ var layers = [
new ol.layer.ImageLayer({ new ol.layer.ImageLayer({
source: new ol.source.SingleImageWMS({ source: new ol.source.SingleImageWMS({
url: 'http://wms.geo.admin.ch/', url: 'http://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
attributions: [new ol.Attribution( attributions: [new ol.Attribution(
'&copy; ' + '&copy; ' +
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' + '<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +

View File

@@ -16,7 +16,6 @@ var layers = [
new ol.layer.ImageLayer({ new ol.layer.ImageLayer({
source: new ol.source.SingleImageWMS({ source: new ol.source.SingleImageWMS({
url: 'http://demo.opengeo.org/geoserver/wms', url: 'http://demo.opengeo.org/geoserver/wms',
crossOrigin: null,
params: {'LAYERS': 'topp:states'}, params: {'LAYERS': 'topp:states'},
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219) extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
}) })

View File

@@ -15,7 +15,6 @@ var layers = [
new ol.layer.TileLayer({ new ol.layer.TileLayer({
source: new ol.source.TiledWMS({ source: new ol.source.TiledWMS({
url: 'http://demo.opengeo.org/geoserver/wms', url: 'http://demo.opengeo.org/geoserver/wms',
crossOrigin: null,
params: {'LAYERS': 'topp:states', 'TILED': true}, params: {'LAYERS': 'topp:states', 'TILED': true},
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219) extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
}) })

View File

@@ -28,6 +28,7 @@ xhr.onload = function() {
capabilities = parser.read(xhr.responseXML); capabilities = parser.read(xhr.responseXML);
var wmtsOptions = ol.source.WMTS.optionsFromCapabilities( var wmtsOptions = ol.source.WMTS.optionsFromCapabilities(
capabilities, 'ch.swisstopo.pixelkarte-farbe'); capabilities, 'ch.swisstopo.pixelkarte-farbe');
wmtsOptions.crossOrigin = 'anonymous';
map = new ol.Map({ map = new ol.Map({
layers: [ layers: [
new ol.layer.TileLayer({ new ol.layer.TileLayer({

View File

@@ -40,7 +40,6 @@ var map = new ol.Map({
matrixIds: matrixIds matrixIds: matrixIds
}), }),
style: '_null', style: '_null',
crossOrigin: null, // FIXME: this should be the default
extent: new ol.Extent(-13682835, 5204068, -13667473, 5221690) extent: new ol.Extent(-13682835, 5204068, -13667473, 5221690)
}) })
}) })

View File

@@ -154,6 +154,7 @@
@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined @exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined
@exportObjectLiteral ol.source.TileJSONOptions @exportObjectLiteral ol.source.TileJSONOptions
@exportObjectLiteralProperty ol.source.TileJSONOptions.crossOrigin null|string|undefined
@exportObjectLiteralProperty ol.source.TileJSONOptions.uri string @exportObjectLiteralProperty ol.source.TileJSONOptions.uri string
@exportObjectLiteral ol.source.TiledWMSOptions @exportObjectLiteral ol.source.TiledWMSOptions

View File

@@ -23,6 +23,7 @@ goog.require('ol.tilegrid.XYZ');
ol.source.BingMaps = function(bingMapsOptions) { ol.source.BingMaps = function(bingMapsOptions) {
goog.base(this, { goog.base(this, {
crossOrigin: 'anonymous',
opaque: true, opaque: true,
projection: ol.projection.get('EPSG:3857') projection: ol.projection.get('EPSG:3857')
}); });

View File

@@ -53,7 +53,7 @@ ol.source.ImageSource = function(options) {
* @type {?string} * @type {?string}
*/ */
this.crossOrigin_ = this.crossOrigin_ =
goog.isDef(options.crossOrigin) ? options.crossOrigin : 'anonymous'; goog.isDef(options.crossOrigin) ? options.crossOrigin : null;
/** /**
* @private * @private

View File

@@ -55,7 +55,7 @@ ol.source.ImageTileSource = function(options) {
* @type {?string} * @type {?string}
*/ */
this.crossOrigin_ = this.crossOrigin_ =
goog.isDef(options.crossOrigin) ? options.crossOrigin : 'anonymous'; goog.isDef(options.crossOrigin) ? options.crossOrigin : null;
/** /**
* @private * @private

View File

@@ -26,6 +26,7 @@ ol.source.MapQuestOSM = function() {
goog.base(this, { goog.base(this, {
attributions: attributions, attributions: attributions,
crossOrigin: 'anonymous',
opaque: true, opaque: true,
maxZoom: 28, maxZoom: 28,
url: 'http://otile{1-4}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg' url: 'http://otile{1-4}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg'
@@ -54,6 +55,7 @@ ol.source.MapQuestOpenAerial = function() {
goog.base(this, { goog.base(this, {
attributions: attributions, attributions: attributions,
crossOrigin: 'anonymous',
maxZoom: 18, maxZoom: 18,
opaque: true, opaque: true,
url: 'http://oatile{1-4}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg' url: 'http://oatile{1-4}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg'

View File

@@ -18,6 +18,7 @@ ol.source.OpenStreetMap = function() {
goog.base(this, { goog.base(this, {
attributions: [attribution], attributions: [attribution],
crossOrigin: 'anonymous',
opaque: true, opaque: true,
maxZoom: 18, maxZoom: 18,
url: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png' url: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'

View File

@@ -106,6 +106,7 @@ ol.source.Stamen = function(options) {
goog.base(this, { goog.base(this, {
attributions: ol.source.STAMEN_ATTRIBUTIONS, attributions: ol.source.STAMEN_ATTRIBUTIONS,
crossOrigin: 'anonymous',
maxZoom: providerConfig.maxZoom, maxZoom: providerConfig.maxZoom,
// FIXME uncomment the following when tilegrid supports minZoom // FIXME uncomment the following when tilegrid supports minZoom
//minZoom: providerConfig.minZoom, //minZoom: providerConfig.minZoom,

View File

@@ -46,6 +46,7 @@ goog.exportSymbol('grid', grid);
ol.source.TileJSON = function(tileJsonOptions) { ol.source.TileJSON = function(tileJsonOptions) {
goog.base(this, { goog.base(this, {
crossOrigin: tileJsonOptions.crossOrigin,
projection: ol.projection.get('EPSG:3857') projection: ol.projection.get('EPSG:3857')
}); });