function Arrow(lineString)
//在地图上画一条线,将这条线(lineString)作为参数传进Arrow方法
{
var linepoints = lineString.components;
var endPoint1 = linepoints[linepoints.length-1];
var endPoint2 = linepoints[linepoints.length-2];
var points1=[endPoint1,endPoint2];
var line1 = new SuperMap.Geometry.LineString(points1);
var midPointX = endPoint2.x+0.9*(endPoint1.x-endPoint2.x);
var midPointY = endPoint2.y+0.9*(endPoint1.y-endPoint2.y);
var midPoint1 = new SuperMap.Geometry.Point(midPointX,midPointY);
var midPoint2 = new SuperMap.Geometry.Point(midPointX,midPointY);
//在线上9/10的位置取一点连接直线末端做两条相同的短直线
var points2=[midPoint1,endPoint1];
var rightLine = new SuperMap.Geometry.LineString(points2);
rightLine.rotate(15,endPoint1);
//此为直线旋转,旋转角度可自由调节
var points3=[midPoint2,endPoint1];
var leftLine = new SuperMap.Geometry.LineString(points3);
leftLine.rotate(345,endPoint1);
//分别旋转两条短直线于lineString两侧,构成一个箭头样式
var multiLineString = new SuperMap.Geometry.MultiLineString([
lineString,rightLine,leftLine
]);
return multiLineString;
//最终return一个箭头(multiLineString)
}
您好,您可以参考这个去写一个绘制带箭头的线的功能