One more thought: Recently, I've been working on an application that displays Canadian postal codes using GPolygons. When you use all 6 characters of the postal code, you have a tiny polygon, often smaller than a city block, and when users define territories based on the 6 character postal code you have a collection of thousands of tiny polygons. I have been able to display 4000 of those tiny polygons in Chrome and Firefox, without too much of an issue. IE is another story, of course. However, all browsers create the polygons very fast, and it is only when you addOverlay() that the trouble starts. Based on that, it might be an option to create 360 different polygons for each boat, each pointing in a different direction, and addOverlay() only the relevant one for the current direction of the boat. When the boat changes direction, you don't rotate the polygon but hide it, and replace it with the appropriate one, which has already been created.
Just a thought. :-) -- Marcelo - http://maps.forum.nu -- On Feb 16, 10:34 am, splasher2001 <[email protected]> wrote: > Hi Larry and Marcelo, > > Thanks for your quick replies. > > Larry, yes, I have checked for memory leaks but haven't found any > (yet). > The test web page I gave you is just a demo, so the dynamics of the > boat is not intended to be realistic. > > Marcelo, thanks for the suggestion about invisible layers. I have seen > this concept discussed before. > I'll give the idea a try and post my findings here when I have got > something working. > > Regards, > > Splasher > > On Feb 15, 10:53 pm, Marcelo <[email protected]> wrote: > > > > > On Feb 15, 11:43 pm, Marcelo <[email protected]> wrote: > > > > 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. > > > Addition: > > On the invisible maps, (boat maps), you only modify the polygons when > > the boat changes direction. > > To check for collisions, you create a copy of each boat on the > > application, but you don't addOverlay() them to any map. > > > -- > > Marcelo -http://maps.forum.nu > > -- > > > > 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.
