首页 / 浏览问题 / 云GIS / 问题详情
supermap iclient 绘制箭头
1EXP 2018年11月17日
supermap iclient 绘制箭头 知道两个坐标点    在两点间绘制箭头

1个回答

您好, 这个需要您自己封装一个箭头的js,然后用drawline的方式写就可以了
5,668EXP 2018年11月19日
这个你有代码吗?
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)

        }
...