本文章描述基于 C4-Model + PlantUML + VSCode 开发设计软件架构,相关环境搭建参看:C4-Model 开发环境搭建
布局
- 1. Rel_
- 2. (Bi)Rel(Index)_ (Back)_(Neighbor)
- 3. (Bi)Rel(Index)_(Back) _方向
- 4. Lay_**
- 5. Lay_Distance
- 6. LAYOUT_LEFT_RIGHT
- 7. LAYOUT_TOP_DOWN
- 8. LAYOUT_LANDSCAPE
- 9. LAYOUT_WITH_LEGEND
- 10. SHOW_LEGEND
- 11. SHOW_FLOATING_LEGEND
- 12. LAYOUT_AS_SKETCH
- 13. HIDE_STEREOTYPE
- 14. HIDE_PERSON_SPRITE
- 15. SHOW_PERSON_SPRITE
- 16. SHOW_PERSON_PORTRAIT
- 17. SHOW_PERSON_OUTLINE
1. Rel_
函数名 | |
Rel_($e_index, $alias1, $alias2, $label, $direction): C4_Dynamic | |
Rel_($e_index, $alias1, $alias2, $label, $techn, $direction):C4_Dynamic | |
Rel_($alias1, $alias2, $label, $direction):C4 | |
Rel_($alias1, $alias2, $label, $techn, $direction):C4 | |
参数 | |
e_index | 用于设置链接的序号 |
alias1(必须) | 链接的起始节点 |
alias2(必须) | 链接的目标节点 |
label | 为链接增加标签 |
techn | 为链接增加一个技术栈如:[C/C++] |
direction | 为链接增加一个方向 "-U->>" "-D->>" "-L->>" "-R->>" |
link | 增加一个链接,实现点击跳转的功能 |
2. (Bi)Rel(Index)_ (Back)_(Neighbor)
Bi.* | 函数名中包含Bi为双向链接,否则为单向链接 |
.*RelIndex.* | 函数名中包含Index则第一个参数为索引设置,可以通过这个参数设置序号 |
.*Rel.*Back.* | 函数中包含Back则链接为逆向链接 |
.*Rel.*Neighbor | 函数中包含Neighbor则链接为水平链接,两个节点在一条水平线上,默认左右关系 |
函数名 | |
Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
BiRel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
RelIndex($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
RelIndex_Back($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
BiRel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
RelIndex_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
RelIndex_Back_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
参数 | |
e_index | 当函数名中包含Index,此参数为必须参数,通过这个参数可以自定义序号 |
from(必须) | 链接节点的起始节点 |
to | 链接节点的目标节点 |
label | 为链接增加一个标签 |
techn | 为链接增加一个技术栈如:[C/C++] |
descr | 为链接增加一个描述 |
sprite | 为链接设置一个自定义的样式 |
tags | 为链接设置一个自定义的标签 |
link | 增加一个链接,实现点击跳转的功能 |
3. (Bi)Rel(Index)_(Back) _方向
Bi.* | 函数名中包含Bi为双向链接,否则为单向链接 | |
.*RelIndex.* | 函数名中包含Index则第一个参数为索引设置,可以通过这个参数设置序号 | |
.*Rel.*Back.* | 函数中包含Back则链接为逆向链接 | |
方向 | ||
D / Down | ⬇️ | |
U / Up | ⬆️ | |
L / Left | ⬅️ | |
R / Right | ➡️ |
函数名 | |
Rel_D / Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
RelIndex_D / Down($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
BiRel_D / Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
Rel_U / Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
RelIndex_U / Up($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
BiRel_U / Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
Rel_L / Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
RelIndex_L / Left($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
BiRel_L / Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
Rel_R / Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
RelIndex_R / Right($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
BiRel_R / Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") | |
参数 | 参见 :(Bi)Rel(Index)_ (Back)_(Neighbor) |
4. Lay_**
函数名 | |
Lay_D / Down($from, $to) | |
Lay_U / Up($from, $to) | |
Lay_L / Left($from, $to) | |
Lay_R / Right($from, $to) | |
参数 | |
from | 两个节点位置的起始节点 |
to | 两个节点位置的目标节点 |
5. Lay_Distance
由于PlantUML Bug,这个方法无法设置方向,如果要设置方向需要使用 Lay_… 方法
函数名 | |
Lay_Distance($from, $to, $distance="0") | |
参数 | |
from | 两个节点位置的起始节点 |
to | 两个节点位置的目标节点 |
distance | 设置两个节点间的距离 |
6. LAYOUT_LEFT_RIGHT
左右布局
7. LAYOUT_TOP_DOWN
上下布局,上下布局为默认布局
8. LAYOUT_LANDSCAPE
自由布局
9. LAYOUT_WITH_LEGEND
显示所有图例
10. SHOW_LEGEND
显示用到的图例,
SHOW_LEGEND(true) : 显示图例,隐藏标签
SHOW_LEGEND(false) : 显示图例,显示标签
11. SHOW_FLOATING_LEGEND
在制定位置显示图例
在person后,container前显示图例
12. LAYOUT_AS_SKETCH
手绘风格
13. HIDE_STEREOTYPE
隐藏标签
14. HIDE_PERSON_SPRITE
隐藏成员的图标,不隐藏其他节点的图标
15. SHOW_PERSON_SPRITE
显示成员的图标
第一个成员隐藏图标,第二个成员显示图标
16. SHOW_PERSON_PORTRAIT
调用SHOW_PERSON_PORTRAIT后成员节点不显示背景色
17. SHOW_PERSON_OUTLINE
将属性显示在图标内