I need to use maps v3 API with GWT, but I've a problem on map showing.
I created a custom map (with a custom image) in this way:
********************************************************************************************
public class MapContainer{
public native JavaScriptObject creaImageMap(Element e, String
path, String imageName, int zoomMax, int zoomStart, boolean navMap,
boolean draggable, boolean zooming, boolean controls) /*-{
function ImageProjection() {};
ImageProjection.prototype.fromLatLngToPoint = function(latlng) {
var origine=256/2;
var pplon=256/360.0;
var pplat=256/180.0;
var x=Math.round(((origine)+(latlng.lng()*pplon)));
var y=Math.round(((origine)-(latlng.lat()*pplat)));
return new $wnd.google.maps.Point(x, y);
};
ImageProjection.prototype.fromPointToLatLng = function(point) {
var origine=256/2;
var glonpp=360/(256);
var glatpp=180/(256);
var lat=((origine)-point.y)*(glatpp);
var lon=(((-1)*(origine))+point.x)*(glonpp);
return new $wnd.google.maps.LatLng(lat, lon);
};
var imageMap;
var imageMapType = new $wnd.google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
var tiles = 1 << zoom; // è equivalente a 2^zoom
// Don't wrap tiles
if (coord.y < 0 || coord.y >= tiles) {
return null;
}
if (coord.x < 0 || coord.x >= tiles) {
return null;
}
var x = coord.x;
var y=coord.y;
var nome="t";
for(k=0;k<zoom;k++){
tiles=tiles/2;
if(y<tiles){
if(x<tiles){
nome+="q";
}
else{
nome+="r";x-=tiles;
}
}
else{
if(x<tiles){
nome+="t";y-=tiles;
}
else{
nome+="s";x-=tiles;y-=tiles;
}
}
}
var immagine=percorso+nomeImage+'-tiles/'+nome+'.jpg';
return immagine;
},
tileSize: new $wnd.google.maps.Size(256, 256),
isPng: true,
minZoom: 0,
maxZoom: zoomMax,
name: 'Image'
});
imageMapType.projection = new ImageProjection();
if(navMap){
var omcOptions={
opened: true,
}
var mapOptions = {
backgroundColor:"#000000",
zoom: zoomStart,
center: new $wnd.google.maps.LatLng(0,0),
overviewMapControl: true,
overviewMapControlOptions: omcOptions,
draggable: draggable,
disableDoubleClickZoom: !zooming,
scrollwheel: zooming,
zoomControl: controls,
panControl: controls,
mapTypeControl: controls,
mapTypeControlOptions: {
mapTypeIds: ['imageMap']
}
};
}
else{
var mapOptions = {
backgroundColor:"#000000",
zoom: zoomStart,
center: new $wnd.google.maps.LatLng(0,0),
draggable: draggable,
disableDoubleClickZoom: !zooming,
scrollwheel: zooming,
zoomControl: controls,
panControl: controls,
mapTypeControl: controls,
mapTypeControlOptions: {
mapTypeIds: ['imageMap']
}
};
}
imageMap = new $wnd.google.maps.Map(e, mapOptions);
imageMap.mapTypes.set('imageMap', imageMapType);
imageMap.setMapTypeId('imageMap');
return imageMap;
}-*/;
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment