One way to work around the issue of sending extra data over the wire
(and oddly, at first glance to save a bit of time on creating the
individual lat/lng points though I haven't actually time tested this)
is to just create the GPolygon.fromEncoded like before, but instead of
adding it as an overlay, make a simple little function to then create
a new polygon from that one by pushing each vertex into a points list,
eg:

    poly_from_encoded_poly_vertices : function(poly){
        var pts = [];
        for (var i=0; i < poly.getVertexCount(); i++){
            pts.push(poly.getVertex(i));
            }
        return new GPolygon(pts, "#f33f00", 5, 1);
        },

Though obviously simplying your polygon first is probably a good idea
as well -- 1500 vertices will definitely be slow in IE.

Cheers,

 -Josh

On May 12, 2:14 am, "Alex (cp9)" <[email protected]> wrote:
> Hi all,
>
> i've a big Speed Problem with redrawing / setFillStyles on
> GPolygons.fromEncoded.
>
> I'am adding GPolygons via addOverlay(polygon) to the Google Map.
> The Polygons were created by using GPolygon.fromEncoded(); to speed up
> polygon/polyline creation by creating them on the server.
>
> I registered a mouseover event listener on the polygon(s), to change
> the color if you enter the polygon with the mousepointer.
>
> ....
> GEvent.addListener(polygon, "mouseover", function(){
>  this.setFillStyle({color:'#FF0000']);});
>
> ...
>
> On the mouseout event i set the fillstyle to the origin style. So if
> the mousepointer enter the polygon, it will change his color.
>
> Changing the color works, but is very slow for big polygons.
> The polyline contains about 1500 points. They are encoded by the
> server.
>
> Calling setFillstyle on this polygon, lets the polygon disappear and
> than it is shown with the new fill color. But from disappearing until
> redraw there is a lag from about 1 second. - which is very very much.
> If you move the mouse from one polygon to another than both will
> disappear than one will appear with its origin fillcolor (mouseout)
> and than the other polygon appears with his new hover Color
> (onmouseover). This looks very very bad.
>
> This was very very quick without any recognizable lag when you use
> GPolygon without fromEncoded. But than the Polygon needs to load very
> long on first time. Because the data to send for a Polygon with 1500
> Points is about 10 times bigger if it is not encoded. And on the
> client side you have to create GPoints for all the 1500 Points to
> create the GPolyline. This needs long time.
>
> I hope someone can help me to solve this problem. I already searched
> for a solution for a few days, but did not find anything.
>
> Thank you very much
>
> Alex (cp9)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to