Manual class transform

This commit is contained in:
Tim Schaub
2018-07-16 17:09:50 -06:00
parent 7b4a73f3b9
commit f78d0d4cfa
96 changed files with 8112 additions and 7964 deletions

View File

@@ -27,54 +27,59 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
* @param {boolean} preemptive Load the tile when visible (before it's needed).
* @param {boolean} jsonp Load the tile as a script.
*/
export const CustomTile = function(tileCoord, state, src, extent, preemptive, jsonp) {
export class CustomTile {
Tile.call(this, tileCoord, state);
constructor(tileCoord, state, src, extent, preemptive, jsonp) {
/**
* @private
* @type {string}
*/
this.src_ = src;
Tile.call(this, tileCoord, state);
/**
* @private
* @type {module:ol/extent~Extent}
*/
this.extent_ = extent;
/**
* @private
* @type {string}
*/
this.src_ = src;
/**
* @private
* @type {boolean}
*/
this.preemptive_ = preemptive;
/**
* @private
* @type {module:ol/extent~Extent}
*/
this.extent_ = extent;
/**
* @private
* @type {Array.<string>}
*/
this.grid_ = null;
/**
* @private
* @type {boolean}
*/
this.preemptive_ = preemptive;
/**
* @private
* @type {Array.<string>}
*/
this.keys_ = null;
/**
* @private
* @type {Array.<string>}
*/
this.grid_ = null;
/**
* @private
* @type {Object.<string, Object>|undefined}
*/
this.data_ = null;
/**
* @private
* @type {Array.<string>}
*/
this.keys_ = null;
/**
* @private
* @type {Object.<string, Object>|undefined}
*/
this.data_ = null;
/**
* @private
* @type {boolean}
*/
this.jsonp_ = jsonp;
/**
* @private
* @type {boolean}
*/
this.jsonp_ = jsonp;
}
}
};
inherits(CustomTile, Tile);
@@ -275,54 +280,59 @@ CustomTile.prototype.load = function() {
* @param {module:ol/source/UTFGrid~Options=} options Source options.
* @api
*/
const UTFGrid = function(options) {
TileSource.call(this, {
projection: getProjection('EPSG:3857'),
state: SourceState.LOADING
});
class UTFGrid {
/**
* @private
* @type {boolean}
*/
this.preemptive_ = options.preemptive !== undefined ?
options.preemptive : true;
constructor(options) {
TileSource.call(this, {
projection: getProjection('EPSG:3857'),
state: SourceState.LOADING
});
/**
* @private
* @type {!module:ol/Tile~UrlFunction}
*/
this.tileUrlFunction_ = nullTileUrlFunction;
/**
* @private
* @type {boolean}
*/
this.preemptive_ = options.preemptive !== undefined ?
options.preemptive : true;
/**
* @private
* @type {string|undefined}
*/
this.template_ = undefined;
/**
* @private
* @type {!module:ol/Tile~UrlFunction}
*/
this.tileUrlFunction_ = nullTileUrlFunction;
/**
* @private
* @type {boolean}
*/
this.jsonp_ = options.jsonp || false;
/**
* @private
* @type {string|undefined}
*/
this.template_ = undefined;
if (options.url) {
if (this.jsonp_) {
requestJSONP(options.url, this.handleTileJSONResponse.bind(this),
this.handleTileJSONError.bind(this));
/**
* @private
* @type {boolean}
*/
this.jsonp_ = options.jsonp || false;
if (options.url) {
if (this.jsonp_) {
requestJSONP(options.url, this.handleTileJSONResponse.bind(this),
this.handleTileJSONError.bind(this));
} else {
const client = new XMLHttpRequest();
client.addEventListener('load', this.onXHRLoad_.bind(this));
client.addEventListener('error', this.onXHRError_.bind(this));
client.open('GET', options.url);
client.send();
}
} else if (options.tileJSON) {
this.handleTileJSONResponse(options.tileJSON);
} else {
const client = new XMLHttpRequest();
client.addEventListener('load', this.onXHRLoad_.bind(this));
client.addEventListener('error', this.onXHRError_.bind(this));
client.open('GET', options.url);
client.send();
assert(false, 51); // Either `url` or `tileJSON` options must be provided
}
} else if (options.tileJSON) {
this.handleTileJSONResponse(options.tileJSON);
} else {
assert(false, 51); // Either `url` or `tileJSON` options must be provided
}
};
}
inherits(UTFGrid, TileSource);