Single provide from ol/collection.js

This commit is contained in:
Tim Schaub
2016-08-06 10:21:19 -06:00
parent 4261523720
commit ffe3565166
10 changed files with 103 additions and 106 deletions

View File

@@ -6,7 +6,6 @@ goog.require('ol.events.Event');
goog.require('ol.events.EventType');
goog.require('ol');
goog.require('ol.Collection');
goog.require('ol.CollectionEventType');
goog.require('ol.Feature');
goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserPointerEvent');
@@ -232,9 +231,9 @@ ol.interaction.Modify = function(options) {
this.features_ = options.features;
this.features_.forEach(this.addFeature_, this);
ol.events.listen(this.features_, ol.CollectionEventType.ADD,
ol.events.listen(this.features_, ol.Collection.EventType.ADD,
this.handleFeatureAdd_, this);
ol.events.listen(this.features_, ol.CollectionEventType.REMOVE,
ol.events.listen(this.features_, ol.Collection.EventType.REMOVE,
this.handleFeatureRemove_, this);
/**
@@ -327,7 +326,7 @@ ol.interaction.Modify.prototype.setMap = function(map) {
/**
* @param {ol.CollectionEvent} evt Event.
* @param {ol.Collection.Event} evt Event.
* @private
*/
ol.interaction.Modify.prototype.handleFeatureAdd_ = function(evt) {
@@ -349,7 +348,7 @@ ol.interaction.Modify.prototype.handleFeatureChange_ = function(evt) {
/**
* @param {ol.CollectionEvent} evt Event.
* @param {ol.Collection.Event} evt Event.
* @private
*/
ol.interaction.Modify.prototype.handleFeatureRemove_ = function(evt) {

View File

@@ -3,7 +3,7 @@ goog.provide('ol.interaction.SelectEvent');
goog.provide('ol.interaction.SelectEventType');
goog.require('ol.functions');
goog.require('ol.CollectionEventType');
goog.require('ol.Collection');
goog.require('ol.Feature');
goog.require('ol.array');
goog.require('ol.events');
@@ -185,9 +185,9 @@ ol.interaction.Select = function(opt_options) {
this.featureLayerAssociation_ = {};
var features = this.featureOverlay_.getSource().getFeaturesCollection();
ol.events.listen(features, ol.CollectionEventType.ADD,
ol.events.listen(features, ol.Collection.EventType.ADD,
this.addFeature_, this);
ol.events.listen(features, ol.CollectionEventType.REMOVE,
ol.events.listen(features, ol.Collection.EventType.REMOVE,
this.removeFeature_, this);
};
@@ -355,7 +355,7 @@ ol.interaction.Select.getDefaultStyleFunction = function() {
/**
* @param {ol.CollectionEvent} evt Event.
* @param {ol.Collection.Event} evt Event.
* @private
*/
ol.interaction.Select.prototype.addFeature_ = function(evt) {
@@ -367,7 +367,7 @@ ol.interaction.Select.prototype.addFeature_ = function(evt) {
/**
* @param {ol.CollectionEvent} evt Event.
* @param {ol.Collection.Event} evt Event.
* @private
*/
ol.interaction.Select.prototype.removeFeature_ = function(evt) {

View File

@@ -3,8 +3,6 @@ goog.provide('ol.interaction.SnapProperty');
goog.require('ol');
goog.require('ol.Collection');
goog.require('ol.CollectionEvent');
goog.require('ol.CollectionEventType');
goog.require('ol.Feature');
goog.require('ol.Object');
goog.require('ol.Observable');
@@ -232,14 +230,14 @@ ol.interaction.Snap.prototype.getFeatures_ = function() {
/**
* @param {ol.source.VectorEvent|ol.CollectionEvent} evt Event.
* @param {ol.source.VectorEvent|ol.Collection.Event} evt Event.
* @private
*/
ol.interaction.Snap.prototype.handleFeatureAdd_ = function(evt) {
var feature;
if (evt instanceof ol.source.VectorEvent) {
feature = evt.feature;
} else if (evt instanceof ol.CollectionEvent) {
} else if (evt instanceof ol.Collection.Event) {
feature = evt.element;
}
this.addFeature(/** @type {ol.Feature} */ (feature));
@@ -247,14 +245,14 @@ ol.interaction.Snap.prototype.handleFeatureAdd_ = function(evt) {
/**
* @param {ol.source.VectorEvent|ol.CollectionEvent} evt Event.
* @param {ol.source.VectorEvent|ol.Collection.Event} evt Event.
* @private
*/
ol.interaction.Snap.prototype.handleFeatureRemove_ = function(evt) {
var feature;
if (evt instanceof ol.source.VectorEvent) {
feature = evt.feature;
} else if (evt instanceof ol.CollectionEvent) {
} else if (evt instanceof ol.Collection.Event) {
feature = evt.element;
}
this.removeFeature(/** @type {ol.Feature} */ (feature));
@@ -342,9 +340,9 @@ ol.interaction.Snap.prototype.setMap = function(map) {
if (map) {
if (this.features_) {
keys.push(
ol.events.listen(this.features_, ol.CollectionEventType.ADD,
ol.events.listen(this.features_, ol.Collection.EventType.ADD,
this.handleFeatureAdd_, this),
ol.events.listen(this.features_, ol.CollectionEventType.REMOVE,
ol.events.listen(this.features_, ol.Collection.EventType.REMOVE,
this.handleFeatureRemove_, this)
);
} else if (this.source_) {