Add ol.Rectangle.toString

This commit is contained in:
Tom Payne
2012-07-18 19:40:07 +02:00
parent 62f3f46b51
commit 0a33077ecc
2 changed files with 14 additions and 0 deletions

View File

@@ -114,3 +114,11 @@ ol.Rectangle.prototype.normalize = function(coordinate) {
(coordinate.x - this.minX) / this.getWidth(),
(coordinate.y - this.minY) / this.getHeight());
};
/**
* @return {string} String.
*/
ol.Rectangle.prototype.toString = function() {
return '(' + [this.minX, this.minY, this.maxX, this.maxY].join(', ') + ')';
};

View File

@@ -134,3 +134,9 @@ function testNormalize() {
assertEquals(0, coordinate.y);
}
function testToString() {
var rectangle = new ol.Rectangle(0, 1, 2, 3);
assertEquals('(0, 1, 2, 3)', rectangle.toString());
}