Ticket #1782 (closed bug: fixed)
Multipoly rendering skips 2nd - Nth poly when first poly is outside extents.
| Reported by: | dzwarg | Owned by: | ahocevar |
|---|---|---|---|
| Priority: | major | Milestone: | 2.8 Release |
| Component: | Renderer.Elements | Version: | 2.7 |
| Keywords: | Cc: | ||
| State: | Complete |
Description
OpenLayers.Geometry.MultiPolygons* are not rendered properly when the first polygon is outside the extent of the map.
In OpenLayers.Renderer.Elements, line 466-467 (at time of reporting), the drawGeometry command is short-circuited with: rendered = rendered && drawGeometry(geometry.components[i], style, featureId); and the polygons of index 1 ... geometry.components.length - 1 are never drawn if the first one was removed from the map.
Consider this case:
- a MultiPolygon is rendered on a Vector layer
- said MultiPolygon geometry has more than one component
- client is zooming in to an extent where the entire MultiPolygon is outside the map extent
The first time through this loop (the first Polygon of the MultiPolygon), the drawGeometry method is called, and the first polygon is un-rendered/removed. The rendered state is set to false, and all subsequent attempts to call drawGeometry() are short-circuited by the fact that rendered is false, so the second part of rendered && drawGeometry(...) is never evaluated.
* probably for OpenLayers.Geometry.Collection, OpenLayers.Geometry.MultiPoint, OpenLayers.Geometry.MultiLineString, too.

