function BDCCArrowedPolyline(points,color,weight,opacity,opts,gapPx,headLength,headColor,headWeight,headOpacity){this.gapPx=gapPx;this.points=points;this.color=color;this.weight=weight;this.opacity=opacity;this.headLength=headLength;this.headColor=headColor;this.headWeight=headWeight;this.headOpacity=headOpacity;this.opts=opts;this.heads=new Array();this.line=null;}
BDCCArrowedPolyline.prototype=new GOverlay();BDCCArrowedPolyline.prototype.getVertex=function(i){return this.points[i];}
BDCCArrowedPolyline.prototype.getVertexCount=function(){return this.points.length;}
BDCCArrowedPolyline.prototype.getLength=function(){var l=0;var j=0;for(var i=1;i<this.points.length;i++)
l+=this.points[j++].distanceFrom(this.points[i]);return l}
BDCCArrowedPolyline.prototype.initialize=function(map){log("initialized..");this.map=map;this.prj=map.getCurrentMapType().getProjection();var self=this;this.recalc();}
BDCCArrowedPolyline.prototype.remove=function(){log("removing....");try{if(this.line)
this.map.removeOverlay(this.line);for(var i=0;i<this.heads.length;i++)
this.map.removeOverlay(this.heads[i]);GEvent.removeListener(this.lstnMoveEnd);GEvent.removeListener(this.lstnType);}
catch(ex)
{}}
BDCCArrowedPolyline.prototype.redraw=function(force){return;}
BDCCArrowedPolyline.prototype.copy=function(map){return new BDCCArrowedPolyline(this.points,this.color,this.weight,this.opacity,this.opts,this.gapPx,this.headLength,this.headColor,this.headWeight,this.headOpacity);}
BDCCArrowedPolyline.prototype.recalc=function(){var zoom=this.map.getZoom();this.remove();this.line=new GPolyline(this.points,this.color,this.weight,this.opacity,this.opts);this.map.addOverlay(this.line);var self=this;this.lstnMoveEnd=GEvent.addListener(this.map,"zoomend",function(){self.recalc();});this.lstnType=GEvent.addListener(this.map,"maptypechanged",function(){self.recalc;});this.heads=new Array();var p1=this.prj.fromLatLngToPixel(this.points[0],zoom);var p2;var dx;var dy;var sl;var theta;var ta;var acc=0;for(var i=1;i<this.points.length;i++){var added=false;p2=this.prj.fromLatLngToPixel(this.points[i],zoom)
dx=p2.x-p1.x;dy=p2.y-p1.y;sl=Math.sqrt((dx*dx)+(dy*dy));theta=Math.atan2(-dy,dx);j=1;if(this.gapPx==0){this.addHead(p2.x,p2.y,theta,zoom);}
else if(this.gapPx==1){var x=p1.x+((sl/2)*Math.cos(theta));var y=p1.y-((sl/2)*Math.sin(theta));this.addHead(x,y,theta,zoom);}
else{ta=this.gapPx;while(ta<sl){acc=0;added=true;var x=p1.x+(ta*Math.cos(theta));var y=p1.y-(ta*Math.sin(theta));this.addHead(x,y,theta,zoom);ta+=this.gapPx;}
if(ta==this.gapPx&&acc>this.gapPx){added=true;acc=0;var x=p1.x+((sl/2)*Math.cos(theta));var y=p1.y-((sl/2)*Math.sin(theta));this.addHead(x,y,theta,zoom);}
if(!added)
acc+=sl;}
p1=p2;}}
BDCCArrowedPolyline.prototype.addHead=function(x,y,theta,zoom){var t=theta+(Math.PI/4);if(t>Math.PI)
t-=2*Math.PI;var t2=theta-(Math.PI/4);if(t2<=(-Math.PI))
t2+=2*Math.PI;var pts=new Array();var x1=x-Math.cos(t)*this.headLength;var y1=y+Math.sin(t)*this.headLength;var x2=x-Math.cos(t2)*this.headLength;var y2=y+Math.sin(t2)*this.headLength;pts.push(this.prj.fromPixelToLatLng(new GPoint(x1,y1),zoom));pts.push(this.prj.fromPixelToLatLng(new GPoint(x,y),zoom));pts.push(this.prj.fromPixelToLatLng(new GPoint(x2,y2),zoom));this.heads.push(new GPolyline(pts,this.headColor,this.headWeight,this.headOpacity,this.opts));this.map.addOverlay(this.heads[this.heads.length-1]);}