如何在 Java 中生成连接形状的可编辑绘图

发布于 2024-12-07 01:26:49 字数 508 浏览 1 评论 0原文

谁能告诉我如何执行以下操作:

我希望我的 Java 代码生成具有多个连接形状的绘图。也许有数百种形状——但规模并不大。我想生成它并将其保存为标准文件格式,以便有人可以在查看器或编辑器中打开。我不想实现查看或编辑逻辑——仅生成。

我希望用户能够获取我生成的文件,在所见即所得编辑器中打开它,并使用连接形状的线来移动形状,在形状移动时保持与形状的连接。这样,我的生成代码就不必非常聪明地确保连接器不重叠。

任何人都可以建议一个文件格式、Java 库、编辑器(或这三者的某些子集)的组合来很好地完成此任务吗?

到目前为止的想法:

  1. yEd 允许这种编辑行为并使用 graphml 作为格式。但是,我不确定 graphml 的使用有多广泛,而且我担心字形的可用性。

  2. Inkscape 和 SVG 被广泛使用,但我完全是新手,到目前为止,当我移动它们时,我还无法使用 Inkscape 使线条与其他形状保持连接。

我对其他选择持开放态度...

Can anybody tell me how I could do the following:

I want my Java code to generate a drawing that has multiple connected shapes. Perhaps hundreds of shapes--not huge. I'd like to generate this and save it as a standard file format that somebody could open in a viewer or an editor. I do not want to implement viewing or editing logic--generation only.

I'd like the user to be able to take my generated file, open it in a WYSIWYG editor, and move the shapes around with the lines that connect the shapes staying connected to the shapes as they move. That way, my generation code does not have to be super smart about making sure that connectors don't overlap.

Can anybody suggest a combination of file format, Java library, editor (or some subset of those three) that would work well for this task?

Thoughts so far:

  1. yEd allows this editing behavior and uses graphml as the format. However, I'm not sure how widely used graphml is, and I'm concerned about availability of glyphs.

  2. Inkscape and SVG are widely used, but I'm a complete novice, and so far I haven't been able to get lines to stay connected to other shapes using Inkscape when I move them around.

I'm open to other options...

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文