OpenLayers OpenLayers

Ticket #1602 (closed bug: invalid)

Opened 2 months ago

Last modified 1 month ago

Vector features won't draw in IE if features are very far outside the visible extent

Reported by: ahocevar Assigned to:
Priority: minor Milestone: 2.7 Release
Component: general Version: 2.6
Keywords: Cc:
State: Complete

Description

According to this thread, there are problems in Internet Explorer when zooming in very far on vector layers with a data extent much larger than the visible extent.

This can be avoided if only features inside the the visible extent are painted.

The drawback of this method is that this requires the bounds of each geometry to be calculated, which is very slow in IE.

Attached is a fix for lib/Renderer/Renderer.js. The patch also contains an example (tests/manual/vector-features-performance.html) which shows performance of this on the Firebug console, compared to the way things are done in trunk.

I would not recommend to put this into trunk. This issue can be avoided by using techniques like WFS (with a bbox strategy) to add vector features to a map, where only features for the visible extent are requested from the server.

Attachments

features-outside-extent.patch (5.9 kB) - added by ahocevar on 06/30/08 18:23:56.
features-outside-extent.2.patch (6.2 kB) - added by ahocevar on 07/17/08 09:43:19.
new version, now only affects the VML renderer

Change History

06/30/08 18:23:56 changed by ahocevar

  • attachment features-outside-extent.patch added.

06/30/08 18:32:01 changed by ahocevar

  • state set to Review.
  • milestone set to 2.7 Release.

Update: I created a new performance test with LinearRing geometries. Also, we can now see the difference between the first and subseqent render passes. The first will be slower because the bboxes of the geometries will be cached.

The results are promising, so I've changed my mind and think now that this should go into trunk:

Firefox 2 (Linux):

First run - feature bboxes will be cached
addFeatures: 136ms
Test with all features inside extent
addFeatures: 106ms
addFeaturesOld: 113ms
Test with some features outside extent
addFeatures: 52ms
addFeaturesOld: 87ms

Internet Explorer 7 (Linux, inside VirtualBox):

First run - feature bboxes will be cached
addFeatures: 8232ms
Test with all features inside extent
addFeatures: 8572ms
addFeaturesOld: 7851ms
Test with some features outside extent
addFeatures: 2233ms
addFeaturesOld: 5537ms

(follow-up: ↓ 3 ) 07/11/08 16:26:58 changed by elemoine

Hi Andreas, thanks for your investigation on this bug and the performance tests. This is serious work! Looking at your patch, I've been wondering if the bounds calculation and intersection could go in VML.js since this is an IE-specific issue, I'm thinking of VML::setStyle. What you think?

(in reply to: ↑ 2 ) 07/17/08 09:38:28 changed by ahocevar

Replying to elemoine:

Hi Andreas, thanks for your investigation on this bug and the performance tests. This is serious work! Looking at your patch, I've been wondering if the bounds calculation and intersection could go in VML.js since this is an IE-specific issue, I'm thinking of VML::setStyle. What you think?

VML::setStyle is too late to do that. But I created a new patch which overrides drawFeature in Renderer.VML.

As the performance test shows, this will increase performance on IE as soon as there is a certain amount of features outside the visible extent:

First run - feature bboxes will be cached
addFeatures: 9051ms
Test with all features inside extent
addFeatures: 9263ms
addFeaturesOld: 8552ms
Test with some features outside extent
addFeatures: 2534ms
addFeaturesOld: 7211ms

07/17/08 09:43:19 changed by ahocevar

  • attachment features-outside-extent.2.patch added.

new version, now only affects the VML renderer

07/17/08 16:52:59 changed by elemoine

  • state changed from Review to Commit.

Andreas, one thing: VML::drawFeature doesn't have the description of its parameters in the ND comments. With this, and if you confirm that the unit tests pass, I'm fine with the patch. Thanks.

07/18/08 08:24:46 changed by ahocevar

  • status changed from new to closed.
  • state changed from Commit to Complete.
  • resolution set to fixed.

(In [7546]) "Vector features won't draw in IE if features are very far outside the visible extent". r=elemoine (closes #1602)

07/21/08 05:06:49 changed by pgiraud

  • status changed from closed to reopened.
  • resolution deleted.

I may be wrong but it seems like tests are breaking with this patch on IE6.

07/21/08 06:03:54 changed by ahocevar

  • status changed from reopened to closed.
  • resolution set to invalid.

The failing of the tests for Handler.Path and Handler.Polygon is not related to this patch.

07/21/08 08:38:25 changed by pgiraud

I'm still convinced that this is related to this patch. However, I'm leaving this ticket closed because this raised another problem. I'm opening a new ticket for that (#1623).

07/21/08 09:57:07 changed by pgiraud

(In [7552]) handlers test are not reflecting the reality, we now simulate a click, move then click \n that way geometry bounds are cleared, and the tests don't fail in IE6 anymore (See #1602), r=ahocevar,crschmidt (Closes #1623)