Rename _ol_Collection_ to Collection
This commit is contained in:
@@ -41,7 +41,7 @@ export var CollectionOptions;
|
|||||||
* @template T
|
* @template T
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_Collection_ = function(opt_array, opt_options) {
|
var Collection = function(opt_array, opt_options) {
|
||||||
|
|
||||||
BaseObject.call(this);
|
BaseObject.call(this);
|
||||||
|
|
||||||
@@ -69,14 +69,14 @@ var _ol_Collection_ = function(opt_array, opt_options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_Collection_, BaseObject);
|
inherits(Collection, BaseObject);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all elements from the collection.
|
* Remove all elements from the collection.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.clear = function() {
|
Collection.prototype.clear = function() {
|
||||||
while (this.getLength() > 0) {
|
while (this.getLength() > 0) {
|
||||||
this.pop();
|
this.pop();
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ _ol_Collection_.prototype.clear = function() {
|
|||||||
* @return {ol.Collection.<T>} This collection.
|
* @return {ol.Collection.<T>} This collection.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.extend = function(arr) {
|
Collection.prototype.extend = function(arr) {
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = arr.length; i < ii; ++i) {
|
for (i = 0, ii = arr.length; i < ii; ++i) {
|
||||||
this.push(arr[i]);
|
this.push(arr[i]);
|
||||||
@@ -106,7 +106,7 @@ _ol_Collection_.prototype.extend = function(arr) {
|
|||||||
* index and the array). The return value is ignored.
|
* index and the array). The return value is ignored.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.forEach = function(f) {
|
Collection.prototype.forEach = function(f) {
|
||||||
var array = this.array_;
|
var array = this.array_;
|
||||||
for (var i = 0, ii = array.length; i < ii; ++i) {
|
for (var i = 0, ii = array.length; i < ii; ++i) {
|
||||||
f(array[i], i, array);
|
f(array[i], i, array);
|
||||||
@@ -122,7 +122,7 @@ _ol_Collection_.prototype.forEach = function(f) {
|
|||||||
* @return {!Array.<T>} Array.
|
* @return {!Array.<T>} Array.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.getArray = function() {
|
Collection.prototype.getArray = function() {
|
||||||
return this.array_;
|
return this.array_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ _ol_Collection_.prototype.getArray = function() {
|
|||||||
* @return {T} Element.
|
* @return {T} Element.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.item = function(index) {
|
Collection.prototype.item = function(index) {
|
||||||
return this.array_[index];
|
return this.array_[index];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ _ol_Collection_.prototype.item = function(index) {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.getLength = function() {
|
Collection.prototype.getLength = function() {
|
||||||
return (/** @type {number} */ this.get(Property.LENGTH));
|
return (/** @type {number} */ this.get(Property.LENGTH));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -155,14 +155,14 @@ _ol_Collection_.prototype.getLength = function() {
|
|||||||
* @param {T} elem Element.
|
* @param {T} elem Element.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.insertAt = function(index, elem) {
|
Collection.prototype.insertAt = function(index, elem) {
|
||||||
if (this.unique_) {
|
if (this.unique_) {
|
||||||
this.assertUnique_(elem);
|
this.assertUnique_(elem);
|
||||||
}
|
}
|
||||||
this.array_.splice(index, 0, elem);
|
this.array_.splice(index, 0, elem);
|
||||||
this.updateLength_();
|
this.updateLength_();
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_Collection_.Event(CollectionEventType.ADD, elem));
|
new Collection.Event(CollectionEventType.ADD, elem));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ _ol_Collection_.prototype.insertAt = function(index, elem) {
|
|||||||
* @return {T|undefined} Element.
|
* @return {T|undefined} Element.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.pop = function() {
|
Collection.prototype.pop = function() {
|
||||||
return this.removeAt(this.getLength() - 1);
|
return this.removeAt(this.getLength() - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ _ol_Collection_.prototype.pop = function() {
|
|||||||
* @return {number} New length of the collection.
|
* @return {number} New length of the collection.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.push = function(elem) {
|
Collection.prototype.push = function(elem) {
|
||||||
if (this.unique_) {
|
if (this.unique_) {
|
||||||
this.assertUnique_(elem);
|
this.assertUnique_(elem);
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ _ol_Collection_.prototype.push = function(elem) {
|
|||||||
* @return {T|undefined} The removed element or undefined if none found.
|
* @return {T|undefined} The removed element or undefined if none found.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.remove = function(elem) {
|
Collection.prototype.remove = function(elem) {
|
||||||
var arr = this.array_;
|
var arr = this.array_;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = arr.length; i < ii; ++i) {
|
for (i = 0, ii = arr.length; i < ii; ++i) {
|
||||||
@@ -218,12 +218,12 @@ _ol_Collection_.prototype.remove = function(elem) {
|
|||||||
* @return {T|undefined} Value.
|
* @return {T|undefined} Value.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.removeAt = function(index) {
|
Collection.prototype.removeAt = function(index) {
|
||||||
var prev = this.array_[index];
|
var prev = this.array_[index];
|
||||||
this.array_.splice(index, 1);
|
this.array_.splice(index, 1);
|
||||||
this.updateLength_();
|
this.updateLength_();
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_Collection_.Event(CollectionEventType.REMOVE, prev));
|
new Collection.Event(CollectionEventType.REMOVE, prev));
|
||||||
return prev;
|
return prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ _ol_Collection_.prototype.removeAt = function(index) {
|
|||||||
* @param {T} elem Element.
|
* @param {T} elem Element.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.setAt = function(index, elem) {
|
Collection.prototype.setAt = function(index, elem) {
|
||||||
var n = this.getLength();
|
var n = this.getLength();
|
||||||
if (index < n) {
|
if (index < n) {
|
||||||
if (this.unique_) {
|
if (this.unique_) {
|
||||||
@@ -243,9 +243,9 @@ _ol_Collection_.prototype.setAt = function(index, elem) {
|
|||||||
var prev = this.array_[index];
|
var prev = this.array_[index];
|
||||||
this.array_[index] = elem;
|
this.array_[index] = elem;
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_Collection_.Event(CollectionEventType.REMOVE, prev));
|
new Collection.Event(CollectionEventType.REMOVE, prev));
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_Collection_.Event(CollectionEventType.ADD, elem));
|
new Collection.Event(CollectionEventType.ADD, elem));
|
||||||
} else {
|
} else {
|
||||||
var j;
|
var j;
|
||||||
for (j = n; j < index; ++j) {
|
for (j = n; j < index; ++j) {
|
||||||
@@ -259,7 +259,7 @@ _ol_Collection_.prototype.setAt = function(index, elem) {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.updateLength_ = function() {
|
Collection.prototype.updateLength_ = function() {
|
||||||
this.set(Property.LENGTH, this.array_.length);
|
this.set(Property.LENGTH, this.array_.length);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ _ol_Collection_.prototype.updateLength_ = function() {
|
|||||||
* @param {T} elem Element.
|
* @param {T} elem Element.
|
||||||
* @param {number=} opt_except Optional index to ignore.
|
* @param {number=} opt_except Optional index to ignore.
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) {
|
Collection.prototype.assertUnique_ = function(elem, opt_except) {
|
||||||
for (var i = 0, ii = this.array_.length; i < ii; ++i) {
|
for (var i = 0, ii = this.array_.length; i < ii; ++i) {
|
||||||
if (this.array_[i] === elem && i !== opt_except) {
|
if (this.array_[i] === elem && i !== opt_except) {
|
||||||
throw new AssertionError(58);
|
throw new AssertionError(58);
|
||||||
@@ -288,7 +288,7 @@ _ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) {
|
|||||||
* @param {ol.CollectionEventType} type Type.
|
* @param {ol.CollectionEventType} type Type.
|
||||||
* @param {*=} opt_element Element.
|
* @param {*=} opt_element Element.
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.Event = function(type, opt_element) {
|
Collection.Event = function(type, opt_element) {
|
||||||
|
|
||||||
Event.call(this, type);
|
Event.call(this, type);
|
||||||
|
|
||||||
@@ -300,6 +300,6 @@ _ol_Collection_.Event = function(type, opt_element) {
|
|||||||
this.element = opt_element;
|
this.element = opt_element;
|
||||||
|
|
||||||
};
|
};
|
||||||
inherits(_ol_Collection_.Event, Event);
|
inherits(Collection.Event, Event);
|
||||||
|
|
||||||
export default _ol_Collection_;
|
export default Collection;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/PluggableMap
|
* @module ol/PluggableMap
|
||||||
*/
|
*/
|
||||||
import {getUid, inherits} from './index.js';
|
import {getUid, inherits} from './index.js';
|
||||||
import _ol_Collection_ from './Collection.js';
|
import Collection from './Collection.js';
|
||||||
import CollectionEventType from './CollectionEventType.js';
|
import CollectionEventType from './CollectionEventType.js';
|
||||||
import MapBrowserEvent from './MapBrowserEvent.js';
|
import MapBrowserEvent from './MapBrowserEvent.js';
|
||||||
import MapBrowserEventHandler from './MapBrowserEventHandler.js';
|
import MapBrowserEventHandler from './MapBrowserEventHandler.js';
|
||||||
@@ -276,13 +276,13 @@ var PluggableMap = function(options) {
|
|||||||
* @type {ol.Collection.<ol.control.Control>}
|
* @type {ol.Collection.<ol.control.Control>}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
this.controls = optionsInternal.controls || new _ol_Collection_();
|
this.controls = optionsInternal.controls || new Collection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.Collection.<ol.interaction.Interaction>}
|
* @type {ol.Collection.<ol.interaction.Interaction>}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
this.interactions = optionsInternal.interactions || new _ol_Collection_();
|
this.interactions = optionsInternal.interactions || new Collection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.Collection.<ol.Overlay>}
|
* @type {ol.Collection.<ol.Overlay>}
|
||||||
@@ -1457,9 +1457,9 @@ function createOptionsInternal(options) {
|
|||||||
var controls;
|
var controls;
|
||||||
if (options.controls !== undefined) {
|
if (options.controls !== undefined) {
|
||||||
if (Array.isArray(options.controls)) {
|
if (Array.isArray(options.controls)) {
|
||||||
controls = new _ol_Collection_(options.controls.slice());
|
controls = new Collection(options.controls.slice());
|
||||||
} else {
|
} else {
|
||||||
assert(options.controls instanceof _ol_Collection_,
|
assert(options.controls instanceof Collection,
|
||||||
47); // Expected `controls` to be an array or an `ol.Collection`
|
47); // Expected `controls` to be an array or an `ol.Collection`
|
||||||
controls = options.controls;
|
controls = options.controls;
|
||||||
}
|
}
|
||||||
@@ -1468,9 +1468,9 @@ function createOptionsInternal(options) {
|
|||||||
var interactions;
|
var interactions;
|
||||||
if (options.interactions !== undefined) {
|
if (options.interactions !== undefined) {
|
||||||
if (Array.isArray(options.interactions)) {
|
if (Array.isArray(options.interactions)) {
|
||||||
interactions = new _ol_Collection_(options.interactions.slice());
|
interactions = new Collection(options.interactions.slice());
|
||||||
} else {
|
} else {
|
||||||
assert(options.interactions instanceof _ol_Collection_,
|
assert(options.interactions instanceof Collection,
|
||||||
48); // Expected `interactions` to be an array or an `ol.Collection`
|
48); // Expected `interactions` to be an array or an `ol.Collection`
|
||||||
interactions = options.interactions;
|
interactions = options.interactions;
|
||||||
}
|
}
|
||||||
@@ -1479,14 +1479,14 @@ function createOptionsInternal(options) {
|
|||||||
var overlays;
|
var overlays;
|
||||||
if (options.overlays !== undefined) {
|
if (options.overlays !== undefined) {
|
||||||
if (Array.isArray(options.overlays)) {
|
if (Array.isArray(options.overlays)) {
|
||||||
overlays = new _ol_Collection_(options.overlays.slice());
|
overlays = new Collection(options.overlays.slice());
|
||||||
} else {
|
} else {
|
||||||
assert(options.overlays instanceof _ol_Collection_,
|
assert(options.overlays instanceof Collection,
|
||||||
49); // Expected `overlays` to be an array or an `ol.Collection`
|
49); // Expected `overlays` to be an array or an `ol.Collection`
|
||||||
overlays = options.overlays;
|
overlays = options.overlays;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
overlays = new _ol_Collection_();
|
overlays = new Collection();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/control
|
* @module ol/control
|
||||||
*/
|
*/
|
||||||
import _ol_Collection_ from './Collection.js';
|
import Collection from './Collection.js';
|
||||||
import Attribution from './control/Attribution.js';
|
import Attribution from './control/Attribution.js';
|
||||||
import Rotate from './control/Rotate.js';
|
import Rotate from './control/Rotate.js';
|
||||||
import Zoom from './control/Zoom.js';
|
import Zoom from './control/Zoom.js';
|
||||||
@@ -23,7 +23,7 @@ export function defaults(opt_options) {
|
|||||||
|
|
||||||
var options = opt_options ? opt_options : {};
|
var options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
var controls = new _ol_Collection_();
|
var controls = new Collection();
|
||||||
|
|
||||||
var zoomControl = options.zoom !== undefined ? options.zoom : true;
|
var zoomControl = options.zoom !== undefined ? options.zoom : true;
|
||||||
if (zoomControl) {
|
if (zoomControl) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/control/OverviewMap
|
* @module ol/control/OverviewMap
|
||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.js';
|
import Collection from '../Collection.js';
|
||||||
import PluggableMap from '../PluggableMap.js';
|
import PluggableMap from '../PluggableMap.js';
|
||||||
import MapEventType from '../MapEventType.js';
|
import MapEventType from '../MapEventType.js';
|
||||||
import MapProperty from '../MapProperty.js';
|
import MapProperty from '../MapProperty.js';
|
||||||
@@ -116,8 +116,8 @@ var OverviewMap = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.ovmap_ = new PluggableMap({
|
this.ovmap_ = new PluggableMap({
|
||||||
controls: new _ol_Collection_(),
|
controls: new Collection(),
|
||||||
interactions: new _ol_Collection_(),
|
interactions: new Collection(),
|
||||||
view: options.view
|
view: options.view
|
||||||
});
|
});
|
||||||
var ovmap = this.ovmap_;
|
var ovmap = this.ovmap_;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/interaction
|
* @module ol/interaction
|
||||||
*/
|
*/
|
||||||
import _ol_Collection_ from './Collection.js';
|
import Collection from './Collection.js';
|
||||||
import Kinetic from './Kinetic.js';
|
import Kinetic from './Kinetic.js';
|
||||||
import DoubleClickZoom from './interaction/DoubleClickZoom.js';
|
import DoubleClickZoom from './interaction/DoubleClickZoom.js';
|
||||||
import DragPan from './interaction/DragPan.js';
|
import DragPan from './interaction/DragPan.js';
|
||||||
@@ -41,7 +41,7 @@ export function defaults(opt_options) {
|
|||||||
|
|
||||||
var options = opt_options ? opt_options : {};
|
var options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
var interactions = new _ol_Collection_();
|
var interactions = new Collection();
|
||||||
|
|
||||||
var kinetic = new Kinetic(-0.005, 0.05, 100);
|
var kinetic = new Kinetic(-0.005, 0.05, 100);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/interaction/Modify
|
* @module ol/interaction/Modify
|
||||||
*/
|
*/
|
||||||
import {getUid, inherits} from '../index.js';
|
import {getUid, inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.js';
|
import Collection from '../Collection.js';
|
||||||
import CollectionEventType from '../CollectionEventType.js';
|
import CollectionEventType from '../CollectionEventType.js';
|
||||||
import Feature from '../Feature.js';
|
import Feature from '../Feature.js';
|
||||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
@@ -195,7 +195,7 @@ var _ol_interaction_Modify_ = function(options) {
|
|||||||
var features;
|
var features;
|
||||||
if (options.source) {
|
if (options.source) {
|
||||||
this.source_ = options.source;
|
this.source_ = options.source;
|
||||||
features = new _ol_Collection_(this.source_.getFeatures());
|
features = new Collection(this.source_.getFeatures());
|
||||||
_ol_events_.listen(this.source_, VectorEventType.ADDFEATURE,
|
_ol_events_.listen(this.source_, VectorEventType.ADDFEATURE,
|
||||||
this.handleSourceAdd_, this);
|
this.handleSourceAdd_, this);
|
||||||
_ol_events_.listen(this.source_, VectorEventType.REMOVEFEATURE,
|
_ol_events_.listen(this.source_, VectorEventType.REMOVEFEATURE,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/interaction/Snap
|
* @module ol/interaction/Snap
|
||||||
*/
|
*/
|
||||||
import {getUid, inherits} from '../index.js';
|
import {getUid, inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.js';
|
import Collection from '../Collection.js';
|
||||||
import CollectionEventType from '../CollectionEventType.js';
|
import CollectionEventType from '../CollectionEventType.js';
|
||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
@@ -221,7 +221,7 @@ _ol_interaction_Snap_.prototype.handleFeatureAdd_ = function(evt) {
|
|||||||
var feature;
|
var feature;
|
||||||
if (evt instanceof VectorSource.Event) {
|
if (evt instanceof VectorSource.Event) {
|
||||||
feature = evt.feature;
|
feature = evt.feature;
|
||||||
} else if (evt instanceof _ol_Collection_.Event) {
|
} else if (evt instanceof Collection.Event) {
|
||||||
feature = evt.element;
|
feature = evt.element;
|
||||||
}
|
}
|
||||||
this.addFeature(/** @type {ol.Feature} */ (feature));
|
this.addFeature(/** @type {ol.Feature} */ (feature));
|
||||||
@@ -236,7 +236,7 @@ _ol_interaction_Snap_.prototype.handleFeatureRemove_ = function(evt) {
|
|||||||
var feature;
|
var feature;
|
||||||
if (evt instanceof VectorSource.Event) {
|
if (evt instanceof VectorSource.Event) {
|
||||||
feature = evt.feature;
|
feature = evt.feature;
|
||||||
} else if (evt instanceof _ol_Collection_.Event) {
|
} else if (evt instanceof Collection.Event) {
|
||||||
feature = evt.element;
|
feature = evt.element;
|
||||||
}
|
}
|
||||||
this.removeFeature(/** @type {ol.Feature} */ (feature));
|
this.removeFeature(/** @type {ol.Feature} */ (feature));
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/interaction/Translate
|
* @module ol/interaction/Translate
|
||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.js';
|
import Collection from '../Collection.js';
|
||||||
import BaseObject from '../Object.js';
|
import BaseObject from '../Object.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
@@ -100,7 +100,7 @@ _ol_interaction_Translate_.handleDownEvent_ = function(event) {
|
|||||||
this.lastCoordinate_ = event.coordinate;
|
this.lastCoordinate_ = event.coordinate;
|
||||||
_ol_interaction_Translate_.handleMoveEvent_.call(this, event);
|
_ol_interaction_Translate_.handleMoveEvent_.call(this, event);
|
||||||
|
|
||||||
var features = this.features_ || new _ol_Collection_([this.lastFeature_]);
|
var features = this.features_ || new Collection([this.lastFeature_]);
|
||||||
|
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_interaction_Translate_.Event(
|
new _ol_interaction_Translate_.Event(
|
||||||
@@ -123,7 +123,7 @@ _ol_interaction_Translate_.handleUpEvent_ = function(event) {
|
|||||||
this.lastCoordinate_ = null;
|
this.lastCoordinate_ = null;
|
||||||
_ol_interaction_Translate_.handleMoveEvent_.call(this, event);
|
_ol_interaction_Translate_.handleMoveEvent_.call(this, event);
|
||||||
|
|
||||||
var features = this.features_ || new _ol_Collection_([this.lastFeature_]);
|
var features = this.features_ || new Collection([this.lastFeature_]);
|
||||||
|
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_interaction_Translate_.Event(
|
new _ol_interaction_Translate_.Event(
|
||||||
@@ -146,7 +146,7 @@ _ol_interaction_Translate_.handleDragEvent_ = function(event) {
|
|||||||
var deltaX = newCoordinate[0] - this.lastCoordinate_[0];
|
var deltaX = newCoordinate[0] - this.lastCoordinate_[0];
|
||||||
var deltaY = newCoordinate[1] - this.lastCoordinate_[1];
|
var deltaY = newCoordinate[1] - this.lastCoordinate_[1];
|
||||||
|
|
||||||
var features = this.features_ || new _ol_Collection_([this.lastFeature_]);
|
var features = this.features_ || new Collection([this.lastFeature_]);
|
||||||
|
|
||||||
features.forEach(function(feature) {
|
features.forEach(function(feature) {
|
||||||
var geom = feature.getGeometry();
|
var geom = feature.getGeometry();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/layer/Group
|
* @module ol/layer/Group
|
||||||
*/
|
*/
|
||||||
import {getUid, inherits} from '../index.js';
|
import {getUid, inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.js';
|
import Collection from '../Collection.js';
|
||||||
import CollectionEventType from '../CollectionEventType.js';
|
import CollectionEventType from '../CollectionEventType.js';
|
||||||
import BaseObject from '../Object.js';
|
import BaseObject from '../Object.js';
|
||||||
import ObjectEventType from '../ObjectEventType.js';
|
import ObjectEventType from '../ObjectEventType.js';
|
||||||
@@ -64,14 +64,14 @@ var LayerGroup = function(opt_options) {
|
|||||||
|
|
||||||
if (layers) {
|
if (layers) {
|
||||||
if (Array.isArray(layers)) {
|
if (Array.isArray(layers)) {
|
||||||
layers = new _ol_Collection_(layers.slice(), {unique: true});
|
layers = new Collection(layers.slice(), {unique: true});
|
||||||
} else {
|
} else {
|
||||||
assert(layers instanceof _ol_Collection_,
|
assert(layers instanceof Collection,
|
||||||
43); // Expected `layers` to be an array or an `ol.Collection`
|
43); // Expected `layers` to be an array or an `ol.Collection`
|
||||||
layers = layers;
|
layers = layers;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
layers = new _ol_Collection_(undefined, {unique: true});
|
layers = new Collection(undefined, {unique: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setLayers(layers);
|
this.setLayers(layers);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {getUid, inherits, nullFunction} from '../index.js';
|
import {getUid, inherits, nullFunction} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.js';
|
import Collection from '../Collection.js';
|
||||||
import CollectionEventType from '../CollectionEventType.js';
|
import CollectionEventType from '../CollectionEventType.js';
|
||||||
import ObjectEventType from '../ObjectEventType.js';
|
import ObjectEventType from '../ObjectEventType.js';
|
||||||
import {extend} from '../array.js';
|
import {extend} from '../array.js';
|
||||||
@@ -131,14 +131,14 @@ var VectorSource = function(opt_options) {
|
|||||||
this.featuresCollection_ = null;
|
this.featuresCollection_ = null;
|
||||||
|
|
||||||
var collection, features;
|
var collection, features;
|
||||||
if (options.features instanceof _ol_Collection_) {
|
if (options.features instanceof Collection) {
|
||||||
collection = options.features;
|
collection = options.features;
|
||||||
features = collection.getArray();
|
features = collection.getArray();
|
||||||
} else if (Array.isArray(options.features)) {
|
} else if (Array.isArray(options.features)) {
|
||||||
features = options.features;
|
features = options.features;
|
||||||
}
|
}
|
||||||
if (!useSpatialIndex && collection === undefined) {
|
if (!useSpatialIndex && collection === undefined) {
|
||||||
collection = new _ol_Collection_(features);
|
collection = new Collection(features);
|
||||||
}
|
}
|
||||||
if (features !== undefined) {
|
if (features !== undefined) {
|
||||||
this.addFeaturesInternal(features);
|
this.addFeaturesInternal(features);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ol_events_ from '../../../src/ol/events.js';
|
import _ol_events_ from '../../../src/ol/events.js';
|
||||||
import _ol_Collection_ from '../../../src/ol/Collection.js';
|
import Collection from '../../../src/ol/Collection.js';
|
||||||
import CollectionEventType from '../../../src/ol/CollectionEventType.js';
|
import CollectionEventType from '../../../src/ol/CollectionEventType.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ describe('ol.collection', function() {
|
|||||||
var collection;
|
var collection;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
collection = new _ol_Collection_();
|
collection = new Collection();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('create an empty collection', function() {
|
describe('create an empty collection', function() {
|
||||||
@@ -21,7 +21,7 @@ describe('ol.collection', function() {
|
|||||||
describe('create a collection from an array', function() {
|
describe('create a collection from an array', function() {
|
||||||
it('creates the expected collection', function() {
|
it('creates the expected collection', function() {
|
||||||
var array = [0, 1, 2];
|
var array = [0, 1, 2];
|
||||||
var collection = new _ol_Collection_(array);
|
var collection = new Collection(array);
|
||||||
expect(collection.item(0)).to.eql(0);
|
expect(collection.item(0)).to.eql(0);
|
||||||
expect(collection.item(1)).to.eql(1);
|
expect(collection.item(1)).to.eql(1);
|
||||||
expect(collection.item(2)).to.eql(2);
|
expect(collection.item(2)).to.eql(2);
|
||||||
@@ -61,7 +61,7 @@ describe('ol.collection', function() {
|
|||||||
|
|
||||||
describe('insertAt', function() {
|
describe('insertAt', function() {
|
||||||
it('inserts elements at the correct location', function() {
|
it('inserts elements at the correct location', function() {
|
||||||
collection = new _ol_Collection_([0, 2]);
|
collection = new Collection([0, 2]);
|
||||||
collection.insertAt(1, 1);
|
collection.insertAt(1, 1);
|
||||||
expect(collection.item(0)).to.eql(0);
|
expect(collection.item(0)).to.eql(0);
|
||||||
expect(collection.item(1)).to.eql(1);
|
expect(collection.item(1)).to.eql(1);
|
||||||
@@ -80,7 +80,7 @@ describe('ol.collection', function() {
|
|||||||
|
|
||||||
describe('removeAt', function() {
|
describe('removeAt', function() {
|
||||||
it('removes elements at the correction', function() {
|
it('removes elements at the correction', function() {
|
||||||
var collection = new _ol_Collection_([0, 1, 2]);
|
var collection = new Collection([0, 1, 2]);
|
||||||
collection.removeAt(1);
|
collection.removeAt(1);
|
||||||
expect(collection.item(0)).to.eql(0);
|
expect(collection.item(0)).to.eql(0);
|
||||||
expect(collection.item(1)).to.eql(2);
|
expect(collection.item(1)).to.eql(2);
|
||||||
@@ -110,13 +110,13 @@ describe('ol.collection', function() {
|
|||||||
|
|
||||||
describe('remove', function() {
|
describe('remove', function() {
|
||||||
it('removes the first matching element', function() {
|
it('removes the first matching element', function() {
|
||||||
var collection = new _ol_Collection_([0, 1, 2]);
|
var collection = new Collection([0, 1, 2]);
|
||||||
expect(collection.remove(1)).to.eql(1);
|
expect(collection.remove(1)).to.eql(1);
|
||||||
expect(collection.getArray()).to.eql([0, 2]);
|
expect(collection.getArray()).to.eql([0, 2]);
|
||||||
expect(collection.getLength()).to.eql(2);
|
expect(collection.getLength()).to.eql(2);
|
||||||
});
|
});
|
||||||
it('fires a remove event', function() {
|
it('fires a remove event', function() {
|
||||||
var collection = new _ol_Collection_([0, 1, 2]);
|
var collection = new Collection([0, 1, 2]);
|
||||||
var cb = sinon.spy();
|
var cb = sinon.spy();
|
||||||
_ol_events_.listen(collection, CollectionEventType.REMOVE, cb);
|
_ol_events_.listen(collection, CollectionEventType.REMOVE, cb);
|
||||||
expect(collection.remove(1)).to.eql(1);
|
expect(collection.remove(1)).to.eql(1);
|
||||||
@@ -124,13 +124,13 @@ describe('ol.collection', function() {
|
|||||||
expect(cb.lastCall.args[0].element).to.eql(1);
|
expect(cb.lastCall.args[0].element).to.eql(1);
|
||||||
});
|
});
|
||||||
it('does not remove more than one matching element', function() {
|
it('does not remove more than one matching element', function() {
|
||||||
var collection = new _ol_Collection_([0, 1, 1, 2]);
|
var collection = new Collection([0, 1, 1, 2]);
|
||||||
expect(collection.remove(1)).to.eql(1);
|
expect(collection.remove(1)).to.eql(1);
|
||||||
expect(collection.getArray()).to.eql([0, 1, 2]);
|
expect(collection.getArray()).to.eql([0, 1, 2]);
|
||||||
expect(collection.getLength()).to.eql(3);
|
expect(collection.getLength()).to.eql(3);
|
||||||
});
|
});
|
||||||
it('returns undefined if the element is not found', function() {
|
it('returns undefined if the element is not found', function() {
|
||||||
var collection = new _ol_Collection_([0, 1, 2]);
|
var collection = new Collection([0, 1, 2]);
|
||||||
expect(collection.remove(3)).to.be(undefined);
|
expect(collection.remove(3)).to.be(undefined);
|
||||||
expect(collection.getArray()).to.eql([0, 1, 2]);
|
expect(collection.getArray()).to.eql([0, 1, 2]);
|
||||||
expect(collection.getLength()).to.eql(3);
|
expect(collection.getLength()).to.eql(3);
|
||||||
@@ -139,7 +139,7 @@ describe('ol.collection', function() {
|
|||||||
|
|
||||||
describe('setAt and event', function() {
|
describe('setAt and event', function() {
|
||||||
it('does dispatch events', function() {
|
it('does dispatch events', function() {
|
||||||
var collection = new _ol_Collection_(['a', 'b']);
|
var collection = new Collection(['a', 'b']);
|
||||||
var added, removed;
|
var added, removed;
|
||||||
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
||||||
added = e.element;
|
added = e.element;
|
||||||
@@ -156,7 +156,7 @@ describe('ol.collection', function() {
|
|||||||
|
|
||||||
describe('removeAt and event', function() {
|
describe('removeAt and event', function() {
|
||||||
it('does dispatch events', function() {
|
it('does dispatch events', function() {
|
||||||
var collection = new _ol_Collection_(['a']);
|
var collection = new Collection(['a']);
|
||||||
var removed;
|
var removed;
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
collection, CollectionEventType.REMOVE, function(e) {
|
collection, CollectionEventType.REMOVE, function(e) {
|
||||||
@@ -169,7 +169,7 @@ describe('ol.collection', function() {
|
|||||||
|
|
||||||
describe('insertAt and event', function() {
|
describe('insertAt and event', function() {
|
||||||
it('does dispatch events', function() {
|
it('does dispatch events', function() {
|
||||||
var collection = new _ol_Collection_([0, 2]);
|
var collection = new Collection([0, 2]);
|
||||||
var added;
|
var added;
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
collection, CollectionEventType.ADD, function(e) {
|
collection, CollectionEventType.ADD, function(e) {
|
||||||
@@ -202,7 +202,7 @@ describe('ol.collection', function() {
|
|||||||
describe('change:length event', function() {
|
describe('change:length event', function() {
|
||||||
var collection, cb;
|
var collection, cb;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
collection = new _ol_Collection_([0, 1, 2]);
|
collection = new Collection([0, 1, 2]);
|
||||||
cb = sinon.spy();
|
cb = sinon.spy();
|
||||||
_ol_events_.listen(collection, 'change:length', cb);
|
_ol_events_.listen(collection, 'change:length', cb);
|
||||||
});
|
});
|
||||||
@@ -231,7 +231,7 @@ describe('ol.collection', function() {
|
|||||||
|
|
||||||
describe('add event', function() {
|
describe('add event', function() {
|
||||||
it('triggers add when pushing', function() {
|
it('triggers add when pushing', function() {
|
||||||
var collection = new _ol_Collection_();
|
var collection = new Collection();
|
||||||
var elem;
|
var elem;
|
||||||
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
||||||
elem = e.element;
|
elem = e.element;
|
||||||
@@ -244,7 +244,7 @@ describe('ol.collection', function() {
|
|||||||
describe('remove event', function() {
|
describe('remove event', function() {
|
||||||
var collection, cb1, cb2;
|
var collection, cb1, cb2;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
collection = new _ol_Collection_([1]);
|
collection = new Collection([1]);
|
||||||
cb1 = sinon.spy();
|
cb1 = sinon.spy();
|
||||||
cb2 = sinon.spy();
|
cb2 = sinon.spy();
|
||||||
});
|
});
|
||||||
@@ -275,7 +275,7 @@ describe('ol.collection', function() {
|
|||||||
expect(collection.item(1)).to.eql(2);
|
expect(collection.item(1)).to.eql(2);
|
||||||
});
|
});
|
||||||
it('fires events', function() {
|
it('fires events', function() {
|
||||||
var collection = new _ol_Collection_();
|
var collection = new Collection();
|
||||||
var elems = [];
|
var elems = [];
|
||||||
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
||||||
elems.push(e.element);
|
elems.push(e.element);
|
||||||
@@ -287,25 +287,25 @@ describe('ol.collection', function() {
|
|||||||
|
|
||||||
describe('unique collection', function() {
|
describe('unique collection', function() {
|
||||||
it('allows unique items in the constructor', function() {
|
it('allows unique items in the constructor', function() {
|
||||||
new _ol_Collection_([{}, {}, {}], {unique: true});
|
new Collection([{}, {}, {}], {unique: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws if duplicate items are passed to the constructor', function() {
|
it('throws if duplicate items are passed to the constructor', function() {
|
||||||
var item = {};
|
var item = {};
|
||||||
var call = function() {
|
var call = function() {
|
||||||
new _ol_Collection_([item, item], {unique: true});
|
new Collection([item, item], {unique: true});
|
||||||
};
|
};
|
||||||
expect(call).to.throwException();
|
expect(call).to.throwException();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows unique items to be added via push', function() {
|
it('allows unique items to be added via push', function() {
|
||||||
var unique = new _ol_Collection_(undefined, {unique: true});
|
var unique = new Collection(undefined, {unique: true});
|
||||||
unique.push({});
|
unique.push({});
|
||||||
unique.push({});
|
unique.push({});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws if duplicate items are added via push', function() {
|
it('throws if duplicate items are added via push', function() {
|
||||||
var unique = new _ol_Collection_(undefined, {unique: true});
|
var unique = new Collection(undefined, {unique: true});
|
||||||
var item = {};
|
var item = {};
|
||||||
unique.push(item);
|
unique.push(item);
|
||||||
var call = function() {
|
var call = function() {
|
||||||
@@ -315,13 +315,13 @@ describe('ol.collection', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('allows unique items to be added via insertAt', function() {
|
it('allows unique items to be added via insertAt', function() {
|
||||||
var unique = new _ol_Collection_(undefined, {unique: true});
|
var unique = new Collection(undefined, {unique: true});
|
||||||
unique.insertAt(0, {});
|
unique.insertAt(0, {});
|
||||||
unique.insertAt(0, {});
|
unique.insertAt(0, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws if duplicate items are added via insertAt', function() {
|
it('throws if duplicate items are added via insertAt', function() {
|
||||||
var unique = new _ol_Collection_(undefined, {unique: true});
|
var unique = new Collection(undefined, {unique: true});
|
||||||
var item = {};
|
var item = {};
|
||||||
unique.insertAt(0, item);
|
unique.insertAt(0, item);
|
||||||
var call = function() {
|
var call = function() {
|
||||||
@@ -331,20 +331,20 @@ describe('ol.collection', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('allows unique items to be added via setAt', function() {
|
it('allows unique items to be added via setAt', function() {
|
||||||
var unique = new _ol_Collection_(undefined, {unique: true});
|
var unique = new Collection(undefined, {unique: true});
|
||||||
unique.setAt(0, {});
|
unique.setAt(0, {});
|
||||||
unique.setAt(1, {});
|
unique.setAt(1, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows items to be reset via setAt', function() {
|
it('allows items to be reset via setAt', function() {
|
||||||
var unique = new _ol_Collection_(undefined, {unique: true});
|
var unique = new Collection(undefined, {unique: true});
|
||||||
var item = {};
|
var item = {};
|
||||||
unique.setAt(0, item);
|
unique.setAt(0, item);
|
||||||
unique.setAt(0, item);
|
unique.setAt(0, item);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws if duplicate items are added via setAt', function() {
|
it('throws if duplicate items are added via setAt', function() {
|
||||||
var unique = new _ol_Collection_(undefined, {unique: true});
|
var unique = new Collection(undefined, {unique: true});
|
||||||
var item = {};
|
var item = {};
|
||||||
unique.setAt(0, item);
|
unique.setAt(0, item);
|
||||||
var call = function() {
|
var call = function() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
import Collection from '../../../../src/ol/Collection.js';
|
||||||
import Feature from '../../../../src/ol/Feature.js';
|
import Feature from '../../../../src/ol/Feature.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||||
@@ -153,7 +153,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
it('adds features to the RTree', function() {
|
it('adds features to the RTree', function() {
|
||||||
var feature = new Feature(
|
var feature = new Feature(
|
||||||
new Point([0, 0]));
|
new Point([0, 0]));
|
||||||
var features = new _ol_Collection_([feature]);
|
var features = new Collection([feature]);
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: features
|
features: features
|
||||||
});
|
});
|
||||||
@@ -164,7 +164,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
|
|
||||||
it('accepts feature without geometry', function() {
|
it('accepts feature without geometry', function() {
|
||||||
var feature = new Feature();
|
var feature = new Feature();
|
||||||
var features = new _ol_Collection_([feature]);
|
var features = new Collection([feature]);
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: features
|
features: features
|
||||||
});
|
});
|
||||||
@@ -200,7 +200,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var secondRevision = second.getGeometry().getRevision();
|
var secondRevision = second.getGeometry().getRevision();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var firstRevision = first.getGeometry().getRevision();
|
var firstRevision = first.getGeometry().getRevision();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var firstRevision = first.getGeometry().getRevision();
|
var firstRevision = first.getGeometry().getRevision();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var firstRevision = first.getGeometry().getRevision();
|
var firstRevision = first.getGeometry().getRevision();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
features.push(lineFeature);
|
features.push(lineFeature);
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -387,7 +387,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
features.push(circleFeature);
|
features.push(circleFeature);
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -418,7 +418,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
modify = new _ol_interaction_Modify_({
|
modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
modify = new _ol_interaction_Modify_({
|
modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features),
|
features: new Collection(features),
|
||||||
deleteCondition: _ol_events_condition_.doubleClick
|
deleteCondition: _ol_events_condition_.doubleClick
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -576,7 +576,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features),
|
features: new Collection(features),
|
||||||
insertVertexCondition: listenerSpy
|
insertVertexCondition: listenerSpy
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -622,7 +622,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
features.push(feature);
|
features.push(feature);
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -658,7 +658,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
|
|
||||||
it('updates polygon segment data', function() {
|
it('updates polygon segment data', function() {
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
@@ -698,7 +698,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
describe('#setActive', function() {
|
describe('#setActive', function() {
|
||||||
it('removes the vertexFeature of deactivation', function() {
|
it('removes the vertexFeature of deactivation', function() {
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new _ol_interaction_Modify_({
|
||||||
features: new _ol_Collection_(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
expect(modify.vertexFeature_).to.be(null);
|
expect(modify.vertexFeature_).to.be(null);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
import Collection from '../../../../src/ol/Collection.js';
|
||||||
import Feature from '../../../../src/ol/Feature.js';
|
import Feature from '../../../../src/ol/Feature.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
|
import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
|
||||||
@@ -111,7 +111,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
describe('user-provided collection', function() {
|
describe('user-provided collection', function() {
|
||||||
|
|
||||||
it('uses the user-provided collection', function() {
|
it('uses the user-provided collection', function() {
|
||||||
var features = new _ol_Collection_();
|
var features = new Collection();
|
||||||
var select = new _ol_interaction_Select_({features: features});
|
var select = new _ol_interaction_Select_({features: features});
|
||||||
expect(select.getFeatures()).to.be(features);
|
expect(select.getFeatures()).to.be(features);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
import Collection from '../../../../src/ol/Collection.js';
|
||||||
import Feature from '../../../../src/ol/Feature.js';
|
import Feature from '../../../../src/ol/Feature.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
@@ -58,7 +58,7 @@ describe('ol.interaction.Snap', function() {
|
|||||||
it('can handle XYZ coordinates', function() {
|
it('can handle XYZ coordinates', function() {
|
||||||
var point = new Feature(new Point([0, 0, 123]));
|
var point = new Feature(new Point([0, 0, 123]));
|
||||||
var snapInteraction = new _ol_interaction_Snap_({
|
var snapInteraction = new _ol_interaction_Snap_({
|
||||||
features: new _ol_Collection_([point])
|
features: new Collection([point])
|
||||||
});
|
});
|
||||||
snapInteraction.setMap(map);
|
snapInteraction.setMap(map);
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ describe('ol.interaction.Snap', function() {
|
|||||||
it('snaps to edges only', function() {
|
it('snaps to edges only', function() {
|
||||||
var point = new Feature(new LineString([[-10, 0], [10, 0]]));
|
var point = new Feature(new LineString([[-10, 0], [10, 0]]));
|
||||||
var snapInteraction = new _ol_interaction_Snap_({
|
var snapInteraction = new _ol_interaction_Snap_({
|
||||||
features: new _ol_Collection_([point]),
|
features: new Collection([point]),
|
||||||
pixelTolerance: 5,
|
pixelTolerance: 5,
|
||||||
vertex: false
|
vertex: false
|
||||||
});
|
});
|
||||||
@@ -93,7 +93,7 @@ describe('ol.interaction.Snap', function() {
|
|||||||
it('snaps to vertices only', function() {
|
it('snaps to vertices only', function() {
|
||||||
var point = new Feature(new LineString([[-10, 0], [10, 0]]));
|
var point = new Feature(new LineString([[-10, 0], [10, 0]]));
|
||||||
var snapInteraction = new _ol_interaction_Snap_({
|
var snapInteraction = new _ol_interaction_Snap_({
|
||||||
features: new _ol_Collection_([point]),
|
features: new Collection([point]),
|
||||||
pixelTolerance: 5,
|
pixelTolerance: 5,
|
||||||
edge: false
|
edge: false
|
||||||
});
|
});
|
||||||
@@ -111,7 +111,7 @@ describe('ol.interaction.Snap', function() {
|
|||||||
it('snaps to circle', function() {
|
it('snaps to circle', function() {
|
||||||
var circle = new Feature(new Circle([0, 0], 10));
|
var circle = new Feature(new Circle([0, 0], 10));
|
||||||
var snapInteraction = new _ol_interaction_Snap_({
|
var snapInteraction = new _ol_interaction_Snap_({
|
||||||
features: new _ol_Collection_([circle]),
|
features: new Collection([circle]),
|
||||||
pixelTolerance: 5
|
pixelTolerance: 5
|
||||||
});
|
});
|
||||||
snapInteraction.setMap(map);
|
snapInteraction.setMap(map);
|
||||||
@@ -130,7 +130,7 @@ describe('ol.interaction.Snap', function() {
|
|||||||
it('handle feature without geometry', function() {
|
it('handle feature without geometry', function() {
|
||||||
var feature = new Feature();
|
var feature = new Feature();
|
||||||
var snapInteraction = new _ol_interaction_Snap_({
|
var snapInteraction = new _ol_interaction_Snap_({
|
||||||
features: new _ol_Collection_([feature]),
|
features: new Collection([feature]),
|
||||||
pixelTolerance: 5,
|
pixelTolerance: 5,
|
||||||
edge: false
|
edge: false
|
||||||
});
|
});
|
||||||
@@ -150,7 +150,7 @@ describe('ol.interaction.Snap', function() {
|
|||||||
it('handle geometry changes', function() {
|
it('handle geometry changes', function() {
|
||||||
var line = new Feature(new LineString([[-10, 0], [0, 0]]));
|
var line = new Feature(new LineString([[-10, 0], [0, 0]]));
|
||||||
var snapInteraction = new _ol_interaction_Snap_({
|
var snapInteraction = new _ol_interaction_Snap_({
|
||||||
features: new _ol_Collection_([line]),
|
features: new Collection([line]),
|
||||||
pixelTolerance: 5,
|
pixelTolerance: 5,
|
||||||
edge: false
|
edge: false
|
||||||
});
|
});
|
||||||
@@ -173,7 +173,7 @@ describe('ol.interaction.Snap', function() {
|
|||||||
alt_geometry: new LineString([[-10, 0], [10, 0]])
|
alt_geometry: new LineString([[-10, 0], [10, 0]])
|
||||||
});
|
});
|
||||||
var snapInteraction = new _ol_interaction_Snap_({
|
var snapInteraction = new _ol_interaction_Snap_({
|
||||||
features: new _ol_Collection_([line]),
|
features: new Collection([line]),
|
||||||
pixelTolerance: 5,
|
pixelTolerance: 5,
|
||||||
edge: false
|
edge: false
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
import Collection from '../../../../src/ol/Collection.js';
|
||||||
import Feature from '../../../../src/ol/Feature.js';
|
import Feature from '../../../../src/ol/Feature.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||||
@@ -159,7 +159,7 @@ describe('ol.interaction.Translate', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
translate = new _ol_interaction_Translate_({
|
translate = new _ol_interaction_Translate_({
|
||||||
features: new _ol_Collection_([features[0]])
|
features: new Collection([features[0]])
|
||||||
});
|
});
|
||||||
map.addInteraction(translate);
|
map.addInteraction(translate);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {getUid} from '../../../../src/ol/index.js';
|
import {getUid} from '../../../../src/ol/index.js';
|
||||||
import {stableSort} from '../../../../src/ol/array.js';
|
import {stableSort} from '../../../../src/ol/array.js';
|
||||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
import Collection from '../../../../src/ol/Collection.js';
|
||||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||||
import LayerGroup from '../../../../src/ol/layer/Group.js';
|
import LayerGroup from '../../../../src/ol/layer/Group.js';
|
||||||
import Layer from '../../../../src/ol/layer/Layer.js';
|
import Layer from '../../../../src/ol/layer/Layer.js';
|
||||||
@@ -50,7 +50,7 @@ describe('ol.layer.Group', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('provides default empty layers collection', function() {
|
it('provides default empty layers collection', function() {
|
||||||
expect(layerGroup.getLayers()).to.be.a(_ol_Collection_);
|
expect(layerGroup.getLayers()).to.be.a(Collection);
|
||||||
expect(layerGroup.getLayers().getLength()).to.be(0);
|
expect(layerGroup.getLayers().getLength()).to.be(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ describe('ol.layer.Group', function() {
|
|||||||
maxResolution: 500,
|
maxResolution: 500,
|
||||||
minResolution: 0.25
|
minResolution: 0.25
|
||||||
});
|
});
|
||||||
expect(layerGroup.getLayers()).to.be.a(_ol_Collection_);
|
expect(layerGroup.getLayers()).to.be.a(Collection);
|
||||||
expect(layerGroup.getLayers().getLength()).to.be(1);
|
expect(layerGroup.getLayers().getLength()).to.be(1);
|
||||||
expect(layerGroup.getLayers().item(0)).to.be(layer);
|
expect(layerGroup.getLayers().item(0)).to.be(layer);
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ describe('ol.layer.Group', function() {
|
|||||||
maxResolution: 500,
|
maxResolution: 500,
|
||||||
minResolution: 0.25
|
minResolution: 0.25
|
||||||
});
|
});
|
||||||
expect(layerGroup.getLayers()).to.be.a(_ol_Collection_);
|
expect(layerGroup.getLayers()).to.be.a(Collection);
|
||||||
expect(layerGroup.getLayers().getLength()).to.be(1);
|
expect(layerGroup.getLayers().getLength()).to.be(1);
|
||||||
expect(layerGroup.getLayers().item(0)).to.be(layer);
|
expect(layerGroup.getLayers().item(0)).to.be(layer);
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ describe('ol.layer.Group', function() {
|
|||||||
describe('layers events', function() {
|
describe('layers events', function() {
|
||||||
|
|
||||||
it('listen / unlisten for layers added to the collection', function() {
|
it('listen / unlisten for layers added to the collection', function() {
|
||||||
var layers = new _ol_Collection_();
|
var layers = new Collection();
|
||||||
var layerGroup = new LayerGroup({
|
var layerGroup = new LayerGroup({
|
||||||
layers: layers
|
layers: layers
|
||||||
});
|
});
|
||||||
@@ -315,7 +315,7 @@ describe('ol.layer.Group', function() {
|
|||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
var layers = new _ol_Collection_([layer]);
|
var layers = new Collection([layer]);
|
||||||
var layerGroup = new LayerGroup();
|
var layerGroup = new LayerGroup();
|
||||||
|
|
||||||
layerGroup.setLayers(layers);
|
layerGroup.setLayers(layers);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ol_events_ from '../../../../src/ol/events.js';
|
import _ol_events_ from '../../../../src/ol/events.js';
|
||||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
import Collection from '../../../../src/ol/Collection.js';
|
||||||
import Feature from '../../../../src/ol/Feature.js';
|
import Feature from '../../../../src/ol/Feature.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
@@ -560,7 +560,7 @@ describe('ol.source.Vector', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns a features collection', function() {
|
it('returns a features collection', function() {
|
||||||
expect(source.getFeaturesCollection()).to.be.a(_ol_Collection_);
|
expect(source.getFeaturesCollection()).to.be.a(Collection);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#forEachFeatureInExtent loops through all features', function() {
|
it('#forEachFeatureInExtent loops through all features', function() {
|
||||||
@@ -622,7 +622,7 @@ describe('ol.source.Vector', function() {
|
|||||||
describe('with a collection of features plus spatial index', function() {
|
describe('with a collection of features plus spatial index', function() {
|
||||||
var collection, source;
|
var collection, source;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
collection = new _ol_Collection_();
|
collection = new Collection();
|
||||||
source = new VectorSource({
|
source = new VectorSource({
|
||||||
features: collection
|
features: collection
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user