目录

PlantUML用例图

定义

用例

用例使用圆括号()包裹,也可以使用关键字usecase来定义用例,还可以用关键字as来定义Alias,这个Alias可以在以后定义关系的时候使用。

@startuml
(First Usecase)
(Another Usecase) as (case2)
usecase case3
usecase (Last\nNewCase) as case4
@enduml

First UsecaseAnother Usecasecase3LastNewCase

用例描述若是要跨越多行,可以用双引号包裹,还可以使用分隔符:

代码描述
横线
..虚线
==双横线
__下划线
@startuml

usecase UC1 as "You can use
several lines to define your usecase.
You can also use separators.
--
Several separators are possible.
==
And you can add titles:
..Conclusion..
This allows large description."

@enduml

You can useseveral lines to define your usecase.You can also use separators.Several separators are possible.And you can add titles:This allows large description.Conclusion

角色

角色使用两个冒号:包裹,也可以使用关键字actor来定义,同样地,也可以使用as来定义Alias。

@startuml
:First Actor:
:Another\nActor: as Man2
actor Woman3
actor :Last Actor: as Person1
@enduml

First ActorAnotherActorWoman3Last Actor

角色的外观默认为火柴棍人,但是也可以更改成用户头像样式或者透明人样式:

@startuml
:Default:
@enduml
@startuml
skinparam actorStyle awesome
:UserAvatar:
@enduml
@startuml
skinparam actorStyle Hollow
:Hollow:
@enduml

DefaultUserAvatarHollow