PDA

View Full Version : GMapPanel and new Tiles ?



terra75
8 Mar 2014, 4:21 AM
Hello,

i have a simple Question.

how do I change the tiles in google map?

I have insert the GMap in a Tab.

Ext.define('GW2.view.pages.map', {
extend : 'Ext.Container',
xtype : 'maptab',
id : 'maptab',

requires: ['Ext.ux.GMapPanel'],

initComponent : function () {
var me = this;

Ext.apply(me, {

//layout : 'border',
items : [{
region : 'north',
xtype : 'toolbar',
border : true,
componentCls : 'x-panel-header-default',
cls: 'top-border',
items : [{
text: 'test'
}]
}, {
xtype: 'gmappanel',
region: 'center',
id: 'mygooglemap',
zoom: 12,
disableDefaultUI: true,
height: 500,
gmapType: 'map',
mapConfOpts:['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
mapControls: [],
center: new google.maps.LatLng (40,40),

}
]

});
me.callParent();
}
});
I have seen this:
https://github.com/codemasher/gw2api-tools/blob/master/examples/gw2maps-gmaps-simple.html

If i add getTileUrl: in the Map Block, do nothing.


Ext.define('GW2.view.pages.map', {
extend : 'Ext.Container',
xtype : 'maptab',
id : 'maptab',

requires: ['Ext.ux.GMapPanel'],

initComponent : function () {
var me = this;

var get_tile = function(coords,zoom){
if(coords.y < 0 || coords.x < 0 || coords.y >= (1 << zoom) || coords.x >= (1 << zoom)){
return "http://wiki-de.guildwars2.com/images/6/6f/Kartenhintergrund.png";
}
return "https://tiles.guildwars2.com/"+gmap.getMapTypeId()+"/1/"+zoom+"/"+coords.x+"/"+coords.y+".jpg";
};

Ext.apply(me, {

//layout : 'border',
items : [{
region : 'north',
xtype : 'toolbar',
border : true,
componentCls : 'x-panel-header-default',
cls: 'top-border',
items : [{
text: 'test'
}]
}, {
xtype: 'gmappanel',
region: 'center',
id: 'mygooglemap',
zoom: 12,
disableDefaultUI: true,
height: 500,
gmapType: 'map',
mapConfOpts:['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
center: new google.maps.LatLng (40,40),
getTileUrl: get_tile
}
]

});
me.callParent();
}
});



What is wrong?
Please help !!

Terra

slemmon
13 Mar 2014, 2:29 PM
Hi,

The GMapPanel is really just a way to wrap the map API/target in an Ext component. Any of the map-specific questions will be best asked on the Google Maps forums.

Best of luck!