PhpStorm中繪畫UML

IDE支持

  • Phpstormcookie

    • 在Plugins中 安裝PlantUML integration插件測試

    • http://www.graphviz.org/網站下載graphviz.exe並安裝(這個軟件能夠支持更多的UML語法)網站

    • 將graphviz安裝目錄下的dot.exe路徑添加到PlantUML的設置中spa

文檔

  • 文檔地址:http://plantuml.com/插件

  • 建議使用活動圖-Activity-bate語法:活動圖Activity-Betacode

  • 活動圖(新語法)orm

當前活動圖(activity diagram)的語法有諸多限制和缺點,好比代碼難以維護。因此從V7947開始提出一種全新的、更好的語法格式和軟件實現供用戶使用(beta版)。就像序列圖同樣,新的軟件實現的另外一個優勢是它再也不依賴與Graphviz。
新的語法將會替換舊的語法。然而考慮到兼容性,舊的語法仍被可以使用以確保向前兼容。
可是咱們鼓勵用戶使用新的語法格式。blog

語法

基礎

  • @startuml@enduml
    開始、結束標記,表示UML解析的部分文檔

  • startend
    表示圖示的開始和結束。圖示的開始和結束。get

  • :Hello world;
    活動標籤(activity label)以冒號開始,以分號結束。活動默認安裝它們定義的順序就行鏈接。

  • ifthenelseelseif
    設置分支測試。標註文字則放在括號中。

  • repeatrepeatwhile 重複循環。

  • whileendwhile進行while循環。還能夠在關鍵字endwhile後添加標註,還有一種方式是使用關鍵字is

  • forkfork againend fork表示並行處理。

  • noteend notefloating note left 等等表示註釋,例如:

floating note left: This is a note
:foo2;
note right
  This note is on several
  //lines// and can
  contain <b>HTML</b>
  ====
  * Calling the method ""foo()"" is prohibited
end note
  • #HotPin:activity;#AAAAAA:ending of the process; 表示顏色

  • 使用->標記,你能夠給箭頭添加文字或者修改箭頭顏色。dotted, dashed, bold or hidden arrows 和顏色標記,例如-[#blue]->

  • 經過定義分區(partition),你能夠把多個活動組合(group)在一塊兒。經過定義分區(partition),你能夠把多個活動組合(group)在一塊兒。例如:

partition Initialization {
    :read config file;
    :init internal variable;
}
  • 使用管道符|來定義泳道。還能夠改變泳道的顏色。

|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
  • 關鍵字detach移除箭頭。

  • 經過修改活動標籤最後的分號分隔符(;),能夠爲活動設置不一樣的形狀。|、<、>、/、]、}

:next(o)|
:Receiving;
split
 :nak(i)<
 :ack(o)>
split again
 :ack(i)<
 :next(o)
 on several line|
 :i := i + 1]
 :ack(o)>
split again
 :err(i)<
 :nak(o)>
split again
 :foo/
split again
 :i > 5}
stop
end split
:finish;

一個例子

@startuml
start
if (is login?) then (Y)
    if (gived box?) then (Y)
        :illegal request;
        detach
    else (N)
        :release box;
        :get boxOid;
    endif
else (N)
    if (has boxOid?) then (N)
        :illegal request;
        detach
    endif
endif

:check wechat broswer;
if (wechat broswer?) then (Y)
    if (get openid from cookie?) then (Y)
        if (get userInfo from DB by openid?) then (N)
            :clear openid in cookie;
            :re-request Url;
            detach
        endif
    else (N)
        :location wechat auth;
        detach
    endif
endif

:receive chocolate;

end
@enduml

一個例子

相關文章
相關標籤/搜索