PDA

View Full Version : Google Maps API integration with ExtJS



paquerette
17 Sep 2013, 4:31 AM
Hi,

I'm trying to use "Shea Frederick - http://www.vinylfox.com" GMap Panel, to switch from google map v2, to google map v3, as V2 will soon be stopped.

I'm trying to customize this lib to add additional functionality...

the first one is to be able to center the map on a specific coordinates...

And I've a weird behaviour :


From Firebug, I can see the inner object gmap and method getMap(), but within the code, if I try to reach the code, it says undefined... whatever the method I try to get it :


try
{
this.getMap().panTo(new google.maps.LatLng(latitude,longitude));
}
catch(e)
{
console.log(e);
}

try
{
this.gmap.panTo(new google.maps.LatLng(latitude,longitude));
}
catch(e)
{
console.log(e);
}


try
{
Ext.getCmp('lieu-editor-gmap-panel').getMap().panTo(new google.maps.LatLng(latitude,longitude));
}
catch(e)
{
console.log(e);
}

try
{
Ext.getCmp('lieu-editor-gmap-panel').gmap.panTo(new google.maps.LatLng(latitude,longitude));
}
catch(e)
{
console.log(e);
}


45839

45841


Any ideas?

Any other framework for ExtJS+GoogleMaps API integration ?

Thanks,
Thomas.

paquerette
17 Sep 2013, 5:54 AM
As I suspected a racing condition (I call the goTo method before the object is ready)
So I wait 5 secondes before calling the goTo method :

window.setTimeout(function(){map.goTo(gpsArray[0], gpsArray[1]);}, 5000);


My goTo method is looking like this :

goTo:function(thisobject, latitude, longitude)
{


try
{
this.gmap.panTo(new google.maps.LatLng(latitude,longitude));
}
catch(e)
{
console.log(e);
}
}


And I get this error :

InternalError: too much recursion






...]||(a[b]=[]);return a[b]}function od(a,b){return a[b]?a[b][C]:0};var pd=/'/g;fun...



Ext.ux...5511434 (line 402)



which I don't understand how a recursion could happen from my code...

Thomas.