Fix #1951 by rounding all floats passed to Bounds.initialize() and
LonLat.initialize() to 14 significant figures. Added an OpenLayers.Util.toFloat() function, and changed the LonLat constructor and the Bounds constructor to truncate all float parameters to 14 significant figures to avoid numeric comparison errors caused by floating point precision loss. See the comments around the definition of OpenLayers.Util.DEFAULT_PRECISION for how it works. Also refactored Bounds.intersectBounds() for readability, and added a Bounds.touchesBounds() in the process. After tweaking the tests for Layer.SphericalMercator and Format.WKT (because they were expecting too many significant figures), all tests pass. git-svn-id: http://svn.openlayers.org/trunk/openlayers@9022 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -38,8 +38,8 @@
|
||||
t.eq(sw.lon, -180, "Southwest lon correct");
|
||||
t.eq(ne.lon, 180, "Northeast lon correct");
|
||||
|
||||
t.eq(sw.lat, -85.05112877980659, "Southwest lat correct");
|
||||
t.eq(ne.lat, 85.05112877980660, "Northeast lat correct");
|
||||
t.eq(sw.lat, -85.051128779807, "Southwest lat correct");
|
||||
t.eq(ne.lat, 85.051128779807, "Northeast lat correct");
|
||||
}
|
||||
|
||||
function strToFixed(str, dig) {
|
||||
|
||||
Reference in New Issue
Block a user