[OpenLayers-Dev] return from renderer.drawFeature
ahocevar at opengeo.org
Fri Apr 1 04:30:37 EDT 2011
Renderer.SVG returns null from drawFeature when a feature was not completely rendered (i.e. clipped somewhere to not exceed the maximum coordinate value). This is missing in the Renderer::drawFeature API docs. So if we could get rid of Renderer.SVG and replace it with Renderer.SVG2, we could change Layer.Vector so it only adds features to the unrenderedFeatures array when Renderer.DrawFeature returns false. Right now, we should check for === false || === null.
I created http://trac.osgeo.org/openlayers/ticket/3235 for this. Patch to come.
On Apr 1, 2011, at 00:39 , Tim Schaub wrote:
> It looks like since r7930 we've been expecting renderers to return truthy values for features that actually get rendered.
> The canvas renderer missed this change.
> So, unless I'm misreading, for the past 2.5 years we've been doing an unnecessary drawFeature call for every feature on every pan in the canvas renderer.
> Volker Grabsch just put up a patch on a ticket so that we always return true in the canvas renderer's drawFeature method. I committed a variant of that patch so the method acts more like the other renderers.
> To be consistent with the NG renderer, the canvas renderer returns undefined if the feature has no geometry. I see there are other tickets about dealing with features outside the extent of the viewport, and I assume these would result in a false return.
> I'm unclear why there needs to be a difference in the return here. The vector layer only checks if the return is falsey. I'm not sure if there are any other custom renderers out there, but it would be safer in my opinion to check for === false in the vector layer.
> Does anybody know if the difference in the returns is significant here?
> Tim Schaub
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.
> Dev mailing list
> Dev at lists.osgeo.org
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Dev