Add opaque flag to ol.source.TileSource
This commit is contained in:
@@ -133,6 +133,7 @@
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.crossOrigin null|string|undefined
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.transparent boolean|undefined
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.Projection|undefined
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined
|
||||
|
||||
@@ -36,6 +36,7 @@ ol.BingMapsStyle = {
|
||||
ol.source.BingMaps = function(bingMapsOptions) {
|
||||
|
||||
goog.base(this, {
|
||||
opaque: true,
|
||||
projection: ol.projection.getFromCode('EPSG:3857')
|
||||
});
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ ol.source.DebugTileSource = function(options) {
|
||||
|
||||
goog.base(this, {
|
||||
extent: options.extent,
|
||||
opaque: false,
|
||||
projection: options.projection,
|
||||
tileGrid: options.tileGrid
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ goog.require('ol.tilegrid.TileGrid');
|
||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||
* crossOrigin: (null|string|undefined),
|
||||
* extent: (ol.Extent|undefined),
|
||||
* opaque: (boolean|undefined),
|
||||
* projection: (ol.Projection|undefined),
|
||||
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
||||
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
|
||||
@@ -36,6 +37,7 @@ ol.source.ImageTileSource = function(options) {
|
||||
goog.base(this, {
|
||||
attributions: options.attributions,
|
||||
extent: options.extent,
|
||||
opaque: options.opaque,
|
||||
projection: options.projection,
|
||||
tileGrid: options.tileGrid
|
||||
});
|
||||
|
||||
@@ -26,6 +26,7 @@ ol.source.MapQuestOSM = function() {
|
||||
|
||||
goog.base(this, {
|
||||
attributions: attributions,
|
||||
opaque: true,
|
||||
maxZoom: 28,
|
||||
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, {
|
||||
attributions: attributions,
|
||||
maxZoom: 18,
|
||||
opaque: true,
|
||||
url: 'http://oatile{1-4}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg'
|
||||
});
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ ol.source.OpenStreetMap = function() {
|
||||
|
||||
goog.base(this, {
|
||||
attributions: [attribution],
|
||||
opaque: true,
|
||||
maxZoom: 18,
|
||||
url: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'
|
||||
});
|
||||
|
||||
@@ -85,6 +85,7 @@ ol.source.Stamen = function(stamenOptions) {
|
||||
goog.base(this, {
|
||||
attributions: [attribution],
|
||||
maxZoom: config.maxZoom,
|
||||
opaque: false,
|
||||
url: 'http://{a-d}.tile.stamen.com/' + layer + '/{z}/{x}/{y}.' + config.type
|
||||
});
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ ol.source.TiledWMS = function(tiledWMSOptions) {
|
||||
var extent = goog.isDef(tiledWMSOptions.extent) ?
|
||||
tiledWMSOptions.extent : projectionExtent;
|
||||
|
||||
var transparent = goog.isDef(tiledWMSOptions.transparent) ?
|
||||
tiledWMSOptions.transparent : true;
|
||||
|
||||
var version = goog.isDef(tiledWMSOptions.version) ?
|
||||
tiledWMSOptions.version : '1.3';
|
||||
|
||||
@@ -44,7 +47,7 @@ ol.source.TiledWMS = function(tiledWMSOptions) {
|
||||
'REQUEST': 'GetMap',
|
||||
'STYLES': '',
|
||||
'FORMAT': 'image/png',
|
||||
'TRANSPARENT': true
|
||||
'TRANSPARENT': transparent
|
||||
};
|
||||
baseParams[version >= '1.3' ? 'CRS' : 'SRS'] = projection.getCode();
|
||||
goog.object.extend(baseParams, tiledWMSOptions.params);
|
||||
@@ -97,6 +100,7 @@ ol.source.TiledWMS = function(tiledWMSOptions) {
|
||||
crossOrigin: tiledWMSOptions.crossOrigin,
|
||||
extent: extent,
|
||||
tileGrid: tileGrid,
|
||||
opaque: !transparent,
|
||||
projection: projection,
|
||||
tileUrlFunction: ol.TileUrlFunction.withTileCoordTransform(
|
||||
tileCoordTransform, tileUrlFunction)
|
||||
|
||||
@@ -15,6 +15,7 @@ goog.require('ol.tilegrid.TileGrid');
|
||||
/**
|
||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||
* extent: (ol.Extent|undefined),
|
||||
* opaque: (boolean|undefined),
|
||||
* projection: (ol.Projection|undefined),
|
||||
* tileGrid: (ol.tilegrid.TileGrid|undefined)}}
|
||||
*/
|
||||
@@ -35,6 +36,13 @@ ol.source.TileSource = function(tileSourceOptions) {
|
||||
projection: tileSourceOptions.projection
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.opaque_ = goog.isDef(tileSourceOptions.opaque) ?
|
||||
tileSourceOptions.opaque : false;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {ol.tilegrid.TileGrid}
|
||||
@@ -98,6 +106,14 @@ ol.source.TileSource.prototype.findLoadedTiles = function(loadedTilesByZ,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Opaque.
|
||||
*/
|
||||
ol.source.TileSource.prototype.getOpaque = function() {
|
||||
return this.opaque_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user