Eclipse GEF/draw2d 坐标系转换
有人可以向我解释一下draw2d中坐标变换是如何工作的吗? 我有一个层次图,其中一个图形可以包含也包含图形的图形。首先,我通过使用请求的 getLocation
添加内部图形,获取 EditPolicy
的主机图形并应用 hostFigure.translateToRelative(location)
但确实如此不工作!既不是 translateToParent
和其他东西的组合。
最后,我从逻辑示例中复制了实现,该示例使用 getConstraintFor,这是由策略提供的方法,该方法本身会进行转换。我检查了这个可以,但也无法理解它是如何工作的。
我在 eclipse 论坛中阅读了有关此主题的许多帖子,但仍然不明白为什么像 translateToAbsolute
这样的简单方法不能按预期运行。有人可以解释一下吗?谢谢
Can someone please explain to me how coordinate transformations work in draw2d?
I have a hierarchical diagram where a figure can contain figures which also contain figures. At first I added internal figures by using the request's getLocation
, fetching the host figure of the EditPolicy
and appliying hostFigure.translateToRelative(location)
but does not work! neither combinations of translateToParent
and other things.
At the end I copied the implementation from the Logic example, which uses getConstraintFor
, a method provided by the policy which does the translation itself. I checked this could but also could not understand how it works.
I read in a number of threads in the eclipse forums on this subject, but still don't understand why a simple method like translateToAbsolute
does not behave as expected. Could anyone please explan? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两条信息可能会阐明您的问题:
Two pieces of information that might shed some light on your problem: