/* RaphaelLayer, a JavaScript library for overlaying Raphael objects onto Leaflet interactive maps. http://dynmeth.github.com/RaphaelLayer (c) 2012-2013, David Howell, Dynamic Methods Pty Ltd Version 0.1.3 */ (function(){var a,b;typeof exports!="undefined"?a=exports:(a={},b=window.R,a.noConflict=function(){return window.R=b,a},window.R=a),a.version="0.1.3",a.Layer=L.Class.extend({includes:L.Mixin.Events,initialize:function(a){},onAdd:function(a){this._map=a,this._map._initRaphaelRoot(),this._paper=this._map._paper,this._set=this._paper.set(),a.on("viewreset",this.projectLatLngs,this),this.projectLatLngs()},onRemove:function(a){a.off("viewreset",this.projectLatLngs,this),this._map=null,this._set.forEach(function(a){a.remove()},this),this._set.clear()},projectLatLngs:function(){},animate:function(a,b,c,d){return this._set.animate(a,b,c,d),this},hover:function(a,b,c,d){return this._set.hover(a,b,c,d),this},attr:function(a,b){return this._set.attr(a,b),this}}),L.Map.include({_initRaphaelRoot:function(){this._raphaelRoot||(this._raphaelRoot=this._panes.overlayPane,this._paper=Raphael(this._raphaelRoot),this.on("moveend",this._updateRaphaelViewport),this._updateRaphaelViewport())},_updateRaphaelViewport:function(){var a=.02,b=this.getSize(),c=L.DomUtil.getPosition(this._mapPane),d=c.multiplyBy(-1)._subtract(b.multiplyBy(a)),e=d.add(b.multiplyBy(1+a*2)),f=e.x-d.x,g=e.y-d.y,h=this._raphaelRoot,i=this._panes.overlayPane;this._paper.setSize(f,g),L.DomUtil.setPosition(h,d),h.setAttribute("width",f),h.setAttribute("height",g),this._paper.setViewBox(d.x,d.y,f,g,!1)}}),a.Marker=a.Layer.extend({initialize:function(b,c,d,e){a.Layer.prototype.initialize.call(this,e),this._latlng=b,this._pathString=typeof c=="string"?c:"M16,3.5c-4.142,0-7.5,3.358-7.5,7.5c0,4.143,7.5,18.121,7.5,18.121S23.5,15.143,23.5,11C23.5,6.858,20.143,3.5,16,3.5z M16,14.584c-1.979,0-3.584-1.604-3.584-3.584S14.021,7.416,16,7.416S19.584,9.021,19.584,11S17.979,14.584,16,14.584z",this._attr=typeof c=="object"?c:d?d:{fill:"#000"}},projectLatLngs:function(){this._path&&this._path.remove();var a=this._map.latLngToLayerPoint(this._latlng),b=Raphael.pathBBox(this._pathString);this._path=this._paper.path(this._pathString).attr(this._attr).translate(a.x-1.05*b.width,a.y-1.15*b.height).toFront(),this._set.push(this._path)}}),a.Pulse=a.Layer.extend({initialize:function(b,c,d,e,f){a.Layer.prototype.initialize.call(this,f),this._latlng=b,this._radius=typeof c=="number"?c:6,this._attr=typeof c=="object"?c:typeof d=="object"?d:{fill:"#30a3ec",stroke:"#30a3ec"},this._pulseAttr=typeof c=="object"?d:typeof e=="object"?e:{"stroke-width":3,stroke:this._attr.stroke},this._repeat=3},onRemove:function(b){a.Layer.prototype.onRemove.call(this,b),this._marker&&this._marker.remove(),this._pulse&&this._pulse.remove()},projectLatLngs:function(){this._marker&&this._marker.remove(),this._pulse&&this._pulse.remove();var a=this._map.latLngToLayerPoint(this._latlng);this._marker=this._paper.circle(a.x,a.y,this._radius).attr(this._attr),this._pulse=this._paper.circle(a.x,a.y,this._radius).attr(this._pulseAttr);var b=Raphael.animation({"0%":{transform:"s0.3",opacity:1},"100%":{transform:"s3.0",opacity:0,easing:"<"}},1e3);this._pulse.animate(b.repeat(this._repeat))}}),a.Polyline=a.Layer.extend({initialize:function(b,c,d){a.Layer.prototype.initialize.call(this,d),this._latlngs=b,this._attr=c||{fill:"#000",stroke:"#000"}},projectLatLngs:function(){this._set.clear(),this._path&&this._path.remove(),this._path=this._paper.path(this.getPathString()).attr(this._attr).toBack(),this._set.push(this._path)},getPathString:function(){for(var a=0,b=this._latlngs.length,c="";a-c&&a-b-c&&a-b