Make geometries event targets

Previously, the tests were using eql to make assertions about matching geometries.  This is inappropriate for structures with circular references (as with goog.events.EventTarget);
This commit is contained in:
Tim Schaub
2013-09-27 19:10:51 +02:00
parent 626a319222
commit 9b47c15bd8
3 changed files with 85 additions and 9 deletions

View File

@@ -1,6 +1,9 @@
goog.provide('ol.geom.Geometry');
goog.provide('ol.geom.GeometryEvent');
goog.provide('ol.geom.GeometryType');
goog.require('goog.events.Event');
goog.require('goog.events.EventTarget');
goog.require('ol.Extent');
goog.require('ol.TransformFunction');
@@ -8,8 +11,12 @@ goog.require('ol.TransformFunction');
/**
* @constructor
* @extends {goog.events.EventTarget}
*/
ol.geom.Geometry = function() {};
ol.geom.Geometry = function() {
goog.base(this);
};
goog.inherits(ol.geom.Geometry, goog.events.EventTarget);
/**
@@ -48,6 +55,23 @@ ol.geom.Geometry.prototype.getType = goog.abstractMethod;
ol.geom.Geometry.prototype.transform = goog.abstractMethod;
/**
* Constructor for geometry events.
* @constructor
* @extends {goog.events.Event}
* @param {string} type Event type.
* @param {ol.geom.Geometry} target The target geometry.
* @param {ol.Extent} oldExtent The previous geometry extent.
*/
ol.geom.GeometryEvent = function(type, target, oldExtent) {
goog.base(this, type, target);
this.oldExtent = oldExtent;
};
goog.inherits(ol.geom.GeometryEvent, goog.events.Event);
/**
* Geometry types.
*