开发者

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.

A thing like this: alt text 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. You can take a look at this tutorial or at Sun tutorial.


In addition to what Riduidel said you should also try to get the angle that results from the intersection of the line with OX. Using that angle you could calculate a transformation matrix to draw the arraws neatly aligned to the line.


Pete Kirkham posted a full working example a few months ago in How to draw a directed arrow in Java?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜