diff --git a/examples/color-manipulation.js b/examples/color-manipulation.js
index 4abd88aa18..045018a426 100644
--- a/examples/color-manipulation.js
+++ b/examples/color-manipulation.js
@@ -2,7 +2,7 @@
import Map from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js';
import _ol_layer_Image_ from '../src/ol/layer/Image.js';
-import _ol_source_Raster_ from '../src/ol/source/Raster.js';
+import RasterSource from '../src/ol/source/Raster.js';
import _ol_source_Stamen_ from '../src/ol/source/Stamen.js';
@@ -100,7 +100,7 @@ function xyz2rgb(x) {
12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}
-var raster = new _ol_source_Raster_({
+var raster = new RasterSource({
sources: [new _ol_source_Stamen_({
layer: 'watercolor',
transition: 0
diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js
index afacdeb9ff..941523b8af 100644
--- a/examples/mapbox-vector-tiles-advanced.js
+++ b/examples/mapbox-vector-tiles-advanced.js
@@ -9,7 +9,7 @@ import _ol_style_Icon_ from '../src/ol/style/Icon.js';
import _ol_style_Stroke_ from '../src/ol/style/Stroke.js';
import _ol_style_Style_ from '../src/ol/style/Style.js';
import _ol_style_Text_ from '../src/ol/style/Text.js';
-import _ol_tilegrid_TileGrid_ from '../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../src/ol/tilegrid/TileGrid.js';
var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
@@ -38,7 +38,7 @@ var map = new Map({
'© ' +
'OpenStreetMap contributors',
format: new MVT(),
- tileGrid: new _ol_tilegrid_TileGrid_({
+ tileGrid: new TileGrid({
extent: getProjection('EPSG:3857').getExtent(),
resolutions: resolutions,
tileSize: 512
diff --git a/examples/raster.js b/examples/raster.js
index 54c520f060..01292f2ad2 100644
--- a/examples/raster.js
+++ b/examples/raster.js
@@ -5,7 +5,7 @@ import _ol_View_ from '../src/ol/View.js';
import _ol_layer_Image_ from '../src/ol/layer/Image.js';
import TileLayer from '../src/ol/layer/Tile.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
-import _ol_source_Raster_ from '../src/ol/source/Raster.js';
+import RasterSource from '../src/ol/source/Raster.js';
var minVgi = 0;
var maxVgi = 0.25;
@@ -59,7 +59,7 @@ var bing = new _ol_source_BingMaps_({
* Create a raster source where pixels with VGI values above a threshold will
* be colored green.
*/
-var raster = new _ol_source_Raster_({
+var raster = new RasterSource({
sources: [bing],
/**
* Run calculations on pixel data.
diff --git a/examples/region-growing.js b/examples/region-growing.js
index 9fecac6eeb..bf14ca45ed 100644
--- a/examples/region-growing.js
+++ b/examples/region-growing.js
@@ -5,7 +5,7 @@ import _ol_layer_Image_ from '../src/ol/layer/Image.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat} from '../src/ol/proj.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
-import _ol_source_Raster_ from '../src/ol/source/Raster.js';
+import RasterSource from '../src/ol/source/Raster.js';
function growRegion(inputs, data) {
var image = inputs[0];
@@ -78,7 +78,7 @@ var imagery = new TileLayer({
source: new _ol_source_BingMaps_({key: key, imagerySet: 'Aerial'})
});
-var raster = new _ol_source_Raster_({
+var raster = new RasterSource({
sources: [imagery.getSource()],
operationType: 'image',
operation: growRegion,
diff --git a/examples/reprojection.js b/examples/reprojection.js
index b7122e4003..b81c302ace 100644
--- a/examples/reprojection.js
+++ b/examples/reprojection.js
@@ -10,7 +10,7 @@ import _ol_source_TileImage_ from '../src/ol/source/TileImage.js';
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
import _ol_source_XYZ_ from '../src/ol/source/XYZ.js';
-import _ol_tilegrid_TileGrid_ from '../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../src/ol/tilegrid/TileGrid.js';
import proj4 from 'proj4';
@@ -140,7 +140,7 @@ layers['states'] = new TileLayer({
crossOrigin: '',
params: {'LAYERS': 'topp:states'},
serverType: 'geoserver',
- tileGrid: new _ol_tilegrid_TileGrid_({
+ tileGrid: new TileGrid({
extent: [-13884991, 2870341, -7455066, 6338219],
resolutions: resolutions,
tileSize: [512, 256]
diff --git a/examples/sea-level.js b/examples/sea-level.js
index b7b0393f83..7f53e4c6d7 100644
--- a/examples/sea-level.js
+++ b/examples/sea-level.js
@@ -4,7 +4,7 @@ import _ol_View_ from '../src/ol/View.js';
import _ol_layer_Image_ from '../src/ol/layer/Image.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat} from '../src/ol/proj.js';
-import _ol_source_Raster_ from '../src/ol/source/Raster.js';
+import RasterSource from '../src/ol/source/Raster.js';
import _ol_source_XYZ_ from '../src/ol/source/XYZ.js';
function flood(pixels, data) {
@@ -30,7 +30,7 @@ var elevation = new _ol_source_XYZ_({
transition: 0
});
-var raster = new _ol_source_Raster_({
+var raster = new RasterSource({
sources: [elevation],
operation: flood
});
diff --git a/examples/shaded-relief.js b/examples/shaded-relief.js
index ba1c27d848..33b1f3f18e 100644
--- a/examples/shaded-relief.js
+++ b/examples/shaded-relief.js
@@ -4,7 +4,7 @@ import _ol_View_ from '../src/ol/View.js';
import _ol_layer_Image_ from '../src/ol/layer/Image.js';
import TileLayer from '../src/ol/layer/Tile.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
-import _ol_source_Raster_ from '../src/ol/source/Raster.js';
+import RasterSource from '../src/ol/source/Raster.js';
import _ol_source_XYZ_ from '../src/ol/source/XYZ.js';
@@ -108,7 +108,7 @@ var elevation = new _ol_source_XYZ_({
transition: 0
});
-var raster = new _ol_source_Raster_({
+var raster = new RasterSource({
sources: [elevation],
operationType: 'image',
operation: shade
diff --git a/examples/wms-custom-tilegrid-512x256.js b/examples/wms-custom-tilegrid-512x256.js
index 4028c8cc5e..b2584a75d9 100644
--- a/examples/wms-custom-tilegrid-512x256.js
+++ b/examples/wms-custom-tilegrid-512x256.js
@@ -5,7 +5,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
-import _ol_tilegrid_TileGrid_ from '../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../src/ol/tilegrid/TileGrid.js';
var projExtent = getProjection('EPSG:3857').getExtent();
@@ -14,7 +14,7 @@ var resolutions = new Array(22);
for (var i = 0, ii = resolutions.length; i < ii; ++i) {
resolutions[i] = startResolution / Math.pow(2, i);
}
-var tileGrid = new _ol_tilegrid_TileGrid_({
+var tileGrid = new TileGrid({
extent: [-13884991, 2870341, -7455066, 6338219],
resolutions: resolutions,
tileSize: [512, 256]
diff --git a/examples/wmts-dimensions.js b/examples/wmts-dimensions.js
index 3a9a4c12b1..6004e66d8f 100644
--- a/examples/wmts-dimensions.js
+++ b/examples/wmts-dimensions.js
@@ -5,7 +5,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
-import _ol_tilegrid_WMTS_ from '../src/ol/tilegrid/WMTS.js';
+import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
// create the WMTS tile grid in the google projection
@@ -18,7 +18,7 @@ for (var i = 0; i <= 14; i++) {
matrixIds[i] = i;
resolutions[i] = tileSizeMtrs / Math.pow(2, i);
}
-var tileGrid = new _ol_tilegrid_WMTS_({
+var tileGrid = new WMTSTileGrid({
origin: _ol_extent_.getTopLeft(projection.getExtent()),
resolutions: resolutions,
matrixIds: matrixIds
diff --git a/examples/wmts-ign.js b/examples/wmts-ign.js
index a9a1ca5fe5..3ce1ab5ef6 100644
--- a/examples/wmts-ign.js
+++ b/examples/wmts-ign.js
@@ -5,7 +5,7 @@ import * as _ol_extent_ from '../src/ol/extent.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat, get as getProjection} from '../src/ol/proj.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
-import _ol_tilegrid_WMTS_ from '../src/ol/tilegrid/WMTS.js';
+import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
var map = new Map({
@@ -31,7 +31,7 @@ for (var i = 0; i < 18; i++) {
resolutions[i] = maxResolution / Math.pow(2, i);
}
-var tileGrid = new _ol_tilegrid_WMTS_({
+var tileGrid = new WMTSTileGrid({
origin: [-20037508, 20037508],
resolutions: resolutions,
matrixIds: matrixIds
diff --git a/examples/wmts.js b/examples/wmts.js
index 7ca572e21e..4a6adfe0a9 100644
--- a/examples/wmts.js
+++ b/examples/wmts.js
@@ -6,7 +6,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
-import _ol_tilegrid_WMTS_ from '../src/ol/tilegrid/WMTS.js';
+import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
var projection = getProjection('EPSG:3857');
@@ -37,7 +37,7 @@ var map = new Map({
matrixSet: 'EPSG:3857',
format: 'image/png',
projection: projection,
- tileGrid: new _ol_tilegrid_WMTS_({
+ tileGrid: new WMTSTileGrid({
origin: _ol_extent_.getTopLeft(projectionExtent),
resolutions: resolutions,
matrixIds: matrixIds
diff --git a/src/ol/Disposable.js b/src/ol/Disposable.js
index 1b39a0125b..3b6137c234 100644
--- a/src/ol/Disposable.js
+++ b/src/ol/Disposable.js
@@ -7,19 +7,19 @@ import {nullFunction} from './index.js';
* Objects that need to clean up after themselves.
* @constructor
*/
-var _ol_Disposable_ = function() {};
+var Disposable = function() {};
/**
* The object has already been disposed.
* @type {boolean}
* @private
*/
-_ol_Disposable_.prototype.disposed_ = false;
+Disposable.prototype.disposed_ = false;
/**
* Clean up.
*/
-_ol_Disposable_.prototype.dispose = function() {
+Disposable.prototype.dispose = function() {
if (!this.disposed_) {
this.disposed_ = true;
this.disposeInternal();
@@ -30,5 +30,5 @@ _ol_Disposable_.prototype.dispose = function() {
* Extension point for disposable objects.
* @protected
*/
-_ol_Disposable_.prototype.disposeInternal = nullFunction;
-export default _ol_Disposable_;
+Disposable.prototype.disposeInternal = nullFunction;
+export default Disposable;
diff --git a/src/ol/ImageTile.js b/src/ol/ImageTile.js
index 2789c53423..e50e38eb98 100644
--- a/src/ol/ImageTile.js
+++ b/src/ol/ImageTile.js
@@ -3,7 +3,7 @@
*/
import {inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
-import _ol_TileState_ from './TileState.js';
+import TileState from './TileState.js';
import {createCanvasContext2D} from './dom.js';
import _ol_events_ from './events.js';
import EventType from './events/EventType.js';
@@ -18,7 +18,7 @@ import EventType from './events/EventType.js';
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
* @param {olx.TileOptions=} opt_options Tile options.
*/
-var _ol_ImageTile_ = function(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
+var ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
_ol_Tile_.call(this, tileCoord, state, opt_options);
@@ -59,21 +59,21 @@ var _ol_ImageTile_ = function(tileCoord, state, src, crossOrigin, tileLoadFuncti
};
-inherits(_ol_ImageTile_, _ol_Tile_);
+inherits(ImageTile, _ol_Tile_);
/**
* @inheritDoc
*/
-_ol_ImageTile_.prototype.disposeInternal = function() {
- if (this.state == _ol_TileState_.LOADING) {
+ImageTile.prototype.disposeInternal = function() {
+ if (this.state == TileState.LOADING) {
this.unlistenImage_();
- this.image_ = _ol_ImageTile_.getBlankImage();
+ this.image_ = ImageTile.getBlankImage();
}
if (this.interimTile) {
this.interimTile.dispose();
}
- this.state = _ol_TileState_.ABORT;
+ this.state = TileState.ABORT;
this.changed();
_ol_Tile_.prototype.disposeInternal.call(this);
};
@@ -84,7 +84,7 @@ _ol_ImageTile_.prototype.disposeInternal = function() {
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
* @api
*/
-_ol_ImageTile_.prototype.getImage = function() {
+ImageTile.prototype.getImage = function() {
return this.image_;
};
@@ -92,7 +92,7 @@ _ol_ImageTile_.prototype.getImage = function() {
/**
* @inheritDoc
*/
-_ol_ImageTile_.prototype.getKey = function() {
+ImageTile.prototype.getKey = function() {
return this.src_;
};
@@ -102,10 +102,10 @@ _ol_ImageTile_.prototype.getKey = function() {
*
* @private
*/
-_ol_ImageTile_.prototype.handleImageError_ = function() {
- this.state = _ol_TileState_.ERROR;
+ImageTile.prototype.handleImageError_ = function() {
+ this.state = TileState.ERROR;
this.unlistenImage_();
- this.image_ = _ol_ImageTile_.getBlankImage();
+ this.image_ = ImageTile.getBlankImage();
this.changed();
};
@@ -115,11 +115,11 @@ _ol_ImageTile_.prototype.handleImageError_ = function() {
*
* @private
*/
-_ol_ImageTile_.prototype.handleImageLoad_ = function() {
+ImageTile.prototype.handleImageLoad_ = function() {
if (this.image_.naturalWidth && this.image_.naturalHeight) {
- this.state = _ol_TileState_.LOADED;
+ this.state = TileState.LOADED;
} else {
- this.state = _ol_TileState_.EMPTY;
+ this.state = TileState.EMPTY;
}
this.unlistenImage_();
this.changed();
@@ -130,16 +130,16 @@ _ol_ImageTile_.prototype.handleImageLoad_ = function() {
* @inheritDoc
* @api
*/
-_ol_ImageTile_.prototype.load = function() {
- if (this.state == _ol_TileState_.ERROR) {
- this.state = _ol_TileState_.IDLE;
+ImageTile.prototype.load = function() {
+ if (this.state == TileState.ERROR) {
+ this.state = TileState.IDLE;
this.image_ = new Image();
if (this.crossOrigin_ !== null) {
this.image_.crossOrigin = this.crossOrigin_;
}
}
- if (this.state == _ol_TileState_.IDLE) {
- this.state = _ol_TileState_.LOADING;
+ if (this.state == TileState.IDLE) {
+ this.state = TileState.LOADING;
this.changed();
this.imageListenerKeys_ = [
_ol_events_.listenOnce(this.image_, EventType.ERROR,
@@ -157,7 +157,7 @@ _ol_ImageTile_.prototype.load = function() {
*
* @private
*/
-_ol_ImageTile_.prototype.unlistenImage_ = function() {
+ImageTile.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.imageListenerKeys_ = null;
};
@@ -167,10 +167,10 @@ _ol_ImageTile_.prototype.unlistenImage_ = function() {
* Get a 1-pixel blank image.
* @return {HTMLCanvasElement} Blank image.
*/
-_ol_ImageTile_.getBlankImage = function() {
+ImageTile.getBlankImage = function() {
var ctx = createCanvasContext2D(1, 1);
ctx.fillStyle = 'rgba(0,0,0,0)';
ctx.fillRect(0, 0, 1, 1);
return ctx.canvas;
};
-export default _ol_ImageTile_;
+export default ImageTile;
diff --git a/src/ol/Tile.js b/src/ol/Tile.js
index 7df8799c71..63430c4985 100644
--- a/src/ol/Tile.js
+++ b/src/ol/Tile.js
@@ -2,7 +2,7 @@
* @module ol/Tile
*/
import {inherits} from './index.js';
-import _ol_TileState_ from './TileState.js';
+import TileState from './TileState.js';
import {easeIn} from './easing.js';
import EventTarget from './events/EventTarget.js';
import EventType from './events/EventType.js';
@@ -102,7 +102,7 @@ _ol_Tile_.prototype.getInterimTile = function() {
// of the list (all those tiles correspond to older requests and will be
// cleaned up by refreshInterimChain)
do {
- if (tile.getState() == _ol_TileState_.LOADED) {
+ if (tile.getState() == TileState.LOADED) {
return tile;
}
tile = tile.interimTile;
@@ -125,17 +125,17 @@ _ol_Tile_.prototype.refreshInterimChain = function() {
var prev = this;
do {
- if (tile.getState() == _ol_TileState_.LOADED) {
+ if (tile.getState() == TileState.LOADED) {
//we have a loaded tile, we can discard the rest of the list
//we would could abort any LOADING tile request
//older than this tile (i.e. any LOADING tile following this entry in the chain)
tile.interimTile = null;
break;
- } else if (tile.getState() == _ol_TileState_.LOADING) {
+ } else if (tile.getState() == TileState.LOADING) {
//keep this LOADING tile any loaded tiles later in the chain are
//older than this tile, so we're still interested in the request
prev = tile;
- } else if (tile.getState() == _ol_TileState_.IDLE) {
+ } else if (tile.getState() == TileState.IDLE) {
//the head of the list is the most current tile, we don't need
//to start any other requests for this chain
prev.interimTile = tile.interimTile;
diff --git a/src/ol/TileQueue.js b/src/ol/TileQueue.js
index 47e13afc92..1788dd0eff 100644
--- a/src/ol/TileQueue.js
+++ b/src/ol/TileQueue.js
@@ -2,7 +2,7 @@
* @module ol/TileQueue
*/
import {inherits} from './index.js';
-import _ol_TileState_ from './TileState.js';
+import TileState from './TileState.js';
import _ol_events_ from './events.js';
import EventType from './events/EventType.js';
import PriorityQueue from './structs/PriorityQueue.js';
@@ -87,8 +87,8 @@ TileQueue.prototype.getTilesLoading = function() {
TileQueue.prototype.handleTileChange = function(event) {
var tile = /** @type {ol.Tile} */ (event.target);
var state = tile.getState();
- if (state === _ol_TileState_.LOADED || state === _ol_TileState_.ERROR ||
- state === _ol_TileState_.EMPTY || state === _ol_TileState_.ABORT) {
+ if (state === TileState.LOADED || state === TileState.ERROR ||
+ state === TileState.EMPTY || state === TileState.ABORT) {
_ol_events_.unlisten(tile, EventType.CHANGE,
this.handleTileChange, this);
var tileKey = tile.getKey();
@@ -114,9 +114,9 @@ TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
tile = /** @type {ol.Tile} */ (this.dequeue()[0]);
tileKey = tile.getKey();
state = tile.getState();
- if (state === _ol_TileState_.ABORT) {
+ if (state === TileState.ABORT) {
abortedTiles = true;
- } else if (state === _ol_TileState_.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
+ } else if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
this.tilesLoadingKeys_[tileKey] = true;
++this.tilesLoading_;
++newLoads;
diff --git a/src/ol/VectorImageTile.js b/src/ol/VectorImageTile.js
index d6ad4abb4e..0118537438 100644
--- a/src/ol/VectorImageTile.js
+++ b/src/ol/VectorImageTile.js
@@ -3,7 +3,7 @@
*/
import {getUid, inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
-import _ol_TileState_ from './TileState.js';
+import TileState from './TileState.js';
import {createCanvasContext2D} from './dom.js';
import _ol_events_ from './events.js';
import {getHeight, getIntersection, getWidth} from './extent.js';
@@ -32,7 +32,7 @@ import {loadFeaturesXhr} from './featureloader.js';
* Function to call when a source tile's state changes.
* @param {olx.TileOptions=} opt_options Tile options.
*/
-var _ol_VectorImageTile_ = function(tileCoord, state, sourceRevision, format,
+var VectorImageTile = function(tileCoord, state, sourceRevision, format,
tileLoadFunction, urlTileCoord, tileUrlFunction, sourceTileGrid, tileGrid,
sourceTiles, pixelRatio, projection, tileClass, handleTileChange, opt_options) {
@@ -107,7 +107,7 @@ var _ol_VectorImageTile_ = function(tileCoord, state, sourceRevision, format,
if (!sourceTile) {
var tileUrl = tileUrlFunction(sourceTileCoord, pixelRatio, projection);
sourceTile = sourceTiles[sourceTileKey] = new tileClass(sourceTileCoord,
- tileUrl == undefined ? _ol_TileState_.EMPTY : _ol_TileState_.IDLE,
+ tileUrl == undefined ? TileState.EMPTY : TileState.IDLE,
tileUrl == undefined ? '' : tileUrl,
format, tileLoadFunction);
this.sourceTileListenerKeys_.push(
@@ -121,14 +121,14 @@ var _ol_VectorImageTile_ = function(tileCoord, state, sourceRevision, format,
};
-inherits(_ol_VectorImageTile_, _ol_Tile_);
+inherits(VectorImageTile, _ol_Tile_);
/**
* @inheritDoc
*/
-_ol_VectorImageTile_.prototype.disposeInternal = function() {
- this.state = _ol_TileState_.ABORT;
+VectorImageTile.prototype.disposeInternal = function() {
+ this.state = TileState.ABORT;
this.changed();
if (this.interimTile) {
this.interimTile.dispose();
@@ -157,7 +157,7 @@ _ol_VectorImageTile_.prototype.disposeInternal = function() {
* @param {ol.layer.Layer} layer Layer.
* @return {CanvasRenderingContext2D} The rendering context.
*/
-_ol_VectorImageTile_.prototype.getContext = function(layer) {
+VectorImageTile.prototype.getContext = function(layer) {
var key = getUid(layer).toString();
if (!(key in this.context_)) {
this.context_[key] = createCanvasContext2D();
@@ -171,7 +171,7 @@ _ol_VectorImageTile_.prototype.getContext = function(layer) {
* @param {ol.layer.Layer} layer Layer.
* @return {HTMLCanvasElement} Canvas.
*/
-_ol_VectorImageTile_.prototype.getImage = function(layer) {
+VectorImageTile.prototype.getImage = function(layer) {
return this.getReplayState(layer).renderedTileRevision == -1 ?
null : this.getContext(layer).canvas;
};
@@ -181,7 +181,7 @@ _ol_VectorImageTile_.prototype.getImage = function(layer) {
* @param {ol.layer.Layer} layer Layer.
* @return {ol.TileReplayState} The replay state.
*/
-_ol_VectorImageTile_.prototype.getReplayState = function(layer) {
+VectorImageTile.prototype.getReplayState = function(layer) {
var key = getUid(layer).toString();
if (!(key in this.replayState_)) {
this.replayState_[key] = {
@@ -198,7 +198,7 @@ _ol_VectorImageTile_.prototype.getReplayState = function(layer) {
/**
* @inheritDoc
*/
-_ol_VectorImageTile_.prototype.getKey = function() {
+VectorImageTile.prototype.getKey = function() {
return this.tileKeys.join('/') + '-' + this.sourceRevision_;
};
@@ -207,7 +207,7 @@ _ol_VectorImageTile_.prototype.getKey = function() {
* @param {string} tileKey Key (tileCoord) of the source tile.
* @return {ol.VectorTile} Source tile.
*/
-_ol_VectorImageTile_.prototype.getTile = function(tileKey) {
+VectorImageTile.prototype.getTile = function(tileKey) {
return this.sourceTiles_[tileKey];
};
@@ -215,7 +215,7 @@ _ol_VectorImageTile_.prototype.getTile = function(tileKey) {
/**
* @inheritDoc
*/
-_ol_VectorImageTile_.prototype.load = function() {
+VectorImageTile.prototype.load = function() {
// Source tiles with LOADED state - we just count them because once they are
// loaded, we're no longer listening to state changes.
var leftToLoad = 0;
@@ -223,23 +223,23 @@ _ol_VectorImageTile_.prototype.load = function() {
// an ERROR state after another load attempt.
var errorSourceTiles = {};
- if (this.state == _ol_TileState_.IDLE) {
- this.setState(_ol_TileState_.LOADING);
+ if (this.state == TileState.IDLE) {
+ this.setState(TileState.LOADING);
}
- if (this.state == _ol_TileState_.LOADING) {
+ if (this.state == TileState.LOADING) {
this.tileKeys.forEach(function(sourceTileKey) {
var sourceTile = this.getTile(sourceTileKey);
- if (sourceTile.state == _ol_TileState_.IDLE) {
+ if (sourceTile.state == TileState.IDLE) {
sourceTile.setLoader(this.loader_);
sourceTile.load();
}
- if (sourceTile.state == _ol_TileState_.LOADING) {
+ if (sourceTile.state == TileState.LOADING) {
var key = _ol_events_.listen(sourceTile, EventType.CHANGE, function(e) {
var state = sourceTile.getState();
- if (state == _ol_TileState_.LOADED ||
- state == _ol_TileState_.ERROR) {
+ if (state == TileState.LOADED ||
+ state == TileState.ERROR) {
var uid = getUid(sourceTile);
- if (state == _ol_TileState_.ERROR) {
+ if (state == TileState.ERROR) {
errorSourceTiles[uid] = true;
} else {
--leftToLoad;
@@ -264,35 +264,35 @@ _ol_VectorImageTile_.prototype.load = function() {
/**
* @private
*/
-_ol_VectorImageTile_.prototype.finishLoading_ = function() {
+VectorImageTile.prototype.finishLoading_ = function() {
var loaded = this.tileKeys.length;
var empty = 0;
for (var i = loaded - 1; i >= 0; --i) {
var state = this.getTile(this.tileKeys[i]).getState();
- if (state != _ol_TileState_.LOADED) {
+ if (state != TileState.LOADED) {
--loaded;
}
- if (state == _ol_TileState_.EMPTY) {
+ if (state == TileState.EMPTY) {
++empty;
}
}
if (loaded == this.tileKeys.length) {
this.loadListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.loadListenerKeys_.length = 0;
- this.setState(_ol_TileState_.LOADED);
+ this.setState(TileState.LOADED);
} else {
- this.setState(empty == this.tileKeys.length ? _ol_TileState_.EMPTY : _ol_TileState_.ERROR);
+ this.setState(empty == this.tileKeys.length ? TileState.EMPTY : TileState.ERROR);
}
};
+export default VectorImageTile;
/**
* Sets the loader for a tile.
* @param {ol.VectorTile} tile Vector tile.
* @param {string} url URL.
*/
-_ol_VectorImageTile_.defaultLoadFunction = function(tile, url) {
+export function defaultLoadFunction(tile, url) {
var loader = loadFeaturesXhr(url, tile.getFormat(), tile.onLoad.bind(tile), tile.onError.bind(tile));
tile.setLoader(loader);
-};
-export default _ol_VectorImageTile_;
+}
diff --git a/src/ol/VectorTile.js b/src/ol/VectorTile.js
index 8f5753cd6e..90e048c389 100644
--- a/src/ol/VectorTile.js
+++ b/src/ol/VectorTile.js
@@ -3,7 +3,7 @@
*/
import {getUid, inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
-import _ol_TileState_ from './TileState.js';
+import TileState from './TileState.js';
/**
* @constructor
@@ -15,7 +15,7 @@ import _ol_TileState_ from './TileState.js';
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
* @param {olx.TileOptions=} opt_options Tile options.
*/
-var _ol_VectorTile_ = function(tileCoord, state, src, format, tileLoadFunction, opt_options) {
+var VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_options) {
_ol_Tile_.call(this, tileCoord, state, opt_options);
@@ -75,16 +75,22 @@ var _ol_VectorTile_ = function(tileCoord, state, src, format, tileLoadFunction,
};
-inherits(_ol_VectorTile_, _ol_Tile_);
+inherits(VectorTile, _ol_Tile_);
+
+/**
+ * @const
+ * @type {ol.Extent}
+ */
+var DEFAULT_EXTENT = [0, 0, 4096, 4096];
/**
* @inheritDoc
*/
-_ol_VectorTile_.prototype.disposeInternal = function() {
+VectorTile.prototype.disposeInternal = function() {
this.features_ = null;
this.replayGroups_ = {};
- this.state = _ol_TileState_.ABORT;
+ this.state = TileState.ABORT;
this.changed();
_ol_Tile_.prototype.disposeInternal.call(this);
};
@@ -95,8 +101,8 @@ _ol_VectorTile_.prototype.disposeInternal = function() {
* @return {ol.Extent} The extent.
* @api
*/
-_ol_VectorTile_.prototype.getExtent = function() {
- return this.extent_ || _ol_VectorTile_.DEFAULT_EXTENT;
+VectorTile.prototype.getExtent = function() {
+ return this.extent_ || DEFAULT_EXTENT;
};
@@ -105,7 +111,7 @@ _ol_VectorTile_.prototype.getExtent = function() {
* @return {ol.format.Feature} Feature format.
* @api
*/
-_ol_VectorTile_.prototype.getFormat = function() {
+VectorTile.prototype.getFormat = function() {
return this.format_;
};
@@ -116,7 +122,7 @@ _ol_VectorTile_.prototype.getFormat = function() {
* @return {Array.
} Features.
* @api
*/
-_ol_VectorTile_.prototype.getFeatures = function() {
+VectorTile.prototype.getFeatures = function() {
return this.features_;
};
@@ -124,7 +130,7 @@ _ol_VectorTile_.prototype.getFeatures = function() {
/**
* @inheritDoc
*/
-_ol_VectorTile_.prototype.getKey = function() {
+VectorTile.prototype.getKey = function() {
return this.url_;
};
@@ -135,7 +141,7 @@ _ol_VectorTile_.prototype.getKey = function() {
* @return {ol.proj.Projection} Feature projection.
* @api
*/
-_ol_VectorTile_.prototype.getProjection = function() {
+VectorTile.prototype.getProjection = function() {
return this.projection_;
};
@@ -145,7 +151,7 @@ _ol_VectorTile_.prototype.getProjection = function() {
* @param {string} key Key.
* @return {ol.render.ReplayGroup} Replay group.
*/
-_ol_VectorTile_.prototype.getReplayGroup = function(layer, key) {
+VectorTile.prototype.getReplayGroup = function(layer, key) {
return this.replayGroups_[getUid(layer) + ',' + key];
};
@@ -153,9 +159,9 @@ _ol_VectorTile_.prototype.getReplayGroup = function(layer, key) {
/**
* @inheritDoc
*/
-_ol_VectorTile_.prototype.load = function() {
- if (this.state == _ol_TileState_.IDLE) {
- this.setState(_ol_TileState_.LOADING);
+VectorTile.prototype.load = function() {
+ if (this.state == TileState.IDLE) {
+ this.setState(TileState.LOADING);
this.tileLoadFunction_(this, this.url_);
this.loader_(null, NaN, null);
}
@@ -168,7 +174,7 @@ _ol_VectorTile_.prototype.load = function() {
* @param {ol.proj.Projection} dataProjection Data projection.
* @param {ol.Extent} extent Extent.
*/
-_ol_VectorTile_.prototype.onLoad = function(features, dataProjection, extent) {
+VectorTile.prototype.onLoad = function(features, dataProjection, extent) {
this.setProjection(dataProjection);
this.setFeatures(features);
this.setExtent(extent);
@@ -178,8 +184,8 @@ _ol_VectorTile_.prototype.onLoad = function(features, dataProjection, extent) {
/**
* Handler for tile load errors.
*/
-_ol_VectorTile_.prototype.onError = function() {
- this.setState(_ol_TileState_.ERROR);
+VectorTile.prototype.onError = function() {
+ this.setState(TileState.ERROR);
};
@@ -195,7 +201,7 @@ _ol_VectorTile_.prototype.onError = function() {
* @param {ol.Extent} extent The extent.
* @api
*/
-_ol_VectorTile_.prototype.setExtent = function(extent) {
+VectorTile.prototype.setExtent = function(extent) {
this.extent_ = extent;
};
@@ -206,9 +212,9 @@ _ol_VectorTile_.prototype.setExtent = function(extent) {
* @param {Array.} features Features.
* @api
*/
-_ol_VectorTile_.prototype.setFeatures = function(features) {
+VectorTile.prototype.setFeatures = function(features) {
this.features_ = features;
- this.setState(_ol_TileState_.LOADED);
+ this.setState(TileState.LOADED);
};
@@ -219,7 +225,7 @@ _ol_VectorTile_.prototype.setFeatures = function(features) {
* @param {ol.proj.Projection} projection Feature projection.
* @api
*/
-_ol_VectorTile_.prototype.setProjection = function(projection) {
+VectorTile.prototype.setProjection = function(projection) {
this.projection_ = projection;
};
@@ -229,7 +235,7 @@ _ol_VectorTile_.prototype.setProjection = function(projection) {
* @param {string} key Key.
* @param {ol.render.ReplayGroup} replayGroup Replay group.
*/
-_ol_VectorTile_.prototype.setReplayGroup = function(layer, key, replayGroup) {
+VectorTile.prototype.setReplayGroup = function(layer, key, replayGroup) {
this.replayGroups_[getUid(layer) + ',' + key] = replayGroup;
};
@@ -239,14 +245,8 @@ _ol_VectorTile_.prototype.setReplayGroup = function(layer, key, replayGroup) {
* @param {ol.FeatureLoader} loader Feature loader.
* @api
*/
-_ol_VectorTile_.prototype.setLoader = function(loader) {
+VectorTile.prototype.setLoader = function(loader) {
this.loader_ = loader;
};
-
-/**
- * @const
- * @type {ol.Extent}
- */
-_ol_VectorTile_.DEFAULT_EXTENT = [0, 0, 4096, 4096];
-export default _ol_VectorTile_;
+export default VectorTile;
diff --git a/src/ol/events/EventTarget.js b/src/ol/events/EventTarget.js
index de69b2c6c2..2436d14e11 100644
--- a/src/ol/events/EventTarget.js
+++ b/src/ol/events/EventTarget.js
@@ -2,7 +2,7 @@
* @module ol/events/EventTarget
*/
import {inherits, nullFunction} from '../index.js';
-import _ol_Disposable_ from '../Disposable.js';
+import Disposable from '../Disposable.js';
import _ol_events_ from '../events.js';
import Event from '../events/Event.js';
@@ -26,7 +26,7 @@ import Event from '../events/Event.js';
*/
var EventTarget = function() {
- _ol_Disposable_.call(this);
+ Disposable.call(this);
/**
* @private
@@ -48,7 +48,7 @@ var EventTarget = function() {
};
-inherits(EventTarget, _ol_Disposable_);
+inherits(EventTarget, Disposable);
/**
diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js
index 6a19c80ed7..9122d45402 100644
--- a/src/ol/format/TopoJSON.js
+++ b/src/ol/format/TopoJSON.js
@@ -52,6 +52,20 @@ var TopoJSON = function(opt_options) {
inherits(TopoJSON, JSONFeature);
+/**
+ * @const
+ * @type {Object.}
+ */
+var GEOMETRY_READERS = {
+ 'Point': readPointGeometry,
+ 'LineString': readLineStringGeometry,
+ 'Polygon': readPolygonGeometry,
+ 'MultiPoint': readMultiPointGeometry,
+ 'MultiLineString': readMultiLineStringGeometry,
+ 'MultiPolygon': readMultiPolygonGeometry
+};
+
+
/**
* Concatenate arcs into a coordinate array.
* @param {Array.} indices Indices of arcs to concatenate. Negative
@@ -59,9 +73,8 @@ inherits(TopoJSON, JSONFeature);
* @param {Array.>} arcs Array of arcs (already
* transformed).
* @return {Array.} Coordinates array.
- * @private
*/
-TopoJSON.concatenateArcs_ = function(indices, arcs) {
+function concatenateArcs(indices, arcs) {
/** @type {Array.} */
var coordinates = [];
var index, arc;
@@ -87,7 +100,7 @@ TopoJSON.concatenateArcs_ = function(indices, arcs) {
coordinates[j] = coordinates[j].slice();
}
return coordinates;
-};
+}
/**
@@ -97,15 +110,14 @@ TopoJSON.concatenateArcs_ = function(indices, arcs) {
* @param {Array.} scale Scale for each dimension.
* @param {Array.} translate Translation for each dimension.
* @return {ol.geom.Point} Geometry.
- * @private
*/
-TopoJSON.readPointGeometry_ = function(object, scale, translate) {
+function readPointGeometry(object, scale, translate) {
var coordinates = object.coordinates;
if (scale && translate) {
- TopoJSON.transformVertex_(coordinates, scale, translate);
+ transformVertex(coordinates, scale, translate);
}
return new Point(coordinates);
-};
+}
/**
@@ -115,19 +127,17 @@ TopoJSON.readPointGeometry_ = function(object, scale, translate) {
* @param {Array.} scale Scale for each dimension.
* @param {Array.} translate Translation for each dimension.
* @return {ol.geom.MultiPoint} Geometry.
- * @private
*/
-TopoJSON.readMultiPointGeometry_ = function(object, scale,
- translate) {
+function readMultiPointGeometry(object, scale, translate) {
var coordinates = object.coordinates;
var i, ii;
if (scale && translate) {
for (i = 0, ii = coordinates.length; i < ii; ++i) {
- TopoJSON.transformVertex_(coordinates[i], scale, translate);
+ transformVertex(coordinates[i], scale, translate);
}
}
return new MultiPoint(coordinates);
-};
+}
/**
@@ -136,12 +146,11 @@ TopoJSON.readMultiPointGeometry_ = function(object, scale,
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.>} arcs Array of arcs.
* @return {ol.geom.LineString} Geometry.
- * @private
*/
-TopoJSON.readLineStringGeometry_ = function(object, arcs) {
- var coordinates = TopoJSON.concatenateArcs_(object.arcs, arcs);
+function readLineStringGeometry(object, arcs) {
+ var coordinates = concatenateArcs(object.arcs, arcs);
return new LineString(coordinates);
-};
+}
/**
@@ -150,16 +159,15 @@ TopoJSON.readLineStringGeometry_ = function(object, arcs) {
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.>} arcs Array of arcs.
* @return {ol.geom.MultiLineString} Geometry.
- * @private
*/
-TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) {
+function readMultiLineStringGeometry(object, arcs) {
var coordinates = [];
var i, ii;
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
- coordinates[i] = TopoJSON.concatenateArcs_(object.arcs[i], arcs);
+ coordinates[i] = concatenateArcs(object.arcs[i], arcs);
}
return new MultiLineString(coordinates);
-};
+}
/**
@@ -168,16 +176,15 @@ TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) {
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.>} arcs Array of arcs.
* @return {ol.geom.Polygon} Geometry.
- * @private
*/
-TopoJSON.readPolygonGeometry_ = function(object, arcs) {
+function readPolygonGeometry(object, arcs) {
var coordinates = [];
var i, ii;
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
- coordinates[i] = TopoJSON.concatenateArcs_(object.arcs[i], arcs);
+ coordinates[i] = concatenateArcs(object.arcs[i], arcs);
}
return new Polygon(coordinates);
-};
+}
/**
@@ -186,9 +193,8 @@ TopoJSON.readPolygonGeometry_ = function(object, arcs) {
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.>} arcs Array of arcs.
* @return {ol.geom.MultiPolygon} Geometry.
- * @private
*/
-TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
+function readMultiPolygonGeometry(object, arcs) {
var coordinates = [];
var polyArray, ringCoords, j, jj;
var i, ii;
@@ -198,12 +204,12 @@ TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
ringCoords = [];
for (j = 0, jj = polyArray.length; j < jj; ++j) {
// for each ring
- ringCoords[j] = TopoJSON.concatenateArcs_(polyArray[j], arcs);
+ ringCoords[j] = concatenateArcs(polyArray[j], arcs);
}
coordinates[i] = ringCoords;
}
return new MultiPolygon(coordinates);
-};
+}
/**
@@ -219,19 +225,17 @@ TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
* @param {string} name Name of the `Topology`'s child object.
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.} Array of features.
- * @private
*/
-TopoJSON.readFeaturesFromGeometryCollection_ = function(
- collection, arcs, scale, translate, property, name, opt_options) {
+function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, property, name, opt_options) {
var geometries = collection.geometries;
var features = [];
var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) {
- features[i] = TopoJSON.readFeatureFromGeometry_(
+ features[i] = readFeatureFromGeometry(
geometries[i], arcs, scale, translate, property, name, opt_options);
}
return features;
-};
+}
/**
@@ -246,13 +250,11 @@ TopoJSON.readFeaturesFromGeometryCollection_ = function(
* @param {string} name Name of the `Topology`'s child object.
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature} Feature.
- * @private
*/
-TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
- scale, translate, property, name, opt_options) {
+function readFeatureFromGeometry(object, arcs, scale, translate, property, name, opt_options) {
var geometry;
var type = object.type;
- var geometryReader = TopoJSON.GEOMETRY_READERS_[type];
+ var geometryReader = GEOMETRY_READERS[type];
if ((type === 'Point') || (type === 'MultiPoint')) {
geometry = geometryReader(object, scale, translate);
} else {
@@ -275,7 +277,7 @@ TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
feature.setProperties(properties);
}
return feature;
-};
+}
/**
@@ -304,7 +306,7 @@ TopoJSON.prototype.readFeaturesFromObject = function(
}
var arcs = topoJSONTopology.arcs;
if (transform) {
- TopoJSON.transformArcs_(arcs, scale, translate);
+ transformArcs(arcs, scale, translate);
}
/** @type {Array.} */
var features = [];
@@ -316,15 +318,12 @@ TopoJSON.prototype.readFeaturesFromObject = function(
continue;
}
if (topoJSONFeatures[objectName].type === 'GeometryCollection') {
- feature = /** @type {TopoJSONGeometryCollection} */
- (topoJSONFeatures[objectName]);
- features.push.apply(features,
- TopoJSON.readFeaturesFromGeometryCollection_(
- feature, arcs, scale, translate, property, objectName, opt_options));
+ feature = /** @type {TopoJSONGeometryCollection} */ (topoJSONFeatures[objectName]);
+ features.push.apply(features, readFeaturesFromGeometryCollection(
+ feature, arcs, scale, translate, property, objectName, opt_options));
} else {
- feature = /** @type {TopoJSONGeometry} */
- (topoJSONFeatures[objectName]);
- features.push(TopoJSON.readFeatureFromGeometry_(
+ feature = /** @type {TopoJSONGeometry} */ (topoJSONFeatures[objectName]);
+ features.push(readFeatureFromGeometry(
feature, arcs, scale, translate, property, objectName, opt_options));
}
}
@@ -342,14 +341,13 @@ TopoJSON.prototype.readFeaturesFromObject = function(
* @param {Array.>} arcs Array of arcs.
* @param {Array.} scale Scale for each dimension.
* @param {Array.} translate Translation for each dimension.
- * @private
*/
-TopoJSON.transformArcs_ = function(arcs, scale, translate) {
+function transformArcs(arcs, scale, translate) {
var i, ii;
for (i = 0, ii = arcs.length; i < ii; ++i) {
- TopoJSON.transformArc_(arcs[i], scale, translate);
+ transformArc(arcs[i], scale, translate);
}
-};
+}
/**
@@ -358,9 +356,8 @@ TopoJSON.transformArcs_ = function(arcs, scale, translate) {
* @param {Array.} arc Arc.
* @param {Array.} scale Scale for each dimension.
* @param {Array.} translate Translation for each dimension.
- * @private
*/
-TopoJSON.transformArc_ = function(arc, scale, translate) {
+function transformArc(arc, scale, translate) {
var x = 0;
var y = 0;
var vertex;
@@ -371,9 +368,9 @@ TopoJSON.transformArc_ = function(arc, scale, translate) {
y += vertex[1];
vertex[0] = x;
vertex[1] = y;
- TopoJSON.transformVertex_(vertex, scale, translate);
+ transformVertex(vertex, scale, translate);
}
-};
+}
/**
@@ -383,12 +380,11 @@ TopoJSON.transformArc_ = function(arc, scale, translate) {
* @param {ol.Coordinate} vertex Vertex.
* @param {Array.} scale Scale for each dimension.
* @param {Array.} translate Translation for each dimension.
- * @private
*/
-TopoJSON.transformVertex_ = function(vertex, scale, translate) {
+function transformVertex(vertex, scale, translate) {
vertex[0] = vertex[0] * scale[0] + translate[0];
vertex[1] = vertex[1] * scale[1] + translate[1];
-};
+}
/**
@@ -410,21 +406,6 @@ TopoJSON.prototype.readProjectionFromObject = function(object) {
};
-/**
- * @const
- * @private
- * @type {Object.}
- */
-TopoJSON.GEOMETRY_READERS_ = {
- 'Point': TopoJSON.readPointGeometry_,
- 'LineString': TopoJSON.readLineStringGeometry_,
- 'Polygon': TopoJSON.readPolygonGeometry_,
- 'MultiPoint': TopoJSON.readMultiPointGeometry_,
- 'MultiLineString': TopoJSON.readMultiLineStringGeometry_,
- 'MultiPolygon': TopoJSON.readMultiPolygonGeometry_
-};
-
-
/**
* Not implemented.
* @inheritDoc
diff --git a/src/ol/render/Box.js b/src/ol/render/Box.js
index fb6b392cf2..a58698770c 100644
--- a/src/ol/render/Box.js
+++ b/src/ol/render/Box.js
@@ -4,7 +4,7 @@
// FIXME add rotation
import {inherits} from '../index.js';
-import _ol_Disposable_ from '../Disposable.js';
+import Disposable from '../Disposable.js';
import Polygon from '../geom/Polygon.js';
/**
@@ -48,7 +48,7 @@ var _ol_render_Box_ = function(className) {
};
-inherits(_ol_render_Box_, _ol_Disposable_);
+inherits(_ol_render_Box_, Disposable);
/**
diff --git a/src/ol/renderer/Layer.js b/src/ol/renderer/Layer.js
index 89e4010222..cd6521bca1 100644
--- a/src/ol/renderer/Layer.js
+++ b/src/ol/renderer/Layer.js
@@ -4,7 +4,7 @@
import {getUid, inherits, nullFunction} from '../index.js';
import ImageState from '../ImageState.js';
import _ol_Observable_ from '../Observable.js';
-import _ol_TileState_ from '../TileState.js';
+import TileState from '../TileState.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {FALSE} from '../functions.js';
@@ -225,7 +225,7 @@ _ol_renderer_Layer_.prototype.manageTilePyramid = function(
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
if (currentZ - z <= preload) {
tile = tileSource.getTile(z, x, y, pixelRatio, projection);
- if (tile.getState() == _ol_TileState_.IDLE) {
+ if (tile.getState() == TileState.IDLE) {
wantedTiles[tile.getKey()] = true;
if (!tileQueue.isKeyQueued(tile.getKey())) {
tileQueue.enqueue([tile, tileSourceKey,
diff --git a/src/ol/renderer/Map.js b/src/ol/renderer/Map.js
index 41990b47ca..56ef4c7201 100644
--- a/src/ol/renderer/Map.js
+++ b/src/ol/renderer/Map.js
@@ -2,7 +2,7 @@
* @module ol/renderer/Map
*/
import {getUid, inherits, nullFunction} from '../index.js';
-import _ol_Disposable_ from '../Disposable.js';
+import Disposable from '../Disposable.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {getWidth} from '../extent.js';
@@ -22,7 +22,7 @@ import _ol_transform_ from '../transform.js';
*/
var _ol_renderer_Map_ = function(container, map) {
- _ol_Disposable_.call(this);
+ Disposable.call(this);
/**
@@ -45,7 +45,7 @@ var _ol_renderer_Map_ = function(container, map) {
};
-inherits(_ol_renderer_Map_, _ol_Disposable_);
+inherits(_ol_renderer_Map_, Disposable);
/**
diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js
index 307bff2fa0..ed6a492caf 100644
--- a/src/ol/renderer/canvas/TileLayer.js
+++ b/src/ol/renderer/canvas/TileLayer.js
@@ -4,7 +4,7 @@
import {getUid, inherits} from '../../index.js';
import LayerType from '../../LayerType.js';
import TileRange from '../../TileRange.js';
-import _ol_TileState_ from '../../TileState.js';
+import TileState from '../../TileState.js';
import _ol_ViewHint_ from '../../ViewHint.js';
import {createCanvasContext2D} from '../../dom.js';
import {containsExtent, createEmpty, equals, getIntersection, isEmpty} from '../../extent.js';
@@ -111,9 +111,9 @@ _ol_renderer_canvas_TileLayer_['create'] = function(mapRenderer, layer) {
_ol_renderer_canvas_TileLayer_.prototype.isDrawableTile_ = function(tile) {
var tileState = tile.getState();
var useInterimTilesOnError = this.getLayer().getUseInterimTilesOnError();
- return tileState == _ol_TileState_.LOADED ||
- tileState == _ol_TileState_.EMPTY ||
- tileState == _ol_TileState_.ERROR && !useInterimTilesOnError;
+ return tileState == TileState.LOADED ||
+ tileState == TileState.EMPTY ||
+ tileState == TileState.ERROR && !useInterimTilesOnError;
};
/**
@@ -166,10 +166,10 @@ _ol_renderer_canvas_TileLayer_.prototype.prepareFrame = function(frameState, lay
for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
tile = tileSource.getTile(z, x, y, pixelRatio, projection);
- if (tile.getState() == _ol_TileState_.ERROR) {
+ if (tile.getState() == TileState.ERROR) {
if (!tileLayer.getUseInterimTilesOnError()) {
// When useInterimTilesOnError is false, we consider the error tile as loaded.
- tile.setState(_ol_TileState_.LOADED);
+ tile.setState(TileState.LOADED);
} else if (tileLayer.getPreload() > 0) {
// Preloaded tiles for lower resolutions might have finished loading.
newTiles = true;
@@ -180,7 +180,7 @@ _ol_renderer_canvas_TileLayer_.prototype.prepareFrame = function(frameState, lay
}
if (this.isDrawableTile_(tile)) {
var uid = getUid(this);
- if (tile.getState() == _ol_TileState_.LOADED) {
+ if (tile.getState() == TileState.LOADED) {
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
var inTransition = tile.inTransition(uid);
if (!newTiles && (inTransition || this.renderedTiles.indexOf(tile) === -1)) {
diff --git a/src/ol/renderer/canvas/VectorTileLayer.js b/src/ol/renderer/canvas/VectorTileLayer.js
index 876e7d4330..34bfdf829a 100644
--- a/src/ol/renderer/canvas/VectorTileLayer.js
+++ b/src/ol/renderer/canvas/VectorTileLayer.js
@@ -3,7 +3,7 @@
*/
import {getUid, inherits} from '../../index.js';
import LayerType from '../../LayerType.js';
-import _ol_TileState_ from '../../TileState.js';
+import TileState from '../../TileState.js';
import {createCanvasContext2D} from '../../dom.js';
import _ol_events_ from '../../events.js';
import EventType from '../../events/EventType.js';
@@ -174,7 +174,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.createReplayGroup_ = function(
var zIndexKeys = {};
for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
var sourceTile = tile.getTile(tile.tileKeys[t]);
- if (sourceTile.getState() == _ol_TileState_.ERROR) {
+ if (sourceTile.getState() == TileState.ERROR) {
continue;
}
@@ -292,7 +292,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.forEachFeatureAtCoordinate = func
}
for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
var sourceTile = tile.getTile(tile.tileKeys[t]);
- if (sourceTile.getState() == _ol_TileState_.ERROR) {
+ if (sourceTile.getState() == TileState.ERROR) {
continue;
}
replayGroup = sourceTile.getReplayGroup(layer, tile.tileCoord.toString());
@@ -393,7 +393,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.postCompose = function(context, f
var zs = [];
for (var i = tiles.length - 1; i >= 0; --i) {
var tile = /** @type {ol.VectorImageTile} */ (tiles[i]);
- if (tile.getState() == _ol_TileState_.ABORT) {
+ if (tile.getState() == TileState.ABORT) {
continue;
}
var tileCoord = tile.tileCoord;
@@ -402,7 +402,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.postCompose = function(context, f
var transform = undefined;
for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
var sourceTile = tile.getTile(tile.tileKeys[t]);
- if (sourceTile.getState() == _ol_TileState_.ERROR) {
+ if (sourceTile.getState() == TileState.ERROR) {
continue;
}
var replayGroup = sourceTile.getReplayGroup(layer, tileCoord.toString());
@@ -507,7 +507,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.renderTileImage_ = function(
var tileExtent = tileGrid.getTileCoordExtent(tileCoord);
for (var i = 0, ii = tile.tileKeys.length; i < ii; ++i) {
var sourceTile = tile.getTile(tile.tileKeys[i]);
- if (sourceTile.getState() == _ol_TileState_.ERROR) {
+ if (sourceTile.getState() == TileState.ERROR) {
continue;
}
var pixelScale = pixelRatio / resolution;
diff --git a/src/ol/renderer/webgl/TileLayer.js b/src/ol/renderer/webgl/TileLayer.js
index 149f3c7815..a223738d9b 100644
--- a/src/ol/renderer/webgl/TileLayer.js
+++ b/src/ol/renderer/webgl/TileLayer.js
@@ -7,7 +7,7 @@
import {inherits} from '../../index.js';
import LayerType from '../../LayerType.js';
import TileRange from '../../TileRange.js';
-import _ol_TileState_ from '../../TileState.js';
+import TileState from '../../TileState.js';
import {numberSafeCompareFunction} from '../../array.js';
import {createEmpty, intersects} from '../../extent.js';
import {roundUpToPowerOfTwo} from '../../math.js';
@@ -262,20 +262,20 @@ _ol_renderer_webgl_TileLayer_.prototype.prepareFrame = function(frameState, laye
}
}
tileState = tile.getState();
- drawable = tileState == _ol_TileState_.LOADED ||
- tileState == _ol_TileState_.EMPTY ||
- tileState == _ol_TileState_.ERROR && !useInterimTilesOnError;
+ drawable = tileState == TileState.LOADED ||
+ tileState == TileState.EMPTY ||
+ tileState == TileState.ERROR && !useInterimTilesOnError;
if (!drawable) {
tile = tile.getInterimTile();
}
tileState = tile.getState();
- if (tileState == _ol_TileState_.LOADED) {
+ if (tileState == TileState.LOADED) {
if (mapRenderer.isTileTextureLoaded(tile)) {
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
continue;
}
- } else if (tileState == _ol_TileState_.EMPTY ||
- (tileState == _ol_TileState_.ERROR &&
+ } else if (tileState == TileState.EMPTY ||
+ (tileState == TileState.ERROR &&
!useInterimTilesOnError)) {
continue;
}
@@ -342,7 +342,7 @@ _ol_renderer_webgl_TileLayer_.prototype.prepareFrame = function(frameState, laye
* @param {ol.Tile} tile Tile.
*/
function(tile) {
- if (tile.getState() == _ol_TileState_.LOADED &&
+ if (tile.getState() == TileState.LOADED &&
!mapRenderer.isTileTextureLoaded(tile) &&
!tileTextureQueue.isKeyQueued(tile.getKey())) {
tileTextureQueue.enqueue([
diff --git a/src/ol/reproj/Tile.js b/src/ol/reproj/Tile.js
index dbab5f9f99..0875b9b30a 100644
--- a/src/ol/reproj/Tile.js
+++ b/src/ol/reproj/Tile.js
@@ -4,7 +4,7 @@
import {ERROR_THRESHOLD} from './common.js';
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
-import _ol_TileState_ from '../TileState.js';
+import TileState from '../TileState.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {getArea, getCenter, getIntersection} from '../extent.js';
@@ -36,7 +36,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
targetProj, targetTileGrid, tileCoord, wrappedTileCoord,
pixelRatio, gutter, getTileFunction,
opt_errorThreshold, opt_renderEdges) {
- _ol_Tile_.call(this, tileCoord, _ol_TileState_.IDLE);
+ _ol_Tile_.call(this, tileCoord, TileState.IDLE);
/**
* @private
@@ -108,7 +108,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
if (getArea(limitedTargetExtent) === 0) {
// Tile is completely outside range -> EMPTY
// TODO: is it actually correct that the source even creates the tile ?
- this.state = _ol_TileState_.EMPTY;
+ this.state = TileState.EMPTY;
return;
}
@@ -131,7 +131,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
if (!isFinite(sourceResolution) || sourceResolution <= 0) {
// invalid sourceResolution -> EMPTY
// probably edges of the projections when no extent is defined
- this.state = _ol_TileState_.EMPTY;
+ this.state = TileState.EMPTY;
return;
}
@@ -148,7 +148,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
if (this.triangulation_.getTriangles().length === 0) {
// no valid triangles -> EMPTY
- this.state = _ol_TileState_.EMPTY;
+ this.state = TileState.EMPTY;
return;
}
@@ -167,7 +167,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
}
if (!getArea(sourceExtent)) {
- this.state = _ol_TileState_.EMPTY;
+ this.state = TileState.EMPTY;
} else {
var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(
sourceExtent, this.sourceZ_);
@@ -182,7 +182,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
}
if (this.sourceTiles_.length === 0) {
- this.state = _ol_TileState_.EMPTY;
+ this.state = TileState.EMPTY;
}
}
};
@@ -194,7 +194,7 @@ inherits(_ol_reproj_Tile_, _ol_Tile_);
* @inheritDoc
*/
_ol_reproj_Tile_.prototype.disposeInternal = function() {
- if (this.state == _ol_TileState_.LOADING) {
+ if (this.state == TileState.LOADING) {
this.unlistenSources_();
}
_ol_Tile_.prototype.disposeInternal.call(this);
@@ -216,7 +216,7 @@ _ol_reproj_Tile_.prototype.getImage = function() {
_ol_reproj_Tile_.prototype.reproject_ = function() {
var sources = [];
this.sourceTiles_.forEach(function(tile, i, arr) {
- if (tile && tile.getState() == _ol_TileState_.LOADED) {
+ if (tile && tile.getState() == TileState.LOADED) {
sources.push({
extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord),
image: tile.getImage()
@@ -226,7 +226,7 @@ _ol_reproj_Tile_.prototype.reproject_ = function() {
this.sourceTiles_.length = 0;
if (sources.length === 0) {
- this.state = _ol_TileState_.ERROR;
+ this.state = TileState.ERROR;
} else {
var z = this.wrappedTileCoord_[0];
var size = this.targetTileGrid_.getTileSize(z);
@@ -242,7 +242,7 @@ _ol_reproj_Tile_.prototype.reproject_ = function() {
targetResolution, targetExtent, this.triangulation_, sources,
this.gutter_, this.renderEdges_);
- this.state = _ol_TileState_.LOADED;
+ this.state = TileState.LOADED;
}
this.changed();
};
@@ -252,8 +252,8 @@ _ol_reproj_Tile_.prototype.reproject_ = function() {
* @inheritDoc
*/
_ol_reproj_Tile_.prototype.load = function() {
- if (this.state == _ol_TileState_.IDLE) {
- this.state = _ol_TileState_.LOADING;
+ if (this.state == TileState.IDLE) {
+ this.state = TileState.LOADING;
this.changed();
var leftToLoad = 0;
@@ -261,16 +261,16 @@ _ol_reproj_Tile_.prototype.load = function() {
this.sourcesListenerKeys_ = [];
this.sourceTiles_.forEach(function(tile, i, arr) {
var state = tile.getState();
- if (state == _ol_TileState_.IDLE || state == _ol_TileState_.LOADING) {
+ if (state == TileState.IDLE || state == TileState.LOADING) {
leftToLoad++;
var sourceListenKey;
sourceListenKey = _ol_events_.listen(tile, EventType.CHANGE,
function(e) {
var state = tile.getState();
- if (state == _ol_TileState_.LOADED ||
- state == _ol_TileState_.ERROR ||
- state == _ol_TileState_.EMPTY) {
+ if (state == TileState.LOADED ||
+ state == TileState.ERROR ||
+ state == TileState.EMPTY) {
_ol_events_.unlistenByKey(sourceListenKey);
leftToLoad--;
if (leftToLoad === 0) {
@@ -285,7 +285,7 @@ _ol_reproj_Tile_.prototype.load = function() {
this.sourceTiles_.forEach(function(tile, i, arr) {
var state = tile.getState();
- if (state == _ol_TileState_.IDLE) {
+ if (state == TileState.IDLE) {
tile.load();
}
});
diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js
index 449c6d2b4b..bfe9ad304d 100644
--- a/src/ol/source/Raster.js
+++ b/src/ol/source/Raster.js
@@ -21,6 +21,27 @@ import SourceState from '../source/State.js';
import _ol_source_Tile_ from '../source/Tile.js';
import _ol_transform_ from '../transform.js';
+
+/**
+ * @enum {string}
+ */
+var RasterEventType = {
+ /**
+ * Triggered before operations are run.
+ * @event ol.source.Raster.Event#beforeoperations
+ * @api
+ */
+ BEFOREOPERATIONS: 'beforeoperations',
+
+ /**
+ * Triggered after operations are run.
+ * @event ol.source.Raster.Event#afteroperations
+ * @api
+ */
+ AFTEROPERATIONS: 'afteroperations'
+};
+
+
/**
* @classdesc
* A source that transforms data from any number of input sources using an
@@ -33,7 +54,7 @@ import _ol_transform_ from '../transform.js';
* @param {olx.source.RasterOptions} options Options.
* @api
*/
-var _ol_source_Raster_ = function(options) {
+var RasterSource = function(options) {
/**
* @private
@@ -58,7 +79,7 @@ var _ol_source_Raster_ = function(options) {
* @private
* @type {Array.}
*/
- this.renderers_ = _ol_source_Raster_.createRenderers_(options.sources);
+ this.renderers_ = createRenderers(options.sources);
for (var r = 0, rr = this.renderers_.length; r < rr; ++r) {
_ol_events_.listen(this.renderers_[r], EventType.CHANGE,
@@ -75,7 +96,7 @@ var _ol_source_Raster_ = function(options) {
},
this.changed.bind(this));
- var layerStatesArray = _ol_source_Raster_.getLayerStatesArray_(this.renderers_);
+ var layerStatesArray = getLayerStatesArray(this.renderers_);
var layerStates = {};
for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
layerStates[getUid(layerStatesArray[i].layer)] = layerStatesArray[i];
@@ -136,7 +157,7 @@ var _ol_source_Raster_ = function(options) {
};
-inherits(_ol_source_Raster_, _ol_source_Image_);
+inherits(RasterSource, _ol_source_Image_);
/**
@@ -146,7 +167,7 @@ inherits(_ol_source_Raster_, _ol_source_Image_);
* in a worker.
* @api
*/
-_ol_source_Raster_.prototype.setOperation = function(operation, opt_lib) {
+RasterSource.prototype.setOperation = function(operation, opt_lib) {
this.worker_ = new Processor({
operation: operation,
imageOps: this.operationType_ === RasterOperationType.IMAGE,
@@ -166,7 +187,7 @@ _ol_source_Raster_.prototype.setOperation = function(operation, opt_lib) {
* @return {olx.FrameState} The updated frame state.
* @private
*/
-_ol_source_Raster_.prototype.updateFrameState_ = function(extent, resolution, projection) {
+RasterSource.prototype.updateFrameState_ = function(extent, resolution, projection) {
var frameState = /** @type {olx.FrameState} */ (
_ol_obj_.assign({}, this.frameState_));
@@ -196,7 +217,7 @@ _ol_source_Raster_.prototype.updateFrameState_ = function(extent, resolution, pr
* @return {boolean} All sources are ready.
* @private
*/
-_ol_source_Raster_.prototype.allSourcesReady_ = function() {
+RasterSource.prototype.allSourcesReady_ = function() {
var ready = true;
var source;
for (var i = 0, ii = this.renderers_.length; i < ii; ++i) {
@@ -213,7 +234,7 @@ _ol_source_Raster_.prototype.allSourcesReady_ = function() {
/**
* @inheritDoc
*/
-_ol_source_Raster_.prototype.getImage = function(extent, resolution, pixelRatio, projection) {
+RasterSource.prototype.getImage = function(extent, resolution, pixelRatio, projection) {
if (!this.allSourcesReady_()) {
return null;
}
@@ -248,12 +269,12 @@ _ol_source_Raster_.prototype.getImage = function(extent, resolution, pixelRatio,
* Start processing source data.
* @private
*/
-_ol_source_Raster_.prototype.processSources_ = function() {
+RasterSource.prototype.processSources_ = function() {
var frameState = this.requestedFrameState_;
var len = this.renderers_.length;
var imageDatas = new Array(len);
for (var i = 0; i < len; ++i) {
- var imageData = _ol_source_Raster_.getImageData_(
+ var imageData = getImageData(
this.renderers_[i], frameState, frameState.layerStatesArray[i]);
if (imageData) {
imageDatas[i] = imageData;
@@ -263,10 +284,8 @@ _ol_source_Raster_.prototype.processSources_ = function() {
}
var data = {};
- this.dispatchEvent(new _ol_source_Raster_.Event(
- _ol_source_Raster_.EventType_.BEFOREOPERATIONS, frameState, data));
- this.worker_.process(imageDatas, data,
- this.onWorkerComplete_.bind(this, frameState));
+ this.dispatchEvent(new RasterSource.Event(RasterEventType.BEFOREOPERATIONS, frameState, data));
+ this.worker_.process(imageDatas, data, this.onWorkerComplete_.bind(this, frameState));
};
@@ -278,7 +297,7 @@ _ol_source_Raster_.prototype.processSources_ = function() {
* @param {Object} data The user data.
* @private
*/
-_ol_source_Raster_.prototype.onWorkerComplete_ = function(frameState, err, output, data) {
+RasterSource.prototype.onWorkerComplete_ = function(frameState, err, output, data) {
if (err || !output) {
return;
}
@@ -305,8 +324,7 @@ _ol_source_Raster_.prototype.onWorkerComplete_ = function(frameState, err, outpu
this.changed();
this.renderedRevision_ = this.getRevision();
- this.dispatchEvent(new _ol_source_Raster_.Event(
- _ol_source_Raster_.EventType_.AFTEROPERATIONS, frameState, data));
+ this.dispatchEvent(new RasterSource.Event(RasterEventType.AFTEROPERATIONS, frameState, data));
};
@@ -316,27 +334,26 @@ _ol_source_Raster_.prototype.onWorkerComplete_ = function(frameState, err, outpu
* @param {olx.FrameState} frameState The frame state.
* @param {ol.LayerState} layerState The layer state.
* @return {ImageData} The image data.
- * @private
*/
-_ol_source_Raster_.getImageData_ = function(renderer, frameState, layerState) {
+function getImageData(renderer, frameState, layerState) {
if (!renderer.prepareFrame(frameState, layerState)) {
return null;
}
var width = frameState.size[0];
var height = frameState.size[1];
- if (!_ol_source_Raster_.context_) {
- _ol_source_Raster_.context_ = createCanvasContext2D(width, height);
+ if (!RasterSource.context_) {
+ RasterSource.context_ = createCanvasContext2D(width, height);
} else {
- var canvas = _ol_source_Raster_.context_.canvas;
+ var canvas = RasterSource.context_.canvas;
if (canvas.width !== width || canvas.height !== height) {
- _ol_source_Raster_.context_ = createCanvasContext2D(width, height);
+ RasterSource.context_ = createCanvasContext2D(width, height);
} else {
- _ol_source_Raster_.context_.clearRect(0, 0, width, height);
+ RasterSource.context_.clearRect(0, 0, width, height);
}
}
- renderer.composeFrame(frameState, layerState, _ol_source_Raster_.context_);
- return _ol_source_Raster_.context_.getImageData(0, 0, width, height);
-};
+ renderer.composeFrame(frameState, layerState, RasterSource.context_);
+ return RasterSource.context_.getImageData(0, 0, width, height);
+}
/**
@@ -344,77 +361,72 @@ _ol_source_Raster_.getImageData_ = function(renderer, frameState, layerState) {
* @type {CanvasRenderingContext2D}
* @private
*/
-_ol_source_Raster_.context_ = null;
+RasterSource.context_ = null;
/**
* Get a list of layer states from a list of renderers.
* @param {Array.} renderers Layer renderers.
* @return {Array.} The layer states.
- * @private
*/
-_ol_source_Raster_.getLayerStatesArray_ = function(renderers) {
+function getLayerStatesArray(renderers) {
return renderers.map(function(renderer) {
return renderer.getLayer().getLayerState();
});
-};
+}
/**
* Create renderers for all sources.
* @param {Array.} sources The sources.
* @return {Array.} Array of layer renderers.
- * @private
*/
-_ol_source_Raster_.createRenderers_ = function(sources) {
+function createRenderers(sources) {
var len = sources.length;
var renderers = new Array(len);
for (var i = 0; i < len; ++i) {
- renderers[i] = _ol_source_Raster_.createRenderer_(sources[i]);
+ renderers[i] = createRenderer(sources[i]);
}
return renderers;
-};
+}
/**
* Create a renderer for the provided source.
* @param {ol.source.Source} source The source.
* @return {ol.renderer.canvas.Layer} The renderer.
- * @private
*/
-_ol_source_Raster_.createRenderer_ = function(source) {
+function createRenderer(source) {
var renderer = null;
if (source instanceof _ol_source_Tile_) {
- renderer = _ol_source_Raster_.createTileRenderer_(source);
+ renderer = createTileRenderer(source);
} else if (source instanceof _ol_source_Image_) {
- renderer = _ol_source_Raster_.createImageRenderer_(source);
+ renderer = createImageRenderer(source);
}
return renderer;
-};
+}
/**
* Create an image renderer for the provided source.
* @param {ol.source.Image} source The source.
* @return {ol.renderer.canvas.Layer} The renderer.
- * @private
*/
-_ol_source_Raster_.createImageRenderer_ = function(source) {
+function createImageRenderer(source) {
var layer = new _ol_layer_Image_({source: source});
return new _ol_renderer_canvas_ImageLayer_(layer);
-};
+}
/**
* Create a tile renderer for the provided source.
* @param {ol.source.Tile} source The source.
* @return {ol.renderer.canvas.Layer} The renderer.
- * @private
*/
-_ol_source_Raster_.createTileRenderer_ = function(source) {
+function createTileRenderer(source) {
var layer = new TileLayer({source: source});
return new _ol_renderer_canvas_TileLayer_(layer);
-};
+}
/**
@@ -429,7 +441,7 @@ _ol_source_Raster_.createTileRenderer_ = function(source) {
* @param {olx.FrameState} frameState The frame state.
* @param {Object} data An object made available to operations.
*/
-_ol_source_Raster_.Event = function(type, frameState, data) {
+RasterSource.Event = function(type, frameState, data) {
Event.call(this, type);
/**
@@ -455,34 +467,15 @@ _ol_source_Raster_.Event = function(type, frameState, data) {
this.data = data;
};
-inherits(_ol_source_Raster_.Event, Event);
+inherits(RasterSource.Event, Event);
/**
* @override
*/
-_ol_source_Raster_.prototype.getImageInternal = function() {
+RasterSource.prototype.getImageInternal = function() {
return null; // not implemented
};
-/**
- * @enum {string}
- * @private
- */
-_ol_source_Raster_.EventType_ = {
- /**
- * Triggered before operations are run.
- * @event ol.source.Raster.Event#beforeoperations
- * @api
- */
- BEFOREOPERATIONS: 'beforeoperations',
-
- /**
- * Triggered after operations are run.
- * @event ol.source.Raster.Event#afteroperations
- * @api
- */
- AFTEROPERATIONS: 'afteroperations'
-};
-export default _ol_source_Raster_;
+export default RasterSource;
diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js
index afc44f8674..c6c95ded6e 100644
--- a/src/ol/source/Tile.js
+++ b/src/ol/source/Tile.js
@@ -3,7 +3,7 @@
*/
import {inherits, nullFunction} from '../index.js';
import TileCache from '../TileCache.js';
-import _ol_TileState_ from '../TileState.js';
+import TileState from '../TileState.js';
import Event from '../events/Event.js';
import {equivalent} from '../proj.js';
import _ol_size_ from '../size.js';
@@ -124,7 +124,7 @@ _ol_source_Tile_.prototype.forEachLoadedTile = function(projection, z, tileRange
loaded = false;
if (tileCache.containsKey(tileCoordKey)) {
tile = /** @type {!ol.Tile} */ (tileCache.get(tileCoordKey));
- loaded = tile.getState() === _ol_TileState_.LOADED;
+ loaded = tile.getState() === TileState.LOADED;
if (loaded) {
loaded = (callback(tile) !== false);
}
diff --git a/src/ol/source/TileDebug.js b/src/ol/source/TileDebug.js
index 28f703497b..a876113fc2 100644
--- a/src/ol/source/TileDebug.js
+++ b/src/ol/source/TileDebug.js
@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
-import _ol_TileState_ from '../TileState.js';
+import TileState from '../TileState.js';
import {createCanvasContext2D} from '../dom.js';
import _ol_size_ from '../size.js';
import _ol_source_Tile_ from '../source/Tile.js';
@@ -66,7 +66,7 @@ _ol_source_TileDebug_.prototype.getTile = function(z, x, y) {
*/
_ol_source_TileDebug_.Tile_ = function(tileCoord, tileSize, text) {
- _ol_Tile_.call(this, tileCoord, _ol_TileState_.LOADED);
+ _ol_Tile_.call(this, tileCoord, TileState.LOADED);
/**
* @private
diff --git a/src/ol/source/TileImage.js b/src/ol/source/TileImage.js
index b6c9b987b9..235927bb3c 100644
--- a/src/ol/source/TileImage.js
+++ b/src/ol/source/TileImage.js
@@ -3,9 +3,9 @@
*/
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
import {getUid, inherits} from '../index.js';
-import _ol_ImageTile_ from '../ImageTile.js';
+import ImageTile from '../ImageTile.js';
import TileCache from '../TileCache.js';
-import _ol_TileState_ from '../TileState.js';
+import TileState from '../TileState.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {equivalent, get as getProjection} from '../proj.js';
@@ -57,7 +57,7 @@ var _ol_source_TileImage_ = function(options) {
* ?string, ol.TileLoadFunctionType, olx.TileOptions=)}
*/
this.tileClass = options.tileClass !== undefined ?
- options.tileClass : _ol_ImageTile_;
+ options.tileClass : ImageTile;
/**
* @protected
@@ -218,7 +218,7 @@ _ol_source_TileImage_.prototype.createTile_ = function(z, x, y, pixelRatio, proj
this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
var tile = new this.tileClass(
tileCoord,
- tileUrl !== undefined ? _ol_TileState_.IDLE : _ol_TileState_.EMPTY,
+ tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY,
tileUrl !== undefined ? tileUrl : '',
this.crossOrigin,
this.tileLoadFunction,
@@ -304,7 +304,7 @@ _ol_source_TileImage_.prototype.getTileInternal = function(z, x, y, pixelRatio,
tile = this.createTile_(z, x, y, pixelRatio, projection, key);
//make the new tile the head of the list,
- if (interimTile.getState() == _ol_TileState_.IDLE) {
+ if (interimTile.getState() == TileState.IDLE) {
//the old tile hasn't begun loading yet, and is now outdated, so we can simply discard it
tile.interimTile = interimTile.interimTile;
} else {
diff --git a/src/ol/source/TileUTFGrid.js b/src/ol/source/TileUTFGrid.js
index 55cca8bfbf..3c8857f9eb 100644
--- a/src/ol/source/TileUTFGrid.js
+++ b/src/ol/source/TileUTFGrid.js
@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
-import _ol_TileState_ from '../TileState.js';
+import TileState from '../TileState.js';
import {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
import {assert} from '../asserts.js';
import _ol_events_ from '../events.js';
@@ -224,7 +224,7 @@ _ol_source_TileUTFGrid_.prototype.getTile = function(z, x, y, pixelRatio, projec
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
var tile = new _ol_source_TileUTFGrid_.Tile_(
tileCoord,
- tileUrl !== undefined ? _ol_TileState_.IDLE : _ol_TileState_.EMPTY,
+ tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY,
tileUrl !== undefined ? tileUrl : '',
this.tileGrid.getTileCoordExtent(tileCoord),
this.preemptive_,
@@ -370,7 +370,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.getData = function(coordinate) {
* @template T
*/
_ol_source_TileUTFGrid_.Tile_.prototype.forDataAtCoordinate = function(coordinate, callback, opt_this, opt_request) {
- if (this.state == _ol_TileState_.IDLE && opt_request === true) {
+ if (this.state == TileState.IDLE && opt_request === true) {
_ol_events_.listenOnce(this, EventType.CHANGE, function(e) {
callback.call(opt_this, this.getData(coordinate));
}, this);
@@ -399,7 +399,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.getKey = function() {
* @private
*/
_ol_source_TileUTFGrid_.Tile_.prototype.handleError_ = function() {
- this.state = _ol_TileState_.ERROR;
+ this.state = TileState.ERROR;
this.changed();
};
@@ -413,7 +413,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.handleLoad_ = function(json) {
this.keys_ = json.keys;
this.data_ = json.data;
- this.state = _ol_TileState_.EMPTY;
+ this.state = TileState.EMPTY;
this.changed();
};
@@ -422,8 +422,8 @@ _ol_source_TileUTFGrid_.Tile_.prototype.handleLoad_ = function(json) {
* @private
*/
_ol_source_TileUTFGrid_.Tile_.prototype.loadInternal_ = function() {
- if (this.state == _ol_TileState_.IDLE) {
- this.state = _ol_TileState_.LOADING;
+ if (this.state == TileState.IDLE) {
+ this.state = TileState.LOADING;
if (this.jsonp_) {
_ol_net_.jsonp(this.src_, this.handleLoad_.bind(this),
this.handleError_.bind(this));
diff --git a/src/ol/source/UrlTile.js b/src/ol/source/UrlTile.js
index 7c2bbedc81..db20bd83db 100644
--- a/src/ol/source/UrlTile.js
+++ b/src/ol/source/UrlTile.js
@@ -2,7 +2,7 @@
* @module ol/source/UrlTile
*/
import {getUid, inherits} from '../index.js';
-import _ol_TileState_ from '../TileState.js';
+import TileState from '../TileState.js';
import {expandUrl, createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
import _ol_source_Tile_ from '../source/Tile.js';
import TileEventType from '../source/TileEventType.js';
@@ -120,13 +120,13 @@ _ol_source_UrlTile_.prototype.handleTileChange = function(event) {
var uid = getUid(tile);
var tileState = tile.getState();
var type;
- if (tileState == _ol_TileState_.LOADING) {
+ if (tileState == TileState.LOADING) {
this.tileLoadingKeys_[uid] = true;
type = TileEventType.TILELOADSTART;
} else if (uid in this.tileLoadingKeys_) {
delete this.tileLoadingKeys_[uid];
- type = tileState == _ol_TileState_.ERROR ? TileEventType.TILELOADERROR :
- (tileState == _ol_TileState_.LOADED || tileState == _ol_TileState_.ABORT) ?
+ type = tileState == TileState.ERROR ? TileEventType.TILELOADERROR :
+ (tileState == TileState.LOADED || tileState == TileState.ABORT) ?
TileEventType.TILELOADEND : undefined;
}
if (type != undefined) {
diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js
index 0d4137c636..6b3a38710a 100644
--- a/src/ol/source/VectorTile.js
+++ b/src/ol/source/VectorTile.js
@@ -2,9 +2,9 @@
* @module ol/source/VectorTile
*/
import {inherits} from '../index.js';
-import _ol_TileState_ from '../TileState.js';
-import _ol_VectorImageTile_ from '../VectorImageTile.js';
-import _ol_VectorTile_ from '../VectorTile.js';
+import TileState from '../TileState.js';
+import VectorImageTile, {defaultLoadFunction} from '../VectorImageTile.js';
+import VectorTile from '../VectorTile.js';
import _ol_size_ from '../size.js';
import _ol_source_UrlTile_ from '../source/UrlTile.js';
import _ol_tilecoord_ from '../tilecoord.js';
@@ -46,8 +46,7 @@ var _ol_source_VectorTile_ = function(options) {
projection: projection,
state: options.state,
tileGrid: tileGrid,
- tileLoadFunction: options.tileLoadFunction ?
- options.tileLoadFunction : _ol_VectorImageTile_.defaultLoadFunction,
+ tileLoadFunction: options.tileLoadFunction ? options.tileLoadFunction : defaultLoadFunction,
tileUrlFunction: options.tileUrlFunction,
url: options.url,
urls: options.urls,
@@ -78,7 +77,7 @@ var _ol_source_VectorTile_ = function(options) {
* @type {function(new: ol.VectorTile, ol.TileCoord, ol.TileState, string,
* ol.format.Feature, ol.TileLoadFunctionType)}
*/
- this.tileClass = options.tileClass ? options.tileClass : _ol_VectorTile_;
+ this.tileClass = options.tileClass ? options.tileClass : VectorTile;
/**
* @private
@@ -118,9 +117,9 @@ _ol_source_VectorTile_.prototype.getTile = function(z, x, y, pixelRatio, project
var tileCoord = [z, x, y];
var urlTileCoord = this.getTileCoordForTileUrlFunction(
tileCoord, projection);
- var tile = new _ol_VectorImageTile_(
+ var tile = new VectorImageTile(
tileCoord,
- urlTileCoord !== null ? _ol_TileState_.IDLE : _ol_TileState_.EMPTY,
+ urlTileCoord !== null ? TileState.IDLE : TileState.EMPTY,
this.getRevision(),
this.format_, this.tileLoadFunction, urlTileCoord, this.tileUrlFunction,
this.tileGrid, this.getTileGridForProjection(projection),
diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js
index 21a7aae4da..a716513d6f 100644
--- a/src/ol/source/WMTS.js
+++ b/src/ol/source/WMTS.js
@@ -8,8 +8,8 @@ import {containsExtent} from '../extent.js';
import _ol_obj_ from '../obj.js';
import {get as getProjection, equivalent, transformExtent} from '../proj.js';
import _ol_source_TileImage_ from '../source/TileImage.js';
-import _ol_source_WMTSRequestEncoding_ from '../source/WMTSRequestEncoding.js';
-import _ol_tilegrid_WMTS_ from '../tilegrid/WMTS.js';
+import WMTSRequestEncoding from '../source/WMTSRequestEncoding.js';
+import {createFromCapabilitiesMatrixSet} from '../tilegrid/WMTS.js';
import _ol_uri_ from '../uri.js';
/**
@@ -75,7 +75,7 @@ var _ol_source_WMTS_ = function(options) {
*/
this.requestEncoding_ = options.requestEncoding !== undefined ?
/** @type {ol.source.WMTSRequestEncoding} */ (options.requestEncoding) :
- _ol_source_WMTSRequestEncoding_.KVP;
+ WMTSRequestEncoding.KVP;
var requestEncoding = this.requestEncoding_;
@@ -91,7 +91,7 @@ var _ol_source_WMTS_ = function(options) {
'tilematrixset': this.matrixSet_
};
- if (requestEncoding == _ol_source_WMTSRequestEncoding_.KVP) {
+ if (requestEncoding == WMTSRequestEncoding.KVP) {
_ol_obj_.assign(context, {
'Service': 'WMTS',
'Request': 'GetTile',
@@ -113,7 +113,7 @@ var _ol_source_WMTS_ = function(options) {
// order conforms to wmts spec guidance, and so that we can avoid to escape
// special template params
- template = (requestEncoding == _ol_source_WMTSRequestEncoding_.KVP) ?
+ template = (requestEncoding == WMTSRequestEncoding.KVP) ?
_ol_uri_.appendParams(template, context) :
template.replace(/\{(\w+?)\}/g, function(m, p) {
return (p.toLowerCase() in context) ? context[p.toLowerCase()] : m;
@@ -137,7 +137,7 @@ var _ol_source_WMTS_ = function(options) {
};
_ol_obj_.assign(localContext, dimensions);
var url = template;
- if (requestEncoding == _ol_source_WMTSRequestEncoding_.KVP) {
+ if (requestEncoding == WMTSRequestEncoding.KVP) {
url = _ol_uri_.appendParams(url, localContext);
} else {
url = url.replace(/\{(\w+?)\}/g, function(m, p) {
@@ -419,8 +419,7 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
}
}
- var tileGrid = _ol_tilegrid_WMTS_.createFromCapabilitiesMatrixSet(
- matrixSetObj, extent, matrixLimits);
+ var tileGrid = createFromCapabilitiesMatrixSet(matrixSetObj, extent, matrixLimits);
/** @type {!Array.} */
var urls = [];
@@ -441,21 +440,21 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
// requestEncoding not provided, use the first encoding from the list
requestEncoding = encodings[0];
}
- if (requestEncoding === _ol_source_WMTSRequestEncoding_.KVP) {
- if (includes(encodings, _ol_source_WMTSRequestEncoding_.KVP)) {
+ if (requestEncoding === WMTSRequestEncoding.KVP) {
+ if (includes(encodings, WMTSRequestEncoding.KVP)) {
urls.push(/** @type {string} */ (gets[i]['href']));
}
} else {
break;
}
} else if (gets[i]['href']) {
- requestEncoding = _ol_source_WMTSRequestEncoding_.KVP;
+ requestEncoding = WMTSRequestEncoding.KVP;
urls.push(/** @type {string} */ (gets[i]['href']));
}
}
}
if (urls.length === 0) {
- requestEncoding = _ol_source_WMTSRequestEncoding_.REST;
+ requestEncoding = WMTSRequestEncoding.REST;
l['ResourceURL'].forEach(function(element) {
if (element['resourceType'] === 'tile') {
format = element['format'];
diff --git a/src/ol/source/Zoomify.js b/src/ol/source/Zoomify.js
index 86dfef8006..e4912966cf 100644
--- a/src/ol/source/Zoomify.js
+++ b/src/ol/source/Zoomify.js
@@ -3,15 +3,15 @@
*/
import {DEFAULT_TILE_SIZE} from '../tilegrid/common.js';
import {inherits} from '../index.js';
-import _ol_ImageTile_ from '../ImageTile.js';
-import _ol_TileState_ from '../TileState.js';
+import ImageTile from '../ImageTile.js';
+import TileState from '../TileState.js';
import {expandUrl, createFromTileUrlFunctions} from '../tileurlfunction.js';
import {assert} from '../asserts.js';
import {createCanvasContext2D} from '../dom.js';
import {getTopLeft} from '../extent.js';
import _ol_size_ from '../size.js';
import _ol_source_TileImage_ from '../source/TileImage.js';
-import _ol_tilegrid_TileGrid_ from '../tilegrid/TileGrid.js';
+import TileGrid from '../tilegrid/TileGrid.js';
/**
* @classdesc
@@ -81,7 +81,7 @@ var _ol_source_Zoomify_ = function(opt_options) {
}
resolutions.reverse();
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
tileSize: tileSize,
extent: extent,
origin: getTopLeft(extent),
@@ -168,7 +168,7 @@ inherits(_ol_source_Zoomify_, _ol_source_TileImage_);
_ol_source_Zoomify_.Tile_ = function(
tileGrid, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
- _ol_ImageTile_.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options);
+ ImageTile.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options);
/**
* @private
@@ -182,7 +182,7 @@ _ol_source_Zoomify_.Tile_ = function(
*/
this.tileSize_ = _ol_size_.toSize(tileGrid.getTileSize(tileCoord[0]));
};
-inherits(_ol_source_Zoomify_.Tile_, _ol_ImageTile_);
+inherits(_ol_source_Zoomify_.Tile_, ImageTile);
/**
@@ -192,8 +192,8 @@ _ol_source_Zoomify_.Tile_.prototype.getImage = function() {
if (this.zoomifyImage_) {
return this.zoomifyImage_;
}
- var image = _ol_ImageTile_.prototype.getImage.call(this);
- if (this.state == _ol_TileState_.LOADED) {
+ var image = ImageTile.prototype.getImage.call(this);
+ if (this.state == TileState.LOADED) {
var tileSize = this.tileSize_;
if (image.width == tileSize[0] && image.height == tileSize[1]) {
this.zoomifyImage_ = image;
diff --git a/src/ol/tilegrid.js b/src/ol/tilegrid.js
index 93c2908a4a..306b2ec34b 100644
--- a/src/ol/tilegrid.js
+++ b/src/ol/tilegrid.js
@@ -8,7 +8,7 @@ import Corner from './extent/Corner.js';
import _ol_obj_ from './obj.js';
import {get as getProjection, METERS_PER_UNIT} from './proj.js';
import _ol_proj_Units_ from './proj/Units.js';
-import _ol_tilegrid_TileGrid_ from './tilegrid/TileGrid.js';
+import TileGrid from './tilegrid/TileGrid.js';
var _ol_tilegrid_ = {};
@@ -63,7 +63,7 @@ _ol_tilegrid_.createForExtent = function(extent, opt_maxZoom, opt_tileSize, opt_
var resolutions = _ol_tilegrid_.resolutionsFromExtent(
extent, opt_maxZoom, opt_tileSize);
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
extent: extent,
origin: getCorner(extent, corner),
resolutions: resolutions,
@@ -89,7 +89,7 @@ _ol_tilegrid_.createXYZ = function(opt_options) {
options.extent, options.maxZoom, options.tileSize);
delete options.maxZoom;
- return new _ol_tilegrid_TileGrid_(options);
+ return new TileGrid(options);
};
diff --git a/src/ol/tilegrid/TileGrid.js b/src/ol/tilegrid/TileGrid.js
index f2bec1efbd..47a8576f23 100644
--- a/src/ol/tilegrid/TileGrid.js
+++ b/src/ol/tilegrid/TileGrid.js
@@ -20,7 +20,7 @@ import _ol_tilecoord_ from '../tilecoord.js';
* @struct
* @api
*/
-var _ol_tilegrid_TileGrid_ = function(options) {
+var TileGrid = function(options) {
/**
* @protected
@@ -155,7 +155,7 @@ var _ol_tilegrid_TileGrid_ = function(options) {
* @private
* @type {ol.TileCoord}
*/
-_ol_tilegrid_TileGrid_.tmpTileCoord_ = [0, 0, 0];
+TileGrid.tmpTileCoord_ = [0, 0, 0];
/**
@@ -166,7 +166,7 @@ _ol_tilegrid_TileGrid_.tmpTileCoord_ = [0, 0, 0];
* @param {function(ol.TileCoord)} callback Function called with each tile coordinate.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.forEachTileCoord = function(extent, zoom, callback) {
+TileGrid.prototype.forEachTileCoord = function(extent, zoom, callback) {
var tileRange = this.getTileRangeForExtentAndZ(extent, zoom);
for (var i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) {
for (var j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) {
@@ -185,7 +185,7 @@ _ol_tilegrid_TileGrid_.prototype.forEachTileCoord = function(extent, zoom, callb
* @return {boolean} Callback succeeded.
* @template T
*/
-_ol_tilegrid_TileGrid_.prototype.forEachTileCoordParentTileRange = function(tileCoord, callback, opt_this, opt_tileRange, opt_extent) {
+TileGrid.prototype.forEachTileCoordParentTileRange = function(tileCoord, callback, opt_this, opt_tileRange, opt_extent) {
var tileRange, x, y;
var tileCoordExtent = null;
var z = tileCoord[0] - 1;
@@ -216,7 +216,7 @@ _ol_tilegrid_TileGrid_.prototype.forEachTileCoordParentTileRange = function(tile
* Get the extent for this tile grid, if it was configured.
* @return {ol.Extent} Extent.
*/
-_ol_tilegrid_TileGrid_.prototype.getExtent = function() {
+TileGrid.prototype.getExtent = function() {
return this.extent_;
};
@@ -226,7 +226,7 @@ _ol_tilegrid_TileGrid_.prototype.getExtent = function() {
* @return {number} Max zoom.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getMaxZoom = function() {
+TileGrid.prototype.getMaxZoom = function() {
return this.maxZoom;
};
@@ -236,7 +236,7 @@ _ol_tilegrid_TileGrid_.prototype.getMaxZoom = function() {
* @return {number} Min zoom.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getMinZoom = function() {
+TileGrid.prototype.getMinZoom = function() {
return this.minZoom;
};
@@ -247,7 +247,7 @@ _ol_tilegrid_TileGrid_.prototype.getMinZoom = function() {
* @return {ol.Coordinate} Origin.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getOrigin = function(z) {
+TileGrid.prototype.getOrigin = function(z) {
if (this.origin_) {
return this.origin_;
} else {
@@ -262,7 +262,7 @@ _ol_tilegrid_TileGrid_.prototype.getOrigin = function(z) {
* @return {number} Resolution.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getResolution = function(z) {
+TileGrid.prototype.getResolution = function(z) {
return this.resolutions_[z];
};
@@ -272,7 +272,7 @@ _ol_tilegrid_TileGrid_.prototype.getResolution = function(z) {
* @return {Array.} Resolutions.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getResolutions = function() {
+TileGrid.prototype.getResolutions = function() {
return this.resolutions_;
};
@@ -283,7 +283,7 @@ _ol_tilegrid_TileGrid_.prototype.getResolutions = function() {
* @param {ol.Extent=} opt_extent Temporary ol.Extent object.
* @return {ol.TileRange} Tile range.
*/
-_ol_tilegrid_TileGrid_.prototype.getTileCoordChildTileRange = function(tileCoord, opt_tileRange, opt_extent) {
+TileGrid.prototype.getTileCoordChildTileRange = function(tileCoord, opt_tileRange, opt_extent) {
if (tileCoord[0] < this.maxZoom) {
if (this.zoomFactor_ === 2) {
var minX = tileCoord[1] * 2;
@@ -305,7 +305,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordChildTileRange = function(tileCoord
* @param {ol.Extent=} opt_extent Temporary ol.Extent object.
* @return {ol.Extent} Extent.
*/
-_ol_tilegrid_TileGrid_.prototype.getTileRangeExtent = function(z, tileRange, opt_extent) {
+TileGrid.prototype.getTileRangeExtent = function(z, tileRange, opt_extent) {
var origin = this.getOrigin(z);
var resolution = this.getResolution(z);
var tileSize = _ol_size_.toSize(this.getTileSize(z), this.tmpSize_);
@@ -324,8 +324,8 @@ _ol_tilegrid_TileGrid_.prototype.getTileRangeExtent = function(z, tileRange, opt
* @param {ol.TileRange=} opt_tileRange Temporary tile range object.
* @return {ol.TileRange} Tile range.
*/
-_ol_tilegrid_TileGrid_.prototype.getTileRangeForExtentAndZ = function(extent, z, opt_tileRange) {
- var tileCoord = _ol_tilegrid_TileGrid_.tmpTileCoord_;
+TileGrid.prototype.getTileRangeForExtentAndZ = function(extent, z, opt_tileRange) {
+ var tileCoord = TileGrid.tmpTileCoord_;
this.getTileCoordForXYAndZ_(extent[0], extent[1], z, false, tileCoord);
var minX = tileCoord[1];
var minY = tileCoord[2];
@@ -339,7 +339,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileRangeForExtentAndZ = function(extent, z,
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @return {ol.Coordinate} Tile center.
*/
-_ol_tilegrid_TileGrid_.prototype.getTileCoordCenter = function(tileCoord) {
+TileGrid.prototype.getTileCoordCenter = function(tileCoord) {
var origin = this.getOrigin(tileCoord[0]);
var resolution = this.getResolution(tileCoord[0]);
var tileSize = _ol_size_.toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);
@@ -358,7 +358,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordCenter = function(tileCoord) {
* @return {ol.Extent} Extent.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getTileCoordExtent = function(tileCoord, opt_extent) {
+TileGrid.prototype.getTileCoordExtent = function(tileCoord, opt_extent) {
var origin = this.getOrigin(tileCoord[0]);
var resolution = this.getResolution(tileCoord[0]);
var tileSize = _ol_size_.toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);
@@ -381,7 +381,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordExtent = function(tileCoord, opt_ex
* @return {ol.TileCoord} Tile coordinate.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getTileCoordForCoordAndResolution = function(coordinate, resolution, opt_tileCoord) {
+TileGrid.prototype.getTileCoordForCoordAndResolution = function(coordinate, resolution, opt_tileCoord) {
return this.getTileCoordForXYAndResolution_(
coordinate[0], coordinate[1], resolution, false, opt_tileCoord);
};
@@ -400,7 +400,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordForCoordAndResolution = function(co
* @return {ol.TileCoord} Tile coordinate.
* @private
*/
-_ol_tilegrid_TileGrid_.prototype.getTileCoordForXYAndResolution_ = function(
+TileGrid.prototype.getTileCoordForXYAndResolution_ = function(
x, y, resolution, reverseIntersectionPolicy, opt_tileCoord) {
var z = this.getZForResolution(resolution);
var scale = resolution / this.getResolution(z);
@@ -441,7 +441,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordForXYAndResolution_ = function(
* @return {ol.TileCoord} Tile coordinate.
* @private
*/
-_ol_tilegrid_TileGrid_.prototype.getTileCoordForXYAndZ_ = function(x, y, z, reverseIntersectionPolicy, opt_tileCoord) {
+TileGrid.prototype.getTileCoordForXYAndZ_ = function(x, y, z, reverseIntersectionPolicy, opt_tileCoord) {
var origin = this.getOrigin(z);
var resolution = this.getResolution(z);
var tileSize = _ol_size_.toSize(this.getTileSize(z), this.tmpSize_);
@@ -473,7 +473,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordForXYAndZ_ = function(x, y, z, reve
* @return {ol.TileCoord} Tile coordinate.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getTileCoordForCoordAndZ = function(coordinate, z, opt_tileCoord) {
+TileGrid.prototype.getTileCoordForCoordAndZ = function(coordinate, z, opt_tileCoord) {
return this.getTileCoordForXYAndZ_(
coordinate[0], coordinate[1], z, false, opt_tileCoord);
};
@@ -483,7 +483,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordForCoordAndZ = function(coordinate,
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @return {number} Tile resolution.
*/
-_ol_tilegrid_TileGrid_.prototype.getTileCoordResolution = function(tileCoord) {
+TileGrid.prototype.getTileCoordResolution = function(tileCoord) {
return this.resolutions_[tileCoord[0]];
};
@@ -496,7 +496,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordResolution = function(tileCoord) {
* @return {number|ol.Size} Tile size.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getTileSize = function(z) {
+TileGrid.prototype.getTileSize = function(z) {
if (this.tileSize_) {
return this.tileSize_;
} else {
@@ -509,7 +509,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileSize = function(z) {
* @param {number} z Zoom level.
* @return {ol.TileRange} Extent tile range for the specified zoom level.
*/
-_ol_tilegrid_TileGrid_.prototype.getFullTileRange = function(z) {
+TileGrid.prototype.getFullTileRange = function(z) {
if (!this.fullTileRanges_) {
return null;
} else {
@@ -526,8 +526,7 @@ _ol_tilegrid_TileGrid_.prototype.getFullTileRange = function(z) {
* @return {number} Z.
* @api
*/
-_ol_tilegrid_TileGrid_.prototype.getZForResolution = function(
- resolution, opt_direction) {
+TileGrid.prototype.getZForResolution = function(resolution, opt_direction) {
var z = linearFindNearest(this.resolutions_, resolution, opt_direction || 0);
return clamp(z, this.minZoom, this.maxZoom);
};
@@ -537,7 +536,7 @@ _ol_tilegrid_TileGrid_.prototype.getZForResolution = function(
* @param {!ol.Extent} extent Extent for this tile grid.
* @private
*/
-_ol_tilegrid_TileGrid_.prototype.calculateTileRanges_ = function(extent) {
+TileGrid.prototype.calculateTileRanges_ = function(extent) {
var length = this.resolutions_.length;
var fullTileRanges = new Array(length);
for (var z = this.minZoom; z < length; ++z) {
@@ -545,4 +544,4 @@ _ol_tilegrid_TileGrid_.prototype.calculateTileRanges_ = function(extent) {
}
this.fullTileRanges_ = fullTileRanges;
};
-export default _ol_tilegrid_TileGrid_;
+export default TileGrid;
diff --git a/src/ol/tilegrid/WMTS.js b/src/ol/tilegrid/WMTS.js
index 5f6dd9f8b2..cabb7cc7bc 100644
--- a/src/ol/tilegrid/WMTS.js
+++ b/src/ol/tilegrid/WMTS.js
@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import {find} from '../array.js';
import {get as getProjection} from '../proj.js';
-import _ol_tilegrid_TileGrid_ from '../tilegrid/TileGrid.js';
+import TileGrid from '../tilegrid/TileGrid.js';
/**
* @classdesc
@@ -16,7 +16,7 @@ import _ol_tilegrid_TileGrid_ from '../tilegrid/TileGrid.js';
* @struct
* @api
*/
-var _ol_tilegrid_WMTS_ = function(options) {
+var WMTSTileGrid = function(options) {
/**
* @private
* @type {!Array.}
@@ -24,7 +24,7 @@ var _ol_tilegrid_WMTS_ = function(options) {
this.matrixIds_ = options.matrixIds;
// FIXME: should the matrixIds become optional?
- _ol_tilegrid_TileGrid_.call(this, {
+ TileGrid.call(this, {
extent: options.extent,
origin: options.origin,
origins: options.origins,
@@ -35,14 +35,14 @@ var _ol_tilegrid_WMTS_ = function(options) {
});
};
-inherits(_ol_tilegrid_WMTS_, _ol_tilegrid_TileGrid_);
+inherits(WMTSTileGrid, TileGrid);
/**
* @param {number} z Z.
* @return {string} MatrixId..
*/
-_ol_tilegrid_WMTS_.prototype.getMatrixId = function(z) {
+WMTSTileGrid.prototype.getMatrixId = function(z) {
return this.matrixIds_[z];
};
@@ -52,10 +52,11 @@ _ol_tilegrid_WMTS_.prototype.getMatrixId = function(z) {
* @return {Array.} MatrixIds.
* @api
*/
-_ol_tilegrid_WMTS_.prototype.getMatrixIds = function() {
+WMTSTileGrid.prototype.getMatrixIds = function() {
return this.matrixIds_;
};
+export default WMTSTileGrid;
/**
* Create a tile grid from a WMTS capabilities matrix set and an
@@ -69,8 +70,7 @@ _ol_tilegrid_WMTS_.prototype.getMatrixIds = function() {
* @return {ol.tilegrid.WMTS} WMTS tileGrid instance.
* @api
*/
-_ol_tilegrid_WMTS_.createFromCapabilitiesMatrixSet = function(matrixSet, opt_extent,
- opt_matrixLimits) {
+export function createFromCapabilitiesMatrixSet(matrixSet, opt_extent, opt_matrixLimits) {
/** @type {!Array.} */
var resolutions = [];
@@ -137,7 +137,7 @@ _ol_tilegrid_WMTS_.createFromCapabilitiesMatrixSet = function(matrixSet, opt_ext
}
});
- return new _ol_tilegrid_WMTS_({
+ return new WMTSTileGrid({
extent: opt_extent,
origins: origins,
resolutions: resolutions,
@@ -145,5 +145,4 @@ _ol_tilegrid_WMTS_.createFromCapabilitiesMatrixSet = function(matrixSet, opt_ext
tileSizes: tileSizes,
sizes: sizes
});
-};
-export default _ol_tilegrid_WMTS_;
+}
diff --git a/src/ol/webgl/Context.js b/src/ol/webgl/Context.js
index b0de647655..de43d84ad5 100644
--- a/src/ol/webgl/Context.js
+++ b/src/ol/webgl/Context.js
@@ -2,7 +2,7 @@
* @module ol/webgl/Context
*/
import {WEBGL_EXTENSIONS, getUid, inherits} from '../index.js';
-import _ol_Disposable_ from '../Disposable.js';
+import Disposable from '../Disposable.js';
import {includes} from '../array.js';
import _ol_events_ from '../events.js';
import _ol_obj_ from '../obj.js';
@@ -91,7 +91,7 @@ var _ol_webgl_Context_ = function(canvas, gl) {
};
-inherits(_ol_webgl_Context_, _ol_Disposable_);
+inherits(_ol_webgl_Context_, Disposable);
/**
diff --git a/test/rendering/ol/reproj/tile.test.js b/test/rendering/ol/reproj/tile.test.js
index 6d9a397cfb..410df98ea5 100644
--- a/test/rendering/ol/reproj/tile.test.js
+++ b/test/rendering/ol/reproj/tile.test.js
@@ -1,4 +1,4 @@
-import _ol_TileState_ from '../../../../src/ol/TileState.js';
+import TileState from '../../../../src/ol/TileState.js';
import _ol_events_ from '../../../../src/ol/events.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js';
@@ -23,9 +23,9 @@ describe('ol.rendering.reproj.Tile', function() {
tilesRequested++;
return source.getTile(z, x, y, pixelRatio, sourceProjection);
});
- if (tile.getState() == _ol_TileState_.IDLE) {
+ if (tile.getState() == TileState.IDLE) {
_ol_events_.listen(tile, 'change', function(e) {
- if (tile.getState() == _ol_TileState_.LOADED) {
+ if (tile.getState() == TileState.LOADED) {
expect(tilesRequested).to.be(expectedRequests);
resembleCanvas(tile.getImage(), expectedUrl, 7.5, done);
}
diff --git a/test/rendering/ol/source/raster.test.js b/test/rendering/ol/source/raster.test.js
index 56926916ab..f5cf437b14 100644
--- a/test/rendering/ol/source/raster.test.js
+++ b/test/rendering/ol/source/raster.test.js
@@ -1,7 +1,7 @@
import Map from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Image_ from '../../../../src/ol/layer/Image.js';
-import _ol_source_Raster_ from '../../../../src/ol/source/Raster.js';
+import RasterSource from '../../../../src/ol/source/Raster.js';
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() {
@@ -55,7 +55,7 @@ where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() {
transition: 0
});
- var raster = new _ol_source_Raster_({
+ var raster = new RasterSource({
sources: [source],
operation: function(pixels) {
var pixel = pixels[0];
diff --git a/test/spec/ol/disposable.test.js b/test/spec/ol/disposable.test.js
index 4348f255b3..7ffaf11c5c 100644
--- a/test/spec/ol/disposable.test.js
+++ b/test/spec/ol/disposable.test.js
@@ -1,4 +1,4 @@
-import _ol_Disposable_ from '../../../src/ol/Disposable.js';
+import Disposable from '../../../src/ol/Disposable.js';
describe('ol.Disposable', function() {
@@ -6,8 +6,8 @@ describe('ol.Disposable', function() {
describe('constructor', function() {
it('creates an instance', function() {
- var disposable = new _ol_Disposable_();
- expect(disposable).to.be.a(_ol_Disposable_);
+ var disposable = new Disposable();
+ expect(disposable).to.be.a(Disposable);
});
});
@@ -15,12 +15,12 @@ describe('ol.Disposable', function() {
describe('#disposed_', function() {
it('is initially false', function() {
- var disposable = new _ol_Disposable_();
+ var disposable = new Disposable();
expect(disposable.disposed_).to.be(false);
});
it('is true after a call to dispose', function() {
- var disposable = new _ol_Disposable_();
+ var disposable = new Disposable();
disposable.dispose();
expect(disposable.disposed_).to.be(true);
});
@@ -30,7 +30,7 @@ describe('ol.Disposable', function() {
describe('#dispose()', function() {
it('calls disposeInternal only once', function() {
- var disposable = new _ol_Disposable_();
+ var disposable = new Disposable();
sinon.spy(disposable, 'disposeInternal');
expect(disposable.disposeInternal.called).to.be(false);
disposable.dispose();
diff --git a/test/spec/ol/events/eventtarget.test.js b/test/spec/ol/events/eventtarget.test.js
index 911cea4565..94b2e9414f 100644
--- a/test/spec/ol/events/eventtarget.test.js
+++ b/test/spec/ol/events/eventtarget.test.js
@@ -1,4 +1,4 @@
-import _ol_Disposable_ from '../../../../src/ol/Disposable.js';
+import Disposable from '../../../../src/ol/Disposable.js';
import _ol_events_ from '../../../../src/ol/events.js';
import Event from '../../../../src/ol/events/Event.js';
import EventTarget from '../../../../src/ol/events/EventTarget.js';
@@ -23,7 +23,7 @@ describe('ol.events.EventTarget', function() {
describe('constructor', function() {
it('creates an instance', function() {
expect(eventTarget).to.be.a(EventTarget);
- expect(eventTarget).to.be.a(_ol_Disposable_);
+ expect(eventTarget).to.be.a(Disposable);
});
it('creates an empty listeners_ object', function() {
expect(Object.keys(eventTarget.listeners_)).to.have.length(0);
diff --git a/test/spec/ol/imagetile.test.js b/test/spec/ol/imagetile.test.js
index c9ce657052..4fed6479ae 100644
--- a/test/spec/ol/imagetile.test.js
+++ b/test/spec/ol/imagetile.test.js
@@ -1,5 +1,5 @@
-import _ol_ImageTile_ from '../../../src/ol/ImageTile.js';
-import _ol_TileState_ from '../../../src/ol/TileState.js';
+import ImageTile from '../../../src/ol/ImageTile.js';
+import TileState from '../../../src/ol/TileState.js';
import _ol_events_ from '../../../src/ol/events.js';
import EventType from '../../../src/ol/events/EventType.js';
import _ol_source_Image_ from '../../../src/ol/source/Image.js';
@@ -11,19 +11,19 @@ describe('ol.ImageTile', function() {
it('can load idle tile', function(done) {
var tileCoord = [0, 0, 0];
- var state = _ol_TileState_.IDLE;
+ var state = TileState.IDLE;
var src = 'spec/ol/data/osm-0-0-0.png';
var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction;
- var tile = new _ol_ImageTile_(tileCoord, state, src, null, tileLoadFunction);
+ var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction);
var previousState = tile.getState();
_ol_events_.listen(tile, EventType.CHANGE, function(event) {
var state = tile.getState();
- if (previousState == _ol_TileState_.IDLE) {
- expect(state).to.be(_ol_TileState_.LOADING);
- } else if (previousState == _ol_TileState_.LOADING) {
- expect(state).to.be(_ol_TileState_.LOADED);
+ if (previousState == TileState.IDLE) {
+ expect(state).to.be(TileState.LOADING);
+ } else if (previousState == TileState.LOADING) {
+ expect(state).to.be(TileState.LOADED);
done();
} else {
expect().fail();
@@ -36,19 +36,19 @@ describe('ol.ImageTile', function() {
it('can load error tile', function(done) {
var tileCoord = [0, 0, 0];
- var state = _ol_TileState_.ERROR;
+ var state = TileState.ERROR;
var src = 'spec/ol/data/osm-0-0-0.png';
var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction;
- var tile = new _ol_ImageTile_(tileCoord, state, src, null, tileLoadFunction);
+ var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction);
var previousState = tile.getState();
_ol_events_.listen(tile, EventType.CHANGE, function(event) {
var state = tile.getState();
- if (previousState == _ol_TileState_.ERROR) {
- expect(state).to.be(_ol_TileState_.LOADING);
- } else if (previousState == _ol_TileState_.LOADING) {
- expect(state).to.be(_ol_TileState_.LOADED);
+ if (previousState == TileState.ERROR) {
+ expect(state).to.be(TileState.LOADING);
+ } else if (previousState == TileState.LOADING) {
+ expect(state).to.be(TileState.LOADED);
done();
} else {
expect().fail();
@@ -61,15 +61,15 @@ describe('ol.ImageTile', function() {
it('loads an empty image on error ', function(done) {
var tileCoord = [0, 0, 0];
- var state = _ol_TileState_.IDLE;
+ var state = TileState.IDLE;
var src = 'spec/ol/data/osm-0-0-99.png';
var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction;
- var tile = new _ol_ImageTile_(tileCoord, state, src, null, tileLoadFunction);
+ var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction);
var key = _ol_events_.listen(tile, EventType.CHANGE, function(event) {
var state = tile.getState();
- if (state == _ol_TileState_.ERROR) {
- expect(state).to.be(_ol_TileState_.ERROR);
+ if (state == TileState.ERROR) {
+ expect(state).to.be(TileState.ERROR);
expect(tile.image_).to.be.a(HTMLCanvasElement);
_ol_events_.unlistenByKey(key);
tile.load();
@@ -87,15 +87,15 @@ describe('ol.ImageTile', function() {
it('sets image src to a blank image data uri', function() {
var tileCoord = [0, 0, 0];
- var state = _ol_TileState_.IDLE;
+ var state = TileState.IDLE;
var src = 'spec/ol/data/osm-0-0-0.png';
var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction;
- var tile = new _ol_ImageTile_(tileCoord, state, src, null, tileLoadFunction);
+ var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction);
tile.load();
- expect(tile.getState()).to.be(_ol_TileState_.LOADING);
+ expect(tile.getState()).to.be(TileState.LOADING);
tile.dispose();
- expect(tile.getState()).to.be(_ol_TileState_.ABORT);
- expect(tile.getImage().src).to.be(_ol_ImageTile_.blankImageUrl);
+ expect(tile.getState()).to.be(TileState.ABORT);
+ expect(tile.getImage().src).to.be(ImageTile.blankImageUrl);
});
});
diff --git a/test/spec/ol/render/box.test.js b/test/spec/ol/render/box.test.js
index 2c8e398e38..291aca824e 100644
--- a/test/spec/ol/render/box.test.js
+++ b/test/spec/ol/render/box.test.js
@@ -1,4 +1,4 @@
-import _ol_Disposable_ from '../../../../src/ol/Disposable.js';
+import Disposable from '../../../../src/ol/Disposable.js';
import Map from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
@@ -35,7 +35,7 @@ describe('ol.render.Box', function() {
it('creates an instance', function() {
var obj = new _ol_render_Box_('test-box');
expect(obj).to.be.a(_ol_render_Box_);
- expect(obj).to.be.a(_ol_Disposable_);
+ expect(obj).to.be.a(Disposable);
obj.dispose();
});
it('creates an absolutely positioned DIV with a className', function() {
diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js
index 46163d858e..2969902dba 100644
--- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js
+++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js
@@ -2,9 +2,9 @@ import {getUid, inherits} from '../../../../../src/ol/index.js';
import _ol_obj_ from '../../../../../src/ol/obj.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Map from '../../../../../src/ol/Map.js';
-import _ol_TileState_ from '../../../../../src/ol/TileState.js';
-import _ol_VectorImageTile_ from '../../../../../src/ol/VectorImageTile.js';
-import _ol_VectorTile_ from '../../../../../src/ol/VectorTile.js';
+import TileState from '../../../../../src/ol/TileState.js';
+import VectorImageTile from '../../../../../src/ol/VectorImageTile.js';
+import VectorTile from '../../../../../src/ol/VectorTile.js';
import _ol_View_ from '../../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../../src/ol/extent.js';
import MVT from '../../../../../src/ol/format/MVT.js';
@@ -60,13 +60,13 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
feature3 = new _ol_render_Feature_('Point', [1, -1], []);
feature2.setStyle(featureStyle);
var TileClass = function() {
- _ol_VectorTile_.apply(this, arguments);
+ VectorTile.apply(this, arguments);
this.setState('loaded');
this.setFeatures([feature1, feature2, feature3]);
this.setProjection(getProjection('EPSG:4326'));
tileCallback(this);
};
- inherits(TileClass, _ol_VectorTile_);
+ inherits(TileClass, VectorTile);
source = new _ol_source_VectorTile_({
format: new MVT(),
tileClass: TileClass,
@@ -74,7 +74,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
});
source.getTile = function() {
var tile = _ol_source_VectorTile_.prototype.getTile.apply(source, arguments);
- tile.setState(_ol_TileState_.LOADED);
+ tile.setState(TileState.LOADED);
return tile;
};
layer = new _ol_layer_VectorTile_({
@@ -224,9 +224,9 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
});
map.addLayer(layer2);
- var spy1 = sinon.spy(_ol_VectorTile_.prototype,
+ var spy1 = sinon.spy(VectorTile.prototype,
'getReplayGroup');
- var spy2 = sinon.spy(_ol_VectorTile_.prototype,
+ var spy2 = sinon.spy(VectorTile.prototype,
'setReplayGroup');
map.renderSync();
expect(spy1.callCount).to.be(4);
@@ -245,16 +245,16 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
transition: 0
})
});
- var sourceTile = new _ol_VectorTile_([0, 0, 0], 2);
+ var sourceTile = new VectorTile([0, 0, 0], 2);
sourceTile.setProjection(getProjection('EPSG:3857'));
sourceTile.features_ = [];
sourceTile.getImage = function() {
return document.createElement('canvas');
};
- var tile = new _ol_VectorImageTile_([0, 0, 0]);
+ var tile = new VectorImageTile([0, 0, 0]);
tile.transition_ = 0;
tile.wrappedTileCoord = [0, 0, 0];
- tile.setState(_ol_TileState_.LOADED);
+ tile.setState(TileState.LOADED);
tile.getSourceTile = function() {
return sourceTile;
};
@@ -291,9 +291,9 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
describe('#forEachFeatureAtCoordinate', function() {
var layer, renderer, replayGroup;
var TileClass = function() {
- _ol_VectorImageTile_.apply(this, arguments);
+ VectorImageTile.apply(this, arguments);
this.setState('loaded');
- var sourceTile = new _ol_VectorTile_([0, 0, 0]);
+ var sourceTile = new VectorTile([0, 0, 0]);
sourceTile.setProjection(getProjection('EPSG:3857'));
sourceTile.getReplayGroup = function() {
return replayGroup;
@@ -304,7 +304,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
this.sourceTiles_[key] = sourceTile;
this.wrappedTileCoord = arguments[0];
};
- inherits(TileClass, _ol_VectorImageTile_);
+ inherits(TileClass, VectorImageTile);
beforeEach(function() {
replayGroup = {};
diff --git a/test/spec/ol/renderer/map.test.js b/test/spec/ol/renderer/map.test.js
index 4ac5ca4adb..5ccdd1c916 100644
--- a/test/spec/ol/renderer/map.test.js
+++ b/test/spec/ol/renderer/map.test.js
@@ -1,4 +1,4 @@
-import _ol_Disposable_ from '../../../../src/ol/Disposable.js';
+import Disposable from '../../../../src/ol/Disposable.js';
import Map from '../../../../src/ol/Map.js';
import _ol_renderer_Map_ from '../../../../src/ol/renderer/Map.js';
@@ -11,7 +11,7 @@ describe('ol.renderer.Map', function() {
var map = new Map({});
var renderer = new _ol_renderer_Map_(null, map);
expect(renderer).to.be.a(_ol_renderer_Map_);
- expect(renderer).to.be.a(_ol_Disposable_);
+ expect(renderer).to.be.a(Disposable);
renderer.dispose();
map.dispose();
});
diff --git a/test/spec/ol/reproj/tile.test.js b/test/spec/ol/reproj/tile.test.js
index c4b518cb84..d9220c9291 100644
--- a/test/spec/ol/reproj/tile.test.js
+++ b/test/spec/ol/reproj/tile.test.js
@@ -1,4 +1,4 @@
-import _ol_ImageTile_ from '../../../../src/ol/ImageTile.js';
+import ImageTile from '../../../../src/ol/ImageTile.js';
import _ol_events_ from '../../../../src/ol/events.js';
import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js';
import {register} from '../../../../src/ol/proj/proj4.js';
@@ -31,7 +31,7 @@ describe('ol.reproj.Tile', function() {
proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326,
_ol_tilegrid_.createForProjection(proj4326, 3, opt_tileSize),
[3, 2, -2], null, pixelRatio, 0, function(z, x, y, pixelRatio) {
- return new _ol_ImageTile_([z, x, y], 0, // IDLE
+ return new ImageTile([z, x, y], 0, // IDLE
'data:image/gif;base64,' +
'R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=', null,
function(tile, src) {
diff --git a/test/spec/ol/source/raster.test.js b/test/spec/ol/source/raster.test.js
index 02f9726123..4e5da06f77 100644
--- a/test/spec/ol/source/raster.test.js
+++ b/test/spec/ol/source/raster.test.js
@@ -1,10 +1,10 @@
import Map from '../../../../src/ol/Map.js';
-import _ol_TileState_ from '../../../../src/ol/TileState.js';
+import TileState from '../../../../src/ol/TileState.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Image_ from '../../../../src/ol/layer/Image.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
-import _ol_source_Raster_ from '../../../../src/ol/source/Raster.js';
+import RasterSource from '../../../../src/ol/source/Raster.js';
import Source from '../../../../src/ol/source/Source.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
@@ -50,7 +50,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() {
imageExtent: extent
});
- raster = new _ol_source_Raster_({
+ raster = new RasterSource({
threads: 0,
sources: [redSource, greenSource, blueSource],
operation: function(inputs) {
@@ -90,19 +90,19 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() {
describe('constructor', function() {
it('returns a tile source', function() {
- var source = new _ol_source_Raster_({
+ var source = new RasterSource({
threads: 0,
sources: [new _ol_source_Tile_({})]
});
expect(source).to.be.a(Source);
- expect(source).to.be.a(_ol_source_Raster_);
+ expect(source).to.be.a(RasterSource);
});
it('defaults to "pixel" operation', function(done) {
var log = [];
- var source = new _ol_source_Raster_({
+ var source = new RasterSource({
threads: 0,
sources: [redSource, greenSource, blueSource],
operation: function(inputs) {
@@ -129,7 +129,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() {
it('allows operation type to be set to "image"', function(done) {
var log = [];
- var source = new _ol_source_Raster_({
+ var source = new RasterSource({
operationType: 'image',
threads: 0,
sources: [redSource, greenSource, blueSource],
@@ -315,7 +315,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() {
url: 'spec/ol/data/osm-{z}-{x}-{y}.png'
});
- raster = new _ol_source_Raster_({
+ raster = new RasterSource({
threads: 0,
sources: [source],
operation: function(inputs) {
@@ -343,7 +343,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() {
map2.once('moveend', function() {
expect(tileCache.getCount()).to.equal(1);
var state = tileCache.peekLast().getState();
- expect(state === _ol_TileState_.LOADED || state === _ol_TileState_.LOADED).to.be(true);
+ expect(state === TileState.LOADED || state === TileState.LOADED).to.be(true);
done();
});
diff --git a/test/spec/ol/source/tile.test.js b/test/spec/ol/source/tile.test.js
index 7b850bc1d4..803d90e07d 100644
--- a/test/spec/ol/source/tile.test.js
+++ b/test/spec/ol/source/tile.test.js
@@ -6,7 +6,7 @@ import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import Source from '../../../../src/ol/source/Source.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js';
-import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
/**
@@ -19,7 +19,7 @@ import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
* tile state.
*/
var MockTile = function(tileStates) {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: [360 / 256, 180 / 256, 90 / 256, 45 / 256],
origin: [-180, -180],
tileSize: 256
diff --git a/test/spec/ol/source/tilearcgisrest.test.js b/test/spec/ol/source/tilearcgisrest.test.js
index 694f884ee7..10771c5572 100644
--- a/test/spec/ol/source/tilearcgisrest.test.js
+++ b/test/spec/ol/source/tilearcgisrest.test.js
@@ -1,4 +1,4 @@
-import _ol_ImageTile_ from '../../../../src/ol/ImageTile.js';
+import ImageTile from '../../../../src/ol/ImageTile.js';
import _ol_source_TileArcGISRest_ from '../../../../src/ol/source/TileArcGISRest.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
@@ -18,7 +18,7 @@ describe('ol.source.TileArcGISRest', function() {
it('returns a tile with the expected URL', function() {
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
- expect(tile).to.be.an(_ol_ImageTile_);
+ expect(tile).to.be.an(ImageTile);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
expect(uri.hostname).to.be('example.com');
@@ -61,7 +61,7 @@ describe('ol.source.TileArcGISRest', function() {
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
- expect(tile).to.be.an(_ol_ImageTile_);
+ expect(tile).to.be.an(ImageTile);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
expect(uri.hostname).to.match(/test[12]\.com/);
@@ -84,7 +84,7 @@ describe('ol.source.TileArcGISRest', function() {
options.url = 'http://example.com/ImageServer';
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
- expect(tile).to.be.an(_ol_ImageTile_);
+ expect(tile).to.be.an(ImageTile);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
expect(uri.hostname).to.be('example.com');
diff --git a/test/spec/ol/source/tileimage.test.js b/test/spec/ol/source/tileimage.test.js
index fc6c9c90d2..23c7e26f33 100644
--- a/test/spec/ol/source/tileimage.test.js
+++ b/test/spec/ol/source/tileimage.test.js
@@ -1,5 +1,5 @@
-import _ol_ImageTile_ from '../../../../src/ol/ImageTile.js';
-import _ol_TileState_ from '../../../../src/ol/TileState.js';
+import ImageTile from '../../../../src/ol/ImageTile.js';
+import TileState from '../../../../src/ol/TileState.js';
import {createFromTemplate} from '../../../../src/ol/tileurlfunction.js';
import _ol_events_ from '../../../../src/ol/events.js';
import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js';
@@ -116,7 +116,7 @@ describe('ol.source.TileImage', function() {
it('does not do reprojection for identity', function() {
var source3857 = createSource('EPSG:3857');
var tile3857 = source3857.getTile(0, 0, -1, 1, getProjection('EPSG:3857'));
- expect(tile3857).to.be.a(_ol_ImageTile_);
+ expect(tile3857).to.be.a(ImageTile);
expect(tile3857).not.to.be.a(_ol_reproj_Tile_);
var projXXX = new _ol_proj_Projection_({
@@ -125,7 +125,7 @@ describe('ol.source.TileImage', function() {
});
var sourceXXX = createSource(projXXX);
var tileXXX = sourceXXX.getTile(0, 0, -1, 1, projXXX);
- expect(tileXXX).to.be.a(_ol_ImageTile_);
+ expect(tileXXX).to.be.a(ImageTile);
expect(tileXXX).not.to.be.a(_ol_reproj_Tile_);
});
@@ -188,7 +188,7 @@ describe('ol.source.TileImage', function() {
it('dispatches tileloadstart and tileloadend events', function() {
source.setTileLoadFunction(function(tile) {
- tile.setState(_ol_TileState_.LOADED);
+ tile.setState(TileState.LOADED);
});
var startSpy = sinon.spy();
source.on('tileloadstart', startSpy);
@@ -203,15 +203,15 @@ describe('ol.source.TileImage', function() {
it('works for loading-error-loading-loaded sequences', function(done) {
source.setTileLoadFunction(function(tile) {
tile.setState(
- tile.state == _ol_TileState_.ERROR ? _ol_TileState_.LOADED : _ol_TileState_.ERROR);
+ tile.state == TileState.ERROR ? TileState.LOADED : TileState.ERROR);
});
var startSpy = sinon.spy();
source.on('tileloadstart', startSpy);
var errorSpy = sinon.spy();
source.on('tileloaderror', function(e) {
setTimeout(function() {
- e.tile.setState(_ol_TileState_.LOADING);
- e.tile.setState(_ol_TileState_.LOADED);
+ e.tile.setState(TileState.LOADING);
+ e.tile.setState(TileState.LOADED);
}, 0);
errorSpy();
});
diff --git a/test/spec/ol/source/tileutfgrid.test.js b/test/spec/ol/source/tileutfgrid.test.js
index 5e9055da98..fc4f33be1f 100644
--- a/test/spec/ol/source/tileutfgrid.test.js
+++ b/test/spec/ol/source/tileutfgrid.test.js
@@ -1,7 +1,7 @@
import {get as getProjection, transformExtent, fromLonLat} from '../../../../src/ol/proj.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import _ol_source_TileUTFGrid_ from '../../../../src/ol/source/TileUTFGrid.js';
-import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.TileUTFGrid', function() {
@@ -66,7 +66,7 @@ describe('ol.source.TileUTFGrid', function() {
source.on('change', function(event) {
if (source.getState() === 'ready') {
- expect(source.tileGrid).to.be.an(_ol_tilegrid_TileGrid_);
+ expect(source.tileGrid).to.be.an(TileGrid);
done();
}
});
@@ -101,7 +101,7 @@ describe('ol.source.TileUTFGrid', function() {
var tileGrid = source.getTileGrid();
expect(tileGrid).to.not.be(null);
- expect(tileGrid).to.be.an(_ol_tilegrid_TileGrid_);
+ expect(tileGrid).to.be.an(TileGrid);
});
it('sets up a tilegrid with expected extent', function() {
diff --git a/test/spec/ol/source/tilewms.test.js b/test/spec/ol/source/tilewms.test.js
index f17c99871b..cff8072c08 100644
--- a/test/spec/ol/source/tilewms.test.js
+++ b/test/spec/ol/source/tilewms.test.js
@@ -1,8 +1,8 @@
-import _ol_ImageTile_ from '../../../../src/ol/ImageTile.js';
+import ImageTile from '../../../../src/ol/ImageTile.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
-import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.TileWMS', function() {
@@ -39,7 +39,7 @@ describe('ol.source.TileWMS', function() {
it('returns a tile with the expected URL', function() {
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
- expect(tile).to.be.an(_ol_ImageTile_);
+ expect(tile).to.be.an(ImageTile);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
expect(uri.hostname).to.be('example.com');
@@ -68,7 +68,7 @@ describe('ol.source.TileWMS', function() {
options.gutter = 16;
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
- expect(tile).to.be.an(_ol_ImageTile_);
+ expect(tile).to.be.an(ImageTile);
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
var bbox = queryData.get('BBOX').split(',');
@@ -182,7 +182,7 @@ describe('ol.source.TileWMS', function() {
});
it('works with non-square tiles', function() {
- options.tileGrid = new _ol_tilegrid_TileGrid_({
+ options.tileGrid = new TileGrid({
tileSize: [640, 320],
resolutions: [1.40625, 0.703125, 0.3515625, 0.17578125],
origin: [-180, -90]
diff --git a/test/spec/ol/source/vectortile.test.js b/test/spec/ol/source/vectortile.test.js
index 12917f48d9..efd38bfab6 100644
--- a/test/spec/ol/source/vectortile.test.js
+++ b/test/spec/ol/source/vectortile.test.js
@@ -1,13 +1,13 @@
import Map from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
-import _ol_VectorImageTile_ from '../../../../src/ol/VectorImageTile.js';
-import _ol_VectorTile_ from '../../../../src/ol/VectorTile.js';
+import VectorImageTile from '../../../../src/ol/VectorImageTile.js';
+import VectorTile from '../../../../src/ol/VectorTile.js';
import MVT from '../../../../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
-import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.VectorTile', function() {
@@ -25,7 +25,7 @@ describe('ol.source.VectorTile', function() {
});
it('uses ol.VectorTile as default tileClass', function() {
- expect(source.tileClass).to.equal(_ol_VectorTile_);
+ expect(source.tileClass).to.equal(VectorTile);
});
it('creates a 512 XYZ tilegrid by default', function() {
@@ -38,7 +38,7 @@ describe('ol.source.VectorTile', function() {
describe('#getTile()', function() {
it('creates a tile with the correct tile class', function() {
tile = source.getTile(0, 0, 0, 1, getProjection('EPSG:3857'));
- expect(tile).to.be.a(_ol_VectorImageTile_);
+ expect(tile).to.be.a(VectorImageTile);
});
it('sets the correct tileCoord on the created tile', function() {
expect(tile.getTileCoord()).to.eql([0, 0, 0]);
@@ -65,7 +65,7 @@ describe('ol.source.VectorTile', function() {
});
source.on('tileloadend', function(e) {
expect(started).to.be(true);
- expect(e.tile).to.be.a(_ol_VectorTile_);
+ expect(e.tile).to.be.a(VectorTile);
expect(e.tile.getFeatures().length).to.be(1327);
done();
});
@@ -97,7 +97,7 @@ describe('ol.source.VectorTile', function() {
var extent = [665584.2026596286, 7033250.839875697, 667162.0221431496, 7035280.378636755];
source = new _ol_source_VectorTile_({
- tileGrid: new _ol_tilegrid_TileGrid_({
+ tileGrid: new TileGrid({
origin: [218128, 6126002],
resolutions: [4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5]
}),
diff --git a/test/spec/ol/source/wmts.test.js b/test/spec/ol/source/wmts.test.js
index bb1e44b901..64dcc61cf1 100644
--- a/test/spec/ol/source/wmts.test.js
+++ b/test/spec/ol/source/wmts.test.js
@@ -1,7 +1,7 @@
import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
-import _ol_tilegrid_WMTS_ from '../../../../src/ol/tilegrid/WMTS.js';
+import WMTSTileGrid from '../../../../src/ol/tilegrid/WMTS.js';
import _ol_source_WMTS_ from '../../../../src/ol/source/WMTS.js';
@@ -62,7 +62,7 @@ describe('ol.source.WMTS', function() {
expect(options.requestEncoding).to.be.eql('KVP');
- expect(options.tileGrid).to.be.a(_ol_tilegrid_WMTS_);
+ expect(options.tileGrid).to.be.a(WMTSTileGrid);
expect(options.style).to.be.eql('DarkBlue');
@@ -96,7 +96,7 @@ describe('ol.source.WMTS', function() {
expect(options.requestEncoding).to.be.eql('REST');
- expect(options.tileGrid).to.be.a(_ol_tilegrid_WMTS_);
+ expect(options.tileGrid).to.be.a(WMTSTileGrid);
expect(options.style).to.be.eql('DarkBlue');
@@ -187,7 +187,7 @@ describe('ol.source.WMTS', function() {
'{tilematrixset}/{TileMatrix}/{TileCol}/{TileRow}.jpg'],
matrixSet: 'EPSG:3857',
requestEncoding: 'REST',
- tileGrid: new _ol_tilegrid_WMTS_({
+ tileGrid: new WMTSTileGrid({
origin: [-20037508.342789244, 20037508.342789244],
resolutions: [559082264.029 * 0.28E-3,
279541132.015 * 0.28E-3,
@@ -213,7 +213,7 @@ describe('ol.source.WMTS', function() {
'{tilematrixset}/{TileMatrix}/{TileCol}/{TileRow}.jpg'],
matrixSet: 'EPSG:3857',
requestEncoding: 'REST',
- tileGrid: new _ol_tilegrid_WMTS_({
+ tileGrid: new WMTSTileGrid({
origin: [-20037508.342789244, 20037508.342789244],
resolutions: [559082264.029 * 0.28E-3,
279541132.015 * 0.28E-3,
@@ -315,7 +315,7 @@ describe('ol.source.WMTS', function() {
'http://1.example.com/{TileMatrix}/{TileRow}/{TileCol}.jpeg',
'http://2.example.com/{TileMatrix}/{TileRow}/{TileCol}.jpeg'
],
- tileGrid: new _ol_tilegrid_WMTS_({
+ tileGrid: new WMTSTileGrid({
matrixIds: [0, 1, 2, 3, 4, 5, 6, 7],
origin: [2690000, 1285000],
resolutions: [4000, 3750, 3500, 3250, 3000, 2750, 2500, 2250]
@@ -354,7 +354,7 @@ describe('ol.source.WMTS', function() {
style: 'default',
matrixSet: 'foo',
requestEncoding: 'REST',
- tileGrid: new _ol_tilegrid_WMTS_({
+ tileGrid: new WMTSTileGrid({
origin: [0, 0],
resolutions: [],
matrixIds: []
@@ -400,7 +400,7 @@ describe('ol.source.WMTS', function() {
style: 'default',
matrixSet: 'foo',
requestEncoding: 'REST',
- tileGrid: new _ol_tilegrid_WMTS_({
+ tileGrid: new WMTSTileGrid({
origin: [0, 0],
resolutions: [],
matrixIds: []
diff --git a/test/spec/ol/source/zoomify.test.js b/test/spec/ol/source/zoomify.test.js
index a6b7d364b3..619570ac00 100644
--- a/test/spec/ol/source/zoomify.test.js
+++ b/test/spec/ol/source/zoomify.test.js
@@ -2,7 +2,7 @@ import {DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js';
import _ol_events_ from '../../../../src/ol/events.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_source_Zoomify_ from '../../../../src/ol/source/Zoomify.js';
-import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.Zoomify', function() {
@@ -125,7 +125,7 @@ describe('ol.source.Zoomify', function() {
var sources = [getZoomifySource(), getIIPSource()];
for (var i = 0; i < sources.length; i++) {
var tileGrid = sources[i].getTileGrid();
- expect(tileGrid).to.be.a(_ol_tilegrid_TileGrid_);
+ expect(tileGrid).to.be.a(TileGrid);
}
});
diff --git a/test/spec/ol/tile.test.js b/test/spec/ol/tile.test.js
index 7c796392cb..e0da139632 100644
--- a/test/spec/ol/tile.test.js
+++ b/test/spec/ol/tile.test.js
@@ -1,21 +1,21 @@
import {getUid} from '../../../src/ol/index.js';
-import _ol_ImageTile_ from '../../../src/ol/ImageTile.js';
+import ImageTile from '../../../src/ol/ImageTile.js';
import _ol_Tile_ from '../../../src/ol/Tile.js';
-import _ol_TileState_ from '../../../src/ol/TileState.js';
+import TileState from '../../../src/ol/TileState.js';
describe('ol.Tile', function() {
describe('constructor', function() {
it('sets a default transition', function() {
var coord = [0, 0, 0];
- var tile = new _ol_Tile_(coord, _ol_TileState_.IDLE);
+ var tile = new _ol_Tile_(coord, TileState.IDLE);
expect(tile.transition_).to.equal(250);
});
it('allows the transition to be set', function() {
var coord = [0, 0, 0];
var transition = 500;
- var tile = new _ol_Tile_(coord, _ol_TileState_.IDLE, {transition: transition});
+ var tile = new _ol_Tile_(coord, TileState.IDLE, {transition: transition});
expect(tile.transition_).to.equal(transition);
});
});
@@ -23,7 +23,7 @@ describe('ol.Tile', function() {
describe('#getAlpha()', function() {
it('returns the alpha value for a tile in transition', function() {
var coord = [0, 0, 0];
- var tile = new _ol_Tile_(coord, _ol_TileState_.IDLE);
+ var tile = new _ol_Tile_(coord, TileState.IDLE);
var id = 'test';
var time = Date.now();
@@ -45,7 +45,7 @@ describe('ol.Tile', function() {
describe('#inTransition()', function() {
it('determines if the tile is in transition', function() {
var coord = [0, 0, 0];
- var tile = new _ol_Tile_(coord, _ol_TileState_.IDLE);
+ var tile = new _ol_Tile_(coord, TileState.IDLE);
var id = 'test';
expect(tile.inTransition(id)).to.be(true);
@@ -58,24 +58,24 @@ describe('ol.Tile', function() {
var head, renderTile;
beforeEach(function() {
var tileCoord = [0, 0, 0];
- head = new _ol_ImageTile_(tileCoord, _ol_TileState_.IDLE);
+ head = new ImageTile(tileCoord, TileState.IDLE);
getUid(head);
var addToChain = function(tile, state) {
- var next = new _ol_ImageTile_(tileCoord, state);
+ var next = new ImageTile(tileCoord, state);
getUid(next);
tile.interimTile = next;
return next;
};
- var tail = addToChain(head, _ol_TileState_.IDLE); //discard, deprecated by head
- tail = addToChain(tail, _ol_TileState_.LOADING); //keep, request already going
- tail = addToChain(tail, _ol_TileState_.IDLE); //discard, deprecated by head
- tail = addToChain(tail, _ol_TileState_.LOADED); //keep, use for rendering
+ var tail = addToChain(head, TileState.IDLE); //discard, deprecated by head
+ tail = addToChain(tail, TileState.LOADING); //keep, request already going
+ tail = addToChain(tail, TileState.IDLE); //discard, deprecated by head
+ tail = addToChain(tail, TileState.LOADED); //keep, use for rendering
renderTile = tail; //store this tile for later tests
- tail = addToChain(tail, _ol_TileState_.IDLE); //rest of list outdated by tile above
- tail = addToChain(tail, _ol_TileState_.LOADED);
- tail = addToChain(tail, _ol_TileState_.LOADING);
- tail = addToChain(tail, _ol_TileState_.LOADED);
+ tail = addToChain(tail, TileState.IDLE); //rest of list outdated by tile above
+ tail = addToChain(tail, TileState.LOADED);
+ tail = addToChain(tail, TileState.LOADING);
+ tail = addToChain(tail, TileState.LOADED);
});
diff --git a/test/spec/ol/tilecoord.test.js b/test/spec/ol/tilecoord.test.js
index cfd61acfd5..74a7878cab 100644
--- a/test/spec/ol/tilecoord.test.js
+++ b/test/spec/ol/tilecoord.test.js
@@ -1,5 +1,5 @@
import _ol_tilecoord_ from '../../../src/ol/tilecoord.js';
-import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
describe('ol.TileCoord', function() {
@@ -50,7 +50,7 @@ describe('ol.TileCoord', function() {
describe('withinExtentAndZ', function() {
it('restricts by z', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
extent: [10, 20, 30, 40],
tileSize: 10,
resolutions: [2, 1],
@@ -62,7 +62,7 @@ describe('ol.TileCoord', function() {
});
it('restricts by extent when extent defines tile ranges', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
extent: [10, 20, 30, 40],
sizes: [[3, -3]],
tileSize: 10,
@@ -74,7 +74,7 @@ describe('ol.TileCoord', function() {
});
it('restricts by extent when sizes define tile ranges', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
origin: [10, 20],
sizes: [[3, 3]],
tileSize: 10,
@@ -89,7 +89,7 @@ describe('ol.TileCoord', function() {
});
it('restricts by extent when sizes (neg y) define tile ranges', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
origin: [10, 40],
sizes: [[3, -3]],
tileSize: 10,
@@ -104,7 +104,7 @@ describe('ol.TileCoord', function() {
});
it('does not restrict by extent with no extent or sizes', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
origin: [10, 20],
tileSize: 10,
resolutions: [1]
diff --git a/test/spec/ol/tilegrid/tilegrid.test.js b/test/spec/ol/tilegrid/tilegrid.test.js
index 6f71131daf..f6210f384f 100644
--- a/test/spec/ol/tilegrid/tilegrid.test.js
+++ b/test/spec/ol/tilegrid/tilegrid.test.js
@@ -5,7 +5,7 @@ import {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js'
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
-import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.tilegrid.TileGrid', function() {
@@ -22,7 +22,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create valid', function() {
it('does not throw an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -34,7 +34,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with duplicate resolutions', function() {
it('throws an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 50, 25, 10],
origin: origin,
tileSize: tileSize
@@ -47,7 +47,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('throws an exception', function() {
var resolutions = [100, 25, 50, 10];
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -59,7 +59,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with multiple origins', function() {
it('does not throw an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 25, 10],
origins: [origin, origin, origin, origin],
tileSize: tileSize
@@ -71,7 +71,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with both origin and multiple origins', function() {
it('throws an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 25, 10],
origins: [origin, origin, origin, origin],
origin: origin,
@@ -84,7 +84,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with too few origins', function() {
it('throws an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 25, 10],
origins: [origin, origin, origin],
tileSize: tileSize
@@ -96,7 +96,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with too many origins', function() {
it('throws an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 25, 10],
origins: [origin, origin, origin, origin, origin],
tileSize: tileSize
@@ -108,7 +108,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with multiple tileSizes', function() {
it('does not throw an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 25, 10],
tileSizes: [tileSize, tileSize, tileSize, tileSize],
origin: origin
@@ -120,7 +120,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with both tileSize and multiple tileSizes', function() {
it('throws an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 25, 10],
tileSizes: [tileSize, tileSize, tileSize, tileSize],
tileSize: tileSize,
@@ -133,7 +133,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with too few tileSizes', function() {
it('throws an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 25, 10],
tileSizes: [tileSize, tileSize, tileSize],
origin: origin
@@ -145,7 +145,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with too many tileSizes', function() {
it('throws an exception', function() {
expect(function() {
- return new _ol_tilegrid_TileGrid_({
+ return new TileGrid({
resolutions: [100, 50, 25, 10],
tileSizes: [tileSize, tileSize, tileSize, tileSize, tileSize],
origin: origin
@@ -157,7 +157,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with origin', function() {
var tileGrid;
beforeEach(function() {
- tileGrid = new _ol_tilegrid_TileGrid_({
+ tileGrid = new TileGrid({
origin: [10, 20],
tileSize: 10,
resolutions: [1]
@@ -180,7 +180,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with extent', function() {
var tileGrid;
beforeEach(function() {
- tileGrid = new _ol_tilegrid_TileGrid_({
+ tileGrid = new TileGrid({
extent: [10, 20, 30, 40],
tileSize: 10,
resolutions: [1]
@@ -203,7 +203,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with extent and sizes', function() {
var tileGrid;
beforeEach(function() {
- tileGrid = new _ol_tilegrid_TileGrid_({
+ tileGrid = new TileGrid({
extent: [10, 20, 30, 40],
sizes: [[3, -3]],
tileSize: 10,
@@ -227,7 +227,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with top-left origin and sizes', function() {
var tileGrid;
beforeEach(function() {
- tileGrid = new _ol_tilegrid_TileGrid_({
+ tileGrid = new TileGrid({
origin: [10, 40],
sizes: [[3, -3]],
tileSize: 10,
@@ -245,7 +245,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with bottom-left origin and sizes', function() {
var tileGrid;
beforeEach(function() {
- tileGrid = new _ol_tilegrid_TileGrid_({
+ tileGrid = new TileGrid({
origin: [10, 10],
sizes: [[3, 3]],
tileSize: 10,
@@ -262,7 +262,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with extent and origin', function() {
it('uses both origin and extent', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
origin: [0, 0],
extent: [10, 20, 30, 40],
tileSize: 10,
@@ -277,7 +277,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('allows creation of tile grid from extent', function() {
var extent = _ol_extent_.createOrUpdate(-100, -100, 100, 100);
var grid = _ol_tilegrid_.createForExtent(extent);
- expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
+ expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(DEFAULT_MAX_ZOOM + 1);
@@ -287,7 +287,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('#zoomFactor_', function() {
it('is set for a consistent zoom factor', function() {
- var grid = new _ol_tilegrid_TileGrid_({
+ var grid = new TileGrid({
resolutions: [10, 5, 2.5, 1.25],
origin: origin,
tileSize: tileSize
@@ -296,7 +296,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('is not set for an inconsistent zoom factor', function() {
- var grid = new _ol_tilegrid_TileGrid_({
+ var grid = new TileGrid({
resolutions: [10, 5, 3, 1.25],
origin: origin,
tileSize: tileSize
@@ -310,7 +310,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('allows easier creation of a tile grid', function() {
var projection = getProjection('EPSG:3857');
var grid = _ol_tilegrid_.createForProjection(projection);
- expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
+ expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(DEFAULT_MAX_ZOOM + 1);
@@ -319,7 +319,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('accepts a number of zoom levels', function() {
var projection = getProjection('EPSG:3857');
var grid = _ol_tilegrid_.createForProjection(projection, 18);
- expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
+ expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(19);
@@ -328,7 +328,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('accepts a big number of zoom levels', function() {
var projection = getProjection('EPSG:3857');
var grid = _ol_tilegrid_.createForProjection(projection, 23);
- expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
+ expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(24);
@@ -421,7 +421,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('gets the default tile grid for a projection', function() {
var projection = getProjection('EPSG:3857');
var grid = _ol_tilegrid_.getForProjection(projection);
- expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
+ expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(DEFAULT_MAX_ZOOM + 1);
@@ -586,7 +586,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('Y North, X East', function() {
it('returns the expected TileCoord', function() {
origin = [0, 0];
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -618,7 +618,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('Y South, X East', function() {
it('returns the expected TileCoord', function() {
origin = [0, 100000];
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -651,7 +651,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileCoordForCoordAndResolution', function() {
it('returns the expected TileCoord', function() {
var tileSize = 256;
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: [10],
origin: origin,
tileSize: tileSize
@@ -728,7 +728,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileCoordForXYAndResolution_', function() {
it('returns higher tile coord for intersections by default', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -753,7 +753,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('handles alt intersection policy', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -781,7 +781,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileCoordCenter', function() {
it('returns the expected center', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -804,7 +804,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileCoordExtent', function() {
it('returns the expected extend', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -833,7 +833,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileRangeForExtentAndZ', function() {
it('returns the expected TileRange', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -873,7 +873,7 @@ describe('ol.tilegrid.TileGrid', function() {
var origin = [0, 0];
it('works with one tile size as number', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
tileSize: 256,
resolutions: resolutions,
origin: origin
@@ -883,7 +883,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('works with one tile size as array', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
tileSize: [512, 256],
resolutions: resolutions,
origin: origin
@@ -893,7 +893,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('works with multiple tile sizes as number', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
tileSizes: [256, 256, 256, 512],
resolutions: resolutions,
origin: origin
@@ -903,7 +903,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('works with multiple tile sizes as array', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
tileSizes: [[512, 256], [512, 256], [512, 256], [640, 320]],
resolutions: resolutions,
origin: origin
@@ -932,7 +932,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('forEachTileCoordParentTileRange', function() {
it('iterates as expected', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -972,7 +972,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getZForResolution (exact)', function() {
it('returns the expected z value', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -987,7 +987,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getZForResolution (approximate)', function() {
it('returns the expected z value', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -1011,7 +1011,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getZForResolution (lower)', function() {
it('returns the expected z value', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -1035,7 +1035,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getZForResolution (higher)', function() {
it('returns the expected z value', function() {
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
diff --git a/test/spec/ol/tilegrid/wmts.test.js b/test/spec/ol/tilegrid/wmts.test.js
index 188bb75d7f..ec3523be87 100644
--- a/test/spec/ol/tilegrid/wmts.test.js
+++ b/test/spec/ol/tilegrid/wmts.test.js
@@ -1,5 +1,5 @@
import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js';
-import _ol_tilegrid_WMTS_ from '../../../../src/ol/tilegrid/WMTS.js';
+import {createFromCapabilitiesMatrixSet} from '../../../../src/ol/tilegrid/WMTS.js';
describe('ol.tilegrid.WMTS', function() {
@@ -21,9 +21,7 @@ describe('ol.tilegrid.WMTS', function() {
it('can create tileGrid for EPSG:3857',
function() {
var matrixSetObj = capabilities.Contents.TileMatrixSet[0];
- var tileGrid;
- tileGrid = _ol_tilegrid_WMTS_.createFromCapabilitiesMatrixSet(
- matrixSetObj);
+ var tileGrid = createFromCapabilitiesMatrixSet(matrixSetObj);
expect(tileGrid.matrixIds_).to.be.an('array');
expect(tileGrid.matrixIds_).to.have.length(20);
expect(tileGrid.matrixIds_).to.eql([
@@ -76,9 +74,7 @@ describe('ol.tilegrid.WMTS', function() {
it('can create tileGrid for EPSG:3857 without matrixLimits',
function() {
var matrixSetObj = capabilities.Contents.TileMatrixSet[0];
- var tileGrid;
- tileGrid = _ol_tilegrid_WMTS_.createFromCapabilitiesMatrixSet(
- matrixSetObj);
+ var tileGrid = createFromCapabilitiesMatrixSet(matrixSetObj);
expect(tileGrid.matrixIds_).to.be.an('array');
expect(tileGrid.matrixIds_).to.have.length(22);
expect(tileGrid.matrixIds_).to.eql([
@@ -117,9 +113,7 @@ describe('ol.tilegrid.WMTS', function() {
var matrixSetObj = capabilities.Contents.TileMatrixSet[0];
var matrixLimitArray = capabilities.Contents.Layer[0]
.TileMatrixSetLink[0].TileMatrixSetLimits;
- var tileGrid;
- tileGrid = _ol_tilegrid_WMTS_.createFromCapabilitiesMatrixSet(
- matrixSetObj, undefined, matrixLimitArray);
+ var tileGrid = createFromCapabilitiesMatrixSet(matrixSetObj, undefined, matrixLimitArray);
expect(tileGrid.matrixIds_).to.be.an('array');
expect(tileGrid.matrixIds_).to.have.length(20);
expect(tileGrid.matrixIds_).to.eql([
diff --git a/test/spec/ol/tilequeue.test.js b/test/spec/ol/tilequeue.test.js
index 07b654d368..2b62283534 100644
--- a/test/spec/ol/tilequeue.test.js
+++ b/test/spec/ol/tilequeue.test.js
@@ -1,7 +1,7 @@
-import _ol_ImageTile_ from '../../../src/ol/ImageTile.js';
+import ImageTile from '../../../src/ol/ImageTile.js';
import _ol_Tile_ from '../../../src/ol/Tile.js';
import TileQueue from '../../../src/ol/TileQueue.js';
-import _ol_TileState_ from '../../../src/ol/TileState.js';
+import TileState from '../../../src/ol/TileState.js';
import _ol_source_Image_ from '../../../src/ol/source/Image.js';
import PriorityQueue from '../../../src/ol/structs/PriorityQueue.js';
@@ -33,7 +33,7 @@ describe('ol.TileQueue', function() {
var tileLoadFunction = opt_tileLoadFunction ?
opt_tileLoadFunction : _ol_source_Image_.defaultImageLoadFunction;
- return new _ol_ImageTile_(tileCoord, state, src, null, tileLoadFunction);
+ return new ImageTile(tileCoord, state, src, null, tileLoadFunction);
}
describe('#loadMoreTiles()', function() {
@@ -95,7 +95,7 @@ describe('ol.TileQueue', function() {
var numTiles = 20;
for (var i = 0; i < numTiles; ++i) {
var tile = createImageTile();
- tile.state = _ol_TileState_.ABORT;
+ tile.state = TileState.ABORT;
queue.enqueue([tile]);
}
var maxLoading = numTiles / 2;
diff --git a/test/spec/ol/tileurlfunction.test.js b/test/spec/ol/tileurlfunction.test.js
index 1a65cb19cc..5cdbd5aa35 100644
--- a/test/spec/ol/tileurlfunction.test.js
+++ b/test/spec/ol/tileurlfunction.test.js
@@ -1,7 +1,7 @@
import {expandUrl, createFromTemplate, createFromTemplates, createFromTileUrlFunctions} from '../../../src/ol/tileurlfunction.js';
import _ol_tilecoord_ from '../../../src/ol/tilecoord.js';
import _ol_tilegrid_ from '../../../src/ol/tilegrid.js';
-import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
describe('ol.TileUrlFunction', function() {
@@ -60,7 +60,7 @@ describe('ol.TileUrlFunction', function() {
expect(tileUrl([3, 2, -3])).to.eql('3/2/5');
});
it('returns correct value for {-y} with custom tile grids', function() {
- var customTileGrid = new _ol_tilegrid_TileGrid_({
+ var customTileGrid = new TileGrid({
extent: [-180, -90, 180, 90],
origin: [-180, -90],
resolutions: [360 / 256, 360 / 512, 360 / 1024, 360 / 2048]
diff --git a/test/spec/ol/vectorimagetile.test.js b/test/spec/ol/vectorimagetile.test.js
index 4e88bb3e1e..e6b5d80043 100644
--- a/test/spec/ol/vectorimagetile.test.js
+++ b/test/spec/ol/vectorimagetile.test.js
@@ -1,11 +1,11 @@
-import _ol_TileState_ from '../../../src/ol/TileState.js';
-import _ol_VectorImageTile_ from '../../../src/ol/VectorImageTile.js';
-import _ol_VectorTile_ from '../../../src/ol/VectorTile.js';
+import TileState from '../../../src/ol/TileState.js';
+import VectorImageTile, {defaultLoadFunction} from '../../../src/ol/VectorImageTile.js';
+import VectorTile from '../../../src/ol/VectorTile.js';
import _ol_events_ from '../../../src/ol/events.js';
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
import {get as getProjection} from '../../../src/ol/proj.js';
import _ol_tilegrid_ from '../../../src/ol/tilegrid.js';
-import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/TileGrid.js';
+import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
describe('ol.VectorImageTile', function() {
@@ -13,11 +13,11 @@ describe('ol.VectorImageTile', function() {
it('configures loader that sets features on the source tile', function(done) {
var format = new GeoJSON();
var url = 'spec/ol/data/point.json';
- var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format,
- _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {
+ var tile = new VectorImageTile([0, 0, -1], 0, url, format,
+ defaultLoadFunction, [0, 0, -1], function() {
return url;
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
- 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {});
+ 1, getProjection('EPSG:3857'), VectorTile, function() {});
tile.load();
var sourceTile = tile.getTile(tile.tileKeys[0]);
@@ -34,25 +34,25 @@ describe('ol.VectorImageTile', function() {
var format = new GeoJSON();
var url = 'spec/ol/data/unavailable.json';
var sourceTile;
- var tile = new _ol_VectorImageTile_([0, 0, 0] /* one world away */, 0, url, format,
+ var tile = new VectorImageTile([0, 0, 0] /* one world away */, 0, url, format,
function(tile, url) {
sourceTile = tile;
- _ol_VectorImageTile_.defaultLoadFunction(tile, url);
+ defaultLoadFunction(tile, url);
}, [0, 0, -1], function() {
return url;
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
- 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {});
+ 1, getProjection('EPSG:3857'), VectorTile, function() {});
tile.load();
var calls = 0;
_ol_events_.listen(tile, 'change', function(e) {
++calls;
- expect(tile.getState()).to.be(calls == 2 ? _ol_TileState_.LOADED : _ol_TileState_.ERROR);
+ expect(tile.getState()).to.be(calls == 2 ? TileState.LOADED : TileState.ERROR);
if (calls == 2) {
done();
} else {
setTimeout(function() {
- sourceTile.setState(_ol_TileState_.LOADED);
+ sourceTile.setState(TileState.LOADED);
}, 0);
}
});
@@ -61,16 +61,16 @@ describe('ol.VectorImageTile', function() {
it('sets ERROR state when source tiles fail to load', function(done) {
var format = new GeoJSON();
var url = 'spec/ol/data/unavailable.json';
- var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format,
- _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {
+ var tile = new VectorImageTile([0, 0, -1], 0, url, format,
+ defaultLoadFunction, [0, 0, -1], function() {
return url;
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
- 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {});
+ 1, getProjection('EPSG:3857'), VectorTile, function() {});
tile.load();
_ol_events_.listen(tile, 'change', function(e) {
- expect(tile.getState()).to.be(_ol_TileState_.ERROR);
+ expect(tile.getState()).to.be(TileState.ERROR);
done();
});
});
@@ -78,15 +78,15 @@ describe('ol.VectorImageTile', function() {
it('sets EMPTY state when tile has only empty source tiles', function(done) {
var format = new GeoJSON();
var url = '';
- var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format,
- _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {},
+ var tile = new VectorImageTile([0, 0, -1], 0, url, format,
+ defaultLoadFunction, [0, 0, -1], function() {},
_ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
- 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {});
+ 1, getProjection('EPSG:3857'), VectorTile, function() {});
tile.load();
_ol_events_.listen(tile, 'change', function() {
- expect(tile.getState()).to.be(_ol_TileState_.EMPTY);
+ expect(tile.getState()).to.be(TileState.EMPTY);
done();
});
});
@@ -94,18 +94,18 @@ describe('ol.VectorImageTile', function() {
it('only loads tiles within the source tileGrid\'s extent', function() {
var format = new GeoJSON();
var url = 'spec/ol/data/point.json';
- var tileGrid = new _ol_tilegrid_TileGrid_({
+ var tileGrid = new TileGrid({
resolutions: [0.02197265625, 0.010986328125, 0.0054931640625],
origin: [-180, 90],
extent: [-88, 35, -87, 36]
});
var sourceTiles = {};
- var tile = new _ol_VectorImageTile_([1, 0, -1], 0, url, format,
- _ol_VectorImageTile_.defaultLoadFunction, [1, 0, -1], function(zxy) {
+ var tile = new VectorImageTile([1, 0, -1], 0, url, format,
+ defaultLoadFunction, [1, 0, -1], function(zxy) {
return url;
}, tileGrid,
_ol_tilegrid_.createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}),
- sourceTiles, 1, getProjection('EPSG:4326'), _ol_VectorTile_, function() {});
+ sourceTiles, 1, getProjection('EPSG:4326'), VectorTile, function() {});
tile.load();
expect(tile.tileKeys.length).to.be(1);
expect(tile.getTile(tile.tileKeys[0]).tileCoord).to.eql([0, 16, -10]);
@@ -114,41 +114,41 @@ describe('ol.VectorImageTile', function() {
it('#dispose() while loading', function() {
var format = new GeoJSON();
var url = 'spec/ol/data/point.json';
- var tile = new _ol_VectorImageTile_([0, 0, 0] /* one world away */, 0, url, format,
- _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {
+ var tile = new VectorImageTile([0, 0, 0] /* one world away */, 0, url, format,
+ defaultLoadFunction, [0, 0, -1], function() {
return url;
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
- 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {});
+ 1, getProjection('EPSG:3857'), VectorTile, function() {});
tile.load();
expect(tile.loadListenerKeys_.length).to.be(4);
expect(tile.tileKeys.length).to.be(4);
- expect(tile.getState()).to.be(_ol_TileState_.LOADING);
+ expect(tile.getState()).to.be(TileState.LOADING);
tile.dispose();
expect(tile.loadListenerKeys_.length).to.be(0);
expect(tile.tileKeys.length).to.be(0);
expect(tile.sourceTiles_).to.be(null);
- expect(tile.getState()).to.be(_ol_TileState_.ABORT);
+ expect(tile.getState()).to.be(TileState.ABORT);
});
it('#dispose() when loaded', function(done) {
var format = new GeoJSON();
var url = 'spec/ol/data/point.json';
- var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format,
- _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {
+ var tile = new VectorImageTile([0, 0, -1], 0, url, format,
+ defaultLoadFunction, [0, 0, -1], function() {
return url;
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
- 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {});
+ 1, getProjection('EPSG:3857'), VectorTile, function() {});
tile.load();
_ol_events_.listenOnce(tile, 'change', function() {
- expect(tile.getState()).to.be(_ol_TileState_.LOADED);
+ expect(tile.getState()).to.be(TileState.LOADED);
expect(tile.loadListenerKeys_.length).to.be(0);
expect(tile.tileKeys.length).to.be(4);
tile.dispose();
expect(tile.tileKeys.length).to.be(0);
expect(tile.sourceTiles_).to.be(null);
- expect(tile.getState()).to.be(_ol_TileState_.ABORT);
+ expect(tile.getState()).to.be(TileState.ABORT);
done();
});
});
diff --git a/test/spec/ol/vectortile.test.js b/test/spec/ol/vectortile.test.js
index 4cb6e2453e..866195b636 100644
--- a/test/spec/ol/vectortile.test.js
+++ b/test/spec/ol/vectortile.test.js
@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../src/ol/Feature.js';
-import _ol_VectorImageTile_ from '../../../src/ol/VectorImageTile.js';
-import _ol_VectorTile_ from '../../../src/ol/VectorTile.js';
+import {defaultLoadFunction} from '../../../src/ol/VectorImageTile.js';
+import VectorTile from '../../../src/ol/VectorTile.js';
import _ol_events_ from '../../../src/ol/events.js';
import TextFeature from '../../../src/ol/format/TextFeature.js';
import {get as getProjection} from '../../../src/ol/proj.js';
@@ -22,10 +22,10 @@ describe('ol.VectorTile', function() {
return [new _ol_Feature_()];
};
- var tile = new _ol_VectorTile_([0, 0, 0], null, null, format);
+ var tile = new VectorTile([0, 0, 0], null, null, format);
var url = 'spec/ol/data/point.json';
- _ol_VectorImageTile_.defaultLoadFunction(tile, url);
+ defaultLoadFunction(tile, url);
var loader = tile.loader_;
_ol_events_.listen(tile, 'change', function(e) {
expect(tile.getFeatures().length).to.be.greaterThan(0);