简体   繁体   English

如何在 PlantUML 序列图中结束参与者的线路

[英]How to end a participant's line in PlantUML sequence diagram

Is there a way to end a participant's line in a sequence diagram before the end of the diagram?有没有办法在图表结束之前在序列图中结束参与者的线路? For example if I want to display how database stored procedures call each other:例如,如果我想显示数据库存储过程如何相互调用:

@startuml
participant SP0
SP0 -> SP0 : Do minor stuff
create participant SP2
SP0 -> SP2 : Exec SP2
SP2 -> SP2 : Insert into table Tbl
SP2 -> SP2 : Do other stuff
SP2 -> SP0
SP0 -> SP0 : Do minor stuff
@enduml

在此处输入图像描述

I would like to terminate SP2's line as soon as it returns processing to SP0.我想在 SP2 的线路返回到 SP0 后立即终止它。 Furthermore, if I later call a complicated procedure SP3 from SP0, I would like to place it on the same level vertically as SP2.此外,如果我稍后从 SP0 调用一个复杂的过程 SP3,我想将它垂直放置在与 SP2 相同的水平面上。

I can remove the footer with hide footbox but the line still stays there.我可以使用hide footbox删除页脚,但该行仍然保留在那里。 Also activate and destroy don't end the line.activatedestroy不要结束行。

Thanks!谢谢!

This option is not available on the sequence help .该选项在序列帮助不可用。 I suppose you have to have SP3 on the right side.我想您必须在右侧安装SP3 A trick to shorten with the diagram's width is to add line breaks \n on long messages or notes.缩短图表宽度的一个技巧是在长消息或注释上添加换行符\n

You can use activate and deactivate for better understanding If you want to make readers understand that your participants are no longer alive after certain tasks, you can also use destroy.您可以使用激活和停用来更好地理解如果您想让读者了解您的参与者在完成某些任务后不再活着,您也可以使用销毁。 Find the example,找到例子,

@startuml
actor User
participant "Class1" as A
participant "Class2" as B
participant "Class3" as C

User -> A: DoWork
activate A

A -> B: Create Request
activate B

B -> C: DoWork
activate C
C --> B: WorkDone
destroy C

B --> A: Request Created
deactivate B

A --> User: Done
deactivate A
@enduml

Output:输出: 在此处输入图像描述

I became a huge fan on PlantUML recently.我最近成为了 PlantUML 的忠实粉丝。 As far as I can tell, one of the first diagrams that was supported was the Sequence Diagram.据我所知,最早支持的图表之一是序列图。 The strange thing here is that precisely this diagram is not conform the UML standards.奇怪的是,这个图不符合 UML 标准。 The life line of an object starts when it is created , but it does not end after its destruction .对象的生命线从创建时开始,但不会在销毁后结束

As a C++ developer, I sometimes make the joke that PlantUML as Java application waits for the Garbage Collector?作为一名 C++ 开发人员,我有时会开玩笑说 PlantUML 作为 Java 应用程序等待垃圾收集器?

这张图片显示了破坏的通常可视化。
(Image copied from https://creately.com/blog/diagrams/sequence-diagram-tutorial/ ) (图片从https://creately.com/blog/diagrams/sequence-diagram-tutorial/复制)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM