[OpenLayers-Dev] unnecessary method invocations ...

Paul Spencer pspencer at dmsolutions.ca
Thu Sep 27 01:28:32 EDT 2007


I'm starting to look at the impact of modifying rendering in  
singleTile layers to not clear the existing tile until the new tile  
arrives.  As I try to grok the code related to this, I'm running into  
a couple of things I think are unnecessary.  My understanding of the  
code is still perhaps too limited to understand if the following are  
extraneous or not, but I thought I would throw it out there and see  
if others can explain why they are necessary:

At the end of initSingleTile in Grid.js, there is a call to:

this.removeExcessTiles(1,1);

This seems unnecessary to me as several lines before, this.grid is  
set to an empty array and exactly one new tile is added to it.  It  
does not seem to me that this.grid can contain any more than one tile  
at the point removeExcessTiles is called and therefore this is pure  
overhead (not much, I grant).

In Tile.js moveTo, this.clear() is called prior to calling this.draw 
(), which also calls this.clear().  It seems calling this.clear in  
moveTo is unnecessary.  This is not quite true because there is a  
code path involving the redraw variable where this.draw() is not  
called and so the clear would need to be done in the alternate path.   
Of course, if you are moving a layer and not redrawing it, should you  
clear it?

Discussion invited :)

Cheers

Paul

+-----------------------------------------------------------------+
|Paul Spencer                          pspencer at dmsolutions.ca    |
+-----------------------------------------------------------------+
|Chief Technology Officer                                         |
|DM Solutions Group Inc                http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+








More information about the Dev mailing list