[英]drawing arrows on a line defined by a set of points( for tracking)
I have a set of points which define a route and I must draw them so a vehicle's moving direction is denoted.
我有一组定义路线的点,必须绘制它们,以便指示车辆的行驶方向。 The points may be from a curve and I need to draw some arrows.
这些点可能来自曲线,我需要画一些箭头。 I want to draw arrows on the route to define which arrow vehicle goes.
我想在路线上绘制箭头以定义要行驶的箭头车辆。 I have a mapviewr java applet and the last I must do is this work, I want to define arrows on every 10 points on the route.
我有一个mapviewr java applet,最后要做的就是这项工作,我想在路线上的每10个点定义箭头。
A thing like this: alt text http://img517.yfrog.com/img517/7690/schermafbeelding2010032.png像这样的东西: 替代文字http://img517.yfrog.com/img517/7690/schermafbeelding2010032.png
I would suggest you to take a look at Java2D shapes :they allow you to define any kind of ... well ... shape and draw them on a given path. 我建议您看一下Java2D形状:它们允许您定义任何类型的... well ...形状并将它们绘制在给定的路径上。 You can take a look at this tutorial or at Sun tutorial .
您可以看一下本教程或Sun教程 。
In addition to what Riduidel said you should also try to get the angle that results from the intersection of the line with OX. 除了Riduidel所说的之外,您还应该尝试获得直线与OX相交所产生的角度。 Using that angle you could calculate a transformation matrix to draw the arraws neatly aligned to the line.
使用该角度,您可以计算转换矩阵以绘制与直线整齐对齐的箭头。
Pete Kirkham在几个月前的《 如何在Java中绘制有向箭头》中发布了一个完整的工作示例 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.