关于PhpStorm中如何绘画UML的解析


本文摘自PHP中文网,作者藏色散人,侵删。

IDE支持

  • Phpstorm

    • 在Plugins中 安装PlantUML integration插件

    • http://www.graphviz.org/网站下载graphviz.exe并安装(这个软件可以支持更多的UML语法)

    • 将graphviz安装目录下的dot.exe路径添加到PlantUML的设置中

文档

  • 文档地址:http://plantuml.com/

  • 建议使用活动图-Activity-bate语法:活动图Activity-Beta(https://plantuml.com/zh/activity-diagram-beta)

  • 活动图(新语法)

当前活动图(activity diagram)的语法有诸多限制和缺点,比如代码难以维护。所以从V7947开始提出一种全新的、更好的语法格式和软件实现供用户使用(beta版)。就像序列图一样,新的软件实现的另一个优点是它不再依赖与Graphviz。
新的语法将会替换旧的语法。然而考虑到兼容性,旧的语法仍被能够使用以确保向前兼容。
但是我们鼓励用户使用新的语法格式。

语法

基础

  • @startuml@enduml
    开始、结束标记,表示UML解析的部分

  • startend
    表示图示的开始和结束。图示的开始和结束。

  • :Hello world;
    活动标签(activity label)以冒号开始,以分号结束。活动默认安装它们定义的顺序就行连接。

  • ifthenelseelseif
    设置分支测试。标注文字则放在括号中。

  • repeatrepeatwhile 重复循环。

  • whileendwhile进行while循环。还可以在关键字endwhile后添加标注,还有一种方式是使用关键字is

  • forkfork againend fork表示并行处理。

  • noteend notefloating note left 等等表示注释,例如:

1

2

3

4

5

6

7

8

9

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)在一起。例如:

1

2

3

4

partition Initialization {

    :read config file;

    :init internal variable;

}

  • 使用管道符|来定义泳道。还可以改变泳道的颜色。

1

2

3

4

5

6

7

8

9

10

11

|Swimlane1|

start

:foo1;

|#AntiqueWhite|Swimlane2|

:foo2;

:foo3;

|Swimlane1|

:foo4;

|Swimlane2|

:foo5;

stop

  • 关键字detach移除箭头。

  • 通过修改活动标签最后的分号分隔符(;),可以为活动设置不同的形状。|、<、>、/、]、}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

: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;

一个例子

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

@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

baa7754637c7481d12354f35ccaf6f3.png


更多phpstorm技术文章,请访问phpstorm教程栏目!

以上就是关于PhpStorm中如何绘画UML的解析的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

phpstorm配置数据库(详解)

phpstorm过期怎么激活

一文讲解phpstorm如何安装ide-helper(基于lumen)

phpstorm运行出现404原因

phpstorm怎么实现分屏展示?

phpstorm修改字体和大小【图文步骤】

phpstorm怎么移除项目

phpstorm怎么配置服务器

详解dvwa切换php版本及phpstorm -xdebug的配置使用

phpstorm怎么调试php web项目

更多相关阅读请进入《uml》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...