diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index c3dae93cb0..1849c5fd5c 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -4,14 +4,14 @@ import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_AtlasManager_ from '../src/ol/style/AtlasManager.js'; +import AtlasManager from '../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; -var atlasManager = new _ol_style_AtlasManager_({ +var atlasManager = new AtlasManager({ // we increase the initial size so that all symbols fit into // a single atlas image initialSize: 512 diff --git a/src/ol/render/webgl/TextReplay.js b/src/ol/render/webgl/TextReplay.js index f83e51b2db..c83e2bb11f 100644 --- a/src/ol/render/webgl/TextReplay.js +++ b/src/ol/render/webgl/TextReplay.js @@ -9,7 +9,7 @@ import _ol_has_ from '../../has.js'; import _ol_render_replay_ from '../replay.js'; import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_TextureReplay_ from '../webgl/TextureReplay.js'; -import _ol_style_AtlasManager_ from '../../style/AtlasManager.js'; +import AtlasManager from '../../style/AtlasManager.js'; import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; /** @@ -421,7 +421,7 @@ _ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) { state.lineWidth / 2) * state.scale); this.atlases_[hash] = { - atlas: new _ol_style_AtlasManager_({ + atlas: new AtlasManager({ space: state.lineWidth + 1 }), width: {}, diff --git a/src/ol/style/AtlasManager.js b/src/ol/style/AtlasManager.js index 3862e1d019..e281735e37 100644 --- a/src/ol/style/AtlasManager.js +++ b/src/ol/style/AtlasManager.js @@ -33,7 +33,7 @@ var MAX_ATLAS_SIZE = -1; * @api * @param {olx.style.AtlasManagerOptions=} opt_options Options. */ -var _ol_style_AtlasManager_ = function(opt_options) { +var AtlasManager = function(opt_options) { var options = opt_options || {}; @@ -88,7 +88,7 @@ var _ol_style_AtlasManager_ = function(opt_options) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the entry is not part of the atlas manager. */ -_ol_style_AtlasManager_.prototype.getInfo = function(id) { +AtlasManager.prototype.getInfo = function(id) { /** @type {?ol.AtlasInfo} */ var info = this.getInfo_(this.atlases_, id); @@ -108,7 +108,7 @@ _ol_style_AtlasManager_.prototype.getInfo = function(id) { * @return {?ol.AtlasInfo} The position and atlas image for the entry, * or `null` if the entry is not part of the atlases. */ -_ol_style_AtlasManager_.prototype.getInfo_ = function(atlases, id) { +AtlasManager.prototype.getInfo_ = function(atlases, id) { var atlas, info, i, ii; for (i = 0, ii = atlases.length; i < ii; ++i) { atlas = atlases[i]; @@ -129,7 +129,7 @@ _ol_style_AtlasManager_.prototype.getInfo_ = function(atlases, id) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the entry is not part of the atlases. */ -_ol_style_AtlasManager_.prototype.mergeInfos_ = function(info, hitInfo) { +AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) { return /** @type {ol.AtlasManagerInfo} */ ({ offsetX: info.offsetX, offsetY: info.offsetY, @@ -161,7 +161,7 @@ _ol_style_AtlasManager_.prototype.mergeInfos_ = function(info, hitInfo) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the image is too big. */ -_ol_style_AtlasManager_.prototype.add = function(id, width, height, +AtlasManager.prototype.add = function(id, width, height, renderCallback, opt_renderHitCallback, opt_this) { if (width + this.space_ > this.maxSize_ || height + this.space_ > this.maxSize_) { @@ -201,7 +201,7 @@ _ol_style_AtlasManager_.prototype.add = function(id, width, height, * @return {?ol.AtlasInfo} The position and atlas image for the entry, * or `null` if the image is too big. */ -_ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height, +AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height, renderCallback, opt_this) { var atlases = (isHitAtlas) ? this.hitAtlases_ : this.atlases_; var atlas, info, i, ii; @@ -229,4 +229,4 @@ _ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height, } return null; }; -export default _ol_style_AtlasManager_; +export default AtlasManager; diff --git a/test/spec/ol/style/atlasmanager.test.js b/test/spec/ol/style/atlasmanager.test.js index 83778a81bd..2559f10d1a 100644 --- a/test/spec/ol/style/atlasmanager.test.js +++ b/test/spec/ol/style/atlasmanager.test.js @@ -1,5 +1,5 @@ import Atlas from '../../../../src/ol/style/Atlas.js'; -import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; describe('ol.style.Atlas', function() { @@ -179,7 +179,7 @@ describe('ol.style.AtlasManager', function() { describe('#constructor', function() { it('inits the atlas manager', function() { - var manager = new _ol_style_AtlasManager_(); + var manager = new AtlasManager(); expect(manager.atlases_).to.not.be.empty(); }); }); @@ -187,7 +187,7 @@ describe('ol.style.AtlasManager', function() { describe('#add', function() { it('adds one entry', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); var info = manager.add('1', 32, 32, defaultRender); expect(info).to.eql({ @@ -198,7 +198,7 @@ describe('ol.style.AtlasManager', function() { }); it('adds one entry (also to the hit detection atlas)', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); var info = manager.add('1', 32, 32, defaultRender, defaultRender); expect(info).to.eql({ @@ -209,7 +209,7 @@ describe('ol.style.AtlasManager', function() { }); it('creates a new atlas if needed', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); var info = manager.add('2', 100, 100, defaultRender, defaultRender); @@ -221,7 +221,7 @@ describe('ol.style.AtlasManager', function() { }); it('creates new atlases until one is large enough', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); expect(manager.atlases_).to.have.length(1); @@ -235,7 +235,7 @@ describe('ol.style.AtlasManager', function() { }); it('checks all existing atlases and create a new if needed', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); expect(manager.add('2', 100, 100, defaultRender, defaultRender)) @@ -251,7 +251,7 @@ describe('ol.style.AtlasManager', function() { }); it('returns null if the size exceeds the maximum size', function() { - var manager = new _ol_style_AtlasManager_( + var manager = new AtlasManager( {initialSize: 128, maxSize: 2048}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); @@ -260,7 +260,7 @@ describe('ol.style.AtlasManager', function() { }); it('always has the same offset for the hit-detection', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); // add one image without hit-detection callback var info = manager.add('1', 32, 32, defaultRender); // add then one with hit-detection callback @@ -277,7 +277,7 @@ describe('ol.style.AtlasManager', function() { describe('#getInfo', function() { it('returns null if no entry for the given id', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.getInfo('123456')).to.eql(null); }); }); diff --git a/test/spec/ol/style/circle.test.js b/test/spec/ol/style/circle.test.js index a69e586459..657d08fc97 100644 --- a/test/spec/ol/style/circle.test.js +++ b/test/spec/ol/style/circle.test.js @@ -1,4 +1,4 @@ -import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -40,7 +40,7 @@ describe('ol.style.Circle', function() { }); it('adds itself to an atlas manager (no fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); + var atlasManager = new AtlasManager({initialSize: 512}); var style = new _ol_style_Circle_({radius: 10, atlasManager: atlasManager}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); @@ -54,7 +54,7 @@ describe('ol.style.Circle', function() { }); it('adds itself to an atlas manager (fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); + var atlasManager = new AtlasManager({initialSize: 512}); var style = new _ol_style_Circle_({ radius: 10, atlasManager: atlasManager, diff --git a/test/spec/ol/style/regularshape.test.js b/test/spec/ol/style/regularshape.test.js index 9442bdd189..faf7a02de0 100644 --- a/test/spec/ol/style/regularshape.test.js +++ b/test/spec/ol/style/regularshape.test.js @@ -1,4 +1,4 @@ -import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -66,7 +66,7 @@ describe('ol.style.RegularShape', function() { }); it('adds itself to an atlas manager (no fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); + var atlasManager = new AtlasManager({initialSize: 512}); var style = new _ol_style_RegularShape_( {radius: 10, atlasManager: atlasManager}); expect(style.getImage()).to.be.an(HTMLCanvasElement); @@ -81,7 +81,7 @@ describe('ol.style.RegularShape', function() { }); it('adds itself to an atlas manager (fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); + var atlasManager = new AtlasManager({initialSize: 512}); var style = new _ol_style_RegularShape_({ radius: 10, atlasManager: atlasManager,