C4-Model Container

本文章描述基于 C4-Model + PlantUML + VSCode 开发设计软件架构,相关环境搭建参看:C4-Model 开发环境搭建

1. Container

在这里插入图片描述

函数名Container($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
参数
alias(必须)定义Person的一个别名,用于后续设计的调用
label(必须)用于定义在图形上显示的标签, 可以使用字符串,也可以直接输入
techn为容器增加技术栈,如 [C/C++] [JS/TS]
descr增加对Container的详细描述
sprite为容器增加图标,C4 容器默认无图标
tags增加一个自定义的 tag, 默认tag为 Container
link增加一个链接,实现点击跳转的功能

2. ContainerDb

在这里插入图片描述

函数名ContainerDb($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
参数参见:Container

3. ContainerQueue

在这里插入图片描述

函数名ContainerQueue($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
参数参见:Container

4. Container_Ext

在这里插入图片描述

函数名Container_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
参数参见:Container

5. ContainerDb_Ext

在这里插入图片描述

函数名ContainerDb_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
参数参见:Container

6. ContainerQueue_Ext

在这里插入图片描述

函数名ContainerQueue_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
参数参见:Container

7. Container_Boundary

在这里插入图片描述

函数名Container_Boundary($alias, $label, $tags="", $link="")
参数参见:Container

8. AddContainerTag

在这里插入图片描述

函数名AddContainerTag ( $tagStereo, $bgColor=$CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="")
参数
tagStereo(必须)设置一个标签的名称,用于后续的调用与显示,设置值为显示值
bgColor设置容器的背景颜色
fontColor设置容器的字体颜色
borderColor设置边框的颜色
shadowing是否显示阴影,true 或者 false
shape 为容器设置一个图标,
默认为直角
roundedBox 圆角
eightSided 斜角
sprite 设置一个图标
techn为容器增加一个技术栈,如果在容器定义中重新声明则显示容器中的定义
legendText设置在图例中显示的标题
legendSprite设置一个在图例中显示的图标,默认为上面参数sprite设置的图标

9. AddExternalContainerTag

在这里插入图片描述

函数名AddExternalContainerTag( $tagStereo, $bgColor=$CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="")
参数参见:AddContainerTag

10. 代码示例

@startuml
' 定义宏 RELATIVE_INCLUDE 指定 C4-PlantUML 仓库
!define RELATIVE_INCLUDE /Users/xxx/C4-PlantUML
!include RELATIVE_INCLUDE/C4_Container.puml
' 引用 office 标准裤,扩展图标
' https://github.com/plantuml/plantuml-stdlib/tree/master/office
!include <office/Clouds/cloud>
!include <office/Servers/application_server> 
!include <office/Servers/3rd_party_mail_server>
!include <office/Sites/my_site>
' 隐藏标签
HIDE_STEREOTYPE()
AddContainerTag("云端", $shadowing=true, $sprite="cloud", $shape="roundedBox", $techn="mysql", $legendText="云",$legendSprite="")
AddContainerTag("APP服务器", $shadowing=true, $sprite="application_server", $shape="roundedBox", $techn="Java", $legendText="APP服务器",$legendSprite="")
AddContainerTag("第三方服务器", $shadowing=true, $bgColor=$EXTERNAL_CONTAINER_BG_COLOR, $sprite="3rd_party_mail_server", $shape="roundedBox", $techn="Java", $legendText="第三方服务器",$legendSprite="")
AddContainerTag("客户端应用", $shadowing=true, $sprite="my_site", $shape="", $techn="C/C++", $legendText="客户端",$legendSprite="")

ContainerDb(cloud, "云端", $descr="数据备份与存储", $tags="云端")
Container_Boundary(server, "本地服务器"){
    Container(server_app, "APP服务器",, $descr="APP1的服务器", $tags="APP服务器")
    ContainerQueue(app_Queue, "APP数据队列服务器",, $descr="APP1的服务器", $tags="APP服务器")
}
Container_Ext(3rd_app_server, "第三方服务器",, $descr="第三方服务器,提供第三方功能支持", $tags="第三方服务器")
Container(pc_app, "电脑应用程序",, $descr="客户交互界面", $tags="客户端应用")
Rel_Neighbor(cloud, 3rd_app_server, "备份数据", "http/RestAPI")
BiRel_U(server_app, cloud, "获取云端数据", "http/RestAPI")
BiRel_U(pc_app, server_app, "获取服务器数据", "http/RestAPI")
Rel_U(pc_app, 3rd_app_server, "获取数据", "http/RestAPI")
Rel_R(server_app, app_Queue,"数据队列","FIFO")
SHOW_LEGEND()
@enduml

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值