如何替代方式(!pic2plot)从某些声明性文本形式生成序列图?

发布于 2024-11-01 11:25:50 字数 1037 浏览 1 评论 0原文

UMLGraph 有 pic2plot 组件来绘制序列图(sequence.pic)。

输入格式如下:

.PS
copy "/usr/local/lib/sequence.pic"; 

object(N0,"0"); 
object(N1,"1"); 

step();

message(N0,N0,"doSomething()"); 
message(N0,N1,"callFunction()");

step();

.PE

主要缺点是它基于 pic2plot,看起来被废弃了,无法处理 UTF-8 并且很难找到文档(甚至 man plotutils 也没有全套有用的手册页)。

是否有其他方法可以在没有 GUI 的情况下从简单的基于文本的输入绘制序列图?

注意:现在使用此技巧:

cat mpiseq.pic | u8h | pic2plot -T svg | pic2plot -T svg | pic2plot -T svg | pic2plot xml2 | perl -pe 's!/svg/\@height=8in!/svg/\@height=32in!; s!/svg/\@viewBox=0 0 1 1!/svg/\@viewBox=0 -0.2 1 3.8!' | 2xml | h8u | svg

u8h/h8u 将 UTF-8 字符屏蔽/取消屏蔽为十六进制序列数字(受签名保护)

There is pic2plot component from UMLGraph to draw sequence diagrams (sequence.pic).

Input format is like:

.PS
copy "/usr/local/lib/sequence.pic"; 

object(N0,"0"); 
object(N1,"1"); 

step();

message(N0,N0,"doSomething()"); 
message(N0,N1,"callFunction()");

step();

.PE

The main disadvantage is that it is based on pic2plot which looks abandoned, fails to handle UTF-8 and have hard-to-find documentation (even man plotutils does not have a full set of useful man pages).

Is there alternatives draw sequence diagrams from simple text-based input without GUI?

Note: Now using this hack:

cat mpiseq.pic | u8h | pic2plot -T svg | xml2 | perl -pe 's!/svg/\@height=8in!/svg/\@height=32in!; s!/svg/\@viewBox=0 0 1 1!/svg/\@viewBox=0 -0.2 1 3.8!' | 2xml | h8u | svg

u8h/h8u masks/unmasks UTF-8 characters as sequence of hex digits (protected by signatures)

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

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

发布评论

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

评论(2

肥爪爪 2024-11-08 11:25:50

事实上,有几种选择。查看文本 UML 工具列表

In fact, there are several alternatives. Take a look at this list of textual UML tools

吹梦到西洲 2024-11-08 11:25:50

我尝试过 sdedit,它甚至无法处理自己的示例!

在众多工具中,plantuml 在我的书中脱颖而出:可以使用清晰的语法处理相当复杂的功能。

@startuml
Alice->Bob : hello
note left: this is a first note

Bob->Alice : ok
note right: this is another note

Bob->Bob : I am thinking
note left
    a note
    can also be defined
    on several lines
end note
@enduml

I've tried sdedit, which couldn't even process its own example!

Among the myriad of tools, plantuml stands out in my book: can handle pretty complex features with crisp clear syntax.

@startuml
Alice->Bob : hello
note left: this is a first note

Bob->Alice : ok
note right: this is another note

Bob->Bob : I am thinking
note left
    a note
    can also be defined
    on several lines
end note
@enduml
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文