From d728779bc6703788c7dd6b43cc6b69e53efe5312 Mon Sep 17 00:00:00 2001 From: mourner Date: Thu, 23 Feb 2012 10:47:19 +0200 Subject: [PATCH] fix controls regression --- dist/leaflet-src.js | 16 ++++++++++------ dist/leaflet.css | 5 +---- dist/leaflet.js | 2 +- src/layer/vector/Polyline.Edit.js | 8 ++++---- src/map/ext/Map.Control.js | 11 ++++++----- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/dist/leaflet-src.js b/dist/leaflet-src.js index 11679959..eebc2c5e 100644 --- a/dist/leaflet-src.js +++ b/dist/leaflet-src.js @@ -5127,6 +5127,9 @@ L.Handler.PolyEdit = L.Handler.extend({ marker._index = index; marker.on('drag', this._onMarkerDrag, this); + marker.on('dragend', function () { + this._poly.fire('edit'); + }, this); this._markerGroup.addLayer(marker); @@ -5192,7 +5195,6 @@ L.Handler.PolyEdit = L.Handler.extend({ this._poly.spliceLatLngs(i, 0, latlng); this._markers.splice(i, 0, marker); - this._poly.fire('edit'); marker.setOpacity(1); @@ -5213,6 +5215,7 @@ L.Handler.PolyEdit = L.Handler.extend({ function onClick() { onDragStart.call(this); onDragEnd.call(this); + this._poly.fire('edit'); } marker @@ -5302,13 +5305,14 @@ L.Map.include({ bottom = 'leaflet-bottom', left = 'leaflet-left', right = 'leaflet-right', - container = L.DomUtil.create('div', 'leaflet-control-container', this._container), + corner = 'leaflet-corner', + container = this._container, corners = this._controlCorners = {}; - corners.topleft = L.DomUtil.create('div', top + ' ' + left, container); - corners.topright = L.DomUtil.create('div', top + ' ' + right, container); - corners.bottomleft = L.DomUtil.create('div', bottom + ' ' + left, container); - corners.bottomright = L.DomUtil.create('div', bottom + ' ' + right, container); + corners.topleft = L.DomUtil.create('div', [corner, top, left].join(' '), container); + corners.topright = L.DomUtil.create('div', [corner, top, right].join(' '), container); + corners.bottomleft = L.DomUtil.create('div', [corner, bottom, left].join(' '), container); + corners.bottomright = L.DomUtil.create('div', [corner, bottom, right].join(' '), container); } }); diff --git a/dist/leaflet.css b/dist/leaflet.css index eb5adfd9..28d0168f 100644 --- a/dist/leaflet.css +++ b/dist/leaflet.css @@ -19,7 +19,7 @@ } .leaflet-tile-pane, .leaflet-container, -.leaflet-control-container, +.leaflet-corner, .leaflet-popup { /* TODO make this configurable */ -webkit-transform: translate3d(0,0,0); @@ -82,9 +82,6 @@ a.leaflet-active { /* Leaflet controls */ -.leaflet-control-container { - height: 100%; - } .leaflet-control { position: relative; z-index: 7; diff --git a/dist/leaflet.js b/dist/leaflet.js index 65f85187..336c7ac3 100644 --- a/dist/leaflet.js +++ b/dist/leaflet.js @@ -3,4 +3,4 @@ Leaflet is a modern open-source JavaScript library for interactive maps. http://leaflet.cloudmade.com */ -(function(a){a.L={VERSION:"0.4",ROOT_URL:a.L_ROOT_URL||function(){var a=document.getElementsByTagName("script"),b=/\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/,c,d,e,f;for(c=0,d=a.length;c0},removeEventListener:function(a,b,c){if(!this.hasEventListeners(a))return this;for(var d=0,e=this._leaflet_events,f=e[a].length;d=this.min.x&&c.x<=this.max.x&&b.y>=this.min.y&&c.y<=this.max.y},intersects:function(a){var b=this.min,c=this.max,d=a.min,e=a.max,f=e.x>=b.x&&d.x<=c.x,g=e.y>=b.y&&d.y<=c.y;return f&&g}}),L.Transformation=L.Class.extend({initialize:function(a,b,c,d){this._a=a,this._b=b,this._c=c,this._d=d},transform:function(a,b){return this._transform(a.clone(),b)},_transform:function(a,b){return b=b||1,a.x=b*(this._a*a.x+this._b),a.y=b*(this._c*a.y+this._d),a},untransform:function(a,b){return b=b||1,new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}}),L.DomUtil={get:function(a){return typeof a=="string"?document.getElementById(a):a},getStyle:function(a,b){var c=a.style[b];!c&&a.currentStyle&&(c=a.currentStyle[b]);if(!c||c==="auto"){var d=document.defaultView.getComputedStyle(a,null);c=d?d[b]:null}return c==="auto"?null:c},getViewportOffset:function(a){var b=0,c=0,d=a,e=document.body;do{b+=d.offsetTop||0,c+=d.offsetLeft||0;if(d.offsetParent===e&&L.DomUtil.getStyle(d,"position")==="absolute")break;d=d.offsetParent}while(d);d=a;do{if(d===e)break;b-=d.scrollTop||0,c-=d.scrollLeft||0,d=d.parentNode}while(d);return new L.Point(c,b)},create:function(a,b,c){var d=document.createElement(a);return d.className=b,c&&c.appendChild(d),d},disableTextSelection:function(){document.selection&&document.selection.empty&&document.selection.empty(),this._onselectstart||(this._onselectstart=document.onselectstart,document.onselectstart=L.Util.falseFn)},enableTextSelection:function(){document.onselectstart=this._onselectstart,this._onselectstart=null},hasClass:function(a,b){return a.className.length>0&&RegExp("(^|\\s)"+b+"(\\s|$)").test(a.className)},addClass:function(a,b){L.DomUtil.hasClass(a,b)||(a.className+=(a.className?" ":"")+b)},removeClass:function(a,b){a.className=a.className.replace(/(\S+)\s*/g,function(a,c){return c===b?"":a}).replace(/^\s+/,"")},setOpacity:function(a,b){L.Browser.ie?a.style.filter="alpha(opacity="+Math.round(b*100)+")":a.style.opacity=b},testProp:function(a){var b=document.documentElement.style;for(var c=0;c=b.lat&&e.lat<=c.lat&&d.lng>=b.lng&&e.lng<=c.lng},intersects:function(a){var b=this._southWest,c=this._northEast,d=a.getSouthWest(),e=a.getNorthEast(),f=e.lat>=b.lat&&d.lat<=c.lat,g=e.lng>=b.lng&&d.lng<=c.lng;return f&&g},toBBoxString:function(){var a=this._southWest,b=this._northEast;return[a.lng,a.lat,b.lng,b.lat].join(",")},equals:function(a){return a?this._southWest.equals(a.getSouthWest())&&this._northEast.equals(a.getNorthEast()):!1}}),L.Projection={},L.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(a){var b=L.LatLng.DEG_TO_RAD,c=this.MAX_LATITUDE,d=Math.max(Math.min(c,a.lat),-c),e=a.lng*b,f=d*b;return f=Math.log(Math.tan(Math.PI/4+f/2)),new L.Point(e,f)},unproject:function(a,b){var c=L.LatLng.RAD_TO_DEG,d=a.x*c,e=(2*Math.atan(Math.exp(a.y))-Math.PI/2)*c;return new L.LatLng(e,d,b)}},L.Projection.LonLat={project:function(a){return new L.Point(a.lng,a.lat)},unproject:function(a,b){return new L.LatLng(a.y,a.x,b)}},L.CRS={latLngToPoint:function(a,b){var c=this.projection.project(a);return this.transformation._transform(c,b)},pointToLatLng:function(a,b,c){var d=this.transformation.untransform(a,b);return this.projection.unproject(d,c)},project:function(a){return this.projection.project(a)}},L.CRS.EPSG3857=L.Util.extend({},L.CRS,{code:"EPSG:3857",projection:L.Projection.SphericalMercator,transformation:new L.Transformation(.5/Math.PI,.5,-0.5/Math.PI,.5),project:function(a){var b=this.projection.project(a),c=6378137;return b.multiplyBy(c)}}),L.CRS.EPSG900913=L.Util.extend({},L.CRS.EPSG3857,{code:"EPSG:900913"}),L.CRS.EPSG4326=L.Util.extend({},L.CRS,{code:"EPSG:4326",projection:L.Projection.LonLat,transformation:new L.Transformation(1/360,.5,-1/360,.5)}),L.Map=L.Class.extend({includes:L.Mixin.Events,options:{crs:L.CRS.EPSG3857||L.CRS.EPSG4326,scale:function(a){return 256*Math.pow(2,a)},center:null,zoom:null,layers:[],dragging:!0,touchZoom:L.Browser.touch&&!L.Browser.android,scrollWheelZoom:!L.Browser.touch,doubleClickZoom:!0,boxZoom:!0,zoomControl:!0,attributionControl:!0,fadeAnimation:L.DomUtil.TRANSITION&&!L.Browser.android,zoomAnimation:L.DomUtil.TRANSITION&&!L.Browser.android&&!L.Browser.mobileOpera,trackResize:!0,closePopupOnClick:!0,worldCopyJump:!0},initialize:function(a,b){L.Util.setOptions(this,b);var c=this._container=L.DomUtil.get(a);if(c._leaflet)throw Error("Map container is already initialized.");c._leaflet=!0,this._initLayout(),L.DomEvent&&(this._initEvents(),L.Handler&&this._initInteraction(),L.Control&&this._initControls()),b=this.options,b.maxBounds&&this.setMaxBounds(b.maxBounds);var d=b.center,e=b.zoom;d&&typeof e!="undefined"&&this.setView(d,e,!0),this._initLayers(b.layers)},setView:function(a,b){return this._resetView(a,this._limitZoom(b)),this},setZoom:function(a){return this.setView(this.getCenter(),a)},zoomIn:function(){return this.setZoom(this._zoom+1)},zoomOut:function(){return this.setZoom(this._zoom-1)},fitBounds:function(a){var b=this.getBoundsZoom(a);return this.setView(a.getCenter(),b)},fitWorld:function(){var a=new L.LatLng(-60,-170),b=new L.LatLng(85,179);return this.fitBounds(new L.LatLngBounds(a,b))},panTo:function(a){return this.setView(a,this._zoom)},panBy:function(a){return this.fire("movestart"),this._rawPanBy(a),this.fire("move"),this.fire("moveend")},setMaxBounds:function(a){this.options.maxBounds=a;if(!a)return this._boundsMinZoom=null,this;var b=this.getBoundsZoom(a,!0);return this._boundsMinZoom=b,this._loaded&&(this._zoomf.x&&(g=f.x-d.x),c.y>e.y&&(h=e.y-c.y),c.xl&&--m>0)o=h*Math.sin(j),n=Math.PI/2-2*Math.atan(i*Math.pow((1-o)/(1+o),.5*h))-j,j+=n;return new L.LatLng(j*c,f,b)}},L.CRS.EPSG3395=L.Util.extend({},L.CRS,{code:"EPSG:3395",projection:L.Projection.Mercator,transformation:function(){var a=L.Projection.Mercator,b=a.R_MAJOR,c=a.R_MINOR;return new L.Transformation(.5/(Math.PI*b),.5,-0.5/(Math.PI*c),.5)}()}),L.TileLayer=L.Class.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,scheme:"xyz",continuousWorld:!1,noWrap:!1,zoomOffset:0,zoomReverse:!1,unloadInvisibleTiles:L.Browser.mobile,updateWhenIdle:L.Browser.mobile,reuseTiles:!1},initialize:function(a,b){L.Util.setOptions(this,b),this._url=a;var c=this.options.subdomains;typeof c=="string"&&(this.options.subdomains=c.split(""))},onAdd:function(a,b){this._map=a,this._insertAtTheBottom=b,this._initContainer(),this._createTileProto(),a.on("viewreset",this._resetCallback,this),this.options.updateWhenIdle?a.on("moveend",this._update,this):(this._limitedUpdate=L.Util.limitExecByInterval(this._update,150,this),a.on("move",this._limitedUpdate,this)),this._reset(),this._update()},onRemove:function(a){a._panes.tilePane.removeChild(this._container),a.off("viewreset",this._resetCallback,this),this.options.updateWhenIdle?a.off("moveend",this._update,this):a.off("move",this._limitedUpdate,this),this._container=null,this._map=null},getAttribution:function(){return this.options.attribution},setOpacity:function(a){this.options.opacity=a,this._map&&this._updateOpacity();var b,c=this._tiles;if(L.Browser.webkit)for(b in c)c.hasOwnProperty(b)&&(c[b].style.webkitTransform+=" translate(0,0)")},_updateOpacity:function(){L.DomUtil.setOpacity(this._container,this.options.opacity)},_initContainer:function(){var a=this._map._panes.tilePane,b=a.firstChild;if(!this._container||a.empty)this._container=L.DomUtil.create("div","leaflet-layer"),this._insertAtTheBottom&&b?a.insertBefore(this._container,b):a.appendChild(this._container),this.options.opacity<1&&this._updateOpacity()},_resetCallback:function(a){this._reset(a.hard)},_reset:function(a){var b,c=this._tiles;for(b in c)c.hasOwnProperty(b)&&this.fire("tileunload",{tile:c[b]});this._tiles={},this.options.reuseTiles&&(this._unusedTiles=[]),a&&this._container&&(this._container.innerHTML=""),this._initContainer()},_update:function(){var a=this._map.getPixelBounds(),b=this._map.getZoom(),c=this.options.tileSize;if(b>this.options.maxZoom||ba.max.x||da.max.y)&&this._removeTile(e))},_removeTile:function(a){var b=this._tiles[a];this.fire("tileunload",{tile:b,url:b.src}),b.parentNode===this._container&&this._container.removeChild(b),this.options.reuseTiles&&this._unusedTiles.push(b),b.src=L.Util.emptyImageUrl,delete this._tiles[a]},_addTile:function(a,b){var c=this._map.getZoom(),d=a.x+":"+a.y,e=Math.pow(2,this._getOffsetZoom(c));if(!this.options.continuousWorld)if(!this.options.noWrap)a.x=(a.x%e+e)%e;else if(a.x<0||a.x>=e||a.y<0||a.y>=e){this._tilesToLoad--;return}var f=this._getTile();L.DomUtil.setPosition(f,this._getTilePos(a)),this._tiles[d]=f,this.options.scheme==="tms"&&(a.y=e-a.y-1),this._loadTile(f,a,c),b.appendChild(f)},_getOffsetZoom:function(a){var b=this.options;return a=b.zoomReverse?b.maxZoom-a:a,a+b.zoomOffset},_getTilePos:function(a){var b=this._map.getPixelOrigin(),c=this.options.tileSize;return a.multiplyBy(c).subtract(b)},getTileUrl:function(a,b){var c=this.options.subdomains,d=(a.x+a.y)%c.length,e=this.options.subdomains[d];return L.Util.template(this._url,L.Util.extend({s:e,z:this._getOffsetZoom(b),x:a.x,y:a.y},this.options))},_createTileProto:function(){var a=this._tileImg=L.DomUtil.create("img","leaflet-tile");a.galleryimg="no";var b=this.options.tileSize;a.style.width=b+"px",a.style.height=b+"px"},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var a=this._unusedTiles.pop();return this._resetTile(a),a}return this._createTile()},_resetTile:function(a){},_createTile:function(){var a=this._tileImg.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a.onload=this._tileOnLoad,a.onerror=this._tileOnError,a.src=this.getTileUrl(b,c)},_tileOnLoad:function(a){var b=this._layer;this.className+=" leaflet-tile-loaded",b.fire("tileload",{tile:this,url:this.src}),b._tilesToLoad--,b._tilesToLoad||b.fire("load")},_tileOnError:function(a){var b=this._layer;b.fire("tileerror",{tile:this,url:this.src});var c=b.options.errorTileUrl;c&&(this.src=c)}}),L.TileLayer.WMS=L.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(a,b){this._url=a;var c=L.Util.extend({},this.defaultWmsParams);c.width=c.height=this.options.tileSize;for(var d in b)this.options.hasOwnProperty(d)||(c[d]=b[d]);this.wmsParams=c,L.Util.setOptions(this,b)},onAdd:function(a,b){var c=parseFloat(this.wmsParams.version)<1.3?"srs":"crs";this.wmsParams[c]=a.options.crs.code,L.TileLayer.prototype.onAdd.call(this,a,b)},getTileUrl:function(a,b){var c=this._map,d=c.options.crs,e=this.options.tileSize,f=a.multiplyBy(e),g=f.add(new L.Point(e,e)),h=c.unproject(f,b,!0),i=c.unproject(g,b,!0),j=d.project(h),k=d.project(i),l=[j.x,k.y,k.x,j.y].join(",");return this._url+L.Util.getParamString(this.wmsParams)+"&bbox="+l}}),L.TileLayer.Canvas=L.TileLayer.extend({options:{async:!1},initialize:function(a){L.Util.setOptions(this,a)},redraw:function(){var a,b=this._tiles;for(a in b)b.hasOwnProperty(a)&&this._redrawTile(b[a])},_redrawTile:function(a){this.drawTile(a,a._tilePoint,a._zoom)},_createTileProto:function(){var a=this._canvasProto=L.DomUtil.create("canvas","leaflet-tile"),b=this.options.tileSize;a.width=b,a.height=b},_createTile:function(){var a=this._canvasProto.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a._tilePoint=b,a._zoom=c,this.drawTile(a,b,c),this.options.async||this.tileDrawn(a)},drawTile:function(a,b,c){},tileDrawn:function(a){this._tileOnLoad.call(a)}}),L.ImageOverlay=L.Class.extend({includes:L.Mixin.Events,initialize:function(a,b){this._url=a,this._bounds=b},onAdd:function(a){this._map=a,this._image||this._initImage(),a._panes.overlayPane.appendChild(this._image),a.on("viewreset",this._reset,this),this._reset()},onRemove:function(a){a.getPanes().overlayPane.removeChild(this._image),a.off("viewreset",this._reset,this)},_initImage:function(){this._image=L.DomUtil.create("img","leaflet-image-layer"),this._image.style.visibility="hidden",L.Util.extend(this._image,{galleryimg:"no",onselectstart:L.Util.falseFn,onmousemove:L.Util.falseFn,onload:L.Util.bind(this._onImageLoad,this),src:this._url})},_reset:function(){var a=this._image,b=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),c=this._map.latLngToLayerPoint(this._bounds.getSouthEast()).subtract(b);L.DomUtil.setPosition(a,b),a.style.width=c.x+"px",a.style.height=c.y+"px"},_onImageLoad:function(){this._image.style.visibility="",this.fire("load")}}),L.Icon=L.Class.extend({options:{className:""},initialize:function(a){L.Util.setOptions(this,a)},createIcon:function(){return this._createIcon("icon")},createShadow:function(){return this.options.shadowUrl?this._createIcon("shadow"):null},_createIcon:function(a){var b=this._createImg(this.options[a+"Url"]);return this._setIconStyles(b,a),b},_setIconStyles:function(a,b){var c=this.options,d=c[b+"Size"],e=c.iconAnchor;!e&&d&&(e=d.divideBy(2,!0)),b==="shadow"&&e&&c.shadowOffset&&e._add(c.shadowOffset),a.className="leaflet-marker-"+b+" "+c.className,e&&(a.style.marginLeft=-e.x+"px",a.style.marginTop=-e.y+"px"),d&&(a.style.width=d.x+"px",a.style.height=d.y+"px")},_createImg:function(a){var b;return L.Browser.ie6?(b=document.createElement("div"),b.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'")'):(b=document.createElement("img"),b.src=a),b}}),L.Icon.Default=L.Icon.extend({options:{iconUrl:L.ROOT_URL+"images/marker.png",iconSize:new L.Point(25,41),iconAnchor:new L.Point(13,41),popupAnchor:new L.Point(0,-33),shadowUrl:L.ROOT_URL+"images/marker-shadow.png",shadowSize:new L.Point(41,41)}}),L.Marker=L.Class.extend({includes:L.Mixin.Events,options:{icon:new L.Icon.Default,title:"",clickable:!0,draggable:!1,zIndexOffset:0,opacity:1},initialize:function(a,b){L.Util.setOptions(this,b),this._latlng=a},onAdd:function(a){this._map=a,a.on("viewreset",this._reset,this),this._initIcon(),this._reset()},onRemove:function(a){this._removeIcon(),this.closePopup&&this.closePopup(),a.off("viewreset",this._reset,this),this._map=null},getLatLng:function(){return this._latlng},setLatLng:function(a){this._latlng=a,this._reset(),this._popup&&this._popup.setLatLng(a)},setZIndexOffset:function(a){this.options.zIndexOffset=a,this._reset()},setIcon:function(a){this._map&&this._removeIcon(),this.options.icon=a,this._map&&(this._initIcon(),this._reset())},_initIcon:function(){var a=this.options;this._icon||(this._icon=a.icon.createIcon(),a.title&&(this._icon.title=a.title),this._initInteraction(),this._updateOpacity()),this._shadow||(this._shadow=a.icon.createShadow());var b=this._map._panes;b.markerPane.appendChild(this._icon),this._shadow&&b.shadowPane.appendChild(this._shadow)},_removeIcon:function(){var a=this._map._panes;a.markerPane.removeChild(this._icon),this._shadow&&a.shadowPane.removeChild(this._shadow),this._icon=this._shadow=null},_reset:function(){var a=this._icon;if(!a)return;var b=this._map.latLngToLayerPoint(this._latlng).round();L.DomUtil.setPosition(a,b),this._shadow&&L.DomUtil.setPosition(this._shadow,b),a.style.zIndex=b.y+this.options.zIndexOffset},_initInteraction:function(){if(!this.options.clickable)return;var a=this._icon,b=["dblclick","mousedown","mouseover","mouseout"];a.className+=" leaflet-clickable",L.DomEvent.addListener(a,"click",this._onMouseClick,this);for(var c=0;cd?(a.style.height=d+"px",a.className+=e):a.className=a.className.replace(e,""),this._containerWidth=this._container.offsetWidth},_updatePosition:function(){var a=this._map.latLngToLayerPoint(this._latlng);this._containerBottom=-a.y-this.options.offset.y,this._containerLeft=a.x-Math.round(this._containerWidth/2)+this.options.offset.x,this._container.style.bottom=this._containerBottom+"px",this._container.style.left=this._containerLeft+"px"},_adjustPan:function(){if(!this.options.autoPan)return;var a=this._map,b=this._container.offsetHeight,c=this._containerWidth,d=new L.Point(this._containerLeft,-b-this._containerBottom),e=a.layerPointToContainerPoint(d),f=new L.Point(0,0),g=this.options.autoPanPadding,h=a.getSize();e.x<0&&(f.x=e.x-g.x),e.x+c>h.x&&(f.x=e.x+c-h.x+g.x),e.y<0&&(f.y=e.y-g.y),e.y+b>h.y&&(f.y=e.y+b-h.y+g.y),(f.x||f.y)&&a.panBy(f)},_onCloseButtonClick:function(a){this._close(),L.DomEvent.stop(a)}}),L.Marker.include({openPopup:function(){return this._popup&&this._map&&(this._popup.setLatLng(this._latlng),this._map.openPopup(this._popup)),this},closePopup:function(){return this._popup&&this._popup._close(),this},bindPopup:function(a,b){var c=this.options.icon.options.popupAnchor||new L.Point(0,0);return b&&b.offset&&(c=c.add(b.offset)),b=L.Util.extend({offset:c},b),this._popup||this.on("click",this.openPopup,this),this._popup=(new L.Popup(b,this)).setContent(a),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.openPopup)),this}}),L.Map.include({openPopup:function(a){return this.closePopup(),this._popup=a,this.addLayer(a).fire("popupopen",{popup:this._popup})},closePopup:function(){return this._popup&&(this.removeLayer(this._popup).fire("popupclose",{popup:this._popup}),this._popup=null),this}}),L.LayerGroup=L.Class.extend({initialize:function(a){this._layers={};var b,c;if(a)for(b=0,c=a.length;b';var b=a.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}(),L.Path=L.Browser.svg||!L.Browser.vml?L.Path:L.Path.extend({statics:{VML:!0,CLIP_PADDING:.02},_createElement:function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(a){return document.createElement("')}}catch(a){return function(a){return document.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_initPath:function(){var a=this._container=this._createElement("shape");a.className+=" leaflet-vml-shape"+(this.options.clickable?" leaflet-clickable":""),a.coordsize="1 1",this._path=this._createElement("path"),a.appendChild(this._path),this._map._pathRoot.appendChild(a)},_initStyle:function(){var a=this._container,b,c;this.options.stroke&&(b=this._stroke=this._createElement("stroke"),b.endcap="round",a.appendChild(b)),this.options.fill&&(c=this._fill=this._createElement("fill"),a.appendChild(c)),this._updateStyle()},_updateStyle:function(){var a=this._stroke,b=this._fill,c=this.options,d=this._container;d.stroked=c.stroke,d.filled=c.fill,c.stroke&&(a.weight=c.weight+"px",a.color=c.color,a.opacity=c.opacity),c.fill&&(b.color=c.fillColor||c.color,b.opacity=c.fillOpacity)},_updatePath:function(){var a=this._container.style;a.display="none",this._path.v=this.getPathString()+" ",a.display=""}}),L.Map.include(L.Browser.svg||!L.Browser.vml?{}:{_initPathRoot:function(){if(this._pathRoot)return;var a=this._pathRoot=document.createElement("div");a.className="leaflet-vml-container",this._panes.overlayPane.appendChild(a),this.on("moveend",this._updatePathViewport),this._updatePathViewport()}}),L.Browser.canvas=function(){return!!document.createElement("canvas").getContext}(),L.Path=L.Path.SVG&&!window.L_PREFER_CANVAS||!L.Browser.canvas?L.Path:L.Path.extend({statics:{CANVAS:!0,SVG:!1},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){var a=this.options;a.stroke&&(this._ctx.lineWidth=a.weight,this._ctx.strokeStyle=a.color),a.fill&&(this._ctx.fillStyle=a.fillColor||a.color)},_drawPath:function(){var a,b,c,d,e,f;this._ctx.beginPath();for(a=0,c=this._parts.length;af&&(g=h,f=i);f>c&&(b[g]=1,this._simplifyDPStep(a,b,c,d,g),this._simplifyDPStep(a,b,c,g,e))},_reducePoints:function(a,b){var c=[a[0]];for(var d=1,e=0,f=a.length;db&&(c.push(a[d]),e=d);return eb.max.x&&(c|=2),a.yb.max.y&&(c|=8),c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqClosestPointOnSegment:function(a,b,c,d){var e=b.x,f=b.y,g=c.x-e,h=c.y-f,i=g*g+h*h,j;return i>0&&(j=((a.x-e)*g+(a.y-f)*h)/i,j>1?(e=c.x,f=c.y):j>0&&(e+=g*j,f+=h*j)),g=a.x-e,h=a.y-f,d?g*g+h*h:new L.Point(e,f)}},L.Polyline=L.Path.extend({initialize:function(a,b){L.Path.prototype.initialize.call(this,b),this._latlngs=a,L.Handler.PolyEdit&&(this.editing=new L.Handler.PolyEdit(this),this.options.editable&&this.editing.enable())},options:{smoothFactor:1,noClip:!1},projectLatlngs:function(){this._originalPoints=[];for(var a=0,b=this._latlngs.length;aa.max.x||c.y-b>a.max.y||c.x+ba.y!=e.y>a.y&&a.x<(e.x-d.x)*(a.y-d.y)/(e.y-d.y)+d.x&&(b=!b)}return b}}:{}),L.Circle.include(L.Path.CANVAS?{_drawPath:function(){var a=this._point;this._ctx.beginPath(),this._ctx.arc(a.x,a.y,this._radius,0,Math.PI*2,!1)},_containsPoint:function(a){var b=this._point,c=this.options.stroke?this.options.weight/2:0;return a.distanceTo(b)<=this._radius+c}}:{}),L.GeoJSON=L.FeatureGroup.extend({initialize:function(a,b){L.Util.setOptions(this,b),this._geojson=a,this._layers={},a&&this.addGeoJSON(a)},addGeoJSON:function(a){var b=a.features,c,d;if(b){for(c=0,d=b.length;c1){this._simulateClick=!1;return}var b=a.touches&&a.touches.length===1?a.touches[0]:a,c=b.target;L.DomEvent.preventDefault(a),L.Browser.touch&&c.tagName.toLowerCase()==="a"&&(c.className+=" leaflet-active"),this._moved=!1;if(this._moving)return;L.Browser.touch||(L.DomUtil.disableTextSelection(),this._setMovingCursor()),this._startPos=this._newPos=L.DomUtil.getPosition(this._element),this._startPoint=new L.Point(b.clientX,b.clientY),L.DomEvent.addListener(document,L.Draggable.MOVE,this._onMove,this),L.DomEvent.addListener(document,L.Draggable.END,this._onUp,this)},_onMove:function(a){if(a.touches&&a.touches.length>1)return;L.DomEvent.preventDefault(a);var b=a.touches&&a.touches.length===1?a.touches[0]:a;this._moved||(this.fire("dragstart"),this._moved=!0),this._moving=!0;var c=new L.Point(b.clientX,b.clientY);this._newPos=this._startPos.add(c).subtract(this._startPoint),L.Util.cancelAnimFrame(this._animRequest),this._animRequest=L.Util.requestAnimFrame(this._updatePosition,this,!0,this._dragStartTarget)},_updatePosition:function(){this.fire("predrag"),L.DomUtil.setPosition(this._element,this._newPos),this.fire("drag")},_onUp:function(a){if(this._simulateClick&&a.changedTouches){var b=a.changedTouches[0],c=b.target,d=this._newPos&&this._newPos.distanceTo(this._startPos)||0;c.tagName.toLowerCase()==="a"&&(c.className=c.className.replace(" leaflet-active","")),d0&&c<=f,d=b}function l(a){e&&(g.type="dblclick",b(g),d=null)}var d,e=!1,f=250,g,h="_leaflet_",i="touchstart",j="touchend";a[h+i+c]=k,a[h+j+c]=l,a.addEventListener(i,k,!1),a.addEventListener(j,l,!1)},removeDoubleTapListener:function(a,b){var c="_leaflet_";a.removeEventListener(a,a[c+"touchstart"+b],!1),a.removeEventListener(a,a[c+"touchend"+b],!1)}}),L.Map.TouchZoom=L.Handler.extend({addHooks:function(){L.DomEvent.addListener(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){L.DomEvent.removeListener(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(a){var b=this._map;if(!a.touches||a.touches.length!==2||b._animatingZoom||this._zooming)return;var c=b.mouseEventToContainerPoint(a.touches[0]),d=b.mouseEventToContainerPoint(a.touches[1]),e=b.containerPointToLayerPoint(b.getSize().divideBy(2));this._startCenter=c.add(d).divideBy(2,!0),this._startDist=c.distanceTo(d),this._moved=!1,this._zooming=!0,this._centerOffset=e.subtract(this._startCenter),L.DomEvent.addListener(document,"touchmove",this._onTouchMove,this).addListener(document,"touchend",this._onTouchEnd,this),L.DomEvent.preventDefault(a)},_onTouchMove:function(a){if(!a.touches||a.touches.length!==2)return;var b=this._map,c=b.mouseEventToContainerPoint(a.touches[0]),d=b.mouseEventToContainerPoint(a.touches[1]);this._scale=c.distanceTo(d)/this._startDist,this._delta=c.add(d).divideBy(2,!0).subtract(this._startCenter);if(this._scale===1)return;this._moved||(b._mapPane.className+=" leaflet-zoom-anim",b.fire("zoomstart").fire("movestart")._prepareTileBg(),this._moved=!0),b._tileBg.style.webkitTransform=L.DomUtil.getTranslateString(this._delta)+" "+L.DomUtil.getScaleString(this._scale,this._startCenter),L.DomEvent.preventDefault(a)},_onTouchEnd:function(a){if(!this._moved||!this._zooming)return;this._zooming=!1,L.DomEvent.removeListener(document,"touchmove",this._onTouchMove).removeListener(document,"touchend",this._onTouchEnd);var b=this._centerOffset.subtract(this._delta).divideBy(this._scale),c=this._map.getPixelOrigin().add(this._startCenter).add(b),d=this._map.unproject(c),e=this._map.getZoom(),f=Math.log(this._scale)/Math.LN2,g=f>0?Math.ceil(f):Math.floor(f),h=this._map._limitZoom(e+g),i=Math.pow(2,h-e);this._map._runAnimation(d,h,i/this._scale,this._startCenter.add(b))}}),L.Map.BoxZoom=L.Handler.extend({initialize:function(a){this._map=a,this._container=a._container,this._pane=a._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(a){if(!a.shiftKey||a.which!==1&&a.button!==1)return!1;L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(a),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this).addListener(document,"mouseup",this._onMouseUp,this).preventDefault(a)},_onMouseMove:function(a){var b=this._startLayerPoint,c=this._box,d=this._map.mouseEventToLayerPoint(a),e=d.subtract(b),f=new L.Point(Math.min(d.x,b.x),Math.min(d.y,b.y));L.DomUtil.setPosition(c,f),c.style.width=Math.abs(e.x)-4+"px",c.style.height=Math.abs(e.y)-4+"px"},_onMouseUp:function(a){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove).removeListener(document,"mouseup",this._onMouseUp);var b=this._map,c=b.mouseEventToLayerPoint(a),d=new L.LatLngBounds(b.layerPointToLatLng(this._startLayerPoint),b.layerPointToLatLng(c));b.fitBounds(d)}}),L.Handler.MarkerDrag=L.Handler.extend({initialize:function(a){this._marker=a},addHooks:function(){var a=this._marker._icon;this._draggable||(this._draggable=(new L.Draggable(a,a)).on("dragstart",this._onDragStart,this).on("drag",this._onDrag,this).on("dragend",this._onDragEnd,this)),this._draggable.enable()},removeHooks:function(){this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(a){this._marker.closePopup().fire("movestart").fire("dragstart")},_onDrag:function(a){var b=L.DomUtil.getPosition(this._marker._icon);this._marker._shadow&&L.DomUtil.setPosition(this._marker._shadow,b),this._marker._latlng=this._marker._map.layerPointToLatLng(b),this._marker.fire("move").fire("drag")},_onDragEnd:function(){this._marker.fire("moveend").fire("dragend")}}),L.Handler.PolyEdit=L.Handler.extend({options:{icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"})},initialize:function(a,b){this._poly=a,L.Util.setOptions(this,b)},addHooks:function(){this._poly._map&&(this._markerGroup||this._initMarkers(),this._poly._map.addLayer(this._markerGroup))},removeHooks:function(){this._poly._map&&this._poly._map.removeLayer(this._markerGroup)},updateMarkers:function(){this._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){this._markerGroup=new L.LayerGroup,this._markers=[];var a=this._poly._latlngs,b,c,d,e;for(b=0,d=a.length;ba&&(c._index+=b)})},_createMiddleMarker:function(a,b){function e(){var e=b._index;d._index=e,d.off("click",g).on("click",this._onMarkerClick,this),this._poly.spliceLatLngs(e,0,c),this._markers.splice(e,0,d),this._poly.fire("edit"),d.setOpacity(1),this._updateIndexes(e,1),b._index++,this._updatePrevNext(a,d),this._updatePrevNext(d,b)}function f(){d.off("dragstart",e,this),d.off("dragend",f,this),this._createMiddleMarker(a,d),this._createMiddleMarker(d,b)}function g(){e.call(this),f.call(this)}var c=this._getMiddleLatLng(a,b),d=this._createMarker(c);d.setOpacity(.6),a._middleRight=b._middleLeft=d,d.on("click",g,this).on("dragstart",e,this).on("dragend",f,this),this._markerGroup.addLayer(d)},_updatePrevNext:function(a,b){a._next=b,b._prev=a},_getMiddleLatLng:function(a,b){var c=this._poly._map,d=c.latLngToLayerPoint(a.getLatLng()),e=c.latLngToLayerPoint(b.getLatLng());return c.layerPointToLatLng(d._add(e).divideBy(2))}}),L.Control=L.Class.extend({options:{position:"topright"},initialize:function(a){L.Util.setOptions(this,a)},getPosition:function(){return this.options.position},setPosition:function(a){this.options.position=a,this._map&&(this._map.removeControl(this),this._map.addControl(this))}}),L.Map.include({addControl:function(a){var b=a.onAdd(this);a._container=b,a._map=this;var c=a.getPosition(),d=this._controlCorners[c];return L.DomUtil.addClass(b,"leaflet-control"),c.indexOf("bottom")!==-1?d.insertBefore(b,d.firstChild):d.appendChild(b),this},removeControl:function(a){var b=a.getPosition(),c=this._controlCorners[b];return c.removeChild(a._container),a._map=null,a.onRemove&&a.onRemove(this),this},_initControlPos:function(){var a="leaflet-top",b="leaflet-bottom",c="leaflet-left",d="leaflet-right",e=L.DomUtil.create("div","leaflet-control-container",this._container),f=this._controlCorners={};f.topleft=L.DomUtil.create("div",a+" "+c,e),f.topright=L.DomUtil.create("div",a+" "+d,e),f.bottomleft=L.DomUtil.create("div",b+" "+c,e),f.bottomright=L.DomUtil.create("div",b+" "+d,e)}}),L.Control.Zoom=L.Control.extend({options:{position:"topleft"},onAdd:function(a){var b="leaflet-control-zoom",c=L.DomUtil.create("div",b);return this._createButton("Zoom in",b+"-in",c,a.zoomIn,a),this._createButton("Zoom out",b+"-out",c,a.zoomOut,a),c},_createButton:function(a,b,c,d,e){var f=L.DomUtil.create("a",b,c);return f.href="#",f.title=a,L.DomEvent.addListener(f,"click",L.DomEvent.stopPropagation).addListener(f,"click",L.DomEvent.preventDefault).addListener(f,"click",d,e),f}}),L.Control.Attribution=L.Control.extend({options:{position:"bottomright"},initialize:function(a,b){L.Util.setOptions(this,b),this._prefix=a||'Powered by Leaflet',this._attributions={}},onAdd:function(a){return this._container=L.DomUtil.create("div","leaflet-control-attribution"),L.DomEvent.disableClickPropagation(this._container),this._map=a,this._update(),this._container},setPrefix:function(a){this._prefix=a,this._update()},addAttribution:function(a){if(!a)return;this._attributions[a]||(this._attributions[a]=0),this._attributions[a]++,this._update()},removeAttribution:function(a){if(!a)return;this._attributions[a]--,this._update()},_update:function(){if(!this._map)return;var a=[];for(var b in this._attributions)this._attributions.hasOwnProperty(b)&&this._attributions[b]&&a.push(b);var c=[];this._prefix&&c.push(this._prefix),a.length&&c.push(a.join(", ")),this._container.innerHTML=c.join(" — ")}}),L.Control.Layers=L.Control.extend({options:{collapsed:!0,position:"topright"},initialize:function(a,b,c){L.Util.setOptions(this,c),this._layers={};for(var d in a)a.hasOwnProperty(d)&&this._addLayer(a[d],d);for(d in b)b.hasOwnProperty(d)&&this._addLayer(b[d],d,!0)},onAdd:function(a){return this._map=a,this._initLayout(),this._update(),this._container},addBaseLayer:function(a,b){return this._addLayer(a,b),this._update(),this},addOverlay:function(a,b){return this._addLayer(a,b,!0),this._update(),this},removeLayer:function(a){var b=L.Util.stamp(a);return delete this._layers[b],this._update(),this},_initLayout:function(){this._container=L.DomUtil.create("div","leaflet-control-layers"),L.Browser.touch?L.DomEvent.addListener(this._container,"click",L.DomEvent.stopPropagation):L.DomEvent.disableClickPropagation(this._container),this._form=L.DomUtil.create("form","leaflet-control-layers-list");if(this.options.collapsed){L.DomEvent.addListener(this._container,"mouseover",this._expand,this),L.DomEvent.addListener(this._container,"mouseout",this._collapse,this);var a=this._layersLink=L.DomUtil.create("a","leaflet-control-layers-toggle");a.href="#",a.title="Layers",L.Browser.touch?L.DomEvent.addListener(a,"click",this._expand,this):L.DomEvent.addListener(a,"focus",this._expand,this),this._map.on("movestart",this._collapse,this),this._container.appendChild(a)}else this._expand();this._baseLayersList=L.DomUtil.create("div","leaflet-control-layers-base",this._form),this._separator=L.DomUtil.create("div","leaflet-control-layers-separator",this._form),this._overlaysList=L.DomUtil.create("div","leaflet-control-layers-overlays",this._form),this._container.appendChild(this._form)},_addLayer:function(a,b,c){var d=L.Util.stamp(a);this._layers[d]={layer:a,name:b,overlay:c}},_update:function(){if(!this._container)return;this._baseLayersList.innerHTML="",this._overlaysList.innerHTML="";var a=!1,b=!1;for(var c in this._layers)if(this._layers.hasOwnProperty(c)){var d=this._layers[c];this._addItem(d),b=b||d.overlay,a=a||!d.overlay}this._separator.style.display=b&&a?"":"none"},_addItem:function(a,b){var c=document.createElement("label"),d=document.createElement("input");a.overlay||(d.name="leaflet-base-layers"),d.type=a.overlay?"checkbox":"radio",d.checked=this._map.hasLayer(a.layer),d.layerId=L.Util.stamp(a.layer),L.DomEvent.addListener(d,"click",this._onInputClick,this);var e=document.createTextNode(" "+a.name);c.appendChild(d),c.appendChild(e);var f=a.overlay?this._overlaysList:this._baseLayersList;f.appendChild(c)},_onInputClick:function(){var a,b,c,d=this._form.getElementsByTagName("input"),e=d.length;for(a=0;a0},removeEventListener:function(a,b,c){if(!this.hasEventListeners(a))return this;for(var d=0,e=this._leaflet_events,f=e[a].length;d=this.min.x&&c.x<=this.max.x&&b.y>=this.min.y&&c.y<=this.max.y},intersects:function(a){var b=this.min,c=this.max,d=a.min,e=a.max,f=e.x>=b.x&&d.x<=c.x,g=e.y>=b.y&&d.y<=c.y;return f&&g}}),L.Transformation=L.Class.extend({initialize:function(a,b,c,d){this._a=a,this._b=b,this._c=c,this._d=d},transform:function(a,b){return this._transform(a.clone(),b)},_transform:function(a,b){return b=b||1,a.x=b*(this._a*a.x+this._b),a.y=b*(this._c*a.y+this._d),a},untransform:function(a,b){return b=b||1,new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}}),L.DomUtil={get:function(a){return typeof a=="string"?document.getElementById(a):a},getStyle:function(a,b){var c=a.style[b];!c&&a.currentStyle&&(c=a.currentStyle[b]);if(!c||c==="auto"){var d=document.defaultView.getComputedStyle(a,null);c=d?d[b]:null}return c==="auto"?null:c},getViewportOffset:function(a){var b=0,c=0,d=a,e=document.body;do{b+=d.offsetTop||0,c+=d.offsetLeft||0;if(d.offsetParent===e&&L.DomUtil.getStyle(d,"position")==="absolute")break;d=d.offsetParent}while(d);d=a;do{if(d===e)break;b-=d.scrollTop||0,c-=d.scrollLeft||0,d=d.parentNode}while(d);return new L.Point(c,b)},create:function(a,b,c){var d=document.createElement(a);return d.className=b,c&&c.appendChild(d),d},disableTextSelection:function(){document.selection&&document.selection.empty&&document.selection.empty(),this._onselectstart||(this._onselectstart=document.onselectstart,document.onselectstart=L.Util.falseFn)},enableTextSelection:function(){document.onselectstart=this._onselectstart,this._onselectstart=null},hasClass:function(a,b){return a.className.length>0&&RegExp("(^|\\s)"+b+"(\\s|$)").test(a.className)},addClass:function(a,b){L.DomUtil.hasClass(a,b)||(a.className+=(a.className?" ":"")+b)},removeClass:function(a,b){a.className=a.className.replace(/(\S+)\s*/g,function(a,c){return c===b?"":a}).replace(/^\s+/,"")},setOpacity:function(a,b){L.Browser.ie?a.style.filter="alpha(opacity="+Math.round(b*100)+")":a.style.opacity=b},testProp:function(a){var b=document.documentElement.style;for(var c=0;c=b.lat&&e.lat<=c.lat&&d.lng>=b.lng&&e.lng<=c.lng},intersects:function(a){var b=this._southWest,c=this._northEast,d=a.getSouthWest(),e=a.getNorthEast(),f=e.lat>=b.lat&&d.lat<=c.lat,g=e.lng>=b.lng&&d.lng<=c.lng;return f&&g},toBBoxString:function(){var a=this._southWest,b=this._northEast;return[a.lng,a.lat,b.lng,b.lat].join(",")},equals:function(a){return a?this._southWest.equals(a.getSouthWest())&&this._northEast.equals(a.getNorthEast()):!1}}),L.Projection={},L.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(a){var b=L.LatLng.DEG_TO_RAD,c=this.MAX_LATITUDE,d=Math.max(Math.min(c,a.lat),-c),e=a.lng*b,f=d*b;return f=Math.log(Math.tan(Math.PI/4+f/2)),new L.Point(e,f)},unproject:function(a,b){var c=L.LatLng.RAD_TO_DEG,d=a.x*c,e=(2*Math.atan(Math.exp(a.y))-Math.PI/2)*c;return new L.LatLng(e,d,b)}},L.Projection.LonLat={project:function(a){return new L.Point(a.lng,a.lat)},unproject:function(a,b){return new L.LatLng(a.y,a.x,b)}},L.CRS={latLngToPoint:function(a,b){var c=this.projection.project(a);return this.transformation._transform(c,b)},pointToLatLng:function(a,b,c){var d=this.transformation.untransform(a,b);return this.projection.unproject(d,c)},project:function(a){return this.projection.project(a)}},L.CRS.EPSG3857=L.Util.extend({},L.CRS,{code:"EPSG:3857",projection:L.Projection.SphericalMercator,transformation:new L.Transformation(.5/Math.PI,.5,-0.5/Math.PI,.5),project:function(a){var b=this.projection.project(a),c=6378137;return b.multiplyBy(c)}}),L.CRS.EPSG900913=L.Util.extend({},L.CRS.EPSG3857,{code:"EPSG:900913"}),L.CRS.EPSG4326=L.Util.extend({},L.CRS,{code:"EPSG:4326",projection:L.Projection.LonLat,transformation:new L.Transformation(1/360,.5,-1/360,.5)}),L.Map=L.Class.extend({includes:L.Mixin.Events,options:{crs:L.CRS.EPSG3857||L.CRS.EPSG4326,scale:function(a){return 256*Math.pow(2,a)},center:null,zoom:null,layers:[],dragging:!0,touchZoom:L.Browser.touch&&!L.Browser.android,scrollWheelZoom:!L.Browser.touch,doubleClickZoom:!0,boxZoom:!0,zoomControl:!0,attributionControl:!0,fadeAnimation:L.DomUtil.TRANSITION&&!L.Browser.android,zoomAnimation:L.DomUtil.TRANSITION&&!L.Browser.android&&!L.Browser.mobileOpera,trackResize:!0,closePopupOnClick:!0,worldCopyJump:!0},initialize:function(a,b){L.Util.setOptions(this,b);var c=this._container=L.DomUtil.get(a);if(c._leaflet)throw Error("Map container is already initialized.");c._leaflet=!0,this._initLayout(),L.DomEvent&&(this._initEvents(),L.Handler&&this._initInteraction(),L.Control&&this._initControls()),b=this.options,b.maxBounds&&this.setMaxBounds(b.maxBounds);var d=b.center,e=b.zoom;d&&typeof e!="undefined"&&this.setView(d,e,!0),this._initLayers(b.layers)},setView:function(a,b){return this._resetView(a,this._limitZoom(b)),this},setZoom:function(a){return this.setView(this.getCenter(),a)},zoomIn:function(){return this.setZoom(this._zoom+1)},zoomOut:function(){return this.setZoom(this._zoom-1)},fitBounds:function(a){var b=this.getBoundsZoom(a);return this.setView(a.getCenter(),b)},fitWorld:function(){var a=new L.LatLng(-60,-170),b=new L.LatLng(85,179);return this.fitBounds(new L.LatLngBounds(a,b))},panTo:function(a){return this.setView(a,this._zoom)},panBy:function(a){return this.fire("movestart"),this._rawPanBy(a),this.fire("move"),this.fire("moveend")},setMaxBounds:function(a){this.options.maxBounds=a;if(!a)return this._boundsMinZoom=null,this;var b=this.getBoundsZoom(a,!0);return this._boundsMinZoom=b,this._loaded&&(this._zoomf.x&&(g=f.x-d.x),c.y>e.y&&(h=e.y-c.y),c.xl&&--m>0)o=h*Math.sin(j),n=Math.PI/2-2*Math.atan(i*Math.pow((1-o)/(1+o),.5*h))-j,j+=n;return new L.LatLng(j*c,f,b)}},L.CRS.EPSG3395=L.Util.extend({},L.CRS,{code:"EPSG:3395",projection:L.Projection.Mercator,transformation:function(){var a=L.Projection.Mercator,b=a.R_MAJOR,c=a.R_MINOR;return new L.Transformation(.5/(Math.PI*b),.5,-0.5/(Math.PI*c),.5)}()}),L.TileLayer=L.Class.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,scheme:"xyz",continuousWorld:!1,noWrap:!1,zoomOffset:0,zoomReverse:!1,unloadInvisibleTiles:L.Browser.mobile,updateWhenIdle:L.Browser.mobile,reuseTiles:!1},initialize:function(a,b){L.Util.setOptions(this,b),this._url=a;var c=this.options.subdomains;typeof c=="string"&&(this.options.subdomains=c.split(""))},onAdd:function(a,b){this._map=a,this._insertAtTheBottom=b,this._initContainer(),this._createTileProto(),a.on("viewreset",this._resetCallback,this),this.options.updateWhenIdle?a.on("moveend",this._update,this):(this._limitedUpdate=L.Util.limitExecByInterval(this._update,150,this),a.on("move",this._limitedUpdate,this)),this._reset(),this._update()},onRemove:function(a){a._panes.tilePane.removeChild(this._container),a.off("viewreset",this._resetCallback,this),this.options.updateWhenIdle?a.off("moveend",this._update,this):a.off("move",this._limitedUpdate,this),this._container=null,this._map=null},getAttribution:function(){return this.options.attribution},setOpacity:function(a){this.options.opacity=a,this._map&&this._updateOpacity();var b,c=this._tiles;if(L.Browser.webkit)for(b in c)c.hasOwnProperty(b)&&(c[b].style.webkitTransform+=" translate(0,0)")},_updateOpacity:function(){L.DomUtil.setOpacity(this._container,this.options.opacity)},_initContainer:function(){var a=this._map._panes.tilePane,b=a.firstChild;if(!this._container||a.empty)this._container=L.DomUtil.create("div","leaflet-layer"),this._insertAtTheBottom&&b?a.insertBefore(this._container,b):a.appendChild(this._container),this.options.opacity<1&&this._updateOpacity()},_resetCallback:function(a){this._reset(a.hard)},_reset:function(a){var b,c=this._tiles;for(b in c)c.hasOwnProperty(b)&&this.fire("tileunload",{tile:c[b]});this._tiles={},this.options.reuseTiles&&(this._unusedTiles=[]),a&&this._container&&(this._container.innerHTML=""),this._initContainer()},_update:function(){var a=this._map.getPixelBounds(),b=this._map.getZoom(),c=this.options.tileSize;if(b>this.options.maxZoom||ba.max.x||da.max.y)&&this._removeTile(e))},_removeTile:function(a){var b=this._tiles[a];this.fire("tileunload",{tile:b,url:b.src}),b.parentNode===this._container&&this._container.removeChild(b),this.options.reuseTiles&&this._unusedTiles.push(b),b.src=L.Util.emptyImageUrl,delete this._tiles[a]},_addTile:function(a,b){var c=this._map.getZoom(),d=a.x+":"+a.y,e=Math.pow(2,this._getOffsetZoom(c));if(!this.options.continuousWorld)if(!this.options.noWrap)a.x=(a.x%e+e)%e;else if(a.x<0||a.x>=e||a.y<0||a.y>=e){this._tilesToLoad--;return}var f=this._getTile();L.DomUtil.setPosition(f,this._getTilePos(a)),this._tiles[d]=f,this.options.scheme==="tms"&&(a.y=e-a.y-1),this._loadTile(f,a,c),b.appendChild(f)},_getOffsetZoom:function(a){var b=this.options;return a=b.zoomReverse?b.maxZoom-a:a,a+b.zoomOffset},_getTilePos:function(a){var b=this._map.getPixelOrigin(),c=this.options.tileSize;return a.multiplyBy(c).subtract(b)},getTileUrl:function(a,b){var c=this.options.subdomains,d=(a.x+a.y)%c.length,e=this.options.subdomains[d];return L.Util.template(this._url,L.Util.extend({s:e,z:this._getOffsetZoom(b),x:a.x,y:a.y},this.options))},_createTileProto:function(){var a=this._tileImg=L.DomUtil.create("img","leaflet-tile");a.galleryimg="no";var b=this.options.tileSize;a.style.width=b+"px",a.style.height=b+"px"},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var a=this._unusedTiles.pop();return this._resetTile(a),a}return this._createTile()},_resetTile:function(a){},_createTile:function(){var a=this._tileImg.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a.onload=this._tileOnLoad,a.onerror=this._tileOnError,a.src=this.getTileUrl(b,c)},_tileOnLoad:function(a){var b=this._layer;this.className+=" leaflet-tile-loaded",b.fire("tileload",{tile:this,url:this.src}),b._tilesToLoad--,b._tilesToLoad||b.fire("load")},_tileOnError:function(a){var b=this._layer;b.fire("tileerror",{tile:this,url:this.src});var c=b.options.errorTileUrl;c&&(this.src=c)}}),L.TileLayer.WMS=L.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(a,b){this._url=a;var c=L.Util.extend({},this.defaultWmsParams);c.width=c.height=this.options.tileSize;for(var d in b)this.options.hasOwnProperty(d)||(c[d]=b[d]);this.wmsParams=c,L.Util.setOptions(this,b)},onAdd:function(a,b){var c=parseFloat(this.wmsParams.version)<1.3?"srs":"crs";this.wmsParams[c]=a.options.crs.code,L.TileLayer.prototype.onAdd.call(this,a,b)},getTileUrl:function(a,b){var c=this._map,d=c.options.crs,e=this.options.tileSize,f=a.multiplyBy(e),g=f.add(new L.Point(e,e)),h=c.unproject(f,b,!0),i=c.unproject(g,b,!0),j=d.project(h),k=d.project(i),l=[j.x,k.y,k.x,j.y].join(",");return this._url+L.Util.getParamString(this.wmsParams)+"&bbox="+l}}),L.TileLayer.Canvas=L.TileLayer.extend({options:{async:!1},initialize:function(a){L.Util.setOptions(this,a)},redraw:function(){var a,b=this._tiles;for(a in b)b.hasOwnProperty(a)&&this._redrawTile(b[a])},_redrawTile:function(a){this.drawTile(a,a._tilePoint,a._zoom)},_createTileProto:function(){var a=this._canvasProto=L.DomUtil.create("canvas","leaflet-tile"),b=this.options.tileSize;a.width=b,a.height=b},_createTile:function(){var a=this._canvasProto.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a._tilePoint=b,a._zoom=c,this.drawTile(a,b,c),this.options.async||this.tileDrawn(a)},drawTile:function(a,b,c){},tileDrawn:function(a){this._tileOnLoad.call(a)}}),L.ImageOverlay=L.Class.extend({includes:L.Mixin.Events,initialize:function(a,b){this._url=a,this._bounds=b},onAdd:function(a){this._map=a,this._image||this._initImage(),a._panes.overlayPane.appendChild(this._image),a.on("viewreset",this._reset,this),this._reset()},onRemove:function(a){a.getPanes().overlayPane.removeChild(this._image),a.off("viewreset",this._reset,this)},_initImage:function(){this._image=L.DomUtil.create("img","leaflet-image-layer"),this._image.style.visibility="hidden",L.Util.extend(this._image,{galleryimg:"no",onselectstart:L.Util.falseFn,onmousemove:L.Util.falseFn,onload:L.Util.bind(this._onImageLoad,this),src:this._url})},_reset:function(){var a=this._image,b=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),c=this._map.latLngToLayerPoint(this._bounds.getSouthEast()).subtract(b);L.DomUtil.setPosition(a,b),a.style.width=c.x+"px",a.style.height=c.y+"px"},_onImageLoad:function(){this._image.style.visibility="",this.fire("load")}}),L.Icon=L.Class.extend({options:{className:""},initialize:function(a){L.Util.setOptions(this,a)},createIcon:function(){return this._createIcon("icon")},createShadow:function(){return this.options.shadowUrl?this._createIcon("shadow"):null},_createIcon:function(a){var b=this._createImg(this.options[a+"Url"]);return this._setIconStyles(b,a),b},_setIconStyles:function(a,b){var c=this.options,d=c[b+"Size"],e=c.iconAnchor;!e&&d&&(e=d.divideBy(2,!0)),b==="shadow"&&e&&c.shadowOffset&&e._add(c.shadowOffset),a.className="leaflet-marker-"+b+" "+c.className,e&&(a.style.marginLeft=-e.x+"px",a.style.marginTop=-e.y+"px"),d&&(a.style.width=d.x+"px",a.style.height=d.y+"px")},_createImg:function(a){var b;return L.Browser.ie6?(b=document.createElement("div"),b.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'")'):(b=document.createElement("img"),b.src=a),b}}),L.Icon.Default=L.Icon.extend({options:{iconUrl:L.ROOT_URL+"images/marker.png",iconSize:new L.Point(25,41),iconAnchor:new L.Point(13,41),popupAnchor:new L.Point(0,-33),shadowUrl:L.ROOT_URL+"images/marker-shadow.png",shadowSize:new L.Point(41,41)}}),L.Marker=L.Class.extend({includes:L.Mixin.Events,options:{icon:new L.Icon.Default,title:"",clickable:!0,draggable:!1,zIndexOffset:0,opacity:1},initialize:function(a,b){L.Util.setOptions(this,b),this._latlng=a},onAdd:function(a){this._map=a,a.on("viewreset",this._reset,this),this._initIcon(),this._reset()},onRemove:function(a){this._removeIcon(),this.closePopup&&this.closePopup(),a.off("viewreset",this._reset,this),this._map=null},getLatLng:function(){return this._latlng},setLatLng:function(a){this._latlng=a,this._reset(),this._popup&&this._popup.setLatLng(a)},setZIndexOffset:function(a){this.options.zIndexOffset=a,this._reset()},setIcon:function(a){this._map&&this._removeIcon(),this.options.icon=a,this._map&&(this._initIcon(),this._reset())},_initIcon:function(){var a=this.options;this._icon||(this._icon=a.icon.createIcon(),a.title&&(this._icon.title=a.title),this._initInteraction(),this._updateOpacity()),this._shadow||(this._shadow=a.icon.createShadow());var b=this._map._panes;b.markerPane.appendChild(this._icon),this._shadow&&b.shadowPane.appendChild(this._shadow)},_removeIcon:function(){var a=this._map._panes;a.markerPane.removeChild(this._icon),this._shadow&&a.shadowPane.removeChild(this._shadow),this._icon=this._shadow=null},_reset:function(){var a=this._icon;if(!a)return;var b=this._map.latLngToLayerPoint(this._latlng).round();L.DomUtil.setPosition(a,b),this._shadow&&L.DomUtil.setPosition(this._shadow,b),a.style.zIndex=b.y+this.options.zIndexOffset},_initInteraction:function(){if(!this.options.clickable)return;var a=this._icon,b=["dblclick","mousedown","mouseover","mouseout"];a.className+=" leaflet-clickable",L.DomEvent.addListener(a,"click",this._onMouseClick,this);for(var c=0;cd?(a.style.height=d+"px",a.className+=e):a.className=a.className.replace(e,""),this._containerWidth=this._container.offsetWidth},_updatePosition:function(){var a=this._map.latLngToLayerPoint(this._latlng);this._containerBottom=-a.y-this.options.offset.y,this._containerLeft=a.x-Math.round(this._containerWidth/2)+this.options.offset.x,this._container.style.bottom=this._containerBottom+"px",this._container.style.left=this._containerLeft+"px"},_adjustPan:function(){if(!this.options.autoPan)return;var a=this._map,b=this._container.offsetHeight,c=this._containerWidth,d=new L.Point(this._containerLeft,-b-this._containerBottom),e=a.layerPointToContainerPoint(d),f=new L.Point(0,0),g=this.options.autoPanPadding,h=a.getSize();e.x<0&&(f.x=e.x-g.x),e.x+c>h.x&&(f.x=e.x+c-h.x+g.x),e.y<0&&(f.y=e.y-g.y),e.y+b>h.y&&(f.y=e.y+b-h.y+g.y),(f.x||f.y)&&a.panBy(f)},_onCloseButtonClick:function(a){this._close(),L.DomEvent.stop(a)}}),L.Marker.include({openPopup:function(){return this._popup&&this._map&&(this._popup.setLatLng(this._latlng),this._map.openPopup(this._popup)),this},closePopup:function(){return this._popup&&this._popup._close(),this},bindPopup:function(a,b){var c=this.options.icon.options.popupAnchor||new L.Point(0,0);return b&&b.offset&&(c=c.add(b.offset)),b=L.Util.extend({offset:c},b),this._popup||this.on("click",this.openPopup,this),this._popup=(new L.Popup(b,this)).setContent(a),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.openPopup)),this}}),L.Map.include({openPopup:function(a){return this.closePopup(),this._popup=a,this.addLayer(a).fire("popupopen",{popup:this._popup})},closePopup:function(){return this._popup&&(this.removeLayer(this._popup).fire("popupclose",{popup:this._popup}),this._popup=null),this}}),L.LayerGroup=L.Class.extend({initialize:function(a){this._layers={};var b,c;if(a)for(b=0,c=a.length;b';var b=a.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}(),L.Path=L.Browser.svg||!L.Browser.vml?L.Path:L.Path.extend({statics:{VML:!0,CLIP_PADDING:.02},_createElement:function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(a){return document.createElement("')}}catch(a){return function(a){return document.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_initPath:function(){var a=this._container=this._createElement("shape");a.className+=" leaflet-vml-shape"+(this.options.clickable?" leaflet-clickable":""),a.coordsize="1 1",this._path=this._createElement("path"),a.appendChild(this._path),this._map._pathRoot.appendChild(a)},_initStyle:function(){var a=this._container,b,c;this.options.stroke&&(b=this._stroke=this._createElement("stroke"),b.endcap="round",a.appendChild(b)),this.options.fill&&(c=this._fill=this._createElement("fill"),a.appendChild(c)),this._updateStyle()},_updateStyle:function(){var a=this._stroke,b=this._fill,c=this.options,d=this._container;d.stroked=c.stroke,d.filled=c.fill,c.stroke&&(a.weight=c.weight+"px",a.color=c.color,a.opacity=c.opacity),c.fill&&(b.color=c.fillColor||c.color,b.opacity=c.fillOpacity)},_updatePath:function(){var a=this._container.style;a.display="none",this._path.v=this.getPathString()+" ",a.display=""}}),L.Map.include(L.Browser.svg||!L.Browser.vml?{}:{_initPathRoot:function(){if(this._pathRoot)return;var a=this._pathRoot=document.createElement("div");a.className="leaflet-vml-container",this._panes.overlayPane.appendChild(a),this.on("moveend",this._updatePathViewport),this._updatePathViewport()}}),L.Browser.canvas=function(){return!!document.createElement("canvas").getContext}(),L.Path=L.Path.SVG&&!window.L_PREFER_CANVAS||!L.Browser.canvas?L.Path:L.Path.extend({statics:{CANVAS:!0,SVG:!1},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){var a=this.options;a.stroke&&(this._ctx.lineWidth=a.weight,this._ctx.strokeStyle=a.color),a.fill&&(this._ctx.fillStyle=a.fillColor||a.color)},_drawPath:function(){var a,b,c,d,e,f;this._ctx.beginPath();for(a=0,c=this._parts.length;af&&(g=h,f=i);f>c&&(b[g]=1,this._simplifyDPStep(a,b,c,d,g),this._simplifyDPStep(a,b,c,g,e))},_reducePoints:function(a,b){var c=[a[0]];for(var d=1,e=0,f=a.length;db&&(c.push(a[d]),e=d);return eb.max.x&&(c|=2),a.yb.max.y&&(c|=8),c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqClosestPointOnSegment:function(a,b,c,d){var e=b.x,f=b.y,g=c.x-e,h=c.y-f,i=g*g+h*h,j;return i>0&&(j=((a.x-e)*g+(a.y-f)*h)/i,j>1?(e=c.x,f=c.y):j>0&&(e+=g*j,f+=h*j)),g=a.x-e,h=a.y-f,d?g*g+h*h:new L.Point(e,f)}},L.Polyline=L.Path.extend({initialize:function(a,b){L.Path.prototype.initialize.call(this,b),this._latlngs=a,L.Handler.PolyEdit&&(this.editing=new L.Handler.PolyEdit(this),this.options.editable&&this.editing.enable())},options:{smoothFactor:1,noClip:!1},projectLatlngs:function(){this._originalPoints=[];for(var a=0,b=this._latlngs.length;aa.max.x||c.y-b>a.max.y||c.x+ba.y!=e.y>a.y&&a.x<(e.x-d.x)*(a.y-d.y)/(e.y-d.y)+d.x&&(b=!b)}return b}}:{}),L.Circle.include(L.Path.CANVAS?{_drawPath:function(){var a=this._point;this._ctx.beginPath(),this._ctx.arc(a.x,a.y,this._radius,0,Math.PI*2,!1)},_containsPoint:function(a){var b=this._point,c=this.options.stroke?this.options.weight/2:0;return a.distanceTo(b)<=this._radius+c}}:{}),L.GeoJSON=L.FeatureGroup.extend({initialize:function(a,b){L.Util.setOptions(this,b),this._geojson=a,this._layers={},a&&this.addGeoJSON(a)},addGeoJSON:function(a){var b=a.features,c,d;if(b){for(c=0,d=b.length;c1){this._simulateClick=!1;return}var b=a.touches&&a.touches.length===1?a.touches[0]:a,c=b.target;L.DomEvent.preventDefault(a),L.Browser.touch&&c.tagName.toLowerCase()==="a"&&(c.className+=" leaflet-active"),this._moved=!1;if(this._moving)return;L.Browser.touch||(L.DomUtil.disableTextSelection(),this._setMovingCursor()),this._startPos=this._newPos=L.DomUtil.getPosition(this._element),this._startPoint=new L.Point(b.clientX,b.clientY),L.DomEvent.addListener(document,L.Draggable.MOVE,this._onMove,this),L.DomEvent.addListener(document,L.Draggable.END,this._onUp,this)},_onMove:function(a){if(a.touches&&a.touches.length>1)return;L.DomEvent.preventDefault(a);var b=a.touches&&a.touches.length===1?a.touches[0]:a;this._moved||(this.fire("dragstart"),this._moved=!0),this._moving=!0;var c=new L.Point(b.clientX,b.clientY);this._newPos=this._startPos.add(c).subtract(this._startPoint),L.Util.cancelAnimFrame(this._animRequest),this._animRequest=L.Util.requestAnimFrame(this._updatePosition,this,!0,this._dragStartTarget)},_updatePosition:function(){this.fire("predrag"),L.DomUtil.setPosition(this._element,this._newPos),this.fire("drag")},_onUp:function(a){if(this._simulateClick&&a.changedTouches){var b=a.changedTouches[0],c=b.target,d=this._newPos&&this._newPos.distanceTo(this._startPos)||0;c.tagName.toLowerCase()==="a"&&(c.className=c.className.replace(" leaflet-active","")),d0&&c<=f,d=b}function l(a){e&&(g.type="dblclick",b(g),d=null)}var d,e=!1,f=250,g,h="_leaflet_",i="touchstart",j="touchend";a[h+i+c]=k,a[h+j+c]=l,a.addEventListener(i,k,!1),a.addEventListener(j,l,!1)},removeDoubleTapListener:function(a,b){var c="_leaflet_";a.removeEventListener(a,a[c+"touchstart"+b],!1),a.removeEventListener(a,a[c+"touchend"+b],!1)}}),L.Map.TouchZoom=L.Handler.extend({addHooks:function(){L.DomEvent.addListener(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){L.DomEvent.removeListener(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(a){var b=this._map;if(!a.touches||a.touches.length!==2||b._animatingZoom||this._zooming)return;var c=b.mouseEventToContainerPoint(a.touches[0]),d=b.mouseEventToContainerPoint(a.touches[1]),e=b.containerPointToLayerPoint(b.getSize().divideBy(2));this._startCenter=c.add(d).divideBy(2,!0),this._startDist=c.distanceTo(d),this._moved=!1,this._zooming=!0,this._centerOffset=e.subtract(this._startCenter),L.DomEvent.addListener(document,"touchmove",this._onTouchMove,this).addListener(document,"touchend",this._onTouchEnd,this),L.DomEvent.preventDefault(a)},_onTouchMove:function(a){if(!a.touches||a.touches.length!==2)return;var b=this._map,c=b.mouseEventToContainerPoint(a.touches[0]),d=b.mouseEventToContainerPoint(a.touches[1]);this._scale=c.distanceTo(d)/this._startDist,this._delta=c.add(d).divideBy(2,!0).subtract(this._startCenter);if(this._scale===1)return;this._moved||(b._mapPane.className+=" leaflet-zoom-anim",b.fire("zoomstart").fire("movestart")._prepareTileBg(),this._moved=!0),b._tileBg.style.webkitTransform=L.DomUtil.getTranslateString(this._delta)+" "+L.DomUtil.getScaleString(this._scale,this._startCenter),L.DomEvent.preventDefault(a)},_onTouchEnd:function(a){if(!this._moved||!this._zooming)return;this._zooming=!1,L.DomEvent.removeListener(document,"touchmove",this._onTouchMove).removeListener(document,"touchend",this._onTouchEnd);var b=this._centerOffset.subtract(this._delta).divideBy(this._scale),c=this._map.getPixelOrigin().add(this._startCenter).add(b),d=this._map.unproject(c),e=this._map.getZoom(),f=Math.log(this._scale)/Math.LN2,g=f>0?Math.ceil(f):Math.floor(f),h=this._map._limitZoom(e+g),i=Math.pow(2,h-e);this._map._runAnimation(d,h,i/this._scale,this._startCenter.add(b))}}),L.Map.BoxZoom=L.Handler.extend({initialize:function(a){this._map=a,this._container=a._container,this._pane=a._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(a){if(!a.shiftKey||a.which!==1&&a.button!==1)return!1;L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(a),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this).addListener(document,"mouseup",this._onMouseUp,this).preventDefault(a)},_onMouseMove:function(a){var b=this._startLayerPoint,c=this._box,d=this._map.mouseEventToLayerPoint(a),e=d.subtract(b),f=new L.Point(Math.min(d.x,b.x),Math.min(d.y,b.y));L.DomUtil.setPosition(c,f),c.style.width=Math.abs(e.x)-4+"px",c.style.height=Math.abs(e.y)-4+"px"},_onMouseUp:function(a){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove).removeListener(document,"mouseup",this._onMouseUp);var b=this._map,c=b.mouseEventToLayerPoint(a),d=new L.LatLngBounds(b.layerPointToLatLng(this._startLayerPoint),b.layerPointToLatLng(c));b.fitBounds(d)}}),L.Handler.MarkerDrag=L.Handler.extend({initialize:function(a){this._marker=a},addHooks:function(){var a=this._marker._icon;this._draggable||(this._draggable=(new L.Draggable(a,a)).on("dragstart",this._onDragStart,this).on("drag",this._onDrag,this).on("dragend",this._onDragEnd,this)),this._draggable.enable()},removeHooks:function(){this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(a){this._marker.closePopup().fire("movestart").fire("dragstart")},_onDrag:function(a){var b=L.DomUtil.getPosition(this._marker._icon);this._marker._shadow&&L.DomUtil.setPosition(this._marker._shadow,b),this._marker._latlng=this._marker._map.layerPointToLatLng(b),this._marker.fire("move").fire("drag")},_onDragEnd:function(){this._marker.fire("moveend").fire("dragend")}}),L.Handler.PolyEdit=L.Handler.extend({options:{icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"})},initialize:function(a,b){this._poly=a,L.Util.setOptions(this,b)},addHooks:function(){this._poly._map&&(this._markerGroup||this._initMarkers(),this._poly._map.addLayer(this._markerGroup))},removeHooks:function(){this._poly._map&&this._poly._map.removeLayer(this._markerGroup)},updateMarkers:function(){this._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){this._markerGroup=new L.LayerGroup,this._markers=[];var a=this._poly._latlngs,b,c,d,e;for(b=0,d=a.length;ba&&(c._index+=b)})},_createMiddleMarker:function(a,b){function e(){var e=b._index;d._index=e,d.off("click",g).on("click",this._onMarkerClick,this),this._poly.spliceLatLngs(e,0,c),this._markers.splice(e,0,d),d.setOpacity(1),this._updateIndexes(e,1),b._index++,this._updatePrevNext(a,d),this._updatePrevNext(d,b)}function f(){d.off("dragstart",e,this),d.off("dragend",f,this),this._createMiddleMarker(a,d),this._createMiddleMarker(d,b)}function g(){e.call(this),f.call(this),this._poly.fire("edit")}var c=this._getMiddleLatLng(a,b),d=this._createMarker(c);d.setOpacity(.6),a._middleRight=b._middleLeft=d,d.on("click",g,this).on("dragstart",e,this).on("dragend",f,this),this._markerGroup.addLayer(d)},_updatePrevNext:function(a,b){a._next=b,b._prev=a},_getMiddleLatLng:function(a,b){var c=this._poly._map,d=c.latLngToLayerPoint(a.getLatLng()),e=c.latLngToLayerPoint(b.getLatLng());return c.layerPointToLatLng(d._add(e).divideBy(2))}}),L.Control=L.Class.extend({options:{position:"topright"},initialize:function(a){L.Util.setOptions(this,a)},getPosition:function(){return this.options.position},setPosition:function(a){this.options.position=a,this._map&&(this._map.removeControl(this),this._map.addControl(this))}}),L.Map.include({addControl:function(a){var b=a.onAdd(this);a._container=b,a._map=this;var c=a.getPosition(),d=this._controlCorners[c];return L.DomUtil.addClass(b,"leaflet-control"),c.indexOf("bottom")!==-1?d.insertBefore(b,d.firstChild):d.appendChild(b),this},removeControl:function(a){var b=a.getPosition(),c=this._controlCorners[b];return c.removeChild(a._container),a._map=null,a.onRemove&&a.onRemove(this),this},_initControlPos:function(){var a="leaflet-top",b="leaflet-bottom",c="leaflet-left",d="leaflet-right",e="leaflet-corner",f=this._container,g=this._controlCorners={};g.topleft=L.DomUtil.create("div",[e,a,c].join(" "),f),g.topright=L.DomUtil.create("div",[e,a,d].join(" "),f),g.bottomleft=L.DomUtil.create("div",[e,b,c].join(" "),f),g.bottomright=L.DomUtil.create("div",[e,b,d].join(" "),f)}}),L.Control.Zoom=L.Control.extend({options:{position:"topleft"},onAdd:function(a){var b="leaflet-control-zoom",c=L.DomUtil.create("div",b);return this._createButton("Zoom in",b+"-in",c,a.zoomIn,a),this._createButton("Zoom out",b+"-out",c,a.zoomOut,a),c},_createButton:function(a,b,c,d,e){var f=L.DomUtil.create("a",b,c);return f.href="#",f.title=a,L.DomEvent.addListener(f,"click",L.DomEvent.stopPropagation).addListener(f,"click",L.DomEvent.preventDefault).addListener(f,"click",d,e),f}}),L.Control.Attribution=L.Control.extend({options:{position:"bottomright"},initialize:function(a,b){L.Util.setOptions(this,b),this._prefix=a||'Powered by Leaflet',this._attributions={}},onAdd:function(a){return this._container=L.DomUtil.create("div","leaflet-control-attribution"),L.DomEvent.disableClickPropagation(this._container),this._map=a,this._update(),this._container},setPrefix:function(a){this._prefix=a,this._update()},addAttribution:function(a){if(!a)return;this._attributions[a]||(this._attributions[a]=0),this._attributions[a]++,this._update()},removeAttribution:function(a){if(!a)return;this._attributions[a]--,this._update()},_update:function(){if(!this._map)return;var a=[];for(var b in this._attributions)this._attributions.hasOwnProperty(b)&&this._attributions[b]&&a.push(b);var c=[];this._prefix&&c.push(this._prefix),a.length&&c.push(a.join(", ")),this._container.innerHTML=c.join(" — ")}}),L.Control.Layers=L.Control.extend({options:{collapsed:!0,position:"topright"},initialize:function(a,b,c){L.Util.setOptions(this,c),this._layers={};for(var d in a)a.hasOwnProperty(d)&&this._addLayer(a[d],d);for(d in b)b.hasOwnProperty(d)&&this._addLayer(b[d],d,!0)},onAdd:function(a){return this._map=a,this._initLayout(),this._update(),this._container},addBaseLayer:function(a,b){return this._addLayer(a,b),this._update(),this},addOverlay:function(a,b){return this._addLayer(a,b,!0),this._update(),this},removeLayer:function(a){var b=L.Util.stamp(a);return delete this._layers[b],this._update(),this},_initLayout:function(){this._container=L.DomUtil.create("div","leaflet-control-layers"),L.Browser.touch?L.DomEvent.addListener(this._container,"click",L.DomEvent.stopPropagation):L.DomEvent.disableClickPropagation(this._container),this._form=L.DomUtil.create("form","leaflet-control-layers-list");if(this.options.collapsed){L.DomEvent.addListener(this._container,"mouseover",this._expand,this),L.DomEvent.addListener(this._container,"mouseout",this._collapse,this);var a=this._layersLink=L.DomUtil.create("a","leaflet-control-layers-toggle");a.href="#",a.title="Layers",L.Browser.touch?L.DomEvent.addListener(a,"click",this._expand,this):L.DomEvent.addListener(a,"focus",this._expand,this),this._map.on("movestart",this._collapse,this),this._container.appendChild(a)}else this._expand();this._baseLayersList=L.DomUtil.create("div","leaflet-control-layers-base",this._form),this._separator=L.DomUtil.create("div","leaflet-control-layers-separator",this._form),this._overlaysList=L.DomUtil.create("div","leaflet-control-layers-overlays",this._form),this._container.appendChild(this._form)},_addLayer:function(a,b,c){var d=L.Util.stamp(a);this._layers[d]={layer:a,name:b,overlay:c}},_update:function(){if(!this._container)return;this._baseLayersList.innerHTML="",this._overlaysList.innerHTML="";var a=!1,b=!1;for(var c in this._layers)if(this._layers.hasOwnProperty(c)){var d=this._layers[c];this._addItem(d),b=b||d.overlay,a=a||!d.overlay}this._separator.style.display=b&&a?"":"none"},_addItem:function(a,b){var c=document.createElement("label"),d=document.createElement("input");a.overlay||(d.name="leaflet-base-layers"),d.type=a.overlay?"checkbox":"radio",d.checked=this._map.hasLayer(a.layer),d.layerId=L.Util.stamp(a.layer),L.DomEvent.addListener(d,"click",this._onInputClick,this);var e=document.createTextNode(" "+a.name);c.appendChild(d),c.appendChild(e);var f=a.overlay?this._overlaysList:this._baseLayersList;f.appendChild(c)},_onInputClick:function(){var a,b,c,d=this._form.getElementsByTagName("input"),e=d.length;for(a=0;a