diff --git a/src/ol/render/webgl/PolygonReplay.js b/src/ol/render/webgl/PolygonReplay.js index 0b18ee0e1f..646e2eda4e 100644 --- a/src/ol/render/webgl/PolygonReplay.js +++ b/src/ol/render/webgl/PolygonReplay.js @@ -15,7 +15,7 @@ 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 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,7 +76,7 @@ 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 outerRing = new LinkedList(); var rtree = new RBush(); // Initialize the outer ring this.processFlatCoordinates_(flatCoordinates, stride, outerRing, rtree, true); @@ -88,7 +88,7 @@ _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 RBush() }; @@ -553,7 +553,7 @@ _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 newPolygon = new LinkedList(); var newRtree = new RBush(); this.insertItem_(p, s0.p1, newPolygon, newRtree); s0.p1 = p; diff --git a/src/ol/structs/LinkedList.js b/src/ol/structs/LinkedList.js index 4a532dbc46..1152d0ad0d 100644 --- a/src/ol/structs/LinkedList.js +++ b/src/ol/structs/LinkedList.js @@ -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; diff --git a/test/spec/ol/render/webgl/polygonreplay.test.js b/test/spec/ol/render/webgl/polygonreplay.test.js index 585da26d0e..49af677f0f 100644 --- a/test/spec/ol/render/webgl/polygonreplay.test.js +++ b/test/spec/ol/render/webgl/polygonreplay.test.js @@ -5,7 +5,7 @@ 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 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,7 +83,7 @@ describe('ol.render.webgl.PolygonReplay', function() { describe('triangulating functions', function() { var list, rtree; beforeEach(function() { - list = new _ol_structs_LinkedList_(); + list = new LinkedList(); rtree = new RBush(); }); diff --git a/test/spec/ol/structs/linkedlist.test.js b/test/spec/ol/structs/linkedlist.test.js index 93ed4367c3..72230bedc2 100644 --- a/test/spec/ol/structs/linkedlist.test.js +++ b/test/spec/ol/structs/linkedlist.test.js @@ -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); });