s/store/source/
This commit is contained in:
@@ -21,4 +21,4 @@ var map = new ol.Map(document.getElementById('map'), {
|
||||
layers: new ol.Collection([layer]),
|
||||
zoom: 0
|
||||
});
|
||||
var zoom = new ol.control.Zoom(map, layer.getStore().getResolutions());
|
||||
var zoom = new ol.control.Zoom(map, layer.getSource().getResolutions());
|
||||
|
||||
@@ -92,7 +92,7 @@ ol.control.Attribution.prototype.addLayer = function(layer) {
|
||||
layer, ol.Object.getChangedEventType(ol.layer.LayerProperty.VISIBLE),
|
||||
this.handleLayerVisibleChanged, false, this);
|
||||
|
||||
if (layer.getStore().isReady()) {
|
||||
if (layer.getSource().isReady()) {
|
||||
this.createAttributionElementsForLayer_(layer);
|
||||
} else {
|
||||
goog.events.listenOnce(layer, goog.events.EventType.LOAD,
|
||||
@@ -109,8 +109,8 @@ ol.control.Attribution.prototype.addLayer = function(layer) {
|
||||
ol.control.Attribution.prototype.createAttributionElementsForLayer_ =
|
||||
function(layer) {
|
||||
|
||||
var store = layer.getStore();
|
||||
var attributions = store.getAttributions();
|
||||
var source = layer.getSource();
|
||||
var attributions = source.getAttributions();
|
||||
if (goog.isNull(attributions)) {
|
||||
return;
|
||||
}
|
||||
@@ -173,17 +173,17 @@ ol.control.Attribution.prototype.getElement = function() {
|
||||
ol.control.Attribution.prototype.getLayerAttributionVisiblities_ =
|
||||
function(layer, mapExtent, mapResolution, mapProjection) {
|
||||
|
||||
var store = layer.getStore();
|
||||
var attributions = store.getAttributions();
|
||||
var source = layer.getSource();
|
||||
var attributions = source.getAttributions();
|
||||
|
||||
if (goog.isNull(attributions)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var mapZ;
|
||||
if (store instanceof ol.TileStore) {
|
||||
var tileStore = /** @type {ol.TileStore} */ store;
|
||||
var tileGrid = tileStore.getTileGrid();
|
||||
if (source instanceof ol.TileSource) {
|
||||
var tileSource = /** @type {ol.TileSource} */ source;
|
||||
var tileGrid = tileSource.getTileGrid();
|
||||
mapZ = tileGrid.getZForResolution(mapResolution);
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ ol.control.Attribution.prototype.getLayerAttributionVisiblities_ =
|
||||
}
|
||||
|
||||
if (!goog.isNull(coverageAreas)) {
|
||||
if (store instanceof ol.TileStore) {
|
||||
if (source instanceof ol.TileSource) {
|
||||
attributionVisible = goog.array.some(
|
||||
coverageAreas,
|
||||
function(coverageArea, index) {
|
||||
@@ -347,13 +347,16 @@ ol.control.Attribution.prototype.removeLayer = function(layer) {
|
||||
goog.events.unlistenByKey(this.layerVisibleChangeListenerKeys_[layerKey]);
|
||||
delete this.layerVisibleChangeListenerKeys_[layerKey];
|
||||
|
||||
goog.array.forEach(layer.getStore().getAttributions(), function(attribution) {
|
||||
var attributionKey = goog.getUid(attribution);
|
||||
delete this.coverageAreass_[attributionKey];
|
||||
var attributionElement = this.attributionElements_[attributionKey];
|
||||
goog.dom.removeNode(attributionElement);
|
||||
delete this.attributionElements_[attributionKey];
|
||||
}, this);
|
||||
goog.array.forEach(
|
||||
layer.getSource().getAttributions(),
|
||||
function(attribution) {
|
||||
var attributionKey = goog.getUid(attribution);
|
||||
delete this.coverageAreass_[attributionKey];
|
||||
var attributionElement = this.attributionElements_[attributionKey];
|
||||
goog.dom.removeNode(attributionElement);
|
||||
delete this.attributionElements_[attributionKey];
|
||||
},
|
||||
this);
|
||||
|
||||
};
|
||||
|
||||
@@ -379,8 +382,8 @@ ol.control.Attribution.prototype.updateLayerAttributionsVisibility_ =
|
||||
},
|
||||
this);
|
||||
} else {
|
||||
var store = layer.getStore();
|
||||
var attributions = store.getAttributions();
|
||||
var source = layer.getSource();
|
||||
var attributions = source.getAttributions();
|
||||
if (!goog.isNull(attributions)) {
|
||||
goog.array.forEach(attributions, function(attribution) {
|
||||
var attributionKey = goog.getUid(attribution);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
goog.provide('ol.layer.BingMaps');
|
||||
goog.provide('ol.tilestore.BingMaps');
|
||||
goog.provide('ol.tilesource.BingMaps');
|
||||
|
||||
goog.require('goog.Uri');
|
||||
goog.require('goog.events');
|
||||
@@ -7,7 +7,7 @@ goog.require('goog.events.EventType');
|
||||
goog.require('goog.net.Jsonp');
|
||||
goog.require('ol.TileCoverageArea');
|
||||
goog.require('ol.TileLayer');
|
||||
goog.require('ol.TileStore');
|
||||
goog.require('ol.TileSource');
|
||||
goog.require('ol.tilegrid.XYZ');
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ ol.BingMapsStyle = {
|
||||
* @param {Object.<string, *>=} opt_values Values.
|
||||
*/
|
||||
ol.layer.BingMaps = function(style, key, opt_culture, opt_values) {
|
||||
var tileStore = new ol.tilestore.BingMaps(style, key, opt_culture,
|
||||
function(tileStore) {
|
||||
var tileSource = new ol.tilesource.BingMaps(style, key, opt_culture,
|
||||
function(tileSource) {
|
||||
this.dispatchEvent(goog.events.EventType.LOAD);
|
||||
}, this);
|
||||
goog.base(this, tileStore, opt_values);
|
||||
goog.base(this, tileSource, opt_values);
|
||||
};
|
||||
goog.inherits(ol.layer.BingMaps, ol.TileLayer);
|
||||
|
||||
@@ -45,14 +45,14 @@ goog.inherits(ol.layer.BingMaps, ol.TileLayer);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.TileStore}
|
||||
* @extends {ol.TileSource}
|
||||
* @param {ol.BingMapsStyle} style Bing Maps style.
|
||||
* @param {string} key Key.
|
||||
* @param {string=} opt_culture Culture.
|
||||
* @param {?function(ol.tilestore.BingMaps)=} opt_callback Callback.
|
||||
* @param {?function(ol.tilesource.BingMaps)=} opt_callback Callback.
|
||||
* @param {*=} opt_obj Object.
|
||||
*/
|
||||
ol.tilestore.BingMaps =
|
||||
ol.tilesource.BingMaps =
|
||||
function(style, key, opt_culture, opt_callback, opt_obj) {
|
||||
|
||||
/**
|
||||
@@ -69,7 +69,7 @@ ol.tilestore.BingMaps =
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?function(ol.tilestore.BingMaps)}
|
||||
* @type {?function(ol.tilesource.BingMaps)}
|
||||
*/
|
||||
this.callback_ = opt_callback || null;
|
||||
|
||||
@@ -94,13 +94,13 @@ ol.tilestore.BingMaps =
|
||||
this, projection, null, ol.TileUrlFunction.nullTileUrlFunction, extent);
|
||||
|
||||
};
|
||||
goog.inherits(ol.tilestore.BingMaps, ol.TileStore);
|
||||
goog.inherits(ol.tilesource.BingMaps, ol.TileSource);
|
||||
|
||||
|
||||
/**
|
||||
* @param {BingMapsImageryMetadataResponse} response Response.
|
||||
*/
|
||||
ol.tilestore.BingMaps.prototype.handleImageryMetadataResponse =
|
||||
ol.tilesource.BingMaps.prototype.handleImageryMetadataResponse =
|
||||
function(response) {
|
||||
|
||||
goog.asserts.assert(
|
||||
@@ -184,6 +184,6 @@ ol.tilestore.BingMaps.prototype.handleImageryMetadataResponse =
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.tilestore.BingMaps.prototype.isReady = function() {
|
||||
ol.tilesource.BingMaps.prototype.isReady = function() {
|
||||
return this.ready_;
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@ goog.provide('ol.layer.LayerProperty');
|
||||
|
||||
goog.require('goog.math');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.Store');
|
||||
goog.require('ol.Source');
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,18 +23,18 @@ ol.layer.LayerProperty = {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Object}
|
||||
* @param {ol.Store} store Store.
|
||||
* @param {ol.Source} source Source.
|
||||
* @param {Object.<string, *>=} opt_values Values.
|
||||
*/
|
||||
ol.layer.Layer = function(store, opt_values) {
|
||||
ol.layer.Layer = function(source, opt_values) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Store}
|
||||
* @type {ol.Source}
|
||||
*/
|
||||
this.store_ = store;
|
||||
this.source_ = source;
|
||||
|
||||
this.setBrightness(0);
|
||||
this.setContrast(0);
|
||||
@@ -112,10 +112,10 @@ goog.exportProperty(
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Store} Store.
|
||||
* @return {ol.Source} Source.
|
||||
*/
|
||||
ol.layer.Layer.prototype.getStore = function() {
|
||||
return this.store_;
|
||||
ol.layer.Layer.prototype.getSource = function() {
|
||||
return this.source_;
|
||||
};
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ goog.exportProperty(
|
||||
* @return {boolean} Is ready.
|
||||
*/
|
||||
ol.layer.Layer.prototype.isReady = function() {
|
||||
return this.getStore().isReady();
|
||||
return this.getSource().isReady();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
goog.provide('ol.layer.OpenStreetMap');
|
||||
goog.provide('ol.store.OpenStreetMap');
|
||||
goog.provide('ol.source.OpenStreetMap');
|
||||
|
||||
goog.require('ol.TileLayer');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.tilestore.XYZ');
|
||||
goog.require('ol.tilesource.XYZ');
|
||||
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ goog.require('ol.tilestore.XYZ');
|
||||
* @param {Object.<string, *>=} opt_values Values.
|
||||
*/
|
||||
ol.layer.OpenStreetMap = function(opt_values) {
|
||||
var tileStore = new ol.store.OpenStreetMap();
|
||||
goog.base(this, tileStore, opt_values);
|
||||
var tileSource = new ol.source.OpenStreetMap();
|
||||
goog.base(this, tileSource, opt_values);
|
||||
};
|
||||
goog.inherits(ol.layer.OpenStreetMap, ol.TileLayer);
|
||||
|
||||
@@ -22,9 +22,9 @@ goog.inherits(ol.layer.OpenStreetMap, ol.TileLayer);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.tilestore.XYZ}
|
||||
* @extends {ol.tilesource.XYZ}
|
||||
*/
|
||||
ol.store.OpenStreetMap = function() {
|
||||
ol.source.OpenStreetMap = function() {
|
||||
|
||||
var tileUrlFunction = ol.TileUrlFunction.createFromTemplate(
|
||||
'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png');
|
||||
@@ -37,4 +37,4 @@ ol.store.OpenStreetMap = function() {
|
||||
goog.base(this, 18, tileUrlFunction, [attribution]);
|
||||
|
||||
};
|
||||
goog.inherits(ol.store.OpenStreetMap, ol.tilestore.XYZ);
|
||||
goog.inherits(ol.source.OpenStreetMap, ol.tilesource.XYZ);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// FIXME Configure minZoom when supported by TileGrid
|
||||
|
||||
goog.provide('ol.layer.Stamen');
|
||||
goog.provide('ol.store.Stamen');
|
||||
goog.provide('ol.source.Stamen');
|
||||
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.layer.XYZ');
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
goog.provide('ol.layer.TileJSON');
|
||||
goog.provide('ol.tilejson');
|
||||
goog.provide('ol.tilestore.TileJSON');
|
||||
goog.provide('ol.tilesource.TileJSON');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events.EventType');
|
||||
@@ -16,7 +16,7 @@ goog.require('goog.net.jsloader');
|
||||
goog.require('goog.string');
|
||||
goog.require('ol.TileCoverageArea');
|
||||
goog.require('ol.TileLayer');
|
||||
goog.require('ol.TileStore');
|
||||
goog.require('ol.TileSource');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ goog.exportSymbol('grid', grid);
|
||||
*/
|
||||
ol.layer.TileJSON = function(url, opt_values) {
|
||||
goog.asserts.assert(goog.string.endsWith(url, '.jsonp'));
|
||||
var tileStore = new ol.tilestore.TileJSON(url, function(tileStore) {
|
||||
var tileSource = new ol.tilesource.TileJSON(url, function(tileSource) {
|
||||
this.dispatchEvent(goog.events.EventType.LOAD);
|
||||
}, this);
|
||||
goog.base(this, tileStore, opt_values);
|
||||
goog.base(this, tileSource, opt_values);
|
||||
};
|
||||
goog.inherits(ol.layer.TileJSON, ol.TileLayer);
|
||||
|
||||
@@ -56,12 +56,12 @@ goog.inherits(ol.layer.TileJSON, ol.TileLayer);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.TileStore}
|
||||
* @extends {ol.TileSource}
|
||||
* @param {string} uri URI.
|
||||
* @param {?function(ol.tilestore.TileJSON)=} opt_callback Callback.
|
||||
* @param {?function(ol.tilesource.TileJSON)=} opt_callback Callback.
|
||||
* @param {*=} opt_obj Object.
|
||||
*/
|
||||
ol.tilestore.TileJSON = function(uri, opt_callback, opt_obj) {
|
||||
ol.tilesource.TileJSON = function(uri, opt_callback, opt_obj) {
|
||||
|
||||
var projection = ol.Projection.getFromCode('EPSG:3857');
|
||||
|
||||
@@ -70,7 +70,7 @@ ol.tilestore.TileJSON = function(uri, opt_callback, opt_obj) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?function(ol.tilestore.TileJSON)}
|
||||
* @type {?function(ol.tilesource.TileJSON)}
|
||||
*/
|
||||
this.callback_ = opt_callback || null;
|
||||
|
||||
@@ -94,13 +94,13 @@ ol.tilestore.TileJSON = function(uri, opt_callback, opt_obj) {
|
||||
this.deferred_.addCallback(this.handleTileJSONResponse, this);
|
||||
|
||||
};
|
||||
goog.inherits(ol.tilestore.TileJSON, ol.TileStore);
|
||||
goog.inherits(ol.tilesource.TileJSON, ol.TileSource);
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
ol.tilestore.TileJSON.prototype.handleTileJSONResponse = function() {
|
||||
ol.tilesource.TileJSON.prototype.handleTileJSONResponse = function() {
|
||||
|
||||
var tileJSON = ol.tilejson.grids_.pop();
|
||||
|
||||
@@ -176,6 +176,6 @@ ol.tilestore.TileJSON.prototype.handleTileJSONResponse = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.tilestore.TileJSON.prototype.isReady = function() {
|
||||
ol.tilesource.TileJSON.prototype.isReady = function() {
|
||||
return this.ready_;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
goog.provide('ol.layer.XYZ');
|
||||
goog.provide('ol.tilegrid.XYZ');
|
||||
goog.provide('ol.tilestore.XYZ');
|
||||
goog.provide('ol.tilesource.XYZ');
|
||||
|
||||
goog.require('goog.math');
|
||||
goog.require('ol.Attribution');
|
||||
@@ -10,7 +10,7 @@ goog.require('ol.Size');
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileGrid');
|
||||
goog.require('ol.TileLayer');
|
||||
goog.require('ol.TileStore');
|
||||
goog.require('ol.TileSource');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.layer.Layer');
|
||||
|
||||
@@ -76,9 +76,9 @@ ol.tilegrid.XYZ.prototype.forEachTileCoordParentTileRange =
|
||||
*/
|
||||
ol.layer.XYZ = function(
|
||||
maxZoom, tileUrlFunction, opt_attributions, opt_crossOrigin, opt_values) {
|
||||
var tileStore = new ol.tilestore.XYZ(
|
||||
var tileSource = new ol.tilesource.XYZ(
|
||||
maxZoom, tileUrlFunction, opt_attributions, opt_crossOrigin);
|
||||
goog.base(this, tileStore, opt_values);
|
||||
goog.base(this, tileSource, opt_values);
|
||||
};
|
||||
goog.inherits(ol.layer.XYZ, ol.TileLayer);
|
||||
|
||||
@@ -86,13 +86,13 @@ goog.inherits(ol.layer.XYZ, ol.TileLayer);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.TileStore}
|
||||
* @extends {ol.TileSource}
|
||||
* @param {number} maxZoom Maximum zoom.
|
||||
* @param {ol.TileUrlFunctionType} tileUrlFunction Tile URL function.
|
||||
* @param {Array.<ol.Attribution>=} opt_attributions Attributions.
|
||||
* @param {string=} opt_crossOrigin Cross origin.
|
||||
*/
|
||||
ol.tilestore.XYZ =
|
||||
ol.tilesource.XYZ =
|
||||
function(maxZoom, tileUrlFunction, opt_attributions, opt_crossOrigin) {
|
||||
|
||||
var projection = ol.Projection.getFromCode('EPSG:3857');
|
||||
@@ -115,4 +115,4 @@ ol.tilestore.XYZ =
|
||||
opt_attributions, opt_crossOrigin);
|
||||
|
||||
};
|
||||
goog.inherits(ol.tilestore.XYZ, ol.TileStore);
|
||||
goog.inherits(ol.tilesource.XYZ, ol.TileSource);
|
||||
|
||||
@@ -74,8 +74,8 @@ ol.renderer.dom.TileLayer.prototype.getLayer = function() {
|
||||
*/
|
||||
ol.renderer.dom.TileLayer.prototype.getTileOffset_ = function(z, resolution) {
|
||||
var tileLayer = this.getLayer();
|
||||
var tileStore = tileLayer.getStore();
|
||||
var tileGrid = tileStore.getTileGrid();
|
||||
var tileSource = tileLayer.getSource();
|
||||
var tileGrid = tileSource.getTileGrid();
|
||||
var tileOrigin = tileGrid.getOrigin(z);
|
||||
var offset = new ol.Coordinate(
|
||||
Math.round((this.origin.x - tileOrigin.x) / resolution),
|
||||
@@ -167,8 +167,8 @@ ol.renderer.dom.TileLayer.prototype.render = function() {
|
||||
var resolutionChanged = (mapResolution !== this.renderedMapResolution_);
|
||||
|
||||
var tileLayer = this.getLayer();
|
||||
var tileStore = tileLayer.getStore();
|
||||
var tileGrid = tileStore.getTileGrid();
|
||||
var tileSource = tileLayer.getSource();
|
||||
var tileGrid = tileSource.getTileGrid();
|
||||
|
||||
// z represents the "best" resolution
|
||||
var z = tileGrid.getZForResolution(mapResolution);
|
||||
@@ -191,9 +191,9 @@ ol.renderer.dom.TileLayer.prototype.render = function() {
|
||||
// first pass through the tile range to determine all the tiles needed
|
||||
var allTilesLoaded = true;
|
||||
tileRange.forEachTileCoord(z, function(tileCoord) {
|
||||
var tile = tileStore.getTile(tileCoord);
|
||||
var tile = tileSource.getTile(tileCoord);
|
||||
if (goog.isNull(tile)) {
|
||||
// we're outside the store's extent, continue
|
||||
// we're outside the source's extent, continue
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ ol.renderer.dom.TileLayer.prototype.render = function() {
|
||||
if (tilesToDrawByZ[altZ] && tilesToDrawByZ[altZ][tileKey]) {
|
||||
return;
|
||||
}
|
||||
var altTile = tileStore.getTile(altTileCoord);
|
||||
var altTile = tileSource.getTile(altTileCoord);
|
||||
if (!goog.isNull(altTile) &&
|
||||
altTile.getState() == ol.TileState.LOADED) {
|
||||
if (!(altZ in tilesToDrawByZ)) {
|
||||
|
||||
@@ -169,7 +169,7 @@ ol.renderer.webgl.Map = function(container, map) {
|
||||
goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.LOST,
|
||||
this.handleWebGLContextLost, false, this);
|
||||
goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.RESTORED,
|
||||
this.handleWebGLContextRestored, false, this);
|
||||
this.handleWebGLContextResourced, false, this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -493,9 +493,9 @@ ol.renderer.webgl.Map.prototype.handleWebGLContextLost = function(event) {
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
ol.renderer.webgl.Map.prototype.handleWebGLContextRestored = function() {
|
||||
ol.renderer.webgl.Map.prototype.handleWebGLContextResourced = function() {
|
||||
if (goog.DEBUG) {
|
||||
this.logger.info('WebGLContextRestored');
|
||||
this.logger.info('WebGLContextResourced');
|
||||
}
|
||||
this.initializeGL_();
|
||||
this.getMap().render();
|
||||
|
||||
@@ -316,8 +316,8 @@ ol.renderer.webgl.TileLayer.prototype.render = function() {
|
||||
var mapRotation = map.getRotation();
|
||||
|
||||
var tileLayer = this.getLayer();
|
||||
var tileStore = tileLayer.getStore();
|
||||
var tileGrid = tileStore.getTileGrid();
|
||||
var tileSource = tileLayer.getSource();
|
||||
var tileGrid = tileSource.getTileGrid();
|
||||
var z = tileGrid.getZForResolution(mapResolution);
|
||||
var tileResolution = tileGrid.getResolution(z);
|
||||
var tileRange = tileGrid.getTileRangeForExtentAndResolution(
|
||||
@@ -406,10 +406,10 @@ ol.renderer.webgl.TileLayer.prototype.render = function() {
|
||||
tilesToDrawByZ[z] = {};
|
||||
tileRange.forEachTileCoord(z, function(tileCoord) {
|
||||
|
||||
var tile = tileStore.getTile(tileCoord);
|
||||
var tile = tileSource.getTile(tileCoord);
|
||||
|
||||
if (goog.isNull(tile)) {
|
||||
// FIXME - consider returning here as this is outside the store's extent
|
||||
// FIXME consider returning here as this is outside the source's extent
|
||||
} else if (tile.getState() == ol.TileState.LOADED) {
|
||||
if (mapRenderer.isImageTextureLoaded(tile.getImage())) {
|
||||
tilesToDrawByZ[z][tileCoord.toString()] = tile;
|
||||
@@ -439,7 +439,7 @@ ol.renderer.webgl.TileLayer.prototype.render = function() {
|
||||
if (tilesToDrawByZ[z] && tilesToDrawByZ[z][tileCoordKey]) {
|
||||
return;
|
||||
}
|
||||
var tile = tileStore.getTile(tileCoord);
|
||||
var tile = tileSource.getTile(tileCoord);
|
||||
if (!goog.isNull(tile) &&
|
||||
tile.getState() == ol.TileState.LOADED) {
|
||||
if (!tilesToDrawByZ[z]) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
goog.provide('ol.Store');
|
||||
goog.provide('ol.Source');
|
||||
|
||||
goog.require('goog.functions');
|
||||
goog.require('ol.Attribution');
|
||||
@@ -13,7 +13,7 @@ goog.require('ol.Projection');
|
||||
* @param {ol.Extent=} opt_extent Extent.
|
||||
* @param {Array.<ol.Attribution>=} opt_attributions Attributions.
|
||||
*/
|
||||
ol.Store = function(projection, opt_extent, opt_attributions) {
|
||||
ol.Source = function(projection, opt_extent, opt_attributions) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -39,7 +39,7 @@ ol.Store = function(projection, opt_extent, opt_attributions) {
|
||||
/**
|
||||
* @return {Array.<ol.Attribution>} Attributions.
|
||||
*/
|
||||
ol.Store.prototype.getAttributions = function() {
|
||||
ol.Source.prototype.getAttributions = function() {
|
||||
return this.attributions_;
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ ol.Store.prototype.getAttributions = function() {
|
||||
/**
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.Store.prototype.getExtent = function() {
|
||||
ol.Source.prototype.getExtent = function() {
|
||||
return this.extent_;
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ ol.Store.prototype.getExtent = function() {
|
||||
/**
|
||||
* @return {ol.Projection} Projection.
|
||||
*/
|
||||
ol.Store.prototype.getProjection = function() {
|
||||
ol.Source.prototype.getProjection = function() {
|
||||
return this.projection_;
|
||||
};
|
||||
|
||||
@@ -63,19 +63,19 @@ ol.Store.prototype.getProjection = function() {
|
||||
/**
|
||||
* @return {Array.<number>|undefined} Resolutions.
|
||||
*/
|
||||
ol.Store.prototype.getResolutions = goog.abstractMethod;
|
||||
ol.Source.prototype.getResolutions = goog.abstractMethod;
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is ready.
|
||||
*/
|
||||
ol.Store.prototype.isReady = goog.functions.TRUE;
|
||||
ol.Source.prototype.isReady = goog.functions.TRUE;
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||
*/
|
||||
ol.Store.prototype.setAttributions = function(attributions) {
|
||||
ol.Source.prototype.setAttributions = function(attributions) {
|
||||
this.attributions_ = attributions;
|
||||
};
|
||||
|
||||
@@ -83,7 +83,7 @@ ol.Store.prototype.setAttributions = function(attributions) {
|
||||
/**
|
||||
* @param {ol.Extent} extent Extent.
|
||||
*/
|
||||
ol.Store.prototype.setExtent = function(extent) {
|
||||
ol.Source.prototype.setExtent = function(extent) {
|
||||
this.extent_ = extent;
|
||||
};
|
||||
|
||||
@@ -91,6 +91,6 @@ ol.Store.prototype.setExtent = function(extent) {
|
||||
/**
|
||||
* @param {ol.Projection} projection Projetion.
|
||||
*/
|
||||
ol.Store.prototype.setProjection = function(projection) {
|
||||
ol.Source.prototype.setProjection = function(projection) {
|
||||
this.projection_ = projection;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
goog.provide('ol.TileLayer');
|
||||
|
||||
goog.require('ol.TileStore');
|
||||
goog.require('ol.TileSource');
|
||||
goog.require('ol.layer.Layer');
|
||||
|
||||
|
||||
@@ -8,19 +8,19 @@ goog.require('ol.layer.Layer');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.layer.Layer}
|
||||
* @param {ol.TileStore} tileStore Tile store.
|
||||
* @param {ol.TileSource} tileSource Tile source.
|
||||
* @param {Object.<string, *>=} opt_values Values.
|
||||
*/
|
||||
ol.TileLayer = function(tileStore, opt_values) {
|
||||
goog.base(this, tileStore, opt_values);
|
||||
ol.TileLayer = function(tileSource, opt_values) {
|
||||
goog.base(this, tileSource, opt_values);
|
||||
};
|
||||
goog.inherits(ol.TileLayer, ol.layer.Layer);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {ol.TileStore} Store.
|
||||
* @return {ol.TileSource} Source.
|
||||
*/
|
||||
ol.TileLayer.prototype.getStore = function() {
|
||||
return /** @type {ol.TileStore} */ goog.base(this, 'getStore');
|
||||
ol.TileLayer.prototype.getSource = function() {
|
||||
return /** @type {ol.TileSource} */ goog.base(this, 'getSource');
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.TileStore');
|
||||
goog.provide('ol.TileSource');
|
||||
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Store');
|
||||
goog.require('ol.Source');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileGrid');
|
||||
@@ -11,7 +11,7 @@ goog.require('ol.TileUrlFunctionType');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Store}
|
||||
* @extends {ol.Source}
|
||||
* @param {ol.Projection} projection Projection.
|
||||
* @param {ol.TileGrid} tileGrid Tile grid.
|
||||
* @param {ol.TileUrlFunctionType} tileUrlFunction Tile URL.
|
||||
@@ -19,7 +19,7 @@ goog.require('ol.TileUrlFunctionType');
|
||||
* @param {Array.<string>=} opt_attributions Attributions.
|
||||
* @param {?string=} opt_crossOrigin Cross origin.
|
||||
*/
|
||||
ol.TileStore = function(projection, tileGrid, tileUrlFunction, opt_extent,
|
||||
ol.TileSource = function(projection, tileGrid, tileUrlFunction, opt_extent,
|
||||
opt_attributions, opt_crossOrigin) {
|
||||
|
||||
goog.base(this, projection, opt_extent, opt_attributions);
|
||||
@@ -51,13 +51,13 @@ ol.TileStore = function(projection, tileGrid, tileUrlFunction, opt_extent,
|
||||
this.tileCache_ = {};
|
||||
|
||||
};
|
||||
goog.inherits(ol.TileStore, ol.Store);
|
||||
goog.inherits(ol.TileSource, ol.Source);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.TileStore.prototype.getResolutions = function() {
|
||||
ol.TileSource.prototype.getResolutions = function() {
|
||||
return this.tileGrid.getResolutions();
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ ol.TileStore.prototype.getResolutions = function() {
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @return {ol.Tile} Tile.
|
||||
*/
|
||||
ol.TileStore.prototype.getTile = function(tileCoord) {
|
||||
ol.TileSource.prototype.getTile = function(tileCoord) {
|
||||
var key = tileCoord.toString();
|
||||
if (goog.object.containsKey(this.tileCache_, key)) {
|
||||
return this.tileCache_[key];
|
||||
@@ -88,7 +88,7 @@ ol.TileStore.prototype.getTile = function(tileCoord) {
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @return {string|undefined} Tile URL.
|
||||
*/
|
||||
ol.TileStore.prototype.getTileCoordUrl = function(tileCoord) {
|
||||
ol.TileSource.prototype.getTileCoordUrl = function(tileCoord) {
|
||||
return this.tileUrlFunction(tileCoord);
|
||||
};
|
||||
|
||||
@@ -96,6 +96,6 @@ ol.TileStore.prototype.getTileCoordUrl = function(tileCoord) {
|
||||
/**
|
||||
* @return {ol.TileGrid} Tile grid.
|
||||
*/
|
||||
ol.TileStore.prototype.getTileGrid = function() {
|
||||
ol.TileSource.prototype.getTileGrid = function() {
|
||||
return this.tileGrid;
|
||||
};
|
||||
|
||||
@@ -1,70 +1,70 @@
|
||||
describe('ol.tilestore.XYZ', function() {
|
||||
describe('ol.tilesource.XYZ', function() {
|
||||
|
||||
describe('getTileCoordUrl', function() {
|
||||
|
||||
var xyzTileStore, tileGrid;
|
||||
var xyzTileSource, tileGrid;
|
||||
|
||||
beforeEach(function() {
|
||||
xyzTileStore = new ol.tilestore.XYZ(
|
||||
xyzTileSource = new ol.tilesource.XYZ(
|
||||
6, ol.TileUrlFunction.createFromTemplate('{z}/{x}/{y}'));
|
||||
tileGrid = xyzTileStore.getTileGrid();
|
||||
tileGrid = xyzTileSource.getTileGrid();
|
||||
});
|
||||
|
||||
it('return the expected URL', function() {
|
||||
var coordinate = new ol.Coordinate(829330.2064098881, 5933916.615134273);
|
||||
var tileUrl;
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 0));
|
||||
expect(tileUrl).toEqual('0/0/0');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 1));
|
||||
expect(tileUrl).toEqual('1/1/0');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 2));
|
||||
expect(tileUrl).toEqual('2/2/1');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 3));
|
||||
expect(tileUrl).toEqual('3/4/2');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 4));
|
||||
expect(tileUrl).toEqual('4/8/5');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 5));
|
||||
expect(tileUrl).toEqual('5/16/11');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 6));
|
||||
expect(tileUrl).toEqual('6/33/22');
|
||||
});
|
||||
|
||||
describe('wrap x', function() {
|
||||
it('returns the expected URL', function() {
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(new ol.TileCoord(6, -31, -23));
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(new ol.TileCoord(6, -31, -23));
|
||||
expect(tileUrl).toEqual('6/33/22');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(new ol.TileCoord(6, 33, -23));
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(new ol.TileCoord(6, 33, -23));
|
||||
expect(tileUrl).toEqual('6/33/22');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(new ol.TileCoord(6, 97, -23));
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(new ol.TileCoord(6, 97, -23));
|
||||
expect(tileUrl).toEqual('6/33/22');
|
||||
});
|
||||
});
|
||||
|
||||
describe('crop y', function() {
|
||||
it('returns the expected URL', function() {
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(new ol.TileCoord(6, 33, -87));
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(new ol.TileCoord(6, 33, -87));
|
||||
expect(tileUrl).toBeUndefined();
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(new ol.TileCoord(6, 33, -23));
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(new ol.TileCoord(6, 33, -23));
|
||||
expect(tileUrl).toEqual('6/33/22');
|
||||
|
||||
tileUrl = xyzTileStore.getTileCoordUrl(new ol.TileCoord(6, 33, 41));
|
||||
tileUrl = xyzTileSource.getTileCoordUrl(new ol.TileCoord(6, 33, 41));
|
||||
expect(tileUrl).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -124,4 +124,4 @@ describe('ol.tilestore.XYZ', function() {
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.tilestore.XYZ');
|
||||
goog.require('ol.tilesource.XYZ');
|
||||
|
||||
Reference in New Issue
Block a user