Rename _ol_style_IconImageCache_ to IconImageCache

This commit is contained in:
Frederic Junod
2017-12-18 11:08:05 +01:00
parent bbd8a3f6ae
commit 7fd957c2e5
2 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
/** /**
* @module ol/style * @module ol/style
*/ */
import _ol_style_IconImageCache_ from './style/IconImageCache.js'; import IconImageCache from './style/IconImageCache.js';
var _ol_style_ = {}; var _ol_style_ = {};
/** /**
* The {@link ol.style.IconImageCache} for {@link ol.style.Icon} images. * The {@link ol.style.IconImageCache} for {@link ol.style.Icon} images.
* @api * @api
*/ */
_ol_style_.iconImageCache = new _ol_style_IconImageCache_(); _ol_style_.iconImageCache = new IconImageCache();
export default _ol_style_; export default _ol_style_;
+11 -11
View File
@@ -7,7 +7,7 @@ import _ol_color_ from '../color.js';
* Singleton class. Available through {@link ol.style.iconImageCache}. * Singleton class. Available through {@link ol.style.iconImageCache}.
* @constructor * @constructor
*/ */
var _ol_style_IconImageCache_ = function() { var IconImageCache = function() {
/** /**
* @type {Object.<string, ol.style.IconImage>} * @type {Object.<string, ol.style.IconImage>}
@@ -35,16 +35,16 @@ var _ol_style_IconImageCache_ = function() {
* @param {ol.Color} color Color. * @param {ol.Color} color Color.
* @return {string} Cache key. * @return {string} Cache key.
*/ */
_ol_style_IconImageCache_.getKey = function(src, crossOrigin, color) { function getKey(src, crossOrigin, color) {
var colorString = color ? _ol_color_.asString(color) : 'null'; var colorString = color ? _ol_color_.asString(color) : 'null';
return crossOrigin + ':' + src + ':' + colorString; return crossOrigin + ':' + src + ':' + colorString;
}; }
/** /**
* FIXME empty description for jsdoc * FIXME empty description for jsdoc
*/ */
_ol_style_IconImageCache_.prototype.clear = function() { IconImageCache.prototype.clear = function() {
this.cache_ = {}; this.cache_ = {};
this.cacheSize_ = 0; this.cacheSize_ = 0;
}; };
@@ -53,7 +53,7 @@ _ol_style_IconImageCache_.prototype.clear = function() {
/** /**
* FIXME empty description for jsdoc * FIXME empty description for jsdoc
*/ */
_ol_style_IconImageCache_.prototype.expire = function() { IconImageCache.prototype.expire = function() {
if (this.cacheSize_ > this.maxCacheSize_) { if (this.cacheSize_ > this.maxCacheSize_) {
var i = 0; var i = 0;
var key, iconImage; var key, iconImage;
@@ -74,8 +74,8 @@ _ol_style_IconImageCache_.prototype.expire = function() {
* @param {ol.Color} color Color. * @param {ol.Color} color Color.
* @return {ol.style.IconImage} Icon image. * @return {ol.style.IconImage} Icon image.
*/ */
_ol_style_IconImageCache_.prototype.get = function(src, crossOrigin, color) { IconImageCache.prototype.get = function(src, crossOrigin, color) {
var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color); var key = getKey(src, crossOrigin, color);
return key in this.cache_ ? this.cache_[key] : null; return key in this.cache_ ? this.cache_[key] : null;
}; };
@@ -86,8 +86,8 @@ _ol_style_IconImageCache_.prototype.get = function(src, crossOrigin, color) {
* @param {ol.Color} color Color. * @param {ol.Color} color Color.
* @param {ol.style.IconImage} iconImage Icon image. * @param {ol.style.IconImage} iconImage Icon image.
*/ */
_ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, iconImage) { IconImageCache.prototype.set = function(src, crossOrigin, color, iconImage) {
var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color); var key = getKey(src, crossOrigin, color);
this.cache_[key] = iconImage; this.cache_[key] = iconImage;
++this.cacheSize_; ++this.cacheSize_;
}; };
@@ -100,8 +100,8 @@ _ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, icon
* @param {number} maxCacheSize Cache max size. * @param {number} maxCacheSize Cache max size.
* @api * @api
*/ */
_ol_style_IconImageCache_.prototype.setSize = function(maxCacheSize) { IconImageCache.prototype.setSize = function(maxCacheSize) {
this.maxCacheSize_ = maxCacheSize; this.maxCacheSize_ = maxCacheSize;
this.expire(); this.expire();
}; };
export default _ol_style_IconImageCache_; export default IconImageCache;