Add ol.Rectangle.toString
This commit is contained in:
@@ -114,3 +114,11 @@ ol.Rectangle.prototype.normalize = function(coordinate) {
|
|||||||
(coordinate.x - this.minX) / this.getWidth(),
|
(coordinate.x - this.minX) / this.getWidth(),
|
||||||
(coordinate.y - this.minY) / this.getHeight());
|
(coordinate.y - this.minY) / this.getHeight());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {string} String.
|
||||||
|
*/
|
||||||
|
ol.Rectangle.prototype.toString = function() {
|
||||||
|
return '(' + [this.minX, this.minY, this.maxX, this.maxY].join(', ') + ')';
|
||||||
|
};
|
||||||
|
|||||||
@@ -134,3 +134,9 @@ function testNormalize() {
|
|||||||
assertEquals(0, coordinate.y);
|
assertEquals(0, coordinate.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function testToString() {
|
||||||
|
var rectangle = new ol.Rectangle(0, 1, 2, 3);
|
||||||
|
assertEquals('(0, 1, 2, 3)', rectangle.toString());
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user