Add rounding support to the default toBBOX() call. Now, toBBOX() will by

default return values which are rounded to 6 decimal places. If you wish more
or less accuracy, you can change it by passing a numeric argument with the
accuracy you want to toBBOX(), and that accuracy will be used instead. Updated
tests to test rounding to various levels. This functionality should help 
prevent different browsers from hitting different caches. At the equator, this
rounding difference is only 4", and smaller as you head towards the poles.   


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1558 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-10-04 14:05:34 +00:00
parent e1a36bdc58
commit 8dfb4c3ce9
2 changed files with 21 additions and 4 deletions

View File

@@ -364,9 +364,17 @@ OpenLayers.Bounds.prototype = {
* (ex. <i>"5,42,10,45"</i>)
* @type String
*/
toBBOX:function() {
return (this.left + "," + this.bottom + ","
+ this.right + "," + this.top);
toBBOX:function(power) {
var mult;
if (power) {
mult = Math.pow(10,power);
} else {
mult = Math.pow(10,6);
}
return (Math.round(this.left*mult)/mult + "," +
Math.round(this.bottom*mult)/mult + "," +
Math.round(this.right*mult)/mult + "," +
Math.round(this.top*mult)/mult);
},
/**