|
|
|
@ -9,12 +9,13 @@ L.Class.extend=function(a){function b(){!L.Class._prototyping&&this.initialize&&
|
|
|
|
|
function(e){L.Util.extend(this.prototype,e)};for(var d in this)if(this.hasOwnProperty(d)&&d!="prototype")b[d]=this[d];return b};L.Mixin={};
|
|
|
|
|
L.Mixin.Events={addEventListener:function(a,b,c){var d=this._leaflet_events=this._leaflet_events||{};d[a]=d[a]||[];d[a].push({action:b,context:c});return this},hasEventListeners:function(a){return"_leaflet_events"in this&&a in this._leaflet_events&&this._leaflet_events[a].length>0},removeEventListener:function(a,b,c){if(!this.hasEventListeners(a))return this;for(var d=0,e=this._leaflet_events,f=e[a].length;d<f;d++)if(e[a][d].action===b&&(!c||e[a][d].context===c)){e[a].splice(d,1);break}return this},fireEvent:function(a,
|
|
|
|
|
b){if(this.hasEventListeners(a)){for(var c=L.Util.extend({type:a,target:this},b),d=this._leaflet_events[a].slice(),e=0,f=d.length;e<f;e++)d[e].action.call(d[e].context||this,c);return this}}};L.Mixin.Events.on=L.Mixin.Events.addEventListener;L.Mixin.Events.off=L.Mixin.Events.removeEventListener;L.Mixin.Events.fire=L.Mixin.Events.fireEvent;(function(){var a=navigator.userAgent.toLowerCase(),b=!!window.ActiveXObject,c=a.indexOf("webkit")!=-1,d=a.indexOf("mobile")!=-1;L.Browser={ie:b,ie6:b&&!window.XMLHttpRequest,webkit:c,webkit3d:c&&"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix,mobileWebkit:c&&d,gecko:a.indexOf("gecko")!=-1}})();L.Point=function(a,b,c){this.x=c?Math.round(a):a;this.y=c?Math.round(b):b};
|
|
|
|
|
L.Point.prototype={add:function(a){return new L.Point(this.x+a.x,this.y+a.y)},subtract:function(a){return new L.Point(this.x-a.x,this.y-a.y)},divideBy:function(a,b){return new L.Point(this.x/a,this.y/a,b)},multiplyBy:function(a){return new L.Point(this.x*a,this.y*a)},distanceTo:function(a){var b=a.x-this.x;a=a.y-this.y;return Math.sqrt(b*b+a*a)},round:function(){return new L.Point(Math.round(this.x),Math.round(this.y))},clone:function(){return new L.Point(this.x,this.y)},toString:function(){return"Point("+
|
|
|
|
|
L.Util.formatNum(this.x)+", "+L.Util.formatNum(this.y)+")"}};L.Bounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){if(!this.min&&!this.max){this.min=new L.Point(a.x,a.y);this.max=new L.Point(a.x,a.y)}else{this.min.x=Math.min(a.x,this.min.x);this.max.x=Math.max(a.x,this.max.x);this.min.y=Math.min(a.y,this.min.y);this.max.y=Math.max(a.y,this.max.y)}},getCenter:function(a){return new L.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,a)},contains:function(a){return a.min.x>=
|
|
|
|
|
this.min.x&&a.max.x<=this.max.x&&a.min.y>=this.min.y&&a.max.y<=this.max.y}});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){b=b||1;return new L.Point(b*(this._a*a.x+this._b),b*(this._c*a.y+this._d))},untransform:function(a,b){b=b||1;return new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}});L.LineUtil={};
|
|
|
|
|
L.Util.extend(L.LineUtil,{simplify:function(a,b){if(!b)return a.slice();var c=b*b;a=this._reducePoints(a,c);return a=this._dpSimplify(a,c)},_dpSimplify:function(a,b){for(var c=0,d=0,e=1,f=a.length,g;e<f-1;e++){g=this._sqPointToSegmentDist(a[e],a[0],a[f-1]);if(g>c){d=e;c=g}}if(c>=b){c=a.slice(0,d);d=a.slice(d);f=this._dpSimplify(c,b).slice(0,f-2);d=this._dpSimplify(d,b);return f.concat(d)}else return[a[0],a[f-1]]},_reducePoints:function(a,b){for(var c=[a[0]],d=1,e=0,f=a.length;d<f;d++)if(!(this._sqDist(a[d],a[e])<
|
|
|
|
|
b)){c.push(a[d]);e=d}e<f-1&&c.push(a[f-1]);return c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqPointToSegmentDist:function(a,b,c){var d=this._sqDist(b,c);if(d==0)return this._sqDist(a,b);var e=c.x-b.x,f=c.y-b.y;d=((a.x-b.x)*e+(a.y-b.y)*f)/d;if(d<0)return this._sqDist(a,b);if(d>1)return this._sqDist(a,c);b=new L.Point(b.x+e*d,b.y+f*d);return this._sqDist(a,b)}});
|
|
|
|
|
L.Util.extend(L.LineUtil,{clipSegment:function(a,b,c){function d(j,k){if(j===0)return k>=0;else{var h=k/j;if(j<0)if(h>f)return false;else{if(h>e)e=h}else if(h<e)return false;else if(h<f)f=h;return true}}var e=0,f=1,g=b.x-a.x,i=b.y-a.y;if(d(-g,a.x-c.min.x)&&d(g,c.max.x-a.x)&&d(-i,a.y-c.min.y)&&d(i,c.max.y-a.y)){if(f<1)b=new L.Point(a.x+g*f,a.y+i*f);if(e>0)a=new L.Point(a.x+g*e,a.y+i*e);return[a,b]}return false}});L.DomEvent={addListener:function(a,b,c,d){function e(g){return c.call(d||a,g||L.DomEvent._getEvent())}var f=L.Util.stamp(c);a["_leaflet_"+b+f]=e;if("addEventListener"in a){b=="mousewheel"&&a.addEventListener("DOMMouseScroll",e,false);a.addEventListener(b,e,false)}else"attachEvent"in a&&a.attachEvent("on"+b,e)},removeListener:function(a,b,c){c=L.Util.stamp(c);c="_leaflet_"+b+c;handler=a[c];if("removeEventListener"in a){b=="mousewheel"&&a.removeEventListener("DOMMouseScroll",handler,false);a.removeEventListener(b,
|
|
|
|
|
L.Point.prototype={add:function(a){return new L.Point(this.x+a.x,this.y+a.y)},subtract:function(a){return this.clone()._subtract(a)},_subtract:function(a){this.x-=a.x;this.y-=a.y;return this},divideBy:function(a,b){return new L.Point(this.x/a,this.y/a,b)},multiplyBy:function(a){return new L.Point(this.x*a,this.y*a)},distanceTo:function(a){var b=a.x-this.x;a=a.y-this.y;return Math.sqrt(b*b+a*a)},round:function(){return this.clone()._round()},_round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);
|
|
|
|
|
return this},clone:function(){return new L.Point(this.x,this.y)},toString:function(){return"Point("+L.Util.formatNum(this.x)+", "+L.Util.formatNum(this.y)+")"}};L.Bounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){if(!this.min&&!this.max){this.min=new L.Point(a.x,a.y);this.max=new L.Point(a.x,a.y)}else{this.min.x=Math.min(a.x,this.min.x);this.max.x=Math.max(a.x,this.max.x);this.min.y=Math.min(a.y,this.min.y);this.max.y=Math.max(a.y,this.max.y)}},getCenter:function(a){return new L.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,a)},contains:function(a){return a.min.x>=
|
|
|
|
|
this.min.x&&a.max.x<=this.max.x&&a.min.y>=this.min.y&&a.max.y<=this.max.y}});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){b=b||1;a.x=b*(this._a*a.x+this._b);a.y=b*(this._c*a.y+this._d);return a},untransform:function(a,b){b=b||1;return new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}});L.LineUtil={};
|
|
|
|
|
L.Util.extend(L.LineUtil,{simplify:function(a,b){if(!b)return a.slice();var c=b*b;a=this._reducePoints(a,c);return a=this._dpSimplify(a,c)},pointToSegmentDistance:function(a,b,c){return Math.sqrt(this._sqPointToSegmentDist(a,b,c))},_dpSimplify:function(a,b){for(var c=0,d=0,e=1,f=a.length,g;e<f-1;e++){g=this._sqPointToSegmentDist(a[e],a[0],a[f-1]);if(g>c){d=e;c=g}}if(c>=b){c=a.slice(0,d);d=a.slice(d);f=this._dpSimplify(c,b).slice(0,f-2);d=this._dpSimplify(d,b);return f.concat(d)}else return[a[0],a[f-
|
|
|
|
|
1]]},_reducePoints:function(a,b){for(var c=[a[0]],d=1,e=0,f=a.length;d<f;d++)if(!(this._sqDist(a[d],a[e])<b)){c.push(a[d]);e=d}e<f-1&&c.push(a[f-1]);return c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqPointToSegmentDist:function(a,b,c){var d=c.x-b.x,e=c.y-b.y,f=((a.x-b.x)*d+(a.y-b.y)*e)/this._sqDist(b,c);if(f<0)return this._sqDist(a,b);if(f>1)return this._sqDist(a,c);b=new L.Point(b.x+d*f,b.y+e*f);return this._sqDist(a,b)}});
|
|
|
|
|
L.Util.extend(L.LineUtil,{clipSegment:function(a,b,c,d){var e=c.min,f=c.max;d=d?this._lastCode:this._getBitCode(a,c);var g=this._getBitCode(b,c);for(this._lastCode=g;;)if(d|g)if(d&g)return false;else{var h=d||g,i=b.x-a.x,k=b.y-a.y,j;if(h&8)j=new L.Point(a.x+i*(f.y-a.y)/k,f.y);else if(h&4)j=new L.Point(a.x+i*(e.y-a.y)/k,e.y);else if(h&2)j=new L.Point(f.x,a.y+k*(f.x-a.x)/i);else if(h&1)j=new L.Point(e.x,a.y+k*(e.x-a.x)/i);i=this._getBitCode(j,c);if(h==d){a=j;d=i}else{b=j;g=i}}else return[a,b]},_getBitCode:function(a,
|
|
|
|
|
b){var c=0;if(a.x<b.min.x)c|=1;else if(a.x>b.max.x)c|=2;if(a.y<b.min.y)c|=4;else if(a.y>b.max.y)c|=8;return c}});L.DomEvent={addListener:function(a,b,c,d){function e(g){return c.call(d||a,g||L.DomEvent._getEvent())}var f=L.Util.stamp(c);a["_leaflet_"+b+f]=e;if("addEventListener"in a){b=="mousewheel"&&a.addEventListener("DOMMouseScroll",e,false);a.addEventListener(b,e,false)}else"attachEvent"in a&&a.attachEvent("on"+b,e)},removeListener:function(a,b,c){c=L.Util.stamp(c);c="_leaflet_"+b+c;handler=a[c];if("removeEventListener"in a){b=="mousewheel"&&a.removeEventListener("DOMMouseScroll",handler,false);a.removeEventListener(b,
|
|
|
|
|
handler,false)}else"detachEvent"in a&&a.detachEvent("on"+b,handler);a[c]=null},_getEvent:function(){var a=window.event;if(!a)for(var b=arguments.callee.caller;b;){if((a=b.arguments[0])&&Event==a.constructor)break;b=b.caller}return a},stopPropagation:function(a){if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true},disableClickPropagation:function(a){L.DomEvent.addListener(a,"mousedown",L.DomEvent.stopPropagation);L.DomEvent.addListener(a,"click",L.DomEvent.stopPropagation);L.DomEvent.addListener(a,
|
|
|
|
|
"dblclick",L.DomEvent.stopPropagation)},preventDefault:function(a){if(a.preventDefault)a.preventDefault();else a.returnValue=false},getMousePosition:function(a,b){var c=new L.Point(a.pageX?a.pageX:a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a.pageY?a.pageY:a.clientY+document.body.scrollTop+document.documentElement.scrollTop);return b?c.subtract(L.DomUtil.getCumulativeOffset(b)):c},getWheelDelta:function(a){var b=0;if(a.wheelDelta)b=a.wheelDelta/120;if(a.detail)b=-a.detail/
|
|
|
|
|
3;return b}};L.DomUtil={get:function(a){return typeof a=="string"?document.getElementById(a):a},getStyle:function(a,b){var c=a.style[b];if(typeof c=="undefined"&&a.currentStyle)c=a.currentStyle[b];if(typeof c=="undefined")c=(c=document.defaultView.getComputedStyle(a,null))?c[b]:null;return c=="auto"?null:c},getCumulativeOffset:function(a){var b=0,c=0;do{b+=a.offsetTop-a.scrollTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return new L.Point(c,b)},create:function(a,b,c){a=document.createElement(a);a.className=
|
|
|
|
@ -28,7 +29,7 @@ this);this._onFakeStep=L.Util.bind(this._onFakeStep,this)},run:function(a){var b
|
|
|
|
|
if(L.Transition.NATIVE)this._timer=setInterval(this._onFakeStep,this.options.fakeStepInterval);else this._onTransitionEnd()},_onFakeStep:function(){this.fire("step")},_onTransitionEnd:function(){if(this._inProgress){this._inProgress=false;clearInterval(this._timer);this._el.style[L.Transition.PROPERTY]="none";this.fire("step");this.fire("end")}}});L.Transition=L.Transition.NATIVE?L.Transition:L.Transition.extend({statics:{getTime:Date.now||function(){return+new Date},TIMER:true,EASINGS:{ease:[0.25,0.1,0.25,1],linear:[0,0,1,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1]},CUSTOM_PROPS_GETTERS:{position:L.DomUtil.getPosition},UNIT_RE:/^[\d\.]+(\D*)$/},options:{fps:50},initialize:function(a,b){this._el=a;L.Util.extend(this.options,b);var c=L.Transition.EASINGS[this.options.easing]||L.Transition.EASINGS.ease;this._p1=
|
|
|
|
|
new L.Point(0,0);this._p2=new L.Point(c[0],c[1]);this._p3=new L.Point(c[2],c[3]);this._p4=new L.Point(1,1);this._step=L.Util.bind(this._step,this);this._interval=Math.round(1E3/this.options.fps)},run:function(a){this._props={};var b=L.Transition.CUSTOM_PROPS_GETTERS,c=L.Transition.UNIT_RE;this.fire("start");for(var d in a)if(a.hasOwnProperty(d)){var e={};if(d in b)e.from=b[d](this._el);else{var f=this._el.style[d].match(c);e.from=parseFloat(f[0]);e.unit=f[1]}e.to=a[d];this._props[d]=e}clearInterval(this._timer);
|
|
|
|
|
this._timer=setInterval(this._step,this._interval);this._startTime=L.Transition.getTime()},_step:function(){var a=L.Transition.getTime()-this._startTime,b=this.options.duration*1E3;if(a<b)this._runFrame(this._cubicBezier(a/b));else{this._runFrame(1);this._complete()}},_runFrame:function(a){var b=L.Transition.CUSTOM_PROPS_SETTERS,c,d;for(c in this._props)if(this._props.hasOwnProperty(c)){d=this._props[c];if(c in b){d=d.to.subtract(d.from).multiplyBy(a).add(d.from);b[c](this._el,d)}else this._el.style[c]=
|
|
|
|
|
(d.to-d.from)*a+d.from+d.unit}this.fire("step")},_complete:function(){clearInterval(this._timer);this.fire("end")},_cubicBezier:function(a){var b=3*Math.pow(1-a,2)*a,c=3*(1-a)*Math.pow(a,2),d=Math.pow(a,3);a=this._p1.multiplyBy(Math.pow(1-a,3));b=this._p2.multiplyBy(b);c=this._p3.multiplyBy(c);d=this._p4.multiplyBy(d);return a.add(b).add(c).add(d).y}});L.LatLng=L.Class.extend({statics:{DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,MAX_MARGIN:1.0E-9},initialize:function(a,b,c){if(c!==true){a=Math.max(Math.min(a,90),-90);b=(b+180)%360+(b<-180?180:-180)}this.lat=a;this.lng=b},equals:function(a){if(!(a instanceof L.LatLng))return false;return Math.max(Math.abs(this.lat-a.lat),Math.abs(this.lng-a.lng))<=L.LatLng.MAX_MARGIN},toString:function(){return"LatLng("+L.Util.formatNum(this.lat)+", "+L.Util.formatNum(this.lng)+")"}});L.LatLngBounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){if(!this._southWest&&!this._northEast){this._southWest=new L.LatLng(a.lat,a.lng);this._northEast=new L.LatLng(a.lat,a.lng)}else{this._southWest.lat=Math.min(a.lat,this._southWest.lat);this._southWest.lng=Math.min(a.lng,this._southWest.lng);this._northEast.lat=Math.max(a.lat,this._northEast.lat);this._northEast.lng=Math.max(a.lng,this._northEast.lng)}},
|
|
|
|
|
(d.to-d.from)*a+d.from+d.unit}this.fire("step")},_complete:function(){clearInterval(this._timer);this.fire("end")},_cubicBezier:function(a){var b=3*Math.pow(1-a,2)*a,c=3*(1-a)*Math.pow(a,2),d=Math.pow(a,3);a=this._p1.multiplyBy(Math.pow(1-a,3));b=this._p2.multiplyBy(b);c=this._p3.multiplyBy(c);d=this._p4.multiplyBy(d);return a.add(b).add(c).add(d).y}});L.LatLng=function(a,b,c){if(c!==true){a=Math.max(Math.min(a,90),-90);b=(b+180)%360+(b<-180?180:-180)}this.lat=a;this.lng=b};L.Util.extend(L.LatLng,{DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,MAX_MARGIN:1.0E-9});L.LatLng.prototype={equals:function(a){if(!(a instanceof L.LatLng))return false;return Math.max(Math.abs(this.lat-a.lat),Math.abs(this.lng-a.lng))<=L.LatLng.MAX_MARGIN},toString:function(){return"LatLng("+L.Util.formatNum(this.lat)+", "+L.Util.formatNum(this.lng)+")"}};L.LatLngBounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){if(!this._southWest&&!this._northEast){this._southWest=new L.LatLng(a.lat,a.lng);this._northEast=new L.LatLng(a.lat,a.lng)}else{this._southWest.lat=Math.min(a.lat,this._southWest.lat);this._southWest.lng=Math.min(a.lng,this._southWest.lng);this._northEast.lat=Math.max(a.lat,this._northEast.lat);this._northEast.lng=Math.max(a.lng,this._northEast.lng)}},
|
|
|
|
|
getCenter:function(){return new L.LatLng((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new L.LatLng(this._northEast.lat,this._southWest.lng)},getSouthEast:function(){return new L.LatLng(this._southWest.lat,this._northEast.lng)},contains:function(a){var b=this._southWest,c=this._northEast,d=a.getSouthWest();a=a.getNorthEast();return d.lat>=
|
|
|
|
|
b.lat&&a.lat<=c.lat&&d.lng>=b.lng&&a.lng<=c.lng}});L.Projection={};L.Projection.Mercator={MAX_LATITUDE:function(){var a=Math.exp(2*Math.PI);return Math.asin((a-1)/(a+1))*L.LatLng.RAD_TO_DEG}(),project:function(a){var b=L.LatLng.DEG_TO_RAD,c=L.Projection.Mercator.MAX_LATITUDE,d=a.lng*b;a=Math.max(Math.min(c,a.lat),-c)*b;a=Math.log(Math.tan(Math.PI/4+a/2));return new L.Point(d,a)},unproject:function(a,b){var c=L.LatLng.DEG_TO_RAD;return new L.LatLng((2*Math.atan(Math.exp(a.y))-Math.PI/2)/c,a.x/c,b)}};L.TileLayer=L.Class.extend({includes:L.Mixin.Events,options:{tileSize:256,minZoom:0,maxZoom:18,subdomains:"abc",copyright:"",unloadInvisibleTiles:L.Browser.mobileWebkit,updateWhenIdle:L.Browser.mobileWebkit,errorTileUrl:""},initialize:function(a,b){L.Util.extend(this.options,b);this._url=a;if(typeof this.options.subdomains=="string")this.options.subdomains=this.options.subdomains.split("")},onAdd:function(a){this._map=a;this._initContainer();this._tileImg=L.DomUtil.create("img","leaflet-tile");this._tileImg.galleryimg=
|
|
|
|
|
"no";var b=this.options.tileSize;this._tileImg.style.width=b+"px";this._tileImg.style.height=b+"px";a.on("viewreset",this._reset,this);if(this.options.updateWhenIdle)a.on("moveend",this._update,this);else{this._limitedUpdate=L.Util.limitExecByInterval(this._update,100,this);a.on("move",this._limitedUpdate,this)}this._reset();this._update()},onRemove:function(){this._map.getPanes().tilePane.removeChild(this._container);this._map.off("viewreset",this._reset);this.options.updateWhenIdle?this._map.off("moveend",
|
|
|
|
@ -48,9 +49,13 @@ this._fireMouseEvent,this);L.DomEvent.addListener(this._icon,"click",this._fireM
|
|
|
|
|
setPathString:function(a){this._pathStr=a;this._path&&this._updatePath()},_initElements:function(){this._initRoot();this._initPath();this._initStyle()},_initRoot:function(){if(!this._map._pathRoot){this._map._pathRoot=this._createElement("svg");this._map._panes.overlayPane.appendChild(this._map._pathRoot);this._map.on("moveend",this._updateSvgViewport,this);this._updateSvgViewport()}},_updateSvgViewport:function(){this._updateViewport();var a=this._map._pathViewport,b=a.min,c=a.max;a=c.x-b.x;c=c.y-
|
|
|
|
|
b.y;var d=this._map._pathRoot;d.setAttribute("width",a);d.setAttribute("height",c);d.setAttribute("viewBox",[b.x,b.y,a,c].join(" "));L.DomUtil.setPosition(d,b)},_updateViewport:function(){var a=L.Path.CLIP_PADDING,b=this._map.getSize(),c=L.DomUtil.getPosition(this._map._mapPane).multiplyBy(-1).subtract(b.multiplyBy(a));a=c.add(b.multiplyBy(1+a*2));this._map._pathViewport=new L.Bounds(c,a)},_initPath:function(){this._container=this._createElement("g");this._path=this._createElement("path");this._container.appendChild(this._path);
|
|
|
|
|
this._map._pathRoot.appendChild(this._container)},_initStyle:function(){if(this.options.stroke){this._path.setAttribute("stroke-linejoin","round");this._path.setAttribute("stroke-linecap","round")}this.options.fill?this._path.setAttribute("fill-rule","evenodd"):this._path.setAttribute("fill","none");this._updateStyle()},_updateStyle:function(){if(this.options.stroke){this._path.setAttribute("stroke",this.options.color);this._path.setAttribute("stroke-opacity",this.options.opacity);this._path.setAttribute("stroke-width",
|
|
|
|
|
this.options.weight)}if(this.options.fill){this._path.setAttribute("fill",this.options.fillColor||this.options.color);this._path.setAttribute("fill-opacity",this.options.fillOpacity)}},_updatePath:function(){this._path.setAttribute("d",this._pathStr)},_createElement:function(a){return document.createElementNS(L.Path.SVG_NS,a)}});L.Polyline=L.Path.extend({initialize:function(a,b){L.Path.prototype.initialize.call(this,b);this._latlngs=a},options:{smoothFactor:1,noClip:false},onAdd:function(a){this._map=a;this._initElements();this._projectLatlngs();this._updatePath();a.on("viewreset",this._projectLatlngs,this);a.on("moveend",this._updatePath,this)},_projectLatlngs:function(){this._originalPoints=[];for(var a=0,b=this._latlngs.length,c;a<b;a++){c=this._map.latLngToLayerPoint(this._latlngs[a]);this._originalPoints.push(c)}},_buildPathStr:function(){this._pathStr=
|
|
|
|
|
"";for(var a=0,b=this._parts.length,c;a<b;a++){c=this._parts[a];for(var d=0,e=c.length,f;d<e;d++){f=c[d];this._pathStr+=(d?"L":"M")+f.x+" "+f.y}}},_clipPoints:function(){var a=this._originalPoints,b=a.length,c,d,e;if(this.options.noClip)this._parts=[a];else{this._parts=[];for(d=c=0;c<b-1;c++)if(e=L.LineUtil.clipSegment(a[c],a[c+1],this._map._pathViewport)){this._parts[d]=this._parts[d]||[];this._parts[d].push(e[0]);if(e[1]!=a[c+1]||c==b-2){this._parts[d].push(e[1]);d++}}}},_simplifyPoints:function(){for(var a=
|
|
|
|
|
0,b=this._parts.length;a<b;a++)this._parts[a]=L.LineUtil.simplify(this._parts[a],this.options.smoothFactor)},_updatePath:function(){this._clipPoints();this._simplifyPoints();this._buildPathStr();L.Path.prototype._updatePath.call(this)}});L.Handler=L.Class.extend({initialize:function(a,b){this._map=a;b&&this.enable()},enabled:function(){return!!this._enabled}});L.Handler.MapDrag=L.Handler.extend({enable:function(){if(!this._enabled){if(!this._draggable){this._draggable=new L.Draggable(this._map._mapPane,this._map._container);var a=this._map.getSize();if(a.x*a.y>=7E5&&L.Browser.gecko)this._draggable._updatePosition=L.Util.deferExecByInterval(this._draggable._updatePosition,0,this._draggable);this._draggable.on("dragstart",this._onDragStart,this);this._draggable.on("drag",this._onDrag,this);this._draggable.on("dragend",this._onDragEnd,this)}this._draggable.enable();
|
|
|
|
|
this.options.weight)}if(this.options.fill){this._path.setAttribute("fill",this.options.fillColor||this.options.color);this._path.setAttribute("fill-opacity",this.options.fillOpacity)}},_updatePath:function(){this._path.setAttribute("d",this._pathStr)},_createElement:function(a){return document.createElementNS(L.Path.SVG_NS,a)}});L.Path.VML=function(){var a=document.createElement("div");a.innerHTML='<v:shape adj="1"/>';a=a.firstChild;a.style.behavior="url(#default#VML)";return a&&typeof a.adj=="object"}();
|
|
|
|
|
L.Path=!L.Path.VML?L.Path:L.Path.extend({_createElement:function(){document.createStyleSheet().addRule(".lvml","behavior:url(#default#VML);display: inline-block; position: absolute;");try{document.namespaces.add("lvml","urn:schemas-microsoft-com:vml");return function(b){return document.createElement("<lvml:"+b+' class="lvml">')}}catch(a){return function(b){return document.createElement("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_initRoot:function(){if(!this._map._pathRoot){this._map._pathRoot=
|
|
|
|
|
document.createElement("div");this._map._pathRoot.className="leaflet-vml-container";this._map._panes.overlayPane.appendChild(this._map._pathRoot);this._map.on("moveend",this._updateViewport,this);this._updateViewport()}},_initPath:function(){this._container=this._createElement("shape");this._container.className+=" leaflet-vml-shape";this._container.coordsize="1 1";this._path=this._createElement("path");this._container.appendChild(this._path);this._map._pathRoot.appendChild(this._container)},_initStyle:function(){if(this.options.stroke){this._stroke=
|
|
|
|
|
this._createElement("stroke");this._stroke.endcap="round";this._container.appendChild(this._stroke)}if(this.options.fill){this._container.filled=true;this._fill=this._createElement("fill");this._container.appendChild(this._fill)}else this._container.filled=false;this._updateStyle()},_updateStyle:function(){if(this.options.stroke){this._stroke.weight=this.options.weight+"px";this._stroke.color=this.options.color;this._stroke.opacity=this.options.opacity}if(this.options.fill){this._fill.color=this.options.fillColor||
|
|
|
|
|
this.options.color;this._fill.opacity=this.options.fillOpacity}},_updatePath:function(){this._container.style.display="none";this._path.v=this._pathStr;this._container.style.display=""}});L.Polyline=L.Path.extend({initialize:function(a,b){L.Path.prototype.initialize.call(this,b);this._latlngs=a},options:{smoothFactor:1,noClip:false},onAdd:function(a){this._map=a;this._initElements();this._projectLatlngs();this._updatePath();a.on("viewreset",this._projectLatlngs,this);a.on("moveend",this._updatePath,this)},_projectLatlngs:function(){this._originalPoints=[];for(var a=0,b=this._latlngs.length;a<b;a++)this._originalPoints[a]=this._map.latLngToLayerPoint(this._latlngs[a])},_buildPathStr:function(){var a=
|
|
|
|
|
L.Path.VML;this._pathStr="";for(var b=0,c=this._parts.length,d;b<c;b++){d=this._parts[b];for(var e=0,f=d.length,g;e<f;e++){g=d[e];a&&g._round();this._pathStr+=(e?"L":"M")+g.x+" "+g.y}}},_clipPoints:function(){var a=this._originalPoints,b=a.length,c,d,e;if(this.options.noClip)this._parts=[a];else{var f=this._parts=[],g=this._map._pathViewport,h=L.LineUtil;for(d=c=0;c<b-1;c++)if(e=h.clipSegment(a[c],a[c+1],g,c)){f[d]=f[d]||[];f[d].push(e[0]);if(e[1]!=a[c+1]||c==b-2){f[d].push(e[1]);d++}}}},_simplifyPoints:function(){for(var a=
|
|
|
|
|
this._parts,b=L.LineUtil,c=0,d=a.length;c<d;c++)a[c]=b.simplify(a[c],this.options.smoothFactor)},_updatePath:function(){this._clipPoints();this._simplifyPoints();this._buildPathStr();L.Path.prototype._updatePath.call(this)}});L.Handler=L.Class.extend({initialize:function(a,b){this._map=a;b&&this.enable()},enabled:function(){return!!this._enabled}});L.Handler.MapDrag=L.Handler.extend({enable:function(){if(!this._enabled){if(!this._draggable){this._draggable=new L.Draggable(this._map._mapPane,this._map._container);var a=this._map.getSize();if(a.x*a.y>=7E5&&L.Browser.gecko)this._draggable._updatePosition=L.Util.deferExecByInterval(this._draggable._updatePosition,0,this._draggable);this._draggable.on("dragstart",this._onDragStart,this);this._draggable.on("drag",this._onDrag,this);this._draggable.on("dragend",this._onDragEnd,this)}this._draggable.enable();
|
|
|
|
|
this._enabled=true}},disable:function(){if(this._enabled){this._draggable.disable();this._enabled=false}},moved:function(){return this._draggable._moved},_onDragStart:function(){this._map.fire("movestart");this._map.fire("dragstart")},_onDrag:function(){this._map.fire("move");this._map.fire("drag")},_onDragEnd:function(){this._map.fire("moveend");this._map.fire("dragend")}});L.Handler.TouchZoom=L.Handler.extend({enable:function(){if(!(!L.Browser.mobileWebkit||this._enabled)){L.DomEvent.addListener(this._map._container,"touchstart",this._onTouchStart,this);this._enabled=true}},disable:function(){if(this._enabled){L.DomEvent.removeListener(this._map._container,"touchstart",this._onTouchStart,this);this._enabled=false}},_onTouchStart:function(a){if(!(!a.touches||a.touches.length!=2)){var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]),
|
|
|
|
|
d=this._map.containerPointToLayerPoint(this._map.getSize().divideBy(2));this._startCenter=b.add(c).divideBy(2,true);this._startDist=b.distanceTo(c);this._startTransform=this._map._mapPane.style.webkitTransform;this._moved=false;this._centerOffset=d.subtract(this._startCenter);L.DomEvent.addListener(document,"touchmove",this._onTouchMove,this);L.DomEvent.addListener(document,"touchend",this._onTouchEnd,this);L.DomEvent.preventDefault(a)}},_onTouchMove:function(a){if(!(!a.touches||a.touches.length!=
|
|
|
|
|
2)){if(!this._moved){this._map._panes.popupPane.style.display="none";this._moved=true}var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]);this._scale=b.distanceTo(c)/this._startDist;this._delta=b.add(c).divideBy(2,true).subtract(this._startCenter);this._map._mapPane.style.webkitTransform=[this._startTransform,L.DomUtil.getTranslateString(this._delta),L.DomUtil.getScaleString(this._scale,this._startCenter)].join(" ");L.DomEvent.preventDefault(a)}},
|
|
|
|
@ -61,9 +66,9 @@ panTo:function(a){return this.setView(a,this._zoom)},panBy:function(a){this.fire
|
|
|
|
|
{layer:a})}return this},removeLayer:function(a){var b=L.Util.stamp(a);if(this._layers[b]){a.onRemove(this);delete this._layers[b];this.fire("layerremove",{layer:a})}return this},invalidateSize:function(){this._sizeChanged=true;this.fire("move");clearTimeout(this._sizeTimer);this._sizeTimer=setTimeout(L.Util.bind(function(){this.fire("moveend")},this),200);return this},getCenter:function(a){var b=this.getSize().divideBy(2);return this.unproject(this._getTopLeftPoint().add(b),this._zoom,a)},getZoom:function(){return this._zoom},
|
|
|
|
|
getBounds:function(){var a=this.getPixelBounds(),b=this.unproject(new L.Point(a.min.x,a.max.y));a=this.unproject(new L.Point(a.max.x,a.min.y));return new L.LatLngBounds(b,a)},getMinZoom:function(){return isNaN(this.options.minZoom)?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return isNaN(this.options.maxZoom)?this._layersMaxZoom||Infinity:this.options.maxZoom},getBoundsZoom:function(a){var b=this.getSize(),c=this.getMinZoom(),d=this.getMaxZoom(),e=a.getNorthEast();a=a.getSouthWest();
|
|
|
|
|
var f,g;do{c++;f=this.project(e,c);g=this.project(a,c);f=new L.Point(f.x-g.x,g.y-f.y)}while(f.x<=b.x&&f.y<=b.y&&c<=d);return c-1},getSize:function(){if(!this._size||this._sizeChanged){this._size=new L.Point(this._container.clientWidth,this._container.clientHeight);this._sizeChanged=false}return this._size},getPixelBounds:function(){var a=this._getTopLeftPoint(),b=this.getSize();return new L.Bounds(a,a.add(b))},getPixelOrigin:function(){return this._initialTopLeftPoint},mouseEventToContainerPoint:function(a){return L.DomEvent.getMousePosition(a,
|
|
|
|
|
this._container)},mouseEventToLayerPoint:function(a){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(a))},mouseEventToLatLng:function(a){return this.layerPointToLatLng(this.mouseEventToLayerPoint(a))},containerPointToLayerPoint:function(a){return a.subtract(L.DomUtil.getPosition(this._mapPane))},layerPointToContainerPoint:function(a){return a.add(L.DomUtil.getPosition(this._mapPane))},layerPointToLatLng:function(a){return this.unproject(a.add(this._initialTopLeftPoint))},latLngToLayerPoint:function(a){return this.project(a).subtract(this._initialTopLeftPoint)},
|
|
|
|
|
project:function(a,b){var c=this.options.projection.project(a),d=this.options.scaling(isNaN(b)?this._zoom:b);return this.options.transformation.transform(c,d)},unproject:function(a,b,c){b=this.options.scaling(isNaN(b)?this._zoom:b);return this.options.projection.unproject(this.options.transformation.untransform(a,b),c)},getPanes:function(){return this._panes},_initLayout:function(){this._container.className+=" leaflet-container";this._container.style.position=L.DomUtil.getStyle(this._container,"position")==
|
|
|
|
|
"absolute"?"absolute":"relative";this._panes={};this._mapPane=this._panes.mapPane=this._createPane("leaflet-map-pane",this._container);this._tilePane=this._panes.tilePane=this._createPane("leaflet-tile-pane");this._panes.shadowPane=this._createPane("leaflet-shadow-pane");this._panes.overlayPane=this._createPane("leaflet-overlay-pane");this._panes.markerPane=this._createPane("leaflet-marker-pane");this._panes.popupPane=this._createPane("leaflet-popup-pane")},_createPane:function(a,b){return L.DomUtil.create("div",
|
|
|
|
|
this._container)},mouseEventToLayerPoint:function(a){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(a))},mouseEventToLatLng:function(a){return this.layerPointToLatLng(this.mouseEventToLayerPoint(a))},containerPointToLayerPoint:function(a){return a.subtract(L.DomUtil.getPosition(this._mapPane))},layerPointToContainerPoint:function(a){return a.add(L.DomUtil.getPosition(this._mapPane))},layerPointToLatLng:function(a){return this.unproject(a.add(this._initialTopLeftPoint))},latLngToLayerPoint:function(a){return this.project(a)._subtract(this._initialTopLeftPoint)},
|
|
|
|
|
project:function(a,b){var c=this.options,d=c.projection.project(a),e=c.scaling(isNaN(b)?this._zoom:b);return c.transformation._transform(d,e)},unproject:function(a,b,c){b=this.options.scaling(isNaN(b)?this._zoom:b);return this.options.projection.unproject(this.options.transformation.untransform(a,b),c)},getPanes:function(){return this._panes},_initLayout:function(){this._container.className+=" leaflet-container";this._container.style.position=L.DomUtil.getStyle(this._container,"position")=="absolute"?
|
|
|
|
|
"absolute":"relative";this._panes={};this._mapPane=this._panes.mapPane=this._createPane("leaflet-map-pane",this._container);this._tilePane=this._panes.tilePane=this._createPane("leaflet-tile-pane");this._panes.shadowPane=this._createPane("leaflet-shadow-pane");this._panes.overlayPane=this._createPane("leaflet-overlay-pane");this._panes.markerPane=this._createPane("leaflet-marker-pane");this._panes.popupPane=this._createPane("leaflet-popup-pane")},_createPane:function(a,b){return L.DomUtil.create("div",
|
|
|
|
|
a,b||this._mapPane)},_resetView:function(a,b){var c=this._zoom!=b;this.fire("movestart");this._zoom=b;this._initialTopLeftPoint=this._getNewTopLeftPoint(a);L.DomUtil.setPosition(this._mapPane,new L.Point(0,0));this.fire("viewreset");this.fire("move");c&&this.fire("zoomend");this.fire("moveend")},_initLayers:function(a){this._layers={};for(var b=0,c=a.length;b<c;b++)this.addLayer(a[b])},_rawPanBy:function(a){var b=L.DomUtil.getPosition(this._mapPane);L.DomUtil.setPosition(this._mapPane,b.subtract(a))},
|
|
|
|
|
_initEvents:function(){L.DomEvent.addListener(this._container,"click",this._onMouseClick,this);L.DomEvent.addListener(this._container,"dblclick",this._fireMouseEvent,this);L.DomEvent.addListener(this._container,"mousedown",this._fireMouseEvent,this);this.options.trackResize&&L.DomEvent.addListener(window,"resize",this.invalidateSize,this)},_onMouseClick:function(a){this.dragging&&this.dragging.moved()||this._fireMouseEvent(a)},_fireMouseEvent:function(a){this.hasEventListeners(a.type)&&this.fire(a.type,
|
|
|
|
|
{position:this.mouseEventToLatLng(a),layerPoint:this.mouseEventToLayerPoint(a)})},_initInteraction:function(){var a={dragging:L.Handler.MapDrag,touchZoom:L.Handler.TouchZoom,doubleClickZoom:L.Handler.DoubleClickZoom,scrollWheelZoom:L.Handler.ScrollWheelZoom},b;for(b in a)if(a.hasOwnProperty(b)&&a[b])this[b]=new a[b](this,this.options[b])},_getTopLeftPoint:function(){return this._initialTopLeftPoint.subtract(L.DomUtil.getPosition(this._mapPane))},_getNewTopLeftPoint:function(a){var b=this.getSize().divideBy(2,
|
|
|
|
|