In V2, you can use the "redraw" method of GOverlay.  In V3, you will
have to add a "bounds-changed" event listener on the map.  I have
asked Google to provide a method similar to "redraw" for OverlayView
but it was rejected.

Calculate the tile number for the left/right & upper/lower edges of
the visible part of the container DIV.  I have found "clientWidth" &
"clientHeight" to be more reliable than using the "getSouthWest(") &
"getNorthEast()" methods.

The extreme pixels are:

    x0=centerXpixel - ((div.clientWidth+1)>>1)
    x1=centerXpixel + ((div.clientWidth+1)>>1)
    y0=centerYpixel - ((div.clientHeight+1)>>1)
    y1=centerYpixel + ((div.clientHeight+1)>>1)

the extra pixel is to compensate for truncation if the width or height
are odd numbers.

The extreme tiles are:

    X0=x0>>8
    X1=((x1-1)>>8)+1
    Y0=y0>>8
    Y1=((y1-1)>>8)+1

If the extreme tiles have not changed since the previous "redraw", do
nothing.  Otherwise, shuffle tiles.  One way is to replace tiles is
with a "removeChild" / "appendChild" sequence.  Another way is to
recycle the same tiles.

You do not have to add "moveend" and "zoomend" event listeners because
you can catch everything important in the "redraw" method.  You will
ignore everything unless X0 or X1 or Y0 or Y1 has changed.

Look at the "redraw" function of:

    www.polyarc.us/sparsetile.js

It lacks a couple of bug fixes.  It still uses the "getSouthWest()" &
"getNorthEast()" methods which may produce erroneous results.  It also
produces incorrect tile numbers near the International Date Line.  It
is superceded by:

    www.polyarc.us/polycluster.js

where the tile replacement function is less obvious.

In my opinion, using DOM listeners is a mistake.  Digging through the
DOM may not be legal.  Regardless, it is slow and error prone.

Google has already changed the DOM structure for V3 a couple of times
in the past month.  Each tile is contained in its own DIV.
Previously, each tile shared the same parent.  The "overlay" panes are
above the tiles in the DOM.  Previously, the "overlay" panes were
below the tiles in the DOM.  The "z-index" values are the same but the
DOM placement has changed.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to Google-Maps-API@googlegroups.com
To unsubscribe from this group, send email to 
google-maps-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to