Changeset 1558
- Timestamp:
- 10/04/06 10:05:34 (2 years ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/BaseTypes.js (modified) (1 diff)
- trunk/openlayers/tests/test_Bounds.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/BaseTypes.js
r1533 r1558 365 365 * @type String 366 366 */ 367 toBBOX:function() { 368 return (this.left + "," + this.bottom + "," 369 + this.right + "," + this.top); 367 toBBOX:function(power) { 368 var mult; 369 if (power) { 370 mult = Math.pow(10,power); 371 } else { 372 mult = Math.pow(10,6); 373 } 374 return (Math.round(this.left*mult)/mult + "," + 375 Math.round(this.bottom*mult)/mult + "," + 376 Math.round(this.right*mult)/mult + "," + 377 Math.round(this.top*mult)/mult); 370 378 }, 371 379 trunk/openlayers/tests/test_Bounds.html
r1533 r1558 42 42 43 43 function test_02_Bounds_toBBOX(t) { 44 t.plan( 1);44 t.plan( 5 ); 45 45 bounds = new OpenLayers.Bounds(1,2,3,4); 46 46 t.eq( bounds.toBBOX(), "1,2,3,4", "toBBOX() returns correct value." ); 47 bounds = new OpenLayers.Bounds(1.00000001,2,3,4); 48 t.eq( bounds.toBBOX(), "1,2,3,4", "toBBOX() rounds off small differences." ); 49 bounds = new OpenLayers.Bounds(1.00000001,2.5,3,4); 50 t.eq( bounds.toBBOX(), "1,2.5,3,4", "toBBOX() returns correct value. for a half number" ); 51 bounds = new OpenLayers.Bounds(1,2.5555555,3,4); 52 t.eq( bounds.toBBOX(), "1,2.555556,3,4", "toBBOX() rounds to correct value." ); 53 bounds = new OpenLayers.Bounds(1,2.5555555,3,4); 54 t.eq( bounds.toBBOX(1), "1,2.6,3,4", "toBBOX() rounds to correct value with power provided." ); 55 bounds = new OpenLayers.Bounds(1,2.5555555,3,4); 47 56 } 48 57
