@@ -12,7 +12,7 @@ import _ol_MapEventType_ from './MapEventType.js';
|
||||
import _ol_MapProperty_ from './MapProperty.js';
|
||||
import _ol_Object_ from './Object.js';
|
||||
import _ol_ObjectEventType_ from './ObjectEventType.js';
|
||||
import _ol_TileQueue_ from './TileQueue.js';
|
||||
import TileQueue from './TileQueue.js';
|
||||
import _ol_View_ from './View.js';
|
||||
import _ol_ViewHint_ from './ViewHint.js';
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
@@ -27,7 +27,7 @@ import _ol_layer_Group_ from './layer/Group.js';
|
||||
import _ol_plugins_ from './plugins.js';
|
||||
import _ol_renderer_Type_ from './renderer/Type.js';
|
||||
import _ol_size_ from './size.js';
|
||||
import _ol_structs_PriorityQueue_ from './structs/PriorityQueue.js';
|
||||
import PriorityQueue from './structs/PriorityQueue.js';
|
||||
import _ol_transform_ from './transform.js';
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ var _ol_PluggableMap_ = function(options) {
|
||||
* @private
|
||||
* @type {ol.TileQueue}
|
||||
*/
|
||||
this.tileQueue_ = new _ol_TileQueue_(
|
||||
this.tileQueue_ = new TileQueue(
|
||||
this.getTilePriority.bind(this),
|
||||
this.handleTileChange_.bind(this));
|
||||
|
||||
@@ -875,10 +875,10 @@ _ol_PluggableMap_.prototype.getTilePriority = function(tile, tileSourceKey, tile
|
||||
// are outside the visible extent.
|
||||
var frameState = this.frameState_;
|
||||
if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {
|
||||
return _ol_structs_PriorityQueue_.DROP;
|
||||
return PriorityQueue.DROP;
|
||||
}
|
||||
if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {
|
||||
return _ol_structs_PriorityQueue_.DROP;
|
||||
return PriorityQueue.DROP;
|
||||
}
|
||||
// Prioritize the highest zoom level tiles closest to the focus.
|
||||
// Tiles at higher zoom levels are prioritized using Math.log(tileResolution).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/TileCache
|
||||
*/
|
||||
import {inherits} from './index.js';
|
||||
import _ol_structs_LRUCache_ from './structs/LRUCache.js';
|
||||
import LRUCache from './structs/LRUCache.js';
|
||||
import _ol_tilecoord_ from './tilecoord.js';
|
||||
|
||||
/**
|
||||
@@ -11,19 +11,19 @@ import _ol_tilecoord_ from './tilecoord.js';
|
||||
* @param {number=} opt_highWaterMark High water mark.
|
||||
* @struct
|
||||
*/
|
||||
var _ol_TileCache_ = function(opt_highWaterMark) {
|
||||
var TileCache = function(opt_highWaterMark) {
|
||||
|
||||
_ol_structs_LRUCache_.call(this, opt_highWaterMark);
|
||||
LRUCache.call(this, opt_highWaterMark);
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_TileCache_, _ol_structs_LRUCache_);
|
||||
inherits(TileCache, LRUCache);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Object.<string, ol.TileRange>} usedTiles Used tiles.
|
||||
*/
|
||||
_ol_TileCache_.prototype.expireCache = function(usedTiles) {
|
||||
TileCache.prototype.expireCache = function(usedTiles) {
|
||||
var tile, zKey;
|
||||
while (this.canExpireCache()) {
|
||||
tile = this.peekLast();
|
||||
@@ -40,7 +40,7 @@ _ol_TileCache_.prototype.expireCache = function(usedTiles) {
|
||||
/**
|
||||
* Prune all tiles from the cache that don't have the same z as the newest tile.
|
||||
*/
|
||||
_ol_TileCache_.prototype.pruneExceptNewestZ = function() {
|
||||
TileCache.prototype.pruneExceptNewestZ = function() {
|
||||
if (this.getCount() === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -54,4 +54,4 @@ _ol_TileCache_.prototype.pruneExceptNewestZ = function() {
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
export default _ol_TileCache_;
|
||||
export default TileCache;
|
||||
|
||||
@@ -5,7 +5,7 @@ import {inherits} from './index.js';
|
||||
import _ol_TileState_ from './TileState.js';
|
||||
import _ol_events_ from './events.js';
|
||||
import EventType from './events/EventType.js';
|
||||
import _ol_structs_PriorityQueue_ from './structs/PriorityQueue.js';
|
||||
import PriorityQueue from './structs/PriorityQueue.js';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -16,9 +16,9 @@ import _ol_structs_PriorityQueue_ from './structs/PriorityQueue.js';
|
||||
* Function called on each tile change event.
|
||||
* @struct
|
||||
*/
|
||||
var _ol_TileQueue_ = function(tilePriorityFunction, tileChangeCallback) {
|
||||
var TileQueue = function(tilePriorityFunction, tileChangeCallback) {
|
||||
|
||||
_ol_structs_PriorityQueue_.call(
|
||||
PriorityQueue.call(
|
||||
this,
|
||||
/**
|
||||
* @param {Array} element Element.
|
||||
@@ -55,14 +55,14 @@ var _ol_TileQueue_ = function(tilePriorityFunction, tileChangeCallback) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_TileQueue_, _ol_structs_PriorityQueue_);
|
||||
inherits(TileQueue, PriorityQueue);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_TileQueue_.prototype.enqueue = function(element) {
|
||||
var added = _ol_structs_PriorityQueue_.prototype.enqueue.call(this, element);
|
||||
TileQueue.prototype.enqueue = function(element) {
|
||||
var added = PriorityQueue.prototype.enqueue.call(this, element);
|
||||
if (added) {
|
||||
var tile = element[0];
|
||||
_ol_events_.listen(tile, EventType.CHANGE,
|
||||
@@ -75,7 +75,7 @@ _ol_TileQueue_.prototype.enqueue = function(element) {
|
||||
/**
|
||||
* @return {number} Number of tiles loading.
|
||||
*/
|
||||
_ol_TileQueue_.prototype.getTilesLoading = function() {
|
||||
TileQueue.prototype.getTilesLoading = function() {
|
||||
return this.tilesLoading_;
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ _ol_TileQueue_.prototype.getTilesLoading = function() {
|
||||
* @param {ol.events.Event} event Event.
|
||||
* @protected
|
||||
*/
|
||||
_ol_TileQueue_.prototype.handleTileChange = function(event) {
|
||||
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 ||
|
||||
@@ -105,7 +105,7 @@ _ol_TileQueue_.prototype.handleTileChange = function(event) {
|
||||
* @param {number} maxTotalLoading Maximum number tiles to load simultaneously.
|
||||
* @param {number} maxNewLoads Maximum number of new tiles to load.
|
||||
*/
|
||||
_ol_TileQueue_.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
|
||||
TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
|
||||
var newLoads = 0;
|
||||
var abortedTiles = false;
|
||||
var state, tile, tileKey;
|
||||
@@ -129,4 +129,4 @@ _ol_TileQueue_.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads)
|
||||
this.tileChangeCallback_();
|
||||
}
|
||||
};
|
||||
export default _ol_TileQueue_;
|
||||
export default TileQueue;
|
||||
|
||||
@@ -21,7 +21,7 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||
import _ol_layer_Vector_ from '../layer/Vector.js';
|
||||
import _ol_source_Vector_ from '../source/Vector.js';
|
||||
import _ol_source_VectorEventType_ from '../source/VectorEventType.js';
|
||||
import _ol_structs_RBush_ from '../structs/RBush.js';
|
||||
import RBush from '../structs/RBush.js';
|
||||
import _ol_style_Style_ from '../style/Style.js';
|
||||
|
||||
/**
|
||||
@@ -123,7 +123,7 @@ var _ol_interaction_Modify_ = function(options) {
|
||||
* @type {ol.structs.RBush.<ol.ModifySegmentDataType>}
|
||||
* @private
|
||||
*/
|
||||
this.rBush_ = new _ol_structs_RBush_();
|
||||
this.rBush_ = new RBush();
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
||||
@@ -15,7 +15,7 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_source_Vector_ from '../source/Vector.js';
|
||||
import _ol_source_VectorEventType_ from '../source/VectorEventType.js';
|
||||
import _ol_structs_RBush_ from '../structs/RBush.js';
|
||||
import RBush from '../structs/RBush.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -128,7 +128,7 @@ var _ol_interaction_Snap_ = function(opt_options) {
|
||||
* @type {ol.structs.RBush.<ol.SnapSegmentDataType>}
|
||||
* @private
|
||||
*/
|
||||
this.rBush_ = new _ol_structs_RBush_();
|
||||
this.rBush_ = new RBush();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import _ol_css_ from '../css.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_structs_LRUCache_ from '../structs/LRUCache.js';
|
||||
import LRUCache from '../structs/LRUCache.js';
|
||||
import _ol_transform_ from '../transform.js';
|
||||
var _ol_render_canvas_ = {};
|
||||
|
||||
@@ -96,7 +96,7 @@ _ol_render_canvas_.defaultLineWidth = 1;
|
||||
/**
|
||||
* @type {ol.structs.LRUCache.<HTMLCanvasElement>}
|
||||
*/
|
||||
_ol_render_canvas_.labelCache = new _ol_structs_LRUCache_();
|
||||
_ol_render_canvas_.labelCache = new LRUCache();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,8 +15,8 @@ import _ol_render_webgl_LineStringReplay_ from '../webgl/LineStringReplay.js';
|
||||
import _ol_render_webgl_Replay_ from '../webgl/Replay.js';
|
||||
import _ol_render_webgl_ from '../webgl.js';
|
||||
import _ol_style_Stroke_ from '../../style/Stroke.js';
|
||||
import _ol_structs_LinkedList_ from '../../structs/LinkedList.js';
|
||||
import _ol_structs_RBush_ from '../../structs/RBush.js';
|
||||
import LinkedList from '../../structs/LinkedList.js';
|
||||
import RBush from '../../structs/RBush.js';
|
||||
import _ol_webgl_ from '../../webgl.js';
|
||||
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
|
||||
|
||||
@@ -76,8 +76,8 @@ inherits(_ol_render_webgl_PolygonReplay_, _ol_render_webgl_Replay_);
|
||||
_ol_render_webgl_PolygonReplay_.prototype.drawCoordinates_ = function(
|
||||
flatCoordinates, holeFlatCoordinates, stride) {
|
||||
// Triangulate the polygon
|
||||
var outerRing = new _ol_structs_LinkedList_();
|
||||
var rtree = new _ol_structs_RBush_();
|
||||
var outerRing = new LinkedList();
|
||||
var rtree = new RBush();
|
||||
// Initialize the outer ring
|
||||
this.processFlatCoordinates_(flatCoordinates, stride, outerRing, rtree, true);
|
||||
var maxCoords = this.getMaxCoords_(outerRing);
|
||||
@@ -88,9 +88,9 @@ _ol_render_webgl_PolygonReplay_.prototype.drawCoordinates_ = function(
|
||||
var holeLists = [];
|
||||
for (i = 0, ii = holeFlatCoordinates.length; i < ii; ++i) {
|
||||
var holeList = {
|
||||
list: new _ol_structs_LinkedList_(),
|
||||
list: new LinkedList(),
|
||||
maxCoords: undefined,
|
||||
rtree: new _ol_structs_RBush_()
|
||||
rtree: new RBush()
|
||||
};
|
||||
holeLists.push(holeList);
|
||||
this.processFlatCoordinates_(holeFlatCoordinates[i],
|
||||
@@ -553,8 +553,8 @@ _ol_render_webgl_PolygonReplay_.prototype.splitPolygon_ = function(list, rtree)
|
||||
var intersection = this.calculateIntersection_(s0.p0,
|
||||
s0.p1, s1.p0, s1.p1);
|
||||
var p = this.createPoint_(intersection[0], intersection[1], n);
|
||||
var newPolygon = new _ol_structs_LinkedList_();
|
||||
var newRtree = new _ol_structs_RBush_();
|
||||
var newPolygon = new LinkedList();
|
||||
var newRtree = new RBush();
|
||||
this.insertItem_(p, s0.p1, newPolygon, newRtree);
|
||||
s0.p1 = p;
|
||||
rtree.update([Math.min(s0.p0.x, p.x), Math.min(s0.p0.y, p.y),
|
||||
|
||||
@@ -15,8 +15,8 @@ import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js';
|
||||
import _ol_renderer_Map_ from '../Map.js';
|
||||
import _ol_renderer_Type_ from '../Type.js';
|
||||
import _ol_source_State_ from '../../source/State.js';
|
||||
import _ol_structs_LRUCache_ from '../../structs/LRUCache.js';
|
||||
import _ol_structs_PriorityQueue_ from '../../structs/PriorityQueue.js';
|
||||
import LRUCache from '../../structs/LRUCache.js';
|
||||
import PriorityQueue from '../../structs/PriorityQueue.js';
|
||||
import _ol_webgl_ from '../../webgl.js';
|
||||
import _ol_webgl_Context_ from '../../webgl/Context.js';
|
||||
import _ol_webgl_ContextEventType_ from '../../webgl/ContextEventType.js';
|
||||
@@ -101,7 +101,7 @@ var _ol_renderer_webgl_Map_ = function(container, map) {
|
||||
* @private
|
||||
* @type {ol.structs.LRUCache.<ol.WebglTextureCacheEntry|null>}
|
||||
*/
|
||||
this.textureCache_ = new _ol_structs_LRUCache_();
|
||||
this.textureCache_ = new LRUCache();
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -113,7 +113,7 @@ var _ol_renderer_webgl_Map_ = function(container, map) {
|
||||
* @private
|
||||
* @type {ol.structs.PriorityQueue.<Array>}
|
||||
*/
|
||||
this.tileTextureQueue_ = new _ol_structs_PriorityQueue_(
|
||||
this.tileTextureQueue_ = new PriorityQueue(
|
||||
/**
|
||||
* @param {Array.<*>} element Element.
|
||||
* @return {number} Priority.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import _ol_ImageCanvas_ from '../ImageCanvas.js';
|
||||
import _ol_TileQueue_ from '../TileQueue.js';
|
||||
import TileQueue from '../TileQueue.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import Event from '../events/Event.js';
|
||||
@@ -69,7 +69,7 @@ var _ol_source_Raster_ = function(options) {
|
||||
* @private
|
||||
* @type {ol.TileQueue}
|
||||
*/
|
||||
this.tileQueue_ = new _ol_TileQueue_(
|
||||
this.tileQueue_ = new TileQueue(
|
||||
function() {
|
||||
return 1;
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/source/Tile
|
||||
*/
|
||||
import {inherits, nullFunction} from '../index.js';
|
||||
import _ol_TileCache_ from '../TileCache.js';
|
||||
import TileCache from '../TileCache.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import Event from '../events/Event.js';
|
||||
import {equivalent} from '../proj.js';
|
||||
@@ -56,7 +56,7 @@ var _ol_source_Tile_ = function(options) {
|
||||
* @protected
|
||||
* @type {ol.TileCache}
|
||||
*/
|
||||
this.tileCache = new _ol_TileCache_(options.cacheSize);
|
||||
this.tileCache = new TileCache(options.cacheSize);
|
||||
|
||||
/**
|
||||
* @protected
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import _ol_ImageTile_ from '../ImageTile.js';
|
||||
import _ol_TileCache_ from '../TileCache.js';
|
||||
import TileCache from '../TileCache.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
@@ -193,7 +193,7 @@ _ol_source_TileImage_.prototype.getTileCacheForProjection = function(projection)
|
||||
} else {
|
||||
var projKey = getUid(projection).toString();
|
||||
if (!(projKey in this.tileCacheForProjection)) {
|
||||
this.tileCacheForProjection[projKey] = new _ol_TileCache_(this.tileCache.highWaterMark);
|
||||
this.tileCacheForProjection[projKey] = new TileCache(this.tileCache.highWaterMark);
|
||||
}
|
||||
return this.tileCacheForProjection[projKey];
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import _ol_obj_ from '../obj.js';
|
||||
import _ol_source_Source_ from '../source/Source.js';
|
||||
import _ol_source_State_ from '../source/State.js';
|
||||
import _ol_source_VectorEventType_ from '../source/VectorEventType.js';
|
||||
import _ol_structs_RBush_ from '../structs/RBush.js';
|
||||
import RBush from '../structs/RBush.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -90,13 +90,13 @@ var _ol_source_Vector_ = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.structs.RBush.<ol.Feature>}
|
||||
*/
|
||||
this.featuresRtree_ = useSpatialIndex ? new _ol_structs_RBush_() : null;
|
||||
this.featuresRtree_ = useSpatialIndex ? new RBush() : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.structs.RBush.<{extent: ol.Extent}>}
|
||||
*/
|
||||
this.loadedExtentsRtree_ = new _ol_structs_RBush_();
|
||||
this.loadedExtentsRtree_ = new RBush();
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -17,7 +17,7 @@ import EventType from '../events/EventType.js';
|
||||
* @template T
|
||||
* @param {number=} opt_highWaterMark High water mark.
|
||||
*/
|
||||
var _ol_structs_LRUCache_ = function(opt_highWaterMark) {
|
||||
var LRUCache = function(opt_highWaterMark) {
|
||||
|
||||
EventTarget.call(this);
|
||||
|
||||
@@ -52,13 +52,13 @@ var _ol_structs_LRUCache_ = function(opt_highWaterMark) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_structs_LRUCache_, EventTarget);
|
||||
inherits(LRUCache, EventTarget);
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Can expire cache.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.canExpireCache = function() {
|
||||
LRUCache.prototype.canExpireCache = function() {
|
||||
return this.getCount() > this.highWaterMark;
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ _ol_structs_LRUCache_.prototype.canExpireCache = function() {
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.clear = function() {
|
||||
LRUCache.prototype.clear = function() {
|
||||
this.count_ = 0;
|
||||
this.entries_ = {};
|
||||
this.oldest_ = null;
|
||||
@@ -79,7 +79,7 @@ _ol_structs_LRUCache_.prototype.clear = function() {
|
||||
* @param {string} key Key.
|
||||
* @return {boolean} Contains key.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.containsKey = function(key) {
|
||||
LRUCache.prototype.containsKey = function(key) {
|
||||
return this.entries_.hasOwnProperty(key);
|
||||
};
|
||||
|
||||
@@ -92,7 +92,7 @@ _ol_structs_LRUCache_.prototype.containsKey = function(key) {
|
||||
* @param {S=} opt_this The object to use as `this` in `f`.
|
||||
* @template S
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.forEach = function(f, opt_this) {
|
||||
LRUCache.prototype.forEach = function(f, opt_this) {
|
||||
var entry = this.oldest_;
|
||||
while (entry) {
|
||||
f.call(opt_this, entry.value_, entry.key_, this);
|
||||
@@ -105,7 +105,7 @@ _ol_structs_LRUCache_.prototype.forEach = function(f, opt_this) {
|
||||
* @param {string} key Key.
|
||||
* @return {T} Value.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.get = function(key) {
|
||||
LRUCache.prototype.get = function(key) {
|
||||
var entry = this.entries_[key];
|
||||
_ol_asserts_.assert(entry !== undefined,
|
||||
15); // Tried to get a value for a key that does not exist in the cache
|
||||
@@ -131,7 +131,7 @@ _ol_structs_LRUCache_.prototype.get = function(key) {
|
||||
* @param {string} key The entry key.
|
||||
* @return {T} The removed entry.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.remove = function(key) {
|
||||
LRUCache.prototype.remove = function(key) {
|
||||
var entry = this.entries_[key];
|
||||
_ol_asserts_.assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
|
||||
if (entry === this.newest_) {
|
||||
@@ -157,7 +157,7 @@ _ol_structs_LRUCache_.prototype.remove = function(key) {
|
||||
/**
|
||||
* @return {number} Count.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.getCount = function() {
|
||||
LRUCache.prototype.getCount = function() {
|
||||
return this.count_;
|
||||
};
|
||||
|
||||
@@ -165,7 +165,7 @@ _ol_structs_LRUCache_.prototype.getCount = function() {
|
||||
/**
|
||||
* @return {Array.<string>} Keys.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.getKeys = function() {
|
||||
LRUCache.prototype.getKeys = function() {
|
||||
var keys = new Array(this.count_);
|
||||
var i = 0;
|
||||
var entry;
|
||||
@@ -179,7 +179,7 @@ _ol_structs_LRUCache_.prototype.getKeys = function() {
|
||||
/**
|
||||
* @return {Array.<T>} Values.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.getValues = function() {
|
||||
LRUCache.prototype.getValues = function() {
|
||||
var values = new Array(this.count_);
|
||||
var i = 0;
|
||||
var entry;
|
||||
@@ -193,7 +193,7 @@ _ol_structs_LRUCache_.prototype.getValues = function() {
|
||||
/**
|
||||
* @return {T} Last value.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.peekLast = function() {
|
||||
LRUCache.prototype.peekLast = function() {
|
||||
return this.oldest_.value_;
|
||||
};
|
||||
|
||||
@@ -201,7 +201,7 @@ _ol_structs_LRUCache_.prototype.peekLast = function() {
|
||||
/**
|
||||
* @return {string} Last key.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.peekLastKey = function() {
|
||||
LRUCache.prototype.peekLastKey = function() {
|
||||
return this.oldest_.key_;
|
||||
};
|
||||
|
||||
@@ -210,7 +210,7 @@ _ol_structs_LRUCache_.prototype.peekLastKey = function() {
|
||||
* Get the key of the newest item in the cache. Throws if the cache is empty.
|
||||
* @return {string} The newest key.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.peekFirstKey = function() {
|
||||
LRUCache.prototype.peekFirstKey = function() {
|
||||
return this.newest_.key_;
|
||||
};
|
||||
|
||||
@@ -218,7 +218,7 @@ _ol_structs_LRUCache_.prototype.peekFirstKey = function() {
|
||||
/**
|
||||
* @return {T} value Value.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.pop = function() {
|
||||
LRUCache.prototype.pop = function() {
|
||||
var entry = this.oldest_;
|
||||
delete this.entries_[entry.key_];
|
||||
if (entry.newer) {
|
||||
@@ -237,7 +237,7 @@ _ol_structs_LRUCache_.prototype.pop = function() {
|
||||
* @param {string} key Key.
|
||||
* @param {T} value Value.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.replace = function(key, value) {
|
||||
LRUCache.prototype.replace = function(key, value) {
|
||||
this.get(key); // update `newest_`
|
||||
this.entries_[key].value_ = value;
|
||||
};
|
||||
@@ -247,7 +247,7 @@ _ol_structs_LRUCache_.prototype.replace = function(key, value) {
|
||||
* @param {string} key Key.
|
||||
* @param {T} value Value.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.set = function(key, value) {
|
||||
LRUCache.prototype.set = function(key, value) {
|
||||
_ol_asserts_.assert(!(key in this.entries_),
|
||||
16); // Tried to set a value for a key that is used already
|
||||
var entry = /** @type {ol.LRUCacheEntry} */ ({
|
||||
@@ -270,9 +270,9 @@ _ol_structs_LRUCache_.prototype.set = function(key, value) {
|
||||
/**
|
||||
* Prune the cache.
|
||||
*/
|
||||
_ol_structs_LRUCache_.prototype.prune = function() {
|
||||
LRUCache.prototype.prune = function() {
|
||||
while (this.canExpireCache()) {
|
||||
this.pop();
|
||||
}
|
||||
};
|
||||
export default _ol_structs_LRUCache_;
|
||||
export default LRUCache;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @module ol/structs/LinkedList
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates an empty linked list structure.
|
||||
*
|
||||
@@ -9,7 +10,7 @@
|
||||
* @param {boolean=} opt_circular The last item is connected to the first one,
|
||||
* and the first item to the last one. Default is true.
|
||||
*/
|
||||
var _ol_structs_LinkedList_ = function(opt_circular) {
|
||||
var LinkedList = function(opt_circular) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -47,7 +48,7 @@ var _ol_structs_LinkedList_ = function(opt_circular) {
|
||||
*
|
||||
* @param {?} data Item data.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.insertItem = function(data) {
|
||||
LinkedList.prototype.insertItem = function(data) {
|
||||
|
||||
/** @type {ol.LinkedListItem} */
|
||||
var item = {
|
||||
@@ -88,7 +89,7 @@ _ol_structs_LinkedList_.prototype.insertItem = function(data) {
|
||||
* Removes the current item from the list. Sets the cursor to the next item,
|
||||
* if possible.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.removeItem = function() {
|
||||
LinkedList.prototype.removeItem = function() {
|
||||
var head = this.head_;
|
||||
if (head) {
|
||||
var next = head.next;
|
||||
@@ -119,7 +120,7 @@ _ol_structs_LinkedList_.prototype.removeItem = function() {
|
||||
*
|
||||
* @return {?} Item data.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.firstItem = function() {
|
||||
LinkedList.prototype.firstItem = function() {
|
||||
this.head_ = this.first_;
|
||||
if (this.head_) {
|
||||
return this.head_.data;
|
||||
@@ -132,7 +133,7 @@ _ol_structs_LinkedList_.prototype.firstItem = function() {
|
||||
*
|
||||
* @return {?} Item data.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.lastItem = function() {
|
||||
LinkedList.prototype.lastItem = function() {
|
||||
this.head_ = this.last_;
|
||||
if (this.head_) {
|
||||
return this.head_.data;
|
||||
@@ -145,7 +146,7 @@ _ol_structs_LinkedList_.prototype.lastItem = function() {
|
||||
*
|
||||
* @return {?} Item data.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.nextItem = function() {
|
||||
LinkedList.prototype.nextItem = function() {
|
||||
if (this.head_ && this.head_.next) {
|
||||
this.head_ = this.head_.next;
|
||||
return this.head_.data;
|
||||
@@ -158,7 +159,7 @@ _ol_structs_LinkedList_.prototype.nextItem = function() {
|
||||
*
|
||||
* @return {?} Item data.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.getNextItem = function() {
|
||||
LinkedList.prototype.getNextItem = function() {
|
||||
if (this.head_ && this.head_.next) {
|
||||
return this.head_.next.data;
|
||||
}
|
||||
@@ -170,7 +171,7 @@ _ol_structs_LinkedList_.prototype.getNextItem = function() {
|
||||
*
|
||||
* @return {?} Item data.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.prevItem = function() {
|
||||
LinkedList.prototype.prevItem = function() {
|
||||
if (this.head_ && this.head_.prev) {
|
||||
this.head_ = this.head_.prev;
|
||||
return this.head_.data;
|
||||
@@ -183,7 +184,7 @@ _ol_structs_LinkedList_.prototype.prevItem = function() {
|
||||
*
|
||||
* @return {?} Item data.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.getPrevItem = function() {
|
||||
LinkedList.prototype.getPrevItem = function() {
|
||||
if (this.head_ && this.head_.prev) {
|
||||
return this.head_.prev.data;
|
||||
}
|
||||
@@ -195,7 +196,7 @@ _ol_structs_LinkedList_.prototype.getPrevItem = function() {
|
||||
*
|
||||
* @return {?} Item data.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.getCurrItem = function() {
|
||||
LinkedList.prototype.getCurrItem = function() {
|
||||
if (this.head_) {
|
||||
return this.head_.data;
|
||||
}
|
||||
@@ -206,7 +207,7 @@ _ol_structs_LinkedList_.prototype.getCurrItem = function() {
|
||||
* Sets the first item of the list. This only works for circular lists, and sets
|
||||
* the last item accordingly.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.setFirstItem = function() {
|
||||
LinkedList.prototype.setFirstItem = function() {
|
||||
if (this.circular_ && this.head_) {
|
||||
this.first_ = this.head_;
|
||||
this.last_ = this.head_.prev;
|
||||
@@ -217,7 +218,7 @@ _ol_structs_LinkedList_.prototype.setFirstItem = function() {
|
||||
* Concatenates two lists.
|
||||
* @param {ol.structs.LinkedList} list List to merge into the current list.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.concat = function(list) {
|
||||
LinkedList.prototype.concat = function(list) {
|
||||
if (list.head_) {
|
||||
if (this.head_) {
|
||||
var end = this.head_.next;
|
||||
@@ -244,7 +245,7 @@ _ol_structs_LinkedList_.prototype.concat = function(list) {
|
||||
*
|
||||
* @return {number} Length.
|
||||
*/
|
||||
_ol_structs_LinkedList_.prototype.getLength = function() {
|
||||
LinkedList.prototype.getLength = function() {
|
||||
return this.length_;
|
||||
};
|
||||
export default _ol_structs_LinkedList_;
|
||||
export default LinkedList;
|
||||
|
||||
@@ -19,7 +19,7 @@ import _ol_obj_ from '../obj.js';
|
||||
* @struct
|
||||
* @template T
|
||||
*/
|
||||
var _ol_structs_PriorityQueue_ = function(priorityFunction, keyFunction) {
|
||||
var PriorityQueue = function(priorityFunction, keyFunction) {
|
||||
|
||||
/**
|
||||
* @type {function(T): number}
|
||||
@@ -58,13 +58,13 @@ var _ol_structs_PriorityQueue_ = function(priorityFunction, keyFunction) {
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.DROP = Infinity;
|
||||
PriorityQueue.DROP = Infinity;
|
||||
|
||||
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.clear = function() {
|
||||
PriorityQueue.prototype.clear = function() {
|
||||
this.elements_.length = 0;
|
||||
this.priorities_.length = 0;
|
||||
_ol_obj_.clear(this.queuedElements_);
|
||||
@@ -75,7 +75,7 @@ _ol_structs_PriorityQueue_.prototype.clear = function() {
|
||||
* Remove and return the highest-priority element. O(log N).
|
||||
* @return {T} Element.
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.dequeue = function() {
|
||||
PriorityQueue.prototype.dequeue = function() {
|
||||
var elements = this.elements_;
|
||||
var priorities = this.priorities_;
|
||||
var element = elements[0];
|
||||
@@ -98,11 +98,11 @@ _ol_structs_PriorityQueue_.prototype.dequeue = function() {
|
||||
* @param {T} element Element.
|
||||
* @return {boolean} The element was added to the queue.
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.enqueue = function(element) {
|
||||
PriorityQueue.prototype.enqueue = function(element) {
|
||||
_ol_asserts_.assert(!(this.keyFunction_(element) in this.queuedElements_),
|
||||
31); // Tried to enqueue an `element` that was already added to the queue
|
||||
var priority = this.priorityFunction_(element);
|
||||
if (priority != _ol_structs_PriorityQueue_.DROP) {
|
||||
if (priority != PriorityQueue.DROP) {
|
||||
this.elements_.push(element);
|
||||
this.priorities_.push(priority);
|
||||
this.queuedElements_[this.keyFunction_(element)] = true;
|
||||
@@ -116,7 +116,7 @@ _ol_structs_PriorityQueue_.prototype.enqueue = function(element) {
|
||||
/**
|
||||
* @return {number} Count.
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.getCount = function() {
|
||||
PriorityQueue.prototype.getCount = function() {
|
||||
return this.elements_.length;
|
||||
};
|
||||
|
||||
@@ -127,7 +127,7 @@ _ol_structs_PriorityQueue_.prototype.getCount = function() {
|
||||
* @return {number} The index of the left child.
|
||||
* @private
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.getLeftChildIndex_ = function(index) {
|
||||
PriorityQueue.prototype.getLeftChildIndex_ = function(index) {
|
||||
return index * 2 + 1;
|
||||
};
|
||||
|
||||
@@ -138,7 +138,7 @@ _ol_structs_PriorityQueue_.prototype.getLeftChildIndex_ = function(index) {
|
||||
* @return {number} The index of the right child.
|
||||
* @private
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.getRightChildIndex_ = function(index) {
|
||||
PriorityQueue.prototype.getRightChildIndex_ = function(index) {
|
||||
return index * 2 + 2;
|
||||
};
|
||||
|
||||
@@ -149,7 +149,7 @@ _ol_structs_PriorityQueue_.prototype.getRightChildIndex_ = function(index) {
|
||||
* @return {number} The index of the parent.
|
||||
* @private
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.getParentIndex_ = function(index) {
|
||||
PriorityQueue.prototype.getParentIndex_ = function(index) {
|
||||
return (index - 1) >> 1;
|
||||
};
|
||||
|
||||
@@ -158,7 +158,7 @@ _ol_structs_PriorityQueue_.prototype.getParentIndex_ = function(index) {
|
||||
* Make this a heap. O(N).
|
||||
* @private
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.heapify_ = function() {
|
||||
PriorityQueue.prototype.heapify_ = function() {
|
||||
var i;
|
||||
for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {
|
||||
this.siftUp_(i);
|
||||
@@ -169,7 +169,7 @@ _ol_structs_PriorityQueue_.prototype.heapify_ = function() {
|
||||
/**
|
||||
* @return {boolean} Is empty.
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.isEmpty = function() {
|
||||
PriorityQueue.prototype.isEmpty = function() {
|
||||
return this.elements_.length === 0;
|
||||
};
|
||||
|
||||
@@ -178,7 +178,7 @@ _ol_structs_PriorityQueue_.prototype.isEmpty = function() {
|
||||
* @param {string} key Key.
|
||||
* @return {boolean} Is key queued.
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.isKeyQueued = function(key) {
|
||||
PriorityQueue.prototype.isKeyQueued = function(key) {
|
||||
return key in this.queuedElements_;
|
||||
};
|
||||
|
||||
@@ -187,7 +187,7 @@ _ol_structs_PriorityQueue_.prototype.isKeyQueued = function(key) {
|
||||
* @param {T} element Element.
|
||||
* @return {boolean} Is queued.
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.isQueued = function(element) {
|
||||
PriorityQueue.prototype.isQueued = function(element) {
|
||||
return this.isKeyQueued(this.keyFunction_(element));
|
||||
};
|
||||
|
||||
@@ -196,7 +196,7 @@ _ol_structs_PriorityQueue_.prototype.isQueued = function(element) {
|
||||
* @param {number} index The index of the node to move down.
|
||||
* @private
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.siftUp_ = function(index) {
|
||||
PriorityQueue.prototype.siftUp_ = function(index) {
|
||||
var elements = this.elements_;
|
||||
var priorities = this.priorities_;
|
||||
var count = elements.length;
|
||||
@@ -228,7 +228,7 @@ _ol_structs_PriorityQueue_.prototype.siftUp_ = function(index) {
|
||||
* @param {number} index The index of the node to move up.
|
||||
* @private
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.siftDown_ = function(startIndex, index) {
|
||||
PriorityQueue.prototype.siftDown_ = function(startIndex, index) {
|
||||
var elements = this.elements_;
|
||||
var priorities = this.priorities_;
|
||||
var element = elements[index];
|
||||
@@ -252,7 +252,7 @@ _ol_structs_PriorityQueue_.prototype.siftDown_ = function(startIndex, index) {
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
_ol_structs_PriorityQueue_.prototype.reprioritize = function() {
|
||||
PriorityQueue.prototype.reprioritize = function() {
|
||||
var priorityFunction = this.priorityFunction_;
|
||||
var elements = this.elements_;
|
||||
var priorities = this.priorities_;
|
||||
@@ -262,7 +262,7 @@ _ol_structs_PriorityQueue_.prototype.reprioritize = function() {
|
||||
for (i = 0; i < n; ++i) {
|
||||
element = elements[i];
|
||||
priority = priorityFunction(element);
|
||||
if (priority == _ol_structs_PriorityQueue_.DROP) {
|
||||
if (priority == PriorityQueue.DROP) {
|
||||
delete this.queuedElements_[this.keyFunction_(element)];
|
||||
} else {
|
||||
priorities[index] = priority;
|
||||
@@ -273,4 +273,4 @@ _ol_structs_PriorityQueue_.prototype.reprioritize = function() {
|
||||
priorities.length = index;
|
||||
this.heapify_();
|
||||
};
|
||||
export default _ol_structs_PriorityQueue_;
|
||||
export default PriorityQueue;
|
||||
|
||||
@@ -15,7 +15,7 @@ import _ol_obj_ from '../obj.js';
|
||||
* @struct
|
||||
* @template T
|
||||
*/
|
||||
var _ol_structs_RBush_ = function(opt_maxEntries) {
|
||||
var RBush = function(opt_maxEntries) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -38,7 +38,7 @@ var _ol_structs_RBush_ = function(opt_maxEntries) {
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {T} value Value.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.insert = function(extent, value) {
|
||||
RBush.prototype.insert = function(extent, value) {
|
||||
/** @type {ol.RBushEntry} */
|
||||
var item = {
|
||||
minX: extent[0],
|
||||
@@ -58,7 +58,7 @@ _ol_structs_RBush_.prototype.insert = function(extent, value) {
|
||||
* @param {Array.<ol.Extent>} extents Extents.
|
||||
* @param {Array.<T>} values Values.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.load = function(extents, values) {
|
||||
RBush.prototype.load = function(extents, values) {
|
||||
var items = new Array(values.length);
|
||||
for (var i = 0, l = values.length; i < l; i++) {
|
||||
var extent = extents[i];
|
||||
@@ -84,7 +84,7 @@ _ol_structs_RBush_.prototype.load = function(extents, values) {
|
||||
* @param {T} value Value.
|
||||
* @return {boolean} Removed.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.remove = function(value) {
|
||||
RBush.prototype.remove = function(value) {
|
||||
var uid = getUid(value);
|
||||
|
||||
// get the object in which the value was wrapped when adding to the
|
||||
@@ -100,7 +100,7 @@ _ol_structs_RBush_.prototype.remove = function(value) {
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {T} value Value.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.update = function(extent, value) {
|
||||
RBush.prototype.update = function(extent, value) {
|
||||
var item = this.items_[getUid(value)];
|
||||
var bbox = [item.minX, item.minY, item.maxX, item.maxY];
|
||||
if (!equals(bbox, extent)) {
|
||||
@@ -114,7 +114,7 @@ _ol_structs_RBush_.prototype.update = function(extent, value) {
|
||||
* Return all values in the RBush.
|
||||
* @return {Array.<T>} All.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.getAll = function() {
|
||||
RBush.prototype.getAll = function() {
|
||||
var items = this.rbush_.all();
|
||||
return items.map(function(item) {
|
||||
return item.value;
|
||||
@@ -127,7 +127,7 @@ _ol_structs_RBush_.prototype.getAll = function() {
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {Array.<T>} All in extent.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.getInExtent = function(extent) {
|
||||
RBush.prototype.getInExtent = function(extent) {
|
||||
/** @type {ol.RBushEntry} */
|
||||
var bbox = {
|
||||
minX: extent[0],
|
||||
@@ -151,7 +151,7 @@ _ol_structs_RBush_.prototype.getInExtent = function(extent) {
|
||||
* @return {*} Callback return value.
|
||||
* @template S
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.forEach = function(callback, opt_this) {
|
||||
RBush.prototype.forEach = function(callback, opt_this) {
|
||||
return this.forEach_(this.getAll(), callback, opt_this);
|
||||
};
|
||||
|
||||
@@ -164,7 +164,7 @@ _ol_structs_RBush_.prototype.forEach = function(callback, opt_this) {
|
||||
* @return {*} Callback return value.
|
||||
* @template S
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.forEachInExtent = function(extent, callback, opt_this) {
|
||||
RBush.prototype.forEachInExtent = function(extent, callback, opt_this) {
|
||||
return this.forEach_(this.getInExtent(extent), callback, opt_this);
|
||||
};
|
||||
|
||||
@@ -177,7 +177,7 @@ _ol_structs_RBush_.prototype.forEachInExtent = function(extent, callback, opt_th
|
||||
* @return {*} Callback return value.
|
||||
* @template S
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.forEach_ = function(values, callback, opt_this) {
|
||||
RBush.prototype.forEach_ = function(values, callback, opt_this) {
|
||||
var result;
|
||||
for (var i = 0, l = values.length; i < l; i++) {
|
||||
result = callback.call(opt_this, values[i]);
|
||||
@@ -192,7 +192,7 @@ _ol_structs_RBush_.prototype.forEach_ = function(values, callback, opt_this) {
|
||||
/**
|
||||
* @return {boolean} Is empty.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.isEmpty = function() {
|
||||
RBush.prototype.isEmpty = function() {
|
||||
return _ol_obj_.isEmpty(this.items_);
|
||||
};
|
||||
|
||||
@@ -200,7 +200,7 @@ _ol_structs_RBush_.prototype.isEmpty = function() {
|
||||
/**
|
||||
* Remove all values from the RBush.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.clear = function() {
|
||||
RBush.prototype.clear = function() {
|
||||
this.rbush_.clear();
|
||||
this.items_ = {};
|
||||
};
|
||||
@@ -210,7 +210,7 @@ _ol_structs_RBush_.prototype.clear = function() {
|
||||
* @param {ol.Extent=} opt_extent Extent.
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.getExtent = function(opt_extent) {
|
||||
RBush.prototype.getExtent = function(opt_extent) {
|
||||
// FIXME add getExtent() to rbush
|
||||
var data = this.rbush_.data;
|
||||
return createOrUpdate(data.minX, data.minY, data.maxX, data.maxY, opt_extent);
|
||||
@@ -220,10 +220,10 @@ _ol_structs_RBush_.prototype.getExtent = function(opt_extent) {
|
||||
/**
|
||||
* @param {ol.structs.RBush} rbush R-Tree.
|
||||
*/
|
||||
_ol_structs_RBush_.prototype.concat = function(rbush) {
|
||||
RBush.prototype.concat = function(rbush) {
|
||||
this.rbush_.load(rbush.rbush_.all());
|
||||
for (var i in rbush.items_) {
|
||||
this.items_[i | 0] = rbush.items_[i | 0];
|
||||
}
|
||||
};
|
||||
export default _ol_structs_RBush_;
|
||||
export default RBush;
|
||||
|
||||
@@ -5,8 +5,8 @@ import Polygon from '../../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js';
|
||||
import _ol_render_webgl_polygonreplay_defaultshader_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader.js';
|
||||
import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js';
|
||||
import _ol_structs_LinkedList_ from '../../../../../src/ol/structs/LinkedList.js';
|
||||
import _ol_structs_RBush_ from '../../../../../src/ol/structs/RBush.js';
|
||||
import LinkedList from '../../../../../src/ol/structs/LinkedList.js';
|
||||
import RBush from '../../../../../src/ol/structs/RBush.js';
|
||||
import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js';
|
||||
import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js';
|
||||
|
||||
@@ -83,8 +83,8 @@ describe('ol.render.webgl.PolygonReplay', function() {
|
||||
describe('triangulating functions', function() {
|
||||
var list, rtree;
|
||||
beforeEach(function() {
|
||||
list = new _ol_structs_LinkedList_();
|
||||
rtree = new _ol_structs_RBush_();
|
||||
list = new LinkedList();
|
||||
rtree = new RBush();
|
||||
});
|
||||
|
||||
describe('#createPoint_', function() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import _ol_structs_LinkedList_ from '../../../../src/ol/structs/LinkedList.js';
|
||||
import LinkedList from '../../../../src/ol/structs/LinkedList.js';
|
||||
|
||||
describe('ol.structs.LinkedList', function() {
|
||||
var ll;
|
||||
var item = {};
|
||||
var item2 = {};
|
||||
beforeEach(function() {
|
||||
ll = new _ol_structs_LinkedList_();
|
||||
ll = new LinkedList();
|
||||
});
|
||||
|
||||
it('defaults to circular', function() {
|
||||
@@ -59,7 +59,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
});
|
||||
|
||||
it('otherwise sets the cursor to the prevous item', function() {
|
||||
ll = new _ol_structs_LinkedList_(false);
|
||||
ll = new LinkedList(false);
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.insertItem(item3);
|
||||
@@ -68,7 +68,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
});
|
||||
|
||||
it('empties a list with only one item', function() {
|
||||
ll = new _ol_structs_LinkedList_();
|
||||
ll = new LinkedList();
|
||||
ll.insertItem(item);
|
||||
ll.removeItem();
|
||||
expect(ll.length_).to.be(0);
|
||||
@@ -202,7 +202,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
var ll2, item3;
|
||||
beforeEach(function() {
|
||||
item3 = {};
|
||||
ll2 = new _ol_structs_LinkedList_();
|
||||
ll2 = new LinkedList();
|
||||
ll2.insertItem(item);
|
||||
ll2.insertItem(item2);
|
||||
ll2.insertItem(item3);
|
||||
@@ -242,7 +242,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
|
||||
describe('when circular', function() {
|
||||
beforeEach(function() {
|
||||
ll = new _ol_structs_LinkedList_();
|
||||
ll = new LinkedList();
|
||||
ll.insertItem(item);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_structs_LRUCache_ from '../../../../src/ol/structs/LRUCache.js';
|
||||
import LRUCache from '../../../../src/ol/structs/LRUCache.js';
|
||||
|
||||
|
||||
describe('ol.structs.LRUCache', function() {
|
||||
@@ -13,7 +13,7 @@ describe('ol.structs.LRUCache', function() {
|
||||
}
|
||||
|
||||
beforeEach(function() {
|
||||
lruCache = new _ol_structs_LRUCache_();
|
||||
lruCache = new LRUCache();
|
||||
});
|
||||
|
||||
describe('empty cache', function() {
|
||||
@@ -164,7 +164,7 @@ describe('ol.structs.LRUCache', function() {
|
||||
|
||||
describe('#peekFirstKey()', function() {
|
||||
it('returns the newest key in the cache', function() {
|
||||
var cache = new _ol_structs_LRUCache_();
|
||||
var cache = new LRUCache();
|
||||
cache.set('oldest', 'oldest');
|
||||
cache.set('oldish', 'oldish');
|
||||
cache.set('newish', 'newish');
|
||||
@@ -173,13 +173,13 @@ describe('ol.structs.LRUCache', function() {
|
||||
});
|
||||
|
||||
it('works if the cache has one item', function() {
|
||||
var cache = new _ol_structs_LRUCache_();
|
||||
var cache = new LRUCache();
|
||||
cache.set('key', 'value');
|
||||
expect(cache.peekFirstKey()).to.eql('key');
|
||||
});
|
||||
|
||||
it('throws if the cache is empty', function() {
|
||||
var cache = new _ol_structs_LRUCache_();
|
||||
var cache = new LRUCache();
|
||||
expect(function() {
|
||||
cache.peekFirstKey();
|
||||
}).to.throwException();
|
||||
@@ -212,7 +212,7 @@ describe('ol.structs.LRUCache', function() {
|
||||
|
||||
describe('#remove()', function() {
|
||||
it('removes an item from the cache', function() {
|
||||
var cache = new _ol_structs_LRUCache_();
|
||||
var cache = new LRUCache();
|
||||
cache.set('oldest', 'oldest');
|
||||
cache.set('oldish', 'oldish');
|
||||
cache.set('newish', 'newish');
|
||||
@@ -224,7 +224,7 @@ describe('ol.structs.LRUCache', function() {
|
||||
});
|
||||
|
||||
it('works when removing the oldest item', function() {
|
||||
var cache = new _ol_structs_LRUCache_();
|
||||
var cache = new LRUCache();
|
||||
cache.set('oldest', 'oldest');
|
||||
cache.set('oldish', 'oldish');
|
||||
cache.set('newish', 'newish');
|
||||
@@ -237,7 +237,7 @@ describe('ol.structs.LRUCache', function() {
|
||||
});
|
||||
|
||||
it('works when removing the newest item', function() {
|
||||
var cache = new _ol_structs_LRUCache_();
|
||||
var cache = new LRUCache();
|
||||
cache.set('oldest', 'oldest');
|
||||
cache.set('oldish', 'oldish');
|
||||
cache.set('newish', 'newish');
|
||||
@@ -250,7 +250,7 @@ describe('ol.structs.LRUCache', function() {
|
||||
});
|
||||
|
||||
it('returns the removed item', function() {
|
||||
var cache = new _ol_structs_LRUCache_();
|
||||
var cache = new LRUCache();
|
||||
var item = {};
|
||||
cache.set('key', item);
|
||||
|
||||
@@ -259,7 +259,7 @@ describe('ol.structs.LRUCache', function() {
|
||||
});
|
||||
|
||||
it('throws if the key does not exist', function() {
|
||||
var cache = new _ol_structs_LRUCache_();
|
||||
var cache = new LRUCache();
|
||||
cache.set('foo', 'foo');
|
||||
cache.set('bar', 'bar');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_structs_PriorityQueue_ from '../../../../src/ol/structs/PriorityQueue.js';
|
||||
import PriorityQueue from '../../../../src/ol/structs/PriorityQueue.js';
|
||||
|
||||
|
||||
describe('ol.structs.PriorityQueue', function() {
|
||||
@@ -11,7 +11,7 @@ describe('ol.structs.PriorityQueue', function() {
|
||||
|
||||
var pq;
|
||||
beforeEach(function() {
|
||||
pq = new _ol_structs_PriorityQueue_(identity, identity);
|
||||
pq = new PriorityQueue(identity, identity);
|
||||
});
|
||||
|
||||
it('is empty', function() {
|
||||
@@ -39,8 +39,7 @@ describe('ol.structs.PriorityQueue', function() {
|
||||
var elements, pq;
|
||||
beforeEach(function() {
|
||||
elements = [];
|
||||
pq = new _ol_structs_PriorityQueue_(
|
||||
identity, identity);
|
||||
pq = new PriorityQueue(identity, identity);
|
||||
var element, i;
|
||||
for (i = 0; i < 32; ++i) {
|
||||
element = Math.random();
|
||||
@@ -65,7 +64,7 @@ describe('ol.structs.PriorityQueue', function() {
|
||||
var pq, target;
|
||||
beforeEach(function() {
|
||||
target = 0.5;
|
||||
pq = new _ol_structs_PriorityQueue_(function(element) {
|
||||
pq = new PriorityQueue(function(element) {
|
||||
return Math.abs(element - target);
|
||||
}, identity);
|
||||
var i;
|
||||
@@ -103,7 +102,7 @@ describe('ol.structs.PriorityQueue', function() {
|
||||
if (i++ % 2 === 0) {
|
||||
return Math.abs(element - target);
|
||||
} else {
|
||||
return _ol_structs_PriorityQueue_.DROP;
|
||||
return PriorityQueue.DROP;
|
||||
}
|
||||
};
|
||||
pq.reprioritize();
|
||||
@@ -123,8 +122,7 @@ describe('ol.structs.PriorityQueue', function() {
|
||||
|
||||
var pq;
|
||||
beforeEach(function() {
|
||||
pq = new _ol_structs_PriorityQueue_(
|
||||
identity, identity);
|
||||
pq = new PriorityQueue(identity, identity);
|
||||
pq.enqueue('a');
|
||||
pq.enqueue('b');
|
||||
pq.enqueue('c');
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import _ol_structs_RBush_ from '../../../../src/ol/structs/RBush.js';
|
||||
import RBush from '../../../../src/ol/structs/RBush.js';
|
||||
|
||||
|
||||
describe('ol.structs.RBush', function() {
|
||||
|
||||
var rBush;
|
||||
beforeEach(function() {
|
||||
rBush = new _ol_structs_RBush_();
|
||||
rBush = new RBush();
|
||||
});
|
||||
|
||||
describe('when empty', function() {
|
||||
@@ -316,7 +316,7 @@ describe('ol.structs.RBush', function() {
|
||||
it('concatenates two RBush objects', function() {
|
||||
var obj1 = {};
|
||||
var obj2 = {};
|
||||
var rBush2 = new _ol_structs_RBush_();
|
||||
var rBush2 = new RBush();
|
||||
rBush.insert([0, 0, 1, 1], obj1);
|
||||
rBush2.insert([0, 0, 2, 2], obj2);
|
||||
rBush.concat(rBush2);
|
||||
@@ -327,7 +327,7 @@ describe('ol.structs.RBush', function() {
|
||||
it('preserves the concatenated object\'s references', function() {
|
||||
var obj1 = {};
|
||||
var obj2 = {};
|
||||
var rBush2 = new _ol_structs_RBush_();
|
||||
var rBush2 = new RBush();
|
||||
rBush.insert([0, 0, 1, 1], obj1);
|
||||
rBush2.insert([0, 0, 2, 2], obj2);
|
||||
rBush.concat(rBush2);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ol_Tile_ from '../../../src/ol/Tile.js';
|
||||
import _ol_TileCache_ from '../../../src/ol/TileCache.js';
|
||||
import TileCache from '../../../src/ol/TileCache.js';
|
||||
import _ol_tilecoord_ from '../../../src/ol/tilecoord.js';
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ describe('ol.TileCache', function() {
|
||||
new _ol_Tile_([2, 2, 0]),
|
||||
new _ol_Tile_([2, 3, 0]) // newest tile at z: 2
|
||||
];
|
||||
var cache = new _ol_TileCache_();
|
||||
var cache = new TileCache();
|
||||
|
||||
sinon.spy(tiles[0], 'dispose');
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import _ol_ImageTile_ from '../../../src/ol/ImageTile.js';
|
||||
import _ol_Tile_ from '../../../src/ol/Tile.js';
|
||||
import _ol_TileQueue_ from '../../../src/ol/TileQueue.js';
|
||||
import TileQueue from '../../../src/ol/TileQueue.js';
|
||||
import _ol_TileState_ from '../../../src/ol/TileState.js';
|
||||
import _ol_source_Image_ from '../../../src/ol/source/Image.js';
|
||||
import _ol_structs_PriorityQueue_ from '../../../src/ol/structs/PriorityQueue.js';
|
||||
import PriorityQueue from '../../../src/ol/structs/PriorityQueue.js';
|
||||
|
||||
|
||||
describe('ol.TileQueue', function() {
|
||||
@@ -40,8 +40,8 @@ describe('ol.TileQueue', function() {
|
||||
var noop = function() {};
|
||||
|
||||
it('works when tile queues share tiles', function(done) {
|
||||
var q1 = new _ol_TileQueue_(noop, noop);
|
||||
var q2 = new _ol_TileQueue_(noop, noop);
|
||||
var q1 = new TileQueue(noop, noop);
|
||||
var q2 = new TileQueue(noop, noop);
|
||||
|
||||
var numTiles = 20;
|
||||
for (var i = 0; i < numTiles; ++i) {
|
||||
@@ -91,7 +91,7 @@ describe('ol.TileQueue', function() {
|
||||
|
||||
it('calls #tileChangeCallback_ when all wanted tiles are aborted', function() {
|
||||
var tileChangeCallback = sinon.spy();
|
||||
var queue = new _ol_TileQueue_(noop, tileChangeCallback);
|
||||
var queue = new TileQueue(noop, tileChangeCallback);
|
||||
var numTiles = 20;
|
||||
for (var i = 0; i < numTiles; ++i) {
|
||||
var tile = createImageTile();
|
||||
@@ -108,7 +108,7 @@ describe('ol.TileQueue', function() {
|
||||
describe('heapify', function() {
|
||||
it('does convert an arbitrary array into a heap', function() {
|
||||
|
||||
var tq = new _ol_TileQueue_(function() {});
|
||||
var tq = new TileQueue(function() {});
|
||||
addRandomPriorityTiles(tq, 100);
|
||||
|
||||
tq.heapify_();
|
||||
@@ -118,7 +118,7 @@ describe('ol.TileQueue', function() {
|
||||
describe('reprioritize', function() {
|
||||
it('does reprioritize the array', function() {
|
||||
|
||||
var tq = new _ol_TileQueue_(function() {});
|
||||
var tq = new TileQueue(function() {});
|
||||
addRandomPriorityTiles(tq, 100);
|
||||
|
||||
tq.heapify_();
|
||||
@@ -129,7 +129,7 @@ describe('ol.TileQueue', function() {
|
||||
var i = 0;
|
||||
tq.priorityFunction_ = function() {
|
||||
if ((i++) % 2 === 0) {
|
||||
return _ol_structs_PriorityQueue_.DROP;
|
||||
return PriorityQueue.DROP;
|
||||
}
|
||||
return Math.floor(Math.random() * 100);
|
||||
};
|
||||
@@ -145,7 +145,7 @@ describe('ol.TileQueue', function() {
|
||||
var noop = function() {};
|
||||
|
||||
it('abort queued tiles', function() {
|
||||
var tq = new _ol_TileQueue_(noop, noop);
|
||||
var tq = new TileQueue(noop, noop);
|
||||
var tile = createImageTile();
|
||||
expect(tile.hasListener('change')).to.be(false);
|
||||
|
||||
@@ -158,7 +158,7 @@ describe('ol.TileQueue', function() {
|
||||
});
|
||||
|
||||
it('abort loading tiles', function() {
|
||||
var tq = new _ol_TileQueue_(noop, noop);
|
||||
var tq = new TileQueue(noop, noop);
|
||||
var tile = createImageTile(noop);
|
||||
|
||||
tq.enqueue([tile]);
|
||||
|
||||
Reference in New Issue
Block a user