I was hopping for something simple that I might have overlooked. Like an arrow line style.
//text symbol// var arrow = function(pt1,pt2){ return new esri.symbol.TextSymbol({ text : "�?�", angle: setAngle(pt1, pt2), type: "esriTS", color: new dojo.Color([0,0,255,0.5]), font: { size: 13, style: 'normal', type: 'font', variant: "normal", weight: "normal", family: "Lucida Grande Console" } }); };
//grab points// //loop over the points on your line// for(var x in "[linename]".geometry.paths[0]){ var pt1 = "[linename]".geometry.paths[0]; var pt2 = "[linename]".geometry.paths[0][x-1]; var point = new esri.geometry.Point(pt1); var arrowGraphic = new esri.Graphic(point, arrow(pt1,pt2));
//angle function// var setAngle = function (p1, p2){ var rise = p2[1] - p1[1]; var run = p2[0] - p1[0]; var angle = ((180/Math.PI) * Math.atan2(run, rise)) return angle-180; }
Hi,
I could somehow add arrows to the lines. But when I zoom in zoom out, the arrow positions keep changing. How to handle this?
Jason,
You need to use the unicode representation: '\u25BC'