Here's an idea that may sound complicated, but it isn't, though depending on the number of boats it may or may not be feasible.
You could have one base map, normal, visible, and one additional invisible map for each boat, all stacked on top of each other. You add each boat on it's own map, but since the map is invisible, (no tiles), it all looks like one map. To make the boat move, you pan the map, and to check collisions you do it the same way you're doing it now. This demo uses that principle to make the state polygons draggable: http://maps.forum.nu/gm_place_that_state.html New states are added to an invisible map. When you drag the state to its location you're actually panning the invisible map, and once you reach the correct location, the polygon is transferred from the invisible map to the visible one. As you can see, the movement is perfectly smooth, even in IE. -- Marcelo - http://maps.forum.nu -- On Feb 15, 8:54 pm, splasher2001 <[email protected]> wrote: > Hi, > > I'm develoiping a web application that uses a GMap embedded in my web > page. > > Here is the link: > > http://www.scrapeworld.com/GMapTest/polygon_redraw.html > > I am trying to draw the sihouette of a boat that moves around on the > water in "real time". > Right now I am doing this by removing and adding polygon overlays. I > do this because I want the polygon to keep the correct size as the > user zooms in and out and also I will want to detect collisions > between boats (polygon overlap). > > The problem is that the adding and removing of the overlay seems to > cause IE7 and IE8 to grind to a halt (I am doing it every 100msecs). > Chrome 4.0 suffers as well, but not to such an extent. > > I am considering changing the code so that the boat is represented by > a div image (that is displayed at an angle of rotation) and I use a > different image depending on the zoom level. The disadvantage in using > images is that I can't see straight away how to detect colissions > between boats! > > Can anyone advise how I might improve the performance? > > Regards, > > splasher -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
