[OpenLayers-Users] Cannot upgrade to 2.6 because of vector lines disappearing in IE (Frustrated)

Christopher Schmidt crschmidt at metacarta.com
Thu Jun 26 14:05:15 EDT 2008


On Thu, Jun 26, 2008 at 07:54:23PM +0200, Andreas Hocevar wrote:
> Ok, I did some investigation.
> 
> The reason why this testcase fails is that the two features are far
> away from each other. So the SVG renderer will find that the
> coordinates are not in valid range (because too large), and the VML
> renderer fails for reasons not clear to me.
> 
> Two separate workarounds are needed, one for IE and one for FF. In IE,
> we have to modify renderer.drawFeature to only draw features that
> intersect the map extent. The FF workaround is to just return always
> true in renderer.inValidRange. Be warned that the FF workaround will
> likely cause FF2 to crash, but as I hear from Linda, her users do not
> use FF anyway.
> 
> Ok, attached is a working version of the test case. The relevant code
> snippet (to be put in the init function, after instantiation of the
> vector layer) is:
> 
> vectorLayer.renderer.inValidRange = function() {
>     return true;
> };
> vectorLayer.renderer.drawFeature = function(feature, style) {
>     if(!feature.geometry.intersects(feature.layer.map.getExtent().toGeometry()))
> {
>         return;
>     }
>     OpenLayers.Renderer.prototype.drawFeature.apply(this, arguments);
> };
> 
> 
> We might consider to add the second workaround to trunk, because it
> will reduce the number of features to be rendered. On the other hand,
> the intersects check is quite expensive.

If we were going to do this, I'd say we should instead use
geometry.getBounds() and map.getBounds() and check intersectsBounds() on
them, rather than using the (more expensive) geometry.intersects(),
since mostly what we care about here is bbox intersection.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list