myput
13 Sep 2011, 6:29 AM
hi,
i have a problem for showing a map and my current location.
I just want to precise i work on computer, a simple editor and i test it on Safari. I don't use phonegap.
Cause it's maybe cause of the environment parameters...
Someone can help me for the code please, cause after lot of researches, it's the only one code who display a map in my application. Then, i would like to keep this code, just don't understand why the app display palo altos during maybe 3 seconds.
Viewport call simply homecard who display the map
items: [
{xtype: 'homecard'},
{xtype: 'infoscard'},
],
And homecard:
myApp.views.Homecard = Ext.extend(Ext.Panel, {
layout:'card',
title: 'Infos',
iconCls: 'home',
initComponent: function(){
var infowindow = new google.maps.InfoWindow({
content: 'You are Here'
});
this.map = new Ext.Map({
mapOptions : {
zoom: 12,
timeout: 10000,
maximumAge: 20000,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.DEFAULT
},
autoUpdate:true,
},
useCurrentLocation: true,
listeners: {
maprender : function(comp, map){
var latlong = new google.maps.LatLng(comp.latitude, comp.longitude); // 45.936661, 6.630557
var marker = new google.maps.Marker({
position: latlong,
title : 'Here',
map: map
});
infowindow.open(map, marker);
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});
}
}
});
this.panel = new Ext.Panel({
layout:'fit',
items:this.map,
dockedItems:[
{
xtype:'toolbar',
title:'My Map',
}
]
});
this.items = this.panel;
myApp.views.Homecard.superclass.initComponent.call(this);
}
});
Ext.reg('homecard', myApp.views.Homecard);
This code display me palo altos during 3 seconds, and display my good location after. But, markers don't work, I don't know why,
var latlong = new google.maps.LatLng(comp.latitude, comp.longitude); // 11.111111, 1.111111
This code don't work. The marker is good when i give longitude and latitude
11.111111, 1.111111, but not when i put
comp.latitude, comp.longitude
If you know why ...
Thanks for your help :)
i have a problem for showing a map and my current location.
I just want to precise i work on computer, a simple editor and i test it on Safari. I don't use phonegap.
Cause it's maybe cause of the environment parameters...
Someone can help me for the code please, cause after lot of researches, it's the only one code who display a map in my application. Then, i would like to keep this code, just don't understand why the app display palo altos during maybe 3 seconds.
Viewport call simply homecard who display the map
items: [
{xtype: 'homecard'},
{xtype: 'infoscard'},
],
And homecard:
myApp.views.Homecard = Ext.extend(Ext.Panel, {
layout:'card',
title: 'Infos',
iconCls: 'home',
initComponent: function(){
var infowindow = new google.maps.InfoWindow({
content: 'You are Here'
});
this.map = new Ext.Map({
mapOptions : {
zoom: 12,
timeout: 10000,
maximumAge: 20000,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.DEFAULT
},
autoUpdate:true,
},
useCurrentLocation: true,
listeners: {
maprender : function(comp, map){
var latlong = new google.maps.LatLng(comp.latitude, comp.longitude); // 45.936661, 6.630557
var marker = new google.maps.Marker({
position: latlong,
title : 'Here',
map: map
});
infowindow.open(map, marker);
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});
}
}
});
this.panel = new Ext.Panel({
layout:'fit',
items:this.map,
dockedItems:[
{
xtype:'toolbar',
title:'My Map',
}
]
});
this.items = this.panel;
myApp.views.Homecard.superclass.initComponent.call(this);
}
});
Ext.reg('homecard', myApp.views.Homecard);
This code display me palo altos during 3 seconds, and display my good location after. But, markers don't work, I don't know why,
var latlong = new google.maps.LatLng(comp.latitude, comp.longitude); // 11.111111, 1.111111
This code don't work. The marker is good when i give longitude and latitude
11.111111, 1.111111, but not when i put
comp.latitude, comp.longitude
If you know why ...
Thanks for your help :)