plantuml畫流程圖

#plantuml畫圖 PlantUML 是一個畫圖腳本語言,用它能夠快速地畫出:markdown

  • 時序圖
  • 流程圖
  • 用例圖
  • 狀態圖
  • 組件圖

在markdown中的使用方式oop

 

##時序圖code

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml

##流程圖 流程標籤以 : 開始,以 ; 結束,按其定義順序隱式連接。 就是正常流程圖判斷是棱形,這個有點奇怪,簡單的流程圖能夠畫的比加快,可是複雜的多泳道,條件複雜的仍是用鼠標操做軟件,我的認爲可維護性更好一點,效率更高。blog

@startuml
:Hello world;
:I am cool;
@enduml

可使用 start 和stop來表示圖的開始和結束。it

@startuml
start
:Hello world;
:I am cool;
stop
@enduml

也可使用endio

@startuml
start
:Hello world;
:I am cool;
end
@enduml

使用if then elseclass

@startuml
start
if (ok?) then (yes)
  :process 1;
else (no)
  :process2;
endif
stop
@enduml

循環 repeat 和 While loop,repeat沒發現能夠在循環判斷的時候寫寫文字說明效率

@startuml
start
repeat :foo as starting label;
  :read data;
  :generate diagrams;
backward:This is backward;
repeat while (more data?)
stop
@enduml
@startuml
while (check filesize ?) is (not empty)
  :read file;
endwhile (empty)
:close file;
@enduml

能夠寫一些註釋:軟件

@startuml
start
:foo1;
floating note left: This is a note
:foo2;
note right
  This right note 
end note
stop
@enduml

使用管道|,您能夠定義泳道:file

@startuml
|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
@enduml

展示的效果:

相關文章
相關標籤/搜索