混合水平和垂直对齐的用例节点

Mixed horizontal and vertical alligned use case nodes

我想在用例图中显示比 Graphviz 默认情况下更紧凑的节点。例如,以下情况被包裹在一个矩形中:

actor A
actor B
A - (case a)
(case b) - B
A - (mixed case)
(mixed case) - B

默认情况下,案例是垂直对齐的。我更喜欢将(案例 a)和(案例 b)side-by-side 和(混合案例)居中并置于前面的案例之下。我也尝试过使用 -[hidden]- links

(case a) -[hidden]- (case b)

但随后(大小写混合)左对齐并且情况 a 和 b 相距太远。这是它的全貌:

@startuml
left to right direction
Source  <<Operator>>
Sink    <<Operator>>
Source ..> Sink : notify service address
rectangle "Init phase" {
    Source -> (Prepare service)
    (Prepare service) -[hidden]-(Register with service)
    (Register with service) <- Sink
    Source -> (Secure channel) : <<initiate>>
    (Secure channel) <-- Sink : <<participate>>
    Source --> (Ensure readiness) : <<participate>>
    (Ensure readiness) <- Sink : <<initiate>>
}
@enduml

图片在这里:

我通常接受格式(在使用 -left->、-right-> 等进行一些调整之后) 您可能会考虑使用 skinparam 将用例放在一列中(默认,非常紧凑)并通过颜色区分它们。这与您要求的不同,但我希望它

@startuml
left to right direction
Source  <<Operator>>
Sink    <<Operator>>

Source ..> Sink : notify service address
skinparam usecase {
    BackgroundColor<< Source >> DarkSeaGreen
    BorderColor<< Source >> DarkSlateGray

    BackgroundColor<< Both >> YellowGreen
    BorderColor<< Both >> YellowGreen

    BackgroundColor<< Sink >> Yellow
    BorderColor<< Sink >> Yellow

}


rectangle "Init phase" {
    Source -> (Prepare service)<<Source>>
    ' (Prepare service) -[hidden]-(Register with service)
    Source -> (Secure channel)<<Both>> : initiate
    (Secure channel) <-- Sink : <<participate>>
    Source --> (Ensure readiness) : <<participate>>
    (Ensure readiness)<<Both>> <- Sink : <<initiate>>
    (Register with service)<<Sink>> <- Sink
}
@enduml

结果如下: