1

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

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

默认情况下,案例垂直对齐。我希望(案例 a)和(案例 b)并排和(混合案例)居中并低于先前的案例。我也尝试过使用 -[hidden]- 链接

(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

图片在这里: UC 格式示例

4

1 回答 1

2

我通常接受格式(在使用 -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

这导致以下结果: 颜色编码示例

于 2015-01-13T11:32:12.037 回答