supermap iclient 绘制箭头

0 投票
supermap iclient 绘制箭头 知道两个坐标点    在两点间绘制箭头
11月 17, 2018 分类:  530次浏览 | 用户: 不会功夫的茶 (1 分)

1个回答

0 投票
您好, 这个需要您自己封装一个箭头的js,然后用drawline的方式写就可以了
11月 19, 2018 用户: 于浩 登峰造极 (5,662 分)
这个你有代码吗?
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)

        }
...