[OpenLayers-Commits] r2364 - in sandbox/vector-2.4: lib/OpenLayers/Geometry tests/Geometry

commits at openlayers.org commits at openlayers.org
Mon Mar 5 20:23:49 EST 2007


Author: sderle
Date: 2007-03-05 20:23:44 -0500 (Mon, 05 Mar 2007)
New Revision: 2364

Modified:
   sandbox/vector-2.4/lib/OpenLayers/Geometry/Point.js
   sandbox/vector-2.4/tests/Geometry/test_Point.html
Log:
Geometry.Point now overrides getBounds() to return something sensible and
non-null.


Modified: sandbox/vector-2.4/lib/OpenLayers/Geometry/Point.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Geometry/Point.js	2007-03-06 01:09:39 UTC (rev 2363)
+++ sandbox/vector-2.4/lib/OpenLayers/Geometry/Point.js	2007-03-06 01:23:44 UTC (rev 2364)
@@ -83,6 +83,14 @@
     },
 
     /**
+    * @type OpenLayers.Bounds
+    */
+    getBounds: function () {
+        return new OpenLayers.Bounds( this.lon, this.lat,
+                                      this.lon, this.lat );
+    },
+
+    /**
      * @returns the coordinates as a string
      * @type String
      */

Modified: sandbox/vector-2.4/tests/Geometry/test_Point.html
===================================================================
--- sandbox/vector-2.4/tests/Geometry/test_Point.html	2007-03-06 01:09:39 UTC (rev 2363)
+++ sandbox/vector-2.4/tests/Geometry/test_Point.html	2007-03-06 01:23:44 UTC (rev 2364)
@@ -20,6 +20,15 @@
         t.eq( point.lat, 20, "point.lat is set correctly");
     }
 
+    function test_02_Point_getBounds (t) {
+        t.plan(4);
+        point = new OpenLayers.Geometry.Point(10, 20);
+        bounds = point.getBounds();
+        t.eq( bounds.left, 10, "bounds.left is 10" );
+        t.eq( bounds.right, 10, "bounds.right is 10" );
+        t.eq( bounds.top, 20, "bounds.top is 20" );
+        t.eq( bounds.bottom, 20, "bounds.bottom is 20" );
+    }
   // -->
   </script>
 </head>



More information about the Commits mailing list