-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlightmap.min.js
More file actions
103 lines (99 loc) · 16.8 KB
/
Copy pathlightmap.min.js
File metadata and controls
103 lines (99 loc) · 16.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
<beginLegalBanter>
The MIT License (MIT)
Copyright (c) 2012 Francisco Valdez de la Fuente
Copyright (c) 2011 Charlie Andrews
Copyright (c) 2007 Klokan Petr Pridal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</endLegalBanter>
*/
Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){t=t||0
for(var i=this.length;i>t;){if(this[t]===e)return t;++t}return-1}),Array.prototype.remove=function(){for(var e,t,i=arguments,o=i.length;o&&this.length;)for(e=i[--o];-1!=(t=this.indexOf(e));)this.splice(t,1)
return this}
var LightMap=function(){var e=function t(e){function i(){for(var e=0;e<u.markers.length;e++)u.markers[e].boundsChanged()}function o(){i()}function n(e,i){if(!(0==e&&0==i||u.reallocating)){u.reallocating=!0
var n=1,l=u.XnumberOfTiles+(0!=e?n:0),s=u.YnumberOfTiles+(0!=i?n:0),a=e*n,m=i*n
u.Xcenter+=a,u.Ycenter+=m,u.center.x+=a,u.center.y+=m,0>e&&(u.leftEdge+=-1*a*u.tileSize),0>i&&(u.bottomEdge+=-1*m*u.tileSize),e>0&&(u.rightEdge+=a*u.tileSize),i>0&&(u.topEdge+=m*u.tileSize)
for(var d=[],A=0;l>A;A++){d.push([])
for(var c=0;s>c;c++){var h=u.center.x-u.Xcenter+A+a+u.minX,p=u.center.y-u.Ycenter+c+m+u.minY
if(A+a>=0&&A+a<u.XnumberOfTiles&&c+m<u.YnumberOfTiles&&c+m>=0?d[A].push(u.tiles[A+a][c+m]):(d[A].push(r(u.map,u.zoom,h,p,A+a+u.minX,c+m+u.minY)),u.getTile(d[A][c],u.zoom,h,p,A+a+u.minX,c+m+u.minY)),0==A&&0==c){var f={x:h,y:p}
u.tms||(f=t.GoogleTile(h,p,u.zoom))
var g=t.TileLatLonBounds(f.x,f.y,u.zoom,u.tileSize,u.initialResolution)
u.bounds[2]=g[2],u.bounds[1]=g[1],u.boundsTMS[2]=h,u.boundsTMS[1]=p,g=null}else if(A+1==l&&c+1==s){var f={x:h,y:p}
u.tms||(f=t.GoogleTile(h,p,u.zoom))
var g=t.TileLatLonBounds(f.x,f.y,u.zoom,u.tileSize,u.initialResolution)
u.bounds[0]=g[0],u.bounds[3]=g[3],u.boundsTMS[0]=h,u.boundsTMS[3]=p,g=null}}}u.XnumberOfTiles=l,u.YnumberOfTiles=s,u.tiles=null,u.tiles=d,0>e&&(u.minX+=a),0>i&&(u.minY+=m),o(),u.reallocating=!1}}function l(e,t){if(!u.movingMap)try{var i=e,o=t,l=0,s=0
i<-u.rightEdge&&(i=-u.rightEdge,l=1),o<-u.topEdge&&(o=-u.topEdge,s=1),i>u.leftEdge&&(i=u.leftEdge,l=-1),o>u.bottomEdge&&(o=u.bottomEdge,s=-1),n(l,s),u.map.style.left=i+"px",u.map.style.top=o+"px",u.xOffset=i,u.yOffset=o}catch(r){alert(r)}}function s(e,t,i,o,n){var l=2*e-1
if(!(l>t&&l>i&&0!=t%2&&0!=i%2||l>t+1&&l>i&&0==t%2&&0!=i%2||l>t&&l>i+1&&0!=t%2&&0==i%2||l>t+1&&l>i+1&&0==t%2&&0==i%2)){if(2>e)1==e&&u.getTile(u.tiles[o][n],u.zoom,u.center.x-u.Xcenter+o,u.center.y-u.Ycenter+n,o,n)
else for(var r=o-e+1;o+e>r;r++)for(var a=n-e+1;n+e>a;a++)t>r&&i>a&&(r==o-e+1||r==o+e-1||a==n-e+1||a==n+e-1)&&r>=0&&a>=0&&u.getTile(u.tiles[r][a],u.zoom,u.center.x-u.Xcenter+r,u.center.y-u.Ycenter+a,r,a)
s(e+1,t,i,o,n)}}function r(e,t,i,o,n,l){n=parseInt(n*u.tileSize)+"px",l=parseInt(l*u.tileSize)+"px"
var s=[],r=document.createElement("img")
return r.src=u.loading,r.style.left=n,r.style.top=l,r.style.position="absolute",r.style.zIndex=0,s.push(r),e.appendChild(r),s}function a(e,t){this.x=e,this.y=t}var u=this
this.withInViewport=function(e,i){if(!u.withinBounds(e,i))return!1
var o=t.LatLonToPixels(e,i,u.zeroTile.x,u.zeroTile.y,u.zoom,u.tms,u.tileSize,u.initialResolution)
return o.x>-1*u.xOffset&&o.x<u.width+-1*u.xOffset&&o.y>-1*u.yOffset&&o.y<u.height+-1*u.yOffset},this.moveMap=function(e,t){l(parseInt(u.xOffset+e*-u.tileSize),parseInt(u.yOffset+t*-u.tileSize)),u.fireEvent("idle")},this.AddListener=function(e,t,i){e.attachEvent?(e["e"+t+i]=i,e[t+i]=function(){e["e"+t+i](window.event)},e.attachEvent("on"+t,e[t+i])):e.addEventListener(t,i,!1)},this.removeListener=function(e,t,i){e.detachEvent?(e.detachEvent("on"+t,e[t+i]),e[t+i]=null):e.removeEventListener(t,i,!1)},this.fireEvent=function(e){if(document.addEventListener){var t=document.createEvent("UIEvents")
t.initEvent(e,!1,!1),document.dispatchEvent(t)}else document.attachEvent&&document.documentElement[e]++},this.addCustomEvent=function(e,t){document.addEventListener?document.addEventListener(e,function(e){t(e)},!1):document.attachEvent&&(document.documentElement[e]=0,document.documentElement.attachEvent("onpropertychange",function(i){i.propertyName==e&&t(i)}))},this.getURL=function(e,t,i){var o=["a","b","c"],n=o[Math.floor(Math.random()*o.length)]
return"http://"+n+".tile.openstreetmap.org/"+e+"/"+t+"/"+i+".png"},this.getTile=function(e,t,i,o,n,l){n=parseInt(n*u.tileSize)+"px",l=parseInt(l*u.tileSize)+"px"
var s=document.createElement("img")
for(s.src=u.getURL(t,i,o),s.style.zIndex=0,s.style.left=n,s.style.top=l,s.name="default",s.style.position="absolute",u.firsttime&&(s.id="default"+t+"_"+i+"_"+o);e.length>0;)e[0].parentNode.removeChild(e[0]),e.remove(e[0])
u.map.appendChild(s),e.push(s)},this.getAllTiles=function(){s(1,u.XnumberOfTiles,u.YnumberOfTiles,parseInt(u.XnumberOfTiles/2),parseInt(u.YnumberOfTiles/2)),u.setCenter(u.WGScenter.lat,u.WGScenter.lon),u.fireEvent("idle")},this.withinBounds=function(e,t){return e>=u.bounds[0]&&e<=u.bounds[2]&&t>=u.bounds[1]&&t<=u.bounds[3]?!0:!1},this.getCenter=function(){var e={x:u.zeroTile.x,y:u.zeroTile.y}
u.tms||(e=t.GoogleTile(u.zeroTile.x,u.zeroTile.y,u.zoom))
var i=t.TileLatLonBounds(e.x,e.y,u.zoom,u.tileSize,u.initialResolution),o=i[2]-(i[2]-i[0])/u.tileSize*(-1*u.yOffset+u.height/2),n=i[1]+(i[3]-i[1])/u.tileSize*(-1*u.xOffset+u.width/2)
return{lat:o,lon:n}},this.zoomIn=function(){var e=u.getCenter()
u.setCenter(e.lat,e.lon,u.zoom+1)},this.zoomOut=function(){var e=u.getCenter()
u.setCenter(e.lat,e.lon,u.zoom-1)},this.setCenter=function(e,i,o){if(o=void 0===o?u.zoom:o,u.withinBounds(e,i)&&o==u.zoom){var n=t.LatLonToPixels(e,i,u.zeroTile.x,u.zeroTile.y,o,u.tms,u.tileSize,u.initialResolution),s=-1*(parseInt(n.x)-parseInt(u.width/2)),r=-1*(parseInt(n.y)-parseInt(u.height/2))
l(s,r)}else u.reallocateMap(e,i,o,!1)},this.calculateSize=function(){u.XnumberOfTiles=parseInt(u.width/u.tileSize)+1,u.YnumberOfTiles=parseInt(u.height/u.tileSize)+1,1==u.XnumberOfTiles&&(u.XnumberOfTiles=3),1==u.YnumberOfTiles&&(u.YnumberOfTiles=3),u.XnumberOfTiles=0==parseFloat(u.XnumberOfTiles)%2?u.XnumberOfTiles+1:u.XnumberOfTiles,u.YnumberOfTiles=0==parseFloat(u.YnumberOfTiles)%2?u.YnumberOfTiles+1:u.YnumberOfTiles,u.Xcenter=parseInt(parseFloat(u.XnumberOfTiles)/2),u.Ycenter=parseInt(parseFloat(u.YnumberOfTiles)/2),u.rightEdge=parseInt(u.XnumberOfTiles*u.tileSize)-u.width,u.topEdge=parseInt(u.YnumberOfTiles*u.tileSize)-u.height,u.leftEdge=0,u.bottomEdge=0,u.minX=0,u.minY=0,u.mousePosition=new a,u.mouseLocations=[],u.velocity=new a,u.timerId=-1,u.timerCount=0},this.reallocateMap=function(i,n,l,s){u.reallocating=!0,u.movingMap=!0,s=void 0===s?!1:s
for(var a=0;a<u.tiles.length;a++)for(var d=0;d<u.tiles[a].length;d++)for(var A=0;A<u.tiles[a][d].length;A++)u.tiles[a][d][A].parentNode.removeChild(u.tiles[a][d][A]),u.tiles[a][d]=[]
if(u.map=document.getElementById(e.id),u.map.innerHTML="",u.WGScenter.lat=i,u.WGScenter.lon=n,u.zoom=l,u.calculateSize(),u.mouseDown){var c=m
u.removeListener(document,"mousemove",c)}u.mouseDown=!1,u.center=t.LatLonToTile(i,n,l,u.tms,u.tileSize,u.initialResolution),u.tiles=[]
for(var a=0;a<u.XnumberOfTiles;a++){u.tiles.push([])
for(var d=0;d<u.YnumberOfTiles;d++){var h=u.center.x-u.Xcenter+a,p=u.center.y-u.Ycenter+d
if(u.tiles[a].push(r(u.map,l,h,p,a,d)),0==a&&0==d){u.zeroTile.x=h,u.zeroTile.y=p
var f={x:h,y:p}
u.tms||(f=t.GoogleTile(h,p,l))
var g=t.TileLatLonBounds(f.x,f.y,l,u.tileSize,u.initialResolution)
u.bounds[2]=g[2],u.bounds[1]=g[1],u.boundsTMS[2]=h,u.boundsTMS[1]=p,g=null}else if(a+1==u.XnumberOfTiles&&d+1==u.YnumberOfTiles){var f={x:h,y:p}
u.tms||(f=t.GoogleTile(h,p,l))
var g=t.TileLatLonBounds(f.x,f.y,l,u.tileSize,u.initialResolution)
u.bounds[0]=g[0],u.bounds[3]=g[3],u.boundsTMS[0]=h,u.boundsTMS[3]=p,g=null}}}o(),u.reallocating=!1,u.movingMap=!1,s||u.getAllTiles()}
var m=function(e){var t=e.clientX-u.mousePosition.x+parseInt(u.map.style.left),i=e.clientY-u.mousePosition.y+parseInt(u.map.style.top)
l(t,i),u.mousePosition.x=e.clientX,u.mousePosition.y=e.clientY},d=function(){if(u.mouseDown)u.mouseLocations.unshift(new a(u.mousePosition.x,u.mousePosition.y)),u.mouseLocations.length>10&&u.mouseLocations.pop()
else{var e=u.scrollTime/20,t=(e-u.timerCount)/e,i=u.velocity.x*t,o=u.velocity.y*t
l(-i+parseInt(u.map.style.left),-o+parseInt(u.map.style.top)),(u.timerCount>=e||void 0===t)&&(clearInterval(u.timerId),u.timerId=-1,u.fireEvent("idle")),++u.timerCount}}
if(this.mousewheel=function(e){if(u.mousewheelZooming){var e=window.event||e,t=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail))
t>0?u.zoomIn():u.zoomOut()}},this.moveToPosition=function(e,t){var i=u.width,o=u.height
u.mousePosition.x=e,u.mousePosition.y=t
var n=.15,l=.05
i*n>e&&u.moveMap(-l,0),e>i*(1-n)&&u.moveMap(l,0),o*n>t&&u.moveMap(0,-l),t>o*(1-n)&&u.moveMap(0,l)},this.mouseover=function(e){var t=e.clientX,i=e.clientY
u.mousePosition.x=e.clientX,u.mousePosition.y=e.clientY,u.moveToPosition(t,i)},this.click=function(e){u.moveToPosition(e.clientX,e.clientY)},this.mousedown=function(e){u.viewingBox.style.cursor="url(data:image/x-win-bitmap;base64,AAACAAEAICACAAcABQAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAAH/AAAB/wAAA/0AAANsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//+AB///wAf//4AH//+AD///yT/////////////////////////////8=), default",u.mousePosition.x=e.clientX,u.mousePosition.y=e.clientY,u.AddListener(document,"mousemove",m),u.mouseDown=!0,u.scrolling?(u.timerCount=0,u.timerId<=0&&(clearInterval(u.timerId),u.timerId=0,u.timerId=setInterval(d,20))):u.fireEvent("idle"),e.preventDefault()},this.mouseup=function(){if(u.mouseDown){var e=m
if(u.removeListener(document,"mousemove",e),u.mouseDown=!1,u.mouseLocations.length>0){var t=u.mouseLocations.length
u.velocity.x=(u.mouseLocations[t-1].x-u.mouseLocations[0].x)/t,u.velocity.y=(u.mouseLocations[t-1].y-u.mouseLocations[0].y)/t,u.mouseLocations.length=0}}u.timerId<=0&&u.fireEvent("idle"),u.viewingBox.style.cursor="auto"},this.Marker=function(e){var i=this
i.draw=function(){var e=t.LatLonToPixels(o,n,u.zeroTile.x,u.zeroTile.y,u.zoom,u.tms,u.tileSize,u.initialResolution),a=void 0===i.img||null==i.img?document.createElement("img"):i.img
a.src=l,a.style.zIndex=3,a.style.left=parseInt(e.x-s)+"px",a.style.top=parseInt(e.y-r)+"px",a.style.position="absolute",i.img=a,i.drawed=!0,u.map.appendChild(a)},i.removeFromMap=function(){i.img.parentNode&&i.img.parentNode.removeChild(i.img),i.img=null,i.drawed=!1},i.boundsChanged=function(){i.drawed?u.withinBounds(o,n)?i.draw():(i.removeFromMap(),u.onHoldMarkers.push(i)):u.withinBounds(o,n)&&(u.onHoldMarkers.remove(i),i.draw())},i.destroy=function(){i.removeFromMap(),u.markers.remove(i)}
var o=e.lat,n=e.lon,l=void 0===e.src?"resources/arrow.png":e.src,s=void 0===e.xoffset?0:e.xoffset,r=void 0===e.yoffset?0:e.yoffset
i.lat=o,i.lon=n,i.src=l,i.drawed=!1,i.x=null,i.y=null,u.withinBounds(o,n)?i.draw():u.onHoldMarkers.push(i),u.markers.push(i)},u.firsttime=!0,u.id=e.id,u.map=document.getElementById(e.id),u.map.innerHTML="",u.WGScenter=void 0===e.center?{lon:-99.17158864746091,lat:19.424792788880602}:e.center,u.zoom=void 0===e.zoom?15:e.zoom,u.width=void 0===e.width?800:e.width,u.height=void 0===e.height?600:e.height,u.tileSize=void 0===e.tileSize?t.tileSize:e.tileSize,u.scrolling=void 0===e.scrolling?!0:e.scrolling,u.scrollTime=void 0===e.scrollTime?300:e.scrollTime,u.controls=void 0===e.controls?!0:e.controls,u.container=void 0===e.container?"container":e.container,u.loading=void 0===e.loading?"resources/loading_caption.png":e.loading,u.tms=void 0===e.tms?!1:e.tms,u.mousewheelZooming=void 0===e.mousewheelZooming?!0:e.mousewheelZooming,void 0!==e.getURL&&(u.getURL=e.getURL),u.initialResolution=t.InitialResolution(u.tileSize),u.viewingBox=document.createElement("div"),u.viewingBox.id=void 0===e.divID?"viewingBox":e.divID,u.map.parentNode.replaceChild(u.viewingBox,u.map),u.viewingBox.appendChild(u.map),u.viewingBox.style.overflow="hidden",u.viewingBox.style.width=u.width+"px",u.viewingBox.style.height=u.height+"px",u.viewingBox.style.position="relative",u.over=!1,u.controls){var A=u.viewingBox.parentNode,c=document.createElement("img")
c.src="resources/plus.png",c.id="zoominbutton",c.style.zIndex=5,c.style.left=parseInt(u.width-55)+"px",c.style.top="5px",c.style.position="absolute",u.AddListener(c,"click",u.zoomIn),A.appendChild(c),c=document.createElement("img"),c.src="resources/minus.png",c.id="zoominout",c.style.zIndex=5,c.style.left=parseInt(u.width-55)+"px",c.style.top="60px",c.style.position="absolute",u.AddListener(c,"click",u.zoomOut),A.appendChild(c)}u.map.style.position="absolute",void 0!==e.cssClass&&(u.viewingBox.className=e.cssClass),u.calculateSize(),u.mouseDown=!1,u.reallocating=!1,u.markers=[],u.onHoldMarkers=[],u.movingMap=!1,u.tiles=Array(1),u.tiles[0]=[],u.bounds=Array(4),u.boundsTMS=Array(4),u.latLonBounds=Array(4),u.zeroTile={},u.xOffsetCenter=-1*(parseInt(u.XnumberOfTiles*u.tileSize/2)-parseInt(u.width/2)),u.yOffsetCenter=-1*(parseInt(u.YnumberOfTiles*u.tileSize/2)-parseInt(u.height/2)),u.xOffset=u.xOffsetCenter,u.yOffset=u.yOffsetCenter,u.reallocateMap(u.WGScenter.lat,u.WGScenter.lon,u.zoom,!0),u.AddListener(u.viewingBox,"mousewheel",u.mousewheel),u.AddListener(u.viewingBox,"mousedown",u.mousedown),u.AddListener(document,"mouseup",u.mouseup),u.AddListener(u.viewingBox,"click",u.click)}
return e.tileSize=256,e.initialResolution=6378137*2*Math.PI/e.tileSize,e.originShift=6378137*2*Math.PI/2,e.LatLonToMeters=function(e,t){var i=t*LightMap.originShift/180,o=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180)
return o=o*LightMap.originShift/180,{x:i,y:o}},e.Resolution=function(e,t){return void 0===t&&(t=LightMap.initialResolution),t/parseFloat(Math.pow(2,e))},e.MetersToPixels=function(e,t,i,o){void 0===o&&(o=LightMap.initialResolution)
var n=LightMap.Resolution(i,o),l=(e+LightMap.originShift)/n,s=(t+LightMap.originShift)/n
return{x:l,y:s}},e.PixelsToTile=function(e,t,i){void 0===i&&(i=LightMap.tileSize)
var o=parseInt(Math.ceil(e/parseFloat(i))-1),n=parseInt(Math.ceil(t/parseFloat(i))-1)
return{x:o,y:n}},e.MetersToTile=function(e,t,i,o,n){void 0===o&&(o=LightMap.tileSize),void 0===n&&(n=o==LightMap.tileSize?LightMap.initialResolution:LightMap.InitialResolution(o))
var l=LightMap.MetersToPixels(e,t,i,n)
return LightMap.PixelsToTile(l.x,l.y,o)},e.LatLonToTile=function(e,t,i,o,n,l){void 0===n&&(n=LightMap.tileSize),void 0===l&&(l=n==LightMap.tileSize?LightMap.initialResolution:LightMap.InitialResolution(n))
var s=LightMap.LatLonToMeters(e,t)
return s=LightMap.MetersToTile(s.x,s.y,i,n,l),o?s:LightMap.GoogleTile(s.x,s.y,i)},e.InitialResolution=function(e){return void 0===e&&(e=LightMap.tileSize),e==LightMap.tileSize?LightMap.initialResolution:6378137*2*Math.PI/e},e.GoogleTile=function(e,t,i){return{x:e,y:Math.pow(2,i)-1-t,ty:t}},e.LatLonToPixels=function(e,t,i,o,n,l,s,r){void 0===l&&(l=!1),void 0===s&&(s=LightMap.tileSize),void 0===r&&(r=s==LightMap.tileSize?LightMap.initialResolution:LightMap.InitialResolution(s))
var a=LightMap.LatLonToTile(e,t,n,l,s,r),u=null
return u=l?LightMap.TileLatLonBounds(a.x,a.y,n,s,r):LightMap.TileLatLonBounds(a.x,a.ty,n,s,r),{x:(1-(u[3]-t)/(u[3]-u[1]))*s+(a.x-i)*s,y:(u[2]-e)/(u[2]-u[0])*s+(a.y-o)*s}},e.TileLatLonBounds=function(e,t,i,o,n){void 0===o&&(o=LightMap.tileSize),void 0===n&&(n=o==LightMap.tileSize?LightMap.initialResolution:LightMap.InitialResolution(o))
var l=LightMap.TileBounds(e,t,i,o,n),s=LightMap.MetersToLatLon(l[0],l[1]),r=LightMap.MetersToLatLon(l[2],l[3])
return[s.lat,s.lon,r.lat,r.lon]},e.TileBounds=function(e,t,i,o,n){void 0===o&&(o=LightMap.tileSize),void 0===n&&(n=o==LightMap.tileSize?LightMap.initialResolution:LightMap.InitialResolution(o))
var l=LightMap.PixelsToMeters(e*o,t*o,i,n),s=LightMap.PixelsToMeters((e+1)*o,(t+1)*o,i,n)
return[l.x,l.y,s.x,s.y]},e.MetersToLatLon=function(e,t){var i=180*(e/LightMap.originShift),o=180*(t/LightMap.originShift)
return o=180/Math.PI*(2*Math.atan(Math.exp(o*Math.PI/180))-Math.PI/2),{lat:o,lon:i}},e.PixelsToMeters=function(e,t,i,o){return void 0===o&&(o=LightMap.initialResolution),res=LightMap.Resolution(i,o),mx=e*res-LightMap.originShift,my=t*res-LightMap.originShift,{x:mx,y:my}},e}()