[OpenLayers-Commits] r11819 - in trunk/openlayers:
lib/OpenLayers/Geometry tests/Geometry
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed Mar 30 19:54:59 EDT 2011
Author: tschaub
Date: 2011-03-30 16:54:54 -0700 (Wed, 30 Mar 2011)
New Revision: 11819
Modified:
trunk/openlayers/lib/OpenLayers/Geometry/LinearRing.js
trunk/openlayers/tests/Geometry/LinearRing.html
Log:
Making it so you can remove more points from a linear ring. p=gregers, r=me (closes #2172)
Modified: trunk/openlayers/lib/OpenLayers/Geometry/LinearRing.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Geometry/LinearRing.js 2011-03-30 23:38:31 UTC (rev 11818)
+++ trunk/openlayers/lib/OpenLayers/Geometry/LinearRing.js 2011-03-30 23:54:54 UTC (rev 11819)
@@ -93,7 +93,7 @@
* point - {<OpenLayers.Geometry.Point>}
*/
removeComponent: function(point) {
- if (this.components.length > 4) {
+ if (this.components.length > 3) {
//remove last point
this.components.pop();
Modified: trunk/openlayers/tests/Geometry/LinearRing.html
===================================================================
--- trunk/openlayers/tests/Geometry/LinearRing.html 2011-03-30 23:38:31 UTC (rev 11818)
+++ trunk/openlayers/tests/Geometry/LinearRing.html 2011-03-30 23:54:54 UTC (rev 11819)
@@ -58,7 +58,7 @@
}
function test_LinearRing_removeComponent(t) {
- t.plan(11);
+ t.plan(10);
var components = [new OpenLayers.Geometry.Point(0,0),
new OpenLayers.Geometry.Point(0,10),
@@ -71,7 +71,7 @@
t.eq(ring.components.length, 4, "removing from linear ring with 5 points: length ok");
t.ok(ring.components[0].equals(components[0]), "point one correct");
t.ok(ring.components[1].equals(components[1]), "point two correct");
- t.ok(ring.components[2].equals(components[3]), "point one correct");
+ t.ok(ring.components[2].equals(components[3]), "point three correct");
t.ok(ring.components[0] === ring.components[ring.components.length - 1],
"first and last point are the same");
@@ -80,10 +80,10 @@
t.ok(ringBounds.equals(testBounds), "bounds correctly recalculated");
ring.removeComponent( ring.components[2] );
- t.eq(ring.components.length, 4, "cant remove from linear ring with only 4 points. new length ok (unchanged)");
+ ring.removeComponent( ring.components[1] );
+ t.eq(ring.components.length, 3, "cant remove from linear ring with only 3 points. new length ok");
t.ok(ring.components[0].equals(components[0]), "point one correct");
t.ok(ring.components[1].equals(components[1]), "point two correct");
- t.ok(ring.components[2].equals(components[3]), "point one correct");
t.ok(ring.components[0] === ring.components[ring.components.length - 1],
"first and last point are the same");
More information about the Commits
mailing list