text: L.River=L.FeatureGroup.extend({options:{color:"blue",minWidth:1,maxWidth:10,ratio:null},initialize:function(t,i){L.FeatureGroup.prototype.initialize.call(this,[],i);this._latLngs=t;L.setOptions(this,i);this._buildLines(t)},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t);this._getLength(t);this.setStyle()},_buildLines:function(t){for(var i=0;i<t.length-1;i++){var n=L.polyline([t[i],t[i+1]]);this.addLayer(n)}},_getLength:function(t){var i=this._latLngs,n=0;for(var e=0;e<i.length-1;e++){n+=t.latLngToLayerPoint(i[e]).distanceTo(t.latLngToLayerPoint(i[e+1]))}return this._length=n},setStyle:function(t){this.options=L.extend(this.options,t);var i=this.options,n=this._length,e=this._map,o=this._layers,s=this._points,h=0,r,a;for(var l in o){r=o[l];a=r.getLatLngs();h+=e.latLngToLayerPoint(a[0]).distanceTo(e.latLngToLayerPoint(a[1]));var u=h/n;var d=i.minWidth+i.maxWidth*u;r.setStyle(L.extend({},i,{weight:i.ratio?h/i.ratio:i.minWidth+(i.maxWidth-i.minWidth)*u}))}},setMinWidth:function(t){this.setStyle({minWidth:t})},setMaxWidth:function(t){this.setStyle({maxWidth:t})},getMinWidth:function(t){return this.options.minWidth},getMaxWidth:function(){return this.options.maxWidth},useLength:function(t){L.setOptions(this,{ratio:t});return this},convertToPolyline:function(t){return L.polyline(this._latLngs,t)}});L.river=function(t,i){return new L.River(t,i)};