2010-09-23 20:56:29 +08:00
/ *
2012-12-18 01:15:51 +08:00
Leaflet , a JavaScript library for mobile - friendly interactive maps . http : //leafletjs.com
2013-01-15 18:16:15 +08:00
( c ) 2010 - 2013 , Vladimir Agafonkin , CloudMade
2010-09-23 20:56:29 +08:00
* /
2013-02-18 10:43:04 +08:00
( function ( t , e , i ) { var n , o ; typeof exports != i + "" ? n = exports : ( o = t . L , n = { } , n . noConflict = function ( ) { return t . L = o , this } , t . L = n ) , n . version = "0.6-dev" , n . Util = { extend : function ( t ) { var e , i , n , o , s = Array . prototype . slice . call ( arguments , 1 ) ; for ( i = 0 , n = s . length ; n > i ; i ++ ) { o = s [ i ] || { } ; for ( e in o ) o . hasOwnProperty ( e ) && ( t [ e ] = o [ e ] ) } return t } , bind : function ( t , e ) { var i = arguments . length > 2 ? Array . prototype . slice . call ( arguments , 2 ) : null ; return function ( ) { return t . apply ( e , i || arguments ) } } , stamp : function ( ) { var t = 0 , e = "_leaflet_id" ; return function ( i ) { return i [ e ] = i [ e ] || ++ t , i [ e ] } } ( ) , limitExecByInterval : function ( t , e , n ) { var o , s ; return function a ( ) { var r = arguments ; return o ? ( s = ! 0 , i ) : ( o = ! 0 , setTimeout ( function ( ) { o = ! 1 , s && ( a . apply ( n , r ) , s = ! 1 ) } , e ) , t . apply ( n , r ) , i ) } } , falseFn : function ( ) { return ! 1 } , formatNum : function ( t , e ) { var i = Math . pow ( 10 , e || 5 ) ; return Math . round ( t * i ) / i } , splitWords : function ( t ) { return t . replace ( /^\s+|\s+$/g , "" ) . split ( /\s+/ ) } , setOptions : function ( t , e ) { return t . options = n . extend ( { } , t . options , e ) , t . options } , getParamString : function ( t , e ) { var i = [ ] ; for ( var n in t ) t . hasOwnProperty ( n ) && i . push ( encodeURIComponent ( n ) + "=" + encodeURIComponent ( t [ n ] ) ) ; return ( e && - 1 !== e . indexOf ( "?" ) ? "&" : "?" ) + i . join ( "&" ) } , template : function ( t , e ) { return t . replace ( /\{ *([\w_]+) *\}/g , function ( t , i ) { var n = e [ i ] ; if ( ! e . hasOwnProperty ( i ) ) throw Error ( "No value provided for variable " + t ) ; return n } ) } , isArray : function ( t ) { return "[object Array]" === Object . prototype . toString . call ( t ) } , emptyImageUrl : "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" } , function ( ) { function e ( e ) { var i , n , o = [ "webkit" , "moz" , "o" , "ms" ] ; for ( i = 0 ; o . length > i && ! n ; i ++ ) n = t [ o [ i ] + e ] ; return n } function o ( e ) { var i = + new Date , n = Math . max ( 0 , 16 - ( i - s ) ) ; return s = i + n , t . setTimeout ( e , n ) } var s = 0 , a = t . requestAnimationFrame || e ( "RequestAnimationFrame" ) || o , r = t . cancelAnimationFrame || e ( "CancelAnimationFrame" ) || e ( "CancelRequestAnimationFrame" ) || function ( e ) { t . clearTimeout ( e ) } ; n . Util . requestAnimFrame = function ( e , s , r , h ) { return e = n . bind ( e , s ) , r && a === o ? ( e ( ) , i ) : a . call ( t , e , h ) } , n . Util . cancelAnimFrame = function ( e ) { e && r . call ( t , e ) } } ( ) , n . extend = n . Util . extend , n . bind = n . Util . bind , n . stamp = n . Util . stamp , n . setOptions = n . Util . setOptions , n . Class = function ( ) { } , n . Class . extend = function ( t ) { var e = function ( ) { this . initialize && this . initialize . apply ( this , arguments ) , this . _initHooks && this . callInitHooks ( ) } , i = function ( ) { } ; i . prototype = this . prototype ; var o = new i ; o . constructor = e , e . prototype = o ; for ( var s in this ) this . hasOwnProperty ( s ) && "prototype" !== s && ( e [ s ] = this [ s ] ) ; t . statics && ( n . extend ( e , t . statics ) , delete t . statics ) , t . includes && ( n . Util . extend . apply ( null , [ o ] . concat ( t . includes ) ) , delete t . includes ) , t . options && o . options && ( t . options = n . extend ( { } , o . options , t . options ) ) , n . extend ( o , t ) , o . _initHooks = [ ] ; var a = this ; return e . _ _super _ _ = a . prototype , o . callInitHooks = function ( ) { if ( ! this . _initHooksCalled ) { a . prototype . callInitHooks && a . prototype . callInitHooks . call ( this ) , this . _initHooksCalled = ! 0 ; for ( var t = 0 , e = o . _initHooks . length ; e > t ; t ++ ) o . _initHooks [ t ] . call ( this ) } } , e } , n . Class . include = function ( t ) { n . extend ( this . prototype , t ) } , n . Class . mergeOptions = function ( t ) { n . extend ( this . prototype . options , t ) } , n . Class . addInitHook = function ( t ) { var e = Array . prototype . slice . call ( arguments , 1 ) , i = "function" == typeof t ? t : function ( ) { this [ t ] . apply ( this , e ) } ; this . prototype . _initHooks = this . prototype . _initHooks || [ ] , this . prototype . _initHooks . push ( i ) } ; var s = "_leaflet_events" ; n . Mixin = { } , n . Mixin . Events = { addEventListener : function ( t , e , i ) { var o , a , r , h , l , u , c , p , _ = this [ s ] = this [ s ] || { } ; if ( "object" == typeof t ) { for ( o in t ) t . hasOwnProperty ( o ) && this . addEventListener ( o , t [ o ] , e ) ; return this } for ( t = n . Util . splitWords ( t ) , a = 0 , r = t . length ; r > a ; a ++ ) h = { action : e , context : i || this } , l = i && i . _leaflet _id , l ? ( u = t [ a ] + "_idx" , c = u + "_len" , p = _ [ u ] = _ [ u ] || { } , p [ l ] ? p [ l ] . push ( h ) : ( p [ l ] = [ h ] , _ [ c ] = ( _ [ c ] || 0 ) + 1 ) ) : ( _ [ t [ a ] ] = _ [ t [ a ] ] || [ ] , _ [ t [ a ] ] . push ( h ) ) ; return this } , hasEventListeners : function ( t ) { return s in this && ( t in this [ s ] && this [ s ] [ t ] . length > 0 || this [ s ] [ t + "_idx_len" ] > 0 ) } , removeEventListener : function ( t , e , i ) { var o , a , r , h , l , u , c , p , _ = this [ s ] ; if ( "object" == typeof t ) { for ( o in t ) t . hasOwnProperty ( o ) && this . removeEventListener ( o , t [ o ] , e ) ; return this } for ( t = n . Util . splitWords ( t ) , a = 0 , r = t . length ; r > a ; a ++ ) if ( this . hasEventListeners ( t [ a ] ) ) { for ( u = i &&
this . _container . appendChild ( l ) } } , _tileShouldBeLoaded : function ( t ) { if ( t . x + ":" + t . y in this . _tiles ) return ! 1 ; if ( ! this . options . continuousWorld ) { var e = this . _getWrapTileNum ( ) ; if ( this . options . noWrap && ( 0 > t . x || t . x >= e ) || 0 > t . y || t . y >= e ) return ! 1 } return ! 0 } , _removeOtherTiles : function ( t ) { var e , i , n , o ; for ( o in this . _tiles ) this . _tiles . hasOwnProperty ( o ) && ( e = o . split ( ":" ) , i = parseInt ( e [ 0 ] , 10 ) , n = parseInt ( e [ 1 ] , 10 ) , ( t . min . x > i || i > t . max . x || t . min . y > n || n > t . max . y ) && this . _removeTile ( o ) ) } , _removeTile : function ( t ) { var e = this . _tiles [ t ] ; this . fire ( "tileunload" , { tile : e , url : e . src } ) , this . options . reuseTiles ? ( n . DomUtil . removeClass ( e , "leaflet-tile-loaded" ) , this . _unusedTiles . push ( e ) ) : e . parentNode === this . _container && this . _container . removeChild ( e ) , n . Browser . android || ( e . src = n . Util . emptyImageUrl ) , delete this . _tiles [ t ] } , _addTile : function ( t , e ) { var i = this . _getTilePos ( t ) , o = this . _getTile ( ) ; n . DomUtil . setPosition ( o , i , n . Browser . chrome || n . Browser . android23 ) , this . _tiles [ t . x + ":" + t . y ] = o , this . _loadTile ( o , t ) , o . parentNode !== this . _container && e . appendChild ( o ) } , _getZoomForUrl : function ( ) { var t = this . options , e = this . _map . getZoom ( ) ; return t . zoomReverse && ( e = t . maxZoom - e ) , e + t . zoomOffset } , _getTilePos : function ( t ) { var e = this . _map . getPixelOrigin ( ) , i = this . options . tileSize ; return t . multiplyBy ( i ) . subtract ( e ) } , getTileUrl : function ( t ) { return n . Util . template ( this . _url , n . extend ( { s : this . _getSubdomain ( t ) , z : t . z , x : t . x , y : t . y } , this . options ) ) } , _getWrapTileNum : function ( ) { return Math . pow ( 2 , this . _getZoomForUrl ( ) ) } , _adjustTilePoint : function ( t ) { var e = this . _getWrapTileNum ( ) ; this . options . continuousWorld || this . options . noWrap || ( t . x = ( t . x % e + e ) % e ) , this . options . tms && ( t . y = e - t . y - 1 ) , t . z = this . _getZoomForUrl ( ) } , _getSubdomain : function ( t ) { var e = ( t . x + t . y ) % this . options . subdomains . length ; return this . options . subdomains [ e ] } , _createTileProto : function ( ) { var t = this . _tileImg = n . DomUtil . create ( "img" , "leaflet-tile" ) ; t . style . width = t . style . height = this . options . tileSize + "px" , t . galleryimg = "no" } , _getTile : function ( ) { if ( this . options . reuseTiles && this . _unusedTiles . length > 0 ) { var t = this . _unusedTiles . pop ( ) ; return this . _resetTile ( t ) , t } return this . _createTile ( ) } , _resetTile : function ( ) { } , _createTile : function ( ) { var t = this . _tileImg . cloneNode ( ! 1 ) ; return t . onselectstart = t . onmousemove = n . Util . falseFn , n . Browser . ielt9 && this . options . opacity !== i && n . DomUtil . setOpacity ( t , this . options . opacity ) , t } , _loadTile : function ( t , e ) { t . _layer = this , t . onload = this . _tileOnLoad , t . onerror = this . _tileOnError , this . _adjustTilePoint ( e ) , t . src = this . getTileUrl ( e ) } , _tileLoaded : function ( ) { this . _tilesToLoad -- , this . _tilesToLoad || this . fire ( "load" ) } , _tileOnLoad : function ( ) { var t = this . _layer ; this . src !== n . Util . emptyImageUrl && ( n . DomUtil . addClass ( this , "leaflet-tile-loaded" ) , t . fire ( "tileload" , { tile : this , url : this . src } ) ) , t . _tileLoaded ( ) } , _tileOnError : function ( ) { var t = this . _layer ; t . fire ( "tileerror" , { tile : this , url : this . src } ) ; var e = t . options . errorTileUrl ; e && ( this . src = e ) , t . _tileLoaded ( ) } } ) , n . tileLayer = function ( t , e ) { return new n . TileLayer ( t , e ) } , n . TileLayer . WMS = n . TileLayer . extend ( { defaultWmsParams : { service : "WMS" , request : "GetMap" , version : "1.1.1" , layers : "" , styles : "" , format : "image/jpeg" , transparent : ! 1 } , initialize : function ( t , e ) { this . _url = t ; var i = n . extend ( { } , this . defaultWmsParams ) ; i . width = i . height = e . detectRetina && n . Browser . retina ? 2 * this . options . tileSize : this . options . tileSize ; for ( var o in e ) this . options . hasOwnProperty ( o ) || ( i [ o ] = e [ o ] ) ; this . wmsParams = i , n . setOptions ( this , e ) } , onAdd : function ( t ) { var e = parseFloat ( this . wmsParams . version ) >= 1.3 ? "crs" : "srs" ; this . wmsParams [ e ] = t . options . crs . code , n . TileLayer . prototype . onAdd . call ( this , t ) } , getTileUrl : function ( t , e ) { var i = this . _map , o = i . options . crs , s = this . options . tileSize , a = t . multiplyBy ( s ) , r = a . add ( new n . Point ( s , s ) ) , h = o . project ( i . unproject ( a , e ) ) , l = o . project ( i . unproject ( r , e ) ) , u = [ h . x , l . y , l . x , h . y ] . join ( "," ) , c = n . Util . template ( this . _url , { s : this . _getSubdomain ( t ) } ) ; return c + n . Util . getParamString ( this . wmsParams , c ) + "&bbox=" + u } , setParams : function ( t , e ) { return n . extend ( this . wmsParams , t ) , e || this . redraw ( ) , this } } ) , n . tileLayer . wms = function ( t , e ) { return new n . TileLayer . WMS ( t , e ) } , n . TileLayer . Canvas = n . TileLayer . extend ( { options : { async : ! 1 } , initialize : function ( t ) { n . setOptions ( this , t ) } , redraw : function ( ) { var t = this . _tiles
for ( this . _lastCode = h ; ; ) { if ( ! ( r | h ) ) return [ t , e ] ; if ( r & h ) return ! 1 ; o = r || h , s = this . _getEdgeIntersection ( t , e , o , i ) , a = this . _getBitCode ( s , i ) , o === r ? ( t = s , r = a ) : ( e = s , h = a ) } } , _getEdgeIntersection : function ( t , e , o , s ) { var a = e . x - t . x , r = e . y - t . y , h = s . min , l = s . max ; return 8 & o ? new n . Point ( t . x + a * ( l . y - t . y ) / r , l . y ) : 4 & o ? new n . Point ( t . x + a * ( h . y - t . y ) / r , h . y ) : 2 & o ? new n . Point ( l . x , t . y + r * ( l . x - t . x ) / a ) : 1 & o ? new n . Point ( h . x , t . y + r * ( h . x - t . x ) / a ) : i } , _getBitCode : function ( t , e ) { var i = 0 ; return t . x < e . min . x ? i |= 1 : t . x > e . max . x && ( i |= 2 ) , t . y < e . min . y ? i |= 4 : t . y > e . max . y && ( i |= 8 ) , i } , _sqDist : function ( t , e ) { var i = e . x - t . x , n = e . y - t . y ; return i * i + n * n } , _sqClosestPointOnSegment : function ( t , e , i , o ) { var s , a = e . x , r = e . y , h = i . x - a , l = i . y - r , u = h * h + l * l ; return u > 0 && ( s = ( ( t . x - a ) * h + ( t . y - r ) * l ) / u , s > 1 ? ( a = i . x , r = i . y ) : s > 0 && ( a += h * s , r += l * s ) ) , h = t . x - a , l = t . y - r , o ? h * h + l * l : new n . Point ( a , r ) } } , n . Polyline = n . Path . extend ( { initialize : function ( t , e ) { n . Path . prototype . initialize . call ( this , e ) , this . _latlngs = this . _convertLatLngs ( t ) } , options : { smoothFactor : 1 , noClip : ! 1 } , projectLatlngs : function ( ) { this . _originalPoints = [ ] ; for ( var t = 0 , e = this . _latlngs . length ; e > t ; t ++ ) this . _originalPoints [ t ] = this . _map . latLngToLayerPoint ( this . _latlngs [ t ] ) } , getPathString : function ( ) { for ( var t = 0 , e = this . _parts . length , i = "" ; e > t ; t ++ ) i += this . _getPathPartStr ( this . _parts [ t ] ) ; return i } , getLatLngs : function ( ) { return this . _latlngs } , setLatLngs : function ( t ) { return this . _latlngs = this . _convertLatLngs ( t ) , this . redraw ( ) } , addLatLng : function ( t ) { return this . _latlngs . push ( n . latLng ( t ) ) , this . redraw ( ) } , spliceLatLngs : function ( ) { var t = [ ] . splice . apply ( this . _latlngs , arguments ) ; return this . _convertLatLngs ( this . _latlngs ) , this . redraw ( ) , t } , closestLayerPoint : function ( t ) { for ( var e , i , o = 1 / 0 , s = this . _parts , a = null , r = 0 , h = s . length ; h > r ; r ++ ) for ( var l = s [ r ] , u = 1 , c = l . length ; c > u ; u ++ ) { e = l [ u - 1 ] , i = l [ u ] ; var p = n . LineUtil . _sqClosestPointOnSegment ( t , e , i , ! 0 ) ; o > p && ( o = p , a = n . LineUtil . _sqClosestPointOnSegment ( t , e , i ) ) } return a && ( a . distance = Math . sqrt ( o ) ) , a } , getBounds : function ( ) { var t , e , i = new n . LatLngBounds , o = this . getLatLngs ( ) ; for ( t = 0 , e = o . length ; e > t ; t ++ ) i . extend ( o [ t ] ) ; return i } , _convertLatLngs : function ( t ) { var e , i ; for ( e = 0 , i = t . length ; i > e ; e ++ ) { if ( n . Util . isArray ( t [ e ] ) && "number" != typeof t [ e ] [ 0 ] ) return ; t [ e ] = n . latLng ( t [ e ] ) } return t } , _initEvents : function ( ) { n . Path . prototype . _initEvents . call ( this ) } , _getPathPartStr : function ( t ) { for ( var e , i = n . Path . VML , o = 0 , s = t . length , a = "" ; s > o ; o ++ ) e = t [ o ] , i && e . _round ( ) , a += ( o ? "L" : "M" ) + e . x + " " + e . y ; return a } , _clipPoints : function ( ) { var t , e , o , s = this . _originalPoints , a = s . length ; if ( this . options . noClip ) return this . _parts = [ s ] , i ; this . _parts = [ ] ; var r = this . _parts , h = this . _map . _pathViewport , l = n . LineUtil ; for ( t = 0 , e = 0 ; a - 1 > t ; t ++ ) o = l . clipSegment ( s [ t ] , s [ t + 1 ] , h , t ) , o && ( r [ e ] = r [ e ] || [ ] , r [ e ] . push ( o [ 0 ] ) , ( o [ 1 ] !== s [ t + 1 ] || t === a - 2 ) && ( r [ e ] . push ( o [ 1 ] ) , e ++ ) ) } , _simplifyPoints : function ( ) { for ( var t = this . _parts , e = n . LineUtil , i = 0 , o = t . length ; o > i ; i ++ ) t [ i ] = e . simplify ( t [ i ] , this . options . smoothFactor ) } , _updatePath : function ( ) { this . _map && ( this . _clipPoints ( ) , this . _simplifyPoints ( ) , n . Path . prototype . _updatePath . call ( this ) ) } } ) , n . polyline = function ( t , e ) { return new n . Polyline ( t , e ) } , n . PolyUtil = { } , n . PolyUtil . clipPolygon = function ( t , e ) { var i , o , s , a , r , h , l , u , c , p = [ 1 , 4 , 2 , 8 ] , _ = n . LineUtil ; for ( o = 0 , l = t . length ; l > o ; o ++ ) t [ o ] . _code = _ . _getBitCode ( t [ o ] , e ) ; for ( a = 0 ; 4 > a ; a ++ ) { for ( u = p [ a ] , i = [ ] , o = 0 , l = t . length , s = l - 1 ; l > o ; s = o ++ ) r = t [ o ] , h = t [ s ] , r . _code & u ? h . _code & u || ( c = _ . _getEdgeIntersection ( h , r , u , e ) , c . _code = _ . _getBitCode ( c , e ) , i . push ( c ) ) : ( h . _code & u && ( c = _ . _getEdgeIntersection ( h , r , u , e ) , c . _code = _ . _getBitCode ( c , e ) , i . push ( c ) ) , i . push ( r ) ) ; t = i } return t } , n . Polygon = n . Polyline . extend ( { options : { fill : ! 0 } , initialize : function ( t , e ) { n . Polyline . prototype . initialize . call ( this , t , e ) , t && n . Util . isArray ( t [ 0 ] ) && "number" != typeof t [ 0 ] [ 0 ] && ( this . _latlngs = this . _convertLatLngs ( t [ 0 ] ) , this . _holes = t . slice ( 1 ) ) , t = this . _latlngs , t [ 0 ] . equals ( t [ t . length - 1 ] ) && t . pop ( ) } , projectLatlngs : function ( ) { if ( n . Polyline . prototype . projectLatlngs . call ( this ) , this . _holePoints = [ ] , this . _holes ) { var t , e , i , o ; for ( t = 0 , i = this . _holes . length ; i > t ; t ++ ) for ( this . _holePoints [ t ] = [ ] , e = 0 , o = this . _holes [ t ] . length ; o > e ; e ++ ) this . _holePoints [ t ] [ e ] = this . _map . latLngToLayerPoint ( this . _holes [ t ] [ e ] ) } } , _clipPoints : function ( ) { var t = this . _originalPoints , e = [ ] ; if ( this . _parts = [ t ] . concat ( this . _ho
} , _zoomIn : function ( t ) { this . _map . zoomIn ( t . shiftKey ? 3 : 1 ) } , _zoomOut : function ( t ) { this . _map . zoomOut ( t . shiftKey ? 3 : 1 ) } , _createButton : function ( t , e , i , o , s , a ) { var r = n . DomUtil . create ( "a" , i , o ) ; r . innerHTML = t , r . href = "#" , r . title = e ; var h = n . DomEvent . stopPropagation ; return n . DomEvent . on ( r , "click" , h ) . on ( r , "mousedown" , h ) . on ( r , "dblclick" , h ) . on ( r , "click" , n . DomEvent . preventDefault ) . on ( r , "click" , s , a ) , r } , _updateDisabled : function ( ) { var t = this . _map , e = "leaflet-disabled" ; n . DomUtil . removeClass ( this . _zoomInButton , e ) , n . DomUtil . removeClass ( this . _zoomOutButton , e ) , t . _zoom === t . getMinZoom ( ) && n . DomUtil . addClass ( this . _zoomOutButton , e ) , t . _zoom === t . getMaxZoom ( ) && n . DomUtil . addClass ( this . _zoomInButton , e ) } } ) , n . Map . mergeOptions ( { zoomControl : ! 0 } ) , n . Map . addInitHook ( function ( ) { this . options . zoomControl && ( this . zoomControl = new n . Control . Zoom , this . addControl ( this . zoomControl ) ) } ) , n . control . zoom = function ( t ) { return new n . Control . Zoom ( t ) } , n . Control . Attribution = n . Control . extend ( { options : { position : "bottomright" , prefix : 'Powered by <a href="http://leafletjs.com">Leaflet</a>' } , initialize : function ( t ) { n . setOptions ( this , t ) , this . _attributions = { } } , onAdd : function ( t ) { return this . _container = n . DomUtil . create ( "div" , "leaflet-control-attribution" ) , n . DomEvent . disableClickPropagation ( this . _container ) , t . on ( "layeradd" , this . _onLayerAdd , this ) . on ( "layerremove" , this . _onLayerRemove , this ) , this . _update ( ) , this . _container } , onRemove : function ( t ) { t . off ( "layeradd" , this . _onLayerAdd ) . off ( "layerremove" , this . _onLayerRemove ) } , setPrefix : function ( t ) { return this . options . prefix = t , this . _update ( ) , this } , addAttribution : function ( t ) { return t ? ( this . _attributions [ t ] || ( this . _attributions [ t ] = 0 ) , this . _attributions [ t ] ++ , this . _update ( ) , this ) : i } , removeAttribution : function ( t ) { return t ? ( this . _attributions [ t ] -- , this . _update ( ) , this ) : i } , _update : function ( ) { if ( this . _map ) { var t = [ ] ; for ( var e in this . _attributions ) this . _attributions . hasOwnProperty ( e ) && this . _attributions [ e ] && t . push ( e ) ; var i = [ ] ; this . options . prefix && i . push ( this . options . prefix ) , t . length && i . push ( t . join ( ", " ) ) , this . _container . innerHTML = i . join ( " — " ) } } , _onLayerAdd : function ( t ) { t . layer . getAttribution && this . addAttribution ( t . layer . getAttribution ( ) ) } , _onLayerRemove : function ( t ) { t . layer . getAttribution && this . removeAttribution ( t . layer . getAttribution ( ) ) } } ) , n . Map . mergeOptions ( { attributionControl : ! 0 } ) , n . Map . addInitHook ( function ( ) { this . options . attributionControl && ( this . attributionControl = ( new n . Control . Attribution ) . addTo ( this ) ) } ) , n . control . attribution = function ( t ) { return new n . Control . Attribution ( t ) } , n . Control . Scale = n . Control . extend ( { options : { position : "bottomleft" , maxWidth : 100 , metric : ! 0 , imperial : ! 0 , updateWhenIdle : ! 1 } , onAdd : function ( t ) { this . _map = t ; var e = "leaflet-control-scale" , i = n . DomUtil . create ( "div" , e ) , o = this . options ; return this . _addScales ( o , e , i ) , t . on ( o . updateWhenIdle ? "moveend" : "move" , this . _update , this ) , t . whenReady ( this . _update , this ) , i } , onRemove : function ( t ) { t . off ( this . options . updateWhenIdle ? "moveend" : "move" , this . _update , this ) } , _addScales : function ( t , e , i ) { t . metric && ( this . _mScale = n . DomUtil . create ( "div" , e + "-line" , i ) ) , t . imperial && ( this . _iScale = n . DomUtil . create ( "div" , e + "-line" , i ) ) } , _update : function ( ) { var t = this . _map . getBounds ( ) , e = t . getCenter ( ) . lat , i = 6378137 * Math . PI * Math . cos ( e * Math . PI / 180 ) , n = i * ( t . getNorthEast ( ) . lng - t . getSouthWest ( ) . lng ) / 180 , o = this . _map . getSize ( ) , s = this . options , a = 0 ; o . x > 0 && ( a = n * ( s . maxWidth / o . x ) ) , this . _updateScales ( s , a ) } , _updateScales : function ( t , e ) { t . metric && e && this . _updateMetric ( e ) , t . imperial && e && this . _updateImperial ( e ) } , _updateMetric : function ( t ) { var e = this . _getRoundNum ( t ) ; this . _mScale . style . width = this . _getScaleWidth ( e / t ) + "px" , this . _mScale . innerHTML = 1e3 > e ? e + " m" : e / 1e3 + " km" } , _updateImperial : function ( t ) { var e , i , n , o = 3.2808399 * t , s = this . _iScale ; o > 5280 ? ( e = o / 5280 , i = this . _getRoundNum ( e ) , s . style . width = this . _getScaleWidth ( i / e ) + "px" , s . innerHTML = i + " mi" ) : ( n = this . _getRoundNum ( o ) , s . style . width = this . _getScaleWidth ( n / o ) + "px" , s . innerHTML = n + " ft" ) } , _getScaleWidth : function ( t ) { return Math . round ( this . options . maxWidth * t ) - 10 } , _getRoundNum : function ( t ) { var e = Math . pow ( 10 , ( Math . floor ( t ) + "" ) . length - 1 ) , i = t / e ; return i = i >= 10 ? 10 : i >= 5 ? 5 : i >= 3 ? 3 : i >= 2 ? 2 : 1 , e * i } } ) , n . control . scale = function ( t ) { return new n . Control . Scal