plantuml样式_GitHub - sinopower/plantuml-style-c4: 自定义的plantuml 样式

本文档介绍了如何自定义PlantUml和C4模型的样式,包括时序图、类图、状态图、用例图、活动图等示例。通过引用样式库,可以美化系统架构图,提高沟通效率。
摘要由CSDN通过智能技术生成

自定义PlantUml和C4 Model样式

da9e7e2f03fe409fcb26e8630719d769.png

什么是PlantUml

PlantUml是一个支持快速绘制的开源项目.其定义了一套完整的语言用于实现UML关系图的描述.并基于强大的graphviz图形渲染库进行UML图的生成.绘制的UML图还可以导出为图片,以及通用的矢量SVG格式文件.

如以下代码,可实现时序图

@startuml

Alice -> Bob: Authentication Request

Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request

Alice

@enduml

4f1a80d8b196646cdeeb4f835b572bc0.png

可以使用常用的编辑器vscode 或者sublime 或者其他IDE工具继承PlantUml

想了解更多PlantUml或者使用方法,可参考官网http://plantuml.com/zh/,上面详细的中英文说明

什么是C4 Model

C4 Model 在我眼里更像是一个标准,一个方法论。让架构师、程序员、业务人员在讨论IT系统架构时候统一维度,统一标准,更方便的理解和沟通IT系统中的真实问题。强烈推荐!!!

C4 模型由一系列分层的软件架构图组成,这些架构图用于描述上下文(Context)、容器(Container)、组件(Component)和代码(Code)。C4 图的层次结构提供了不同的抽象级别,每种抽象级别都与不同的受众有关

0638dc2405536d0dae4a29f57dd0a433.png

本库只是一个样式库

本库的目的是美化PlantUml和C4 Model所绘制系统架构图的样式,统一审美而产生。

1.时序图

在PlantUml代码中引用

@startuml

actor User

participant "First Class" as first

participant "Second Class" as second

participant "Last Class" as last

User -> first: DoWork

activate first

note right

this is a first note

end note

first -> second: Create Request

activate second

second -> last: DoWork

activate last

last --> second: WorkDone

destroy last

deactivate last

second --> first: Request Created

deactivate second

first --> User: Done

deactivate first

@enduml

3f1b7180855460f2c044c0aca5168ded.png

2. 类图

以下为示例

@startuml 示例类图

!includeurl https://raw.githubusercontent.com/xuanye/plantuml-style-c4/master/core.puml

' uncomment the following line and comment the first to use locally

'!include core.puml

GREY_ARROW

abstract class BaseClass {

+ AbstractMethod() : void

# VirtualMethod(s:string) : int

}

class SubClass {

+ AbstractMethod() : void

# VirtualMethod(s:string) : int

}

interface IInterfaceA {

}

interface "IInterfaceA`1" {

Value : T <>

}

class ImplementClass {

+ Value : int <>

}

BaseClass

IInterfaceA

"IInterfaceA`1" ""

@enduml

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值