views:

49

answers:

0

I'm getting stuck on a piece of code, mostly because Google's API is quite unhelpful when getting errors due to the packing.

I'm trying to render a circle around a marker via a click listener on my DataView. It renders the markers just fine, but when I attempt to create a GPolyline (the error occurs when I attempt to create GPolyline not when I try to add the overlay). The error firebug reports is:

a is undefined [Break on this error]
function Eh(a){x(gd).EU();eval(a)}

Offending code is below:

listeners: { 
    selectionchange: { 
        fn: function(dv,node){ 
            Ext.getCmp('mapPanel').getMap().clearOverlays(); 
            var day = $(node).children('.weekly-day').text(); 
            store.each(function(rec) { 
                if (rec.data.weekday==day) { 
                    for (i=0;i<rec.data.games.length;i++) { 
                        var game = rec.data.games[i]; 
                        var point = new GLatLng(game.host_lat,game.host_lng); 
                        var icon = new GIcon(G_DEFAULT_ICON); 
                        icon.image = '/media/images/admin/map_marker_' + game.level_class + '.png'; 
                        icon.iconSize = new GSize(26,35); 
                        var options = { 
                            icon: icon 
                        } 
                        Ext.getCmp('mapPanel').getMap().addOverlay(new GMarker(point,options)); 
                        var points = []; 
                        var radius = 10; 
                        var d2r = Math.PI/180; 
                        var r2d = 180/Math.PI; 
                        var Clat = (radius / 3963)*r2d; 
                        var Clng = Clat/Math.cos(game.host_lat*d2r); 
                        for (var j=0;j<41;j++) { 
                            var theta = Math.PI * (j / (j/2)); 
                            Cx = game.host_lng + (Clng * Math.cos(theta)); 
                            Cy = game.host_lat + (Clat * Math.sin(theta)); 
                            points.push(new GLatLng(Cy,Cx)); 
                        } 
                        points.push(points[0]); 
                        Ext.getCmp('mapPanel').getMap().addOverlay(new GPolyline(points,'#ff0000',5,.8)); 
                    } 
                } 
            }); 
        } 
    } 
}  

At this point, I'm completely lost. Any thoughts?