Add ol.Rectangle.getSize

This commit is contained in:
Tom Payne
2012-07-17 22:37:21 +02:00
parent b31c3f90bd
commit 0d5bc44326
3 changed files with 18 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ goog.provide('ol.Rectangle');
goog.require('goog.asserts');
goog.require('goog.math.Coordinate');
goog.require('goog.math.Size');
@@ -78,3 +79,11 @@ ol.Rectangle.prototype.getCenter = function() {
return new goog.math.Coordinate(
(this.minX + this.maxX) / 2, (this.minY + this.maxY) / 2);
};
/**
* @return {goog.math.Size} Size.
*/
ol.Rectangle.prototype.getSize = function() {
return new goog.math.Size(this.maxX - this.minX, this.maxY - this.minY);
};