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