用正交线绘制层次树(HV-Drawing – 二叉树)
我需要绘制一个分层树结构(HV-Drawing – 二叉树),在根和子节点之间使用正交线(直矩形连接线)(如下所示: http://lab.kapit.fr/display/visualizationlayouts/Hierarchical+Tree+布局 )。 我想知道是否有类似绘制树的算法的开源示例,以便我可以在 ActionScript 中实现相同的算法。 谢谢 帕拉什
I need to work on drawing a hierarchical tree structure (HV-Drawing – Binary Tree) with orthogonal lines(straight rectangular connecting lines) between root and children ( like the following:
http://lab.kapit.fr/display/visualizationlayouts/Hierarchical+Tree+layout
).
I want to know if there are any open source examples of the algorithm of drawing trees like that so that I can implement the same algorithm in actionscript.
Thanks
Palash
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我做了一个 C# 版本并将代码放在 CodeProject 上。它位于:
http://www.codeproject.com/KB/WPF/LayeredTreeDraw.aspx< /a>
有一个通用部分,它给出了所有节点的位置,还有一个 WPF 特定实现,它实际上使用您正在寻找的直线或正交线来绘制所有内容。
I did a C# version and put the code up on CodeProject. It's at:
http://www.codeproject.com/KB/WPF/LayeredTreeDraw.aspx
There's a generic part which gives the positions of all the nodes and a WPF specific implementation which actually draws everything using either straight lines or the orthogonal lines you're looking for.
这是我的 Python 3 实现:GitLab (这是内部项目,需要注册 GitLab)。
该程序仅包含一个文件,因此安装非常简单(克隆存储库并使用必要的参数运行
hv-drawing.py
)。该存储库还包含一些用于绘制的图表示例。
该代码有很好的注释,因此您可以了解其实现的算法。
Here is my Python 3 realization: GitLab (this is internal project, GitLab registration required).
The program consists of only one file, so the installation is very simple (clone the repository and run
hv-drawing.py
with necessary arguments).Also the repository contents some examples of graphs for drawing.
The code is well-commented, so you can learn the algorithm on its realization.