Transformed
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
goog.provide('ol.source.TileDebug');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.size');
|
||||
goog.require('ol.source.Tile');
|
||||
goog.require('ol.tilecoord');
|
||||
|
||||
/**
|
||||
* @module ol/source/TileDebug
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_Tile_ from '../Tile.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import _ol_dom_ from '../dom.js';
|
||||
import _ol_size_ from '../size.js';
|
||||
import _ol_source_Tile_ from '../source/Tile.js';
|
||||
import _ol_tilecoord_ from '../tilecoord.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -22,9 +22,9 @@ goog.require('ol.tilecoord');
|
||||
* @param {olx.source.TileDebugOptions} options Debug tile options.
|
||||
* @api
|
||||
*/
|
||||
ol.source.TileDebug = function(options) {
|
||||
var _ol_source_TileDebug_ = function(options) {
|
||||
|
||||
ol.source.Tile.call(this, {
|
||||
_ol_source_Tile_.call(this, {
|
||||
opaque: false,
|
||||
projection: options.projection,
|
||||
tileGrid: options.tileGrid,
|
||||
@@ -32,23 +32,24 @@ ol.source.TileDebug = function(options) {
|
||||
});
|
||||
|
||||
};
|
||||
ol.inherits(ol.source.TileDebug, ol.source.Tile);
|
||||
|
||||
_ol_.inherits(_ol_source_TileDebug_, _ol_source_Tile_);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.source.TileDebug.prototype.getTile = function(z, x, y) {
|
||||
var tileCoordKey = ol.tilecoord.getKeyZXY(z, x, y);
|
||||
_ol_source_TileDebug_.prototype.getTile = function(z, x, y) {
|
||||
var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y);
|
||||
if (this.tileCache.containsKey(tileCoordKey)) {
|
||||
return /** @type {!ol.source.TileDebug.Tile_} */ (this.tileCache.get(tileCoordKey));
|
||||
} else {
|
||||
var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z));
|
||||
var tileSize = _ol_size_.toSize(this.tileGrid.getTileSize(z));
|
||||
var tileCoord = [z, x, y];
|
||||
var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord);
|
||||
var text = !textTileCoord ? '' :
|
||||
this.getTileCoordForTileUrlFunction(textTileCoord).toString();
|
||||
var tile = new ol.source.TileDebug.Tile_(tileCoord, tileSize, text);
|
||||
var tile = new _ol_source_TileDebug_.Tile_(tileCoord, tileSize, text);
|
||||
this.tileCache.set(tileCoordKey, tile);
|
||||
return tile;
|
||||
}
|
||||
@@ -63,9 +64,9 @@ ol.source.TileDebug.prototype.getTile = function(z, x, y) {
|
||||
* @param {string} text Text.
|
||||
* @private
|
||||
*/
|
||||
ol.source.TileDebug.Tile_ = function(tileCoord, tileSize, text) {
|
||||
_ol_source_TileDebug_.Tile_ = function(tileCoord, tileSize, text) {
|
||||
|
||||
ol.Tile.call(this, tileCoord, ol.TileState.LOADED);
|
||||
_ol_Tile_.call(this, tileCoord, _ol_TileState_.LOADED);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -86,19 +87,19 @@ ol.source.TileDebug.Tile_ = function(tileCoord, tileSize, text) {
|
||||
this.canvas_ = null;
|
||||
|
||||
};
|
||||
ol.inherits(ol.source.TileDebug.Tile_, ol.Tile);
|
||||
_ol_.inherits(_ol_source_TileDebug_.Tile_, _ol_Tile_);
|
||||
|
||||
|
||||
/**
|
||||
* Get the image element for this tile.
|
||||
* @return {HTMLCanvasElement} Image.
|
||||
*/
|
||||
ol.source.TileDebug.Tile_.prototype.getImage = function() {
|
||||
_ol_source_TileDebug_.Tile_.prototype.getImage = function() {
|
||||
if (this.canvas_) {
|
||||
return this.canvas_;
|
||||
} else {
|
||||
var tileSize = this.tileSize_;
|
||||
var context = ol.dom.createCanvasContext2D(tileSize[0], tileSize[1]);
|
||||
var context = _ol_dom_.createCanvasContext2D(tileSize[0], tileSize[1]);
|
||||
|
||||
context.strokeStyle = 'black';
|
||||
context.strokeRect(0.5, 0.5, tileSize[0] + 0.5, tileSize[1] + 0.5);
|
||||
@@ -118,4 +119,5 @@ ol.source.TileDebug.Tile_.prototype.getImage = function() {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.source.TileDebug.Tile_.prototype.load = function() {};
|
||||
_ol_source_TileDebug_.Tile_.prototype.load = function() {};
|
||||
export default _ol_source_TileDebug_;
|
||||
|
||||
Reference in New Issue
Block a user