Rename _ol_structs_LinkedList_ to LinkedList
This commit is contained in:
@@ -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_Replay_ from '../webgl/Replay.js';
|
||||||
import _ol_render_webgl_ from '../webgl.js';
|
import _ol_render_webgl_ from '../webgl.js';
|
||||||
import _ol_style_Stroke_ from '../../style/Stroke.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 RBush from '../../structs/RBush.js';
|
||||||
import _ol_webgl_ from '../../webgl.js';
|
import _ol_webgl_ from '../../webgl.js';
|
||||||
import _ol_webgl_Buffer_ from '../../webgl/Buffer.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(
|
_ol_render_webgl_PolygonReplay_.prototype.drawCoordinates_ = function(
|
||||||
flatCoordinates, holeFlatCoordinates, stride) {
|
flatCoordinates, holeFlatCoordinates, stride) {
|
||||||
// Triangulate the polygon
|
// Triangulate the polygon
|
||||||
var outerRing = new _ol_structs_LinkedList_();
|
var outerRing = new LinkedList();
|
||||||
var rtree = new RBush();
|
var rtree = new RBush();
|
||||||
// Initialize the outer ring
|
// Initialize the outer ring
|
||||||
this.processFlatCoordinates_(flatCoordinates, stride, outerRing, rtree, true);
|
this.processFlatCoordinates_(flatCoordinates, stride, outerRing, rtree, true);
|
||||||
@@ -88,7 +88,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawCoordinates_ = function(
|
|||||||
var holeLists = [];
|
var holeLists = [];
|
||||||
for (i = 0, ii = holeFlatCoordinates.length; i < ii; ++i) {
|
for (i = 0, ii = holeFlatCoordinates.length; i < ii; ++i) {
|
||||||
var holeList = {
|
var holeList = {
|
||||||
list: new _ol_structs_LinkedList_(),
|
list: new LinkedList(),
|
||||||
maxCoords: undefined,
|
maxCoords: undefined,
|
||||||
rtree: new RBush()
|
rtree: new RBush()
|
||||||
};
|
};
|
||||||
@@ -553,7 +553,7 @@ _ol_render_webgl_PolygonReplay_.prototype.splitPolygon_ = function(list, rtree)
|
|||||||
var intersection = this.calculateIntersection_(s0.p0,
|
var intersection = this.calculateIntersection_(s0.p0,
|
||||||
s0.p1, s1.p0, s1.p1);
|
s0.p1, s1.p0, s1.p1);
|
||||||
var p = this.createPoint_(intersection[0], intersection[1], n);
|
var p = this.createPoint_(intersection[0], intersection[1], n);
|
||||||
var newPolygon = new _ol_structs_LinkedList_();
|
var newPolygon = new LinkedList();
|
||||||
var newRtree = new RBush();
|
var newRtree = new RBush();
|
||||||
this.insertItem_(p, s0.p1, newPolygon, newRtree);
|
this.insertItem_(p, s0.p1, newPolygon, newRtree);
|
||||||
s0.p1 = p;
|
s0.p1 = p;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/structs/LinkedList
|
* @module ol/structs/LinkedList
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty linked list structure.
|
* Creates an empty linked list structure.
|
||||||
*
|
*
|
||||||
@@ -9,7 +10,7 @@
|
|||||||
* @param {boolean=} opt_circular The last item is connected to the first one,
|
* @param {boolean=} opt_circular The last item is connected to the first one,
|
||||||
* and the first item to the last one. Default is true.
|
* and the first item to the last one. Default is true.
|
||||||
*/
|
*/
|
||||||
var _ol_structs_LinkedList_ = function(opt_circular) {
|
var LinkedList = function(opt_circular) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -47,7 +48,7 @@ var _ol_structs_LinkedList_ = function(opt_circular) {
|
|||||||
*
|
*
|
||||||
* @param {?} data Item data.
|
* @param {?} data Item data.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.insertItem = function(data) {
|
LinkedList.prototype.insertItem = function(data) {
|
||||||
|
|
||||||
/** @type {ol.LinkedListItem} */
|
/** @type {ol.LinkedListItem} */
|
||||||
var item = {
|
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,
|
* Removes the current item from the list. Sets the cursor to the next item,
|
||||||
* if possible.
|
* if possible.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.removeItem = function() {
|
LinkedList.prototype.removeItem = function() {
|
||||||
var head = this.head_;
|
var head = this.head_;
|
||||||
if (head) {
|
if (head) {
|
||||||
var next = head.next;
|
var next = head.next;
|
||||||
@@ -119,7 +120,7 @@ _ol_structs_LinkedList_.prototype.removeItem = function() {
|
|||||||
*
|
*
|
||||||
* @return {?} Item data.
|
* @return {?} Item data.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.firstItem = function() {
|
LinkedList.prototype.firstItem = function() {
|
||||||
this.head_ = this.first_;
|
this.head_ = this.first_;
|
||||||
if (this.head_) {
|
if (this.head_) {
|
||||||
return this.head_.data;
|
return this.head_.data;
|
||||||
@@ -132,7 +133,7 @@ _ol_structs_LinkedList_.prototype.firstItem = function() {
|
|||||||
*
|
*
|
||||||
* @return {?} Item data.
|
* @return {?} Item data.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.lastItem = function() {
|
LinkedList.prototype.lastItem = function() {
|
||||||
this.head_ = this.last_;
|
this.head_ = this.last_;
|
||||||
if (this.head_) {
|
if (this.head_) {
|
||||||
return this.head_.data;
|
return this.head_.data;
|
||||||
@@ -145,7 +146,7 @@ _ol_structs_LinkedList_.prototype.lastItem = function() {
|
|||||||
*
|
*
|
||||||
* @return {?} Item data.
|
* @return {?} Item data.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.nextItem = function() {
|
LinkedList.prototype.nextItem = function() {
|
||||||
if (this.head_ && this.head_.next) {
|
if (this.head_ && this.head_.next) {
|
||||||
this.head_ = this.head_.next;
|
this.head_ = this.head_.next;
|
||||||
return this.head_.data;
|
return this.head_.data;
|
||||||
@@ -158,7 +159,7 @@ _ol_structs_LinkedList_.prototype.nextItem = function() {
|
|||||||
*
|
*
|
||||||
* @return {?} Item data.
|
* @return {?} Item data.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.getNextItem = function() {
|
LinkedList.prototype.getNextItem = function() {
|
||||||
if (this.head_ && this.head_.next) {
|
if (this.head_ && this.head_.next) {
|
||||||
return this.head_.next.data;
|
return this.head_.next.data;
|
||||||
}
|
}
|
||||||
@@ -170,7 +171,7 @@ _ol_structs_LinkedList_.prototype.getNextItem = function() {
|
|||||||
*
|
*
|
||||||
* @return {?} Item data.
|
* @return {?} Item data.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.prevItem = function() {
|
LinkedList.prototype.prevItem = function() {
|
||||||
if (this.head_ && this.head_.prev) {
|
if (this.head_ && this.head_.prev) {
|
||||||
this.head_ = this.head_.prev;
|
this.head_ = this.head_.prev;
|
||||||
return this.head_.data;
|
return this.head_.data;
|
||||||
@@ -183,7 +184,7 @@ _ol_structs_LinkedList_.prototype.prevItem = function() {
|
|||||||
*
|
*
|
||||||
* @return {?} Item data.
|
* @return {?} Item data.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.getPrevItem = function() {
|
LinkedList.prototype.getPrevItem = function() {
|
||||||
if (this.head_ && this.head_.prev) {
|
if (this.head_ && this.head_.prev) {
|
||||||
return this.head_.prev.data;
|
return this.head_.prev.data;
|
||||||
}
|
}
|
||||||
@@ -195,7 +196,7 @@ _ol_structs_LinkedList_.prototype.getPrevItem = function() {
|
|||||||
*
|
*
|
||||||
* @return {?} Item data.
|
* @return {?} Item data.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.getCurrItem = function() {
|
LinkedList.prototype.getCurrItem = function() {
|
||||||
if (this.head_) {
|
if (this.head_) {
|
||||||
return this.head_.data;
|
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
|
* Sets the first item of the list. This only works for circular lists, and sets
|
||||||
* the last item accordingly.
|
* the last item accordingly.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.setFirstItem = function() {
|
LinkedList.prototype.setFirstItem = function() {
|
||||||
if (this.circular_ && this.head_) {
|
if (this.circular_ && this.head_) {
|
||||||
this.first_ = this.head_;
|
this.first_ = this.head_;
|
||||||
this.last_ = this.head_.prev;
|
this.last_ = this.head_.prev;
|
||||||
@@ -217,7 +218,7 @@ _ol_structs_LinkedList_.prototype.setFirstItem = function() {
|
|||||||
* Concatenates two lists.
|
* Concatenates two lists.
|
||||||
* @param {ol.structs.LinkedList} list List to merge into the current list.
|
* @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 (list.head_) {
|
||||||
if (this.head_) {
|
if (this.head_) {
|
||||||
var end = this.head_.next;
|
var end = this.head_.next;
|
||||||
@@ -244,7 +245,7 @@ _ol_structs_LinkedList_.prototype.concat = function(list) {
|
|||||||
*
|
*
|
||||||
* @return {number} Length.
|
* @return {number} Length.
|
||||||
*/
|
*/
|
||||||
_ol_structs_LinkedList_.prototype.getLength = function() {
|
LinkedList.prototype.getLength = function() {
|
||||||
return this.length_;
|
return this.length_;
|
||||||
};
|
};
|
||||||
export default _ol_structs_LinkedList_;
|
export default LinkedList;
|
||||||
|
|||||||
@@ -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_ 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_ 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_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 RBush from '../../../../../src/ol/structs/RBush.js';
|
||||||
import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js';
|
import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js';
|
||||||
import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.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() {
|
describe('triangulating functions', function() {
|
||||||
var list, rtree;
|
var list, rtree;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
list = new _ol_structs_LinkedList_();
|
list = new LinkedList();
|
||||||
rtree = new RBush();
|
rtree = new RBush();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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() {
|
describe('ol.structs.LinkedList', function() {
|
||||||
var ll;
|
var ll;
|
||||||
var item = {};
|
var item = {};
|
||||||
var item2 = {};
|
var item2 = {};
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
ll = new _ol_structs_LinkedList_();
|
ll = new LinkedList();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('defaults to circular', function() {
|
it('defaults to circular', function() {
|
||||||
@@ -59,7 +59,7 @@ describe('ol.structs.LinkedList', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('otherwise sets the cursor to the prevous item', 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(item);
|
||||||
ll.insertItem(item2);
|
ll.insertItem(item2);
|
||||||
ll.insertItem(item3);
|
ll.insertItem(item3);
|
||||||
@@ -68,7 +68,7 @@ describe('ol.structs.LinkedList', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('empties a list with only one item', function() {
|
it('empties a list with only one item', function() {
|
||||||
ll = new _ol_structs_LinkedList_();
|
ll = new LinkedList();
|
||||||
ll.insertItem(item);
|
ll.insertItem(item);
|
||||||
ll.removeItem();
|
ll.removeItem();
|
||||||
expect(ll.length_).to.be(0);
|
expect(ll.length_).to.be(0);
|
||||||
@@ -202,7 +202,7 @@ describe('ol.structs.LinkedList', function() {
|
|||||||
var ll2, item3;
|
var ll2, item3;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
item3 = {};
|
item3 = {};
|
||||||
ll2 = new _ol_structs_LinkedList_();
|
ll2 = new LinkedList();
|
||||||
ll2.insertItem(item);
|
ll2.insertItem(item);
|
||||||
ll2.insertItem(item2);
|
ll2.insertItem(item2);
|
||||||
ll2.insertItem(item3);
|
ll2.insertItem(item3);
|
||||||
@@ -242,7 +242,7 @@ describe('ol.structs.LinkedList', function() {
|
|||||||
|
|
||||||
describe('when circular', function() {
|
describe('when circular', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
ll = new _ol_structs_LinkedList_();
|
ll = new LinkedList();
|
||||||
ll.insertItem(item);
|
ll.insertItem(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user