draw2d 库中的三角形
我无法理解 org.eclipse.draw2d.Triangle 的 api。有一些用于操作的字段:
protected int direction
The direction this triangle will face. Possible values are PositionConstants.NORTH, PositionConstants.SOUTH, PositionConstants.EAST and PositionConstants.WEST.
protected int orientation
The orientation of this triangle. Possible values are Orientable.VERTICAL and Orientable.HORIZONTAL.
还有“三角形的点”。但没有可以直接操作它们的 API。 所以我可能需要一些例子来理解..(通过点或smt创建三角形)
谢谢。
I can't understand org.eclipse.draw2d.Triangle's api. There are some fields for manipulation:
protected int direction
The direction this triangle will face. Possible values are PositionConstants.NORTH, PositionConstants.SOUTH, PositionConstants.EAST and PositionConstants.WEST.
protected int orientation
The orientation of this triangle. Possible values are Orientable.VERTICAL and Orientable.HORIZONTAL.
There are "The points of the triangle" also. But there is no api for direct manipulation with them.
So I need probably some examples for understanding.. (Creating triangle by points or smt like this)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太了解 API,但从源代码来看,这个类看起来对于生成“箭头”类型的三角形很有用,这些三角形指向上、下、左或右,具体取决于您是否指定北、南、分别以西或东为方向。
方向取决于方向,反之亦然。为了说明我的意思,这里是
setDirection()
的代码:因此,如果您指定
NORTH
或,方向将设置为
方向,VERTICAL
>SOUTHHORIZONTAL
否则。我不认为你可以使用这个类来绘制任意三角形。
I don't know the API very well, but from looking at the source, this class looks like it is useful for producing "arrowhead" type triangles that point either up, down, left or right depending on whether you specify north, south, west or east respectively for the direction.
The orientation is dependent on direction, and vice-versa. To illustrate what I mean, here is the code for
setDirection()
:So orientation is set to
VERTICAL
if you specify aNORTH
orSOUTH
direction, andHORIZONTAL
otherwise.I don't think you can use this class to draw arbitrary triangles.