Mercurial > hg > batmud > gmap2
view map.js @ 0:f8eeb66cdb07 gmap2
initial commit of new map
author | jeskko |
---|---|
date | Fri, 29 May 2009 01:42:40 +0000 |
parents | |
children |
line wrap: on
line source
var map = new GMap2(document.getElementById("map"),{draggableCursor: 'crosshair', draggingCursor: 'pointer'}); map.enableContinuousZoom(); map.enableScrollWheelZoom(); map.addControl(new GSmallZoomControl3D()); var copyright = new GCopyright(1, new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)), 0, "Map data by BAT ry, Ooga, Ggr, Slobber and Jeskko"); var cc = new GCopyrightCollection('BatMUD'); cc.addCopyright(copyright); var tl = [new GTileLayer(cc, 2, 10), new GTileLayer(cc, 2, 10)]; tl[0].getTileUrl=function(a,b){ return "/map/tiles/"+(b)+"/"+a.y+"/"+a.x+".png"; } tl[1].getTileUrl=function(a,b){ return "/map/overlay.php?x="+a.x+"&y="+a.y+"&zoom="+(b); } var custommap = new GMapType(tl, new GMercatorProjection(12),"BatMud", {errorMessage:"No data available"}); map.addMapType(custommap); map.setCenter(new GLatLng(-20.2828,16.0620),3,custommap); var proj=map.getCurrentMapType().getProjection(); google.maps.Event.addListener(map, "mousemove", function(point) { var p=proj.fromLatLngToPixel(point,7); tx=Math.round((p.x-16383)/2)-1; ty=Math.round((p.y-16383)/2)-1; xx=tx; yy=ty; cont="Deep Sea"; if (tx>0&&tx<829&&ty>0&&ty<783) { cont="Laenor"; xx=tx; yy=ty; } if (tx>1210&&tx<1653&&ty>1154&&ty<1655) { cont="Furnachia"; xx=tx-1210; yy=ty-1154; } if (tx>1310&&tx<1792&&ty>-1256&&ty<-774) { cont="Rothikgen"; xx=tx-1310; yy=ty-1256; } if (tx>-635&&tx<68&&ty>2344&&ty<2847) { cont="Lucentium"; xx=tx+635; yy=ty-2344; } if (tx>-1211&&tx<-669&&ty>819&&ty<1352) { cont="Desolathya"; xx=tx+1211; yy=ty-819; } if (tx>2066&&tx<2238&&ty>-912&&ty<-825) { cont="Renardy"; xx=tx-2068; yy=ty+910; } document.getElementById("xcoord").innerHTML=xx; document.getElementById("ycoord").innerHTML=yy; document.getElementById("continent").innerHTML=cont; });