如何使用 Perl 从图中获取节点坐标?

发布于 2024-08-30 20:22:16 字数 414 浏览 2 评论 0原文

好的,我有一个流程图定义(基本上,节点数组和每个节点的边)。 现在我想计算流程中每个任务的坐标, 最好是 hierarchycal 风格。

我需要类似 Graph::Easy::Layout 但我不知道如何获取节点坐标:我自己渲染节点,我只想检索框坐标/大小。有什么建议吗?

我需要的是一个即使在 Debian 存储库中也可用的 CPAN 模块。

Ok, I have a flowchart definition (basically, array of nodes and edges for each node).
Now I want to calculate coordinates for every task in the flow,
preferably hierarchycal style.

I need something like Graph::Easy::Layout
but I have no idea how to get nodes coordinates: I render nodes myself and I only want to retrieve box coordinates/size. Any suggestions?

What I need is a CPAN module available even in Debian repository.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假情假意假温柔 2024-09-06 20:22:16

您可以将 CPAN 的 tarball 转换为 Debian 软件包。请参阅 将 CPAN 模块转换为Debian 软件包?

在那里你会发现很多好的建议和链接。那里甚至有一些关于为什么以这种方式安装模块可能是一个坏主意的讨论。


更新

对于包含坐标信息的布局,Graph:: Layout::Aesthetic 可能是您最好的选择。

CPAN 上的大多数其他软件包都以某种描述语言(例如 Graphviz DOT、GraphML 或 GDL)生成图形,并依赖其他图形布局库来处理实际的布局任务。具体的例子是 Graphviz 和 aisee。

从这些库之一请求节点(顶点)的坐标类似于从 HTML::TreeBuilder 请求

标记的坐标。

有一个名为 Graph::Renderer 的包CPAN 但它看起来很不完整,所以我犹豫是否推荐它。但它可能可以满足您的需求。

Graph::Easy::As_svg 实际上列出了图表,因此可能可修改以满足您的需求。

You can convert a tarball from CPAN into a Debian package. See What’s the best way to turn CPAN modules into Debian packages?

There you will find lots of good advice and links. There's even some discussion there as to why it might be a bad idea to install modules in this way.


Update

For layout with information on coordinates, Graph::Layout::Aesthetic is probably your best bet.

Most of the other packages on CPAN produce graphs in some description language (such as Graphviz DOT, GraphML or GDL) and rely on other graph layout libraries to handle actual layout tasks. Specific examples would be Graphviz and aisee.

Asking for the coordinates of a node (vertex) from one of these libraries is analogous to asking for the coordinates of a <P> tag from HTML::TreeBuilder.

There is a package called Graph::Renderer on CPAN but it looks very incomplete, so I hesitate to recommend it. But it may be usable for your needs.

Graph::Easy::As_svg actually lays out graphs and so may be modifiable to meet your needs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文