[OpenLayers-Commits] r12205 - in trunk/openlayers:
lib/OpenLayers/Renderer tests/Renderer
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed Aug 3 11:47:07 EDT 2011
Author: fredj
Date: 2011-08-03 08:47:06 -0700 (Wed, 03 Aug 2011)
New Revision: 12205
Modified:
trunk/openlayers/lib/OpenLayers/Renderer/Canvas.js
trunk/openlayers/tests/Renderer/Canvas.html
Log:
handle features with null bounds in OpenLayers.Renderer.Canvas.drawFeature. p=arublev,me r=erilem (closes #3442)
Modified: trunk/openlayers/lib/OpenLayers/Renderer/Canvas.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Renderer/Canvas.js 2011-08-03 14:39:55 UTC (rev 12204)
+++ trunk/openlayers/lib/OpenLayers/Renderer/Canvas.js 2011-08-03 15:47:06 UTC (rev 12205)
@@ -140,8 +140,9 @@
if (feature.geometry) {
style = this.applyDefaultSymbolizer(style || feature.style);
// don't render if display none or feature outside extent
- rendered = (style.display !== "none") &&
- feature.geometry.getBounds().intersectsBounds(this.extent);
+ var bounds = feature.geometry.getBounds();
+ rendered = (style.display !== "none") && !!bounds &&
+ bounds.intersectsBounds(this.extent);
if (rendered) {
// keep track of what we have rendered for redraw
this.features[feature.id] = [feature, style];
Modified: trunk/openlayers/tests/Renderer/Canvas.html
===================================================================
--- trunk/openlayers/tests/Renderer/Canvas.html 2011-08-03 14:39:55 UTC (rev 12204)
+++ trunk/openlayers/tests/Renderer/Canvas.html 2011-08-03 15:47:06 UTC (rev 12205)
@@ -123,7 +123,7 @@
return;
}
- t.plan(8);
+ t.plan(10);
var layer = new OpenLayers.Layer.Vector(null, {
isBaseLayer: true,
renderers: ["Canvas"]
@@ -183,6 +183,15 @@
t.eq(count, 1, "d) redraw is called when drawing a feature outside renderer extent");
renderer.clear();
+ // e) draw a polygon feature without bounds
+ count = 0;
+ exp = renderer.drawFeature(
+ new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon()), {}
+ );
+ t.eq(exp, false, "d) drawFeature returns false");
+ t.eq(count, 1, "d) redraw is called when drawing a feature without bounds");
+ renderer.clear();
+
map.destroy();
}
More information about the Commits
mailing list