Fire change events for multi-part geometries
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.GeometryCollection');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.geom.AbstractCollection');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
@@ -18,8 +20,14 @@ goog.require('ol.geom.GeometryType');
|
||||
ol.geom.GeometryCollection = function(geometries) {
|
||||
goog.base(this);
|
||||
|
||||
for (var i = geometries.length - 1; i >= 0; --i) {
|
||||
goog.events.listen(geometries[i], goog.events.EventType.CHANGE,
|
||||
this.handleComponentChange, false, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {Array.<ol.geom.Geometry>}
|
||||
* @protected
|
||||
*/
|
||||
this.components = geometries;
|
||||
|
||||
@@ -27,6 +35,19 @@ ol.geom.GeometryCollection = function(geometries) {
|
||||
goog.inherits(ol.geom.GeometryCollection, ol.geom.AbstractCollection);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.clone = function() {
|
||||
var numComponents = this.components.length;
|
||||
var components = new Array(numComponents);
|
||||
for (var i = 0; i < numComponents; ++i) {
|
||||
components[i] = this.components[i];
|
||||
}
|
||||
return new ol.geom.GeometryCollection(components);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user