/**/
PlantUML VS. StartUML
优点
-
以文本方式管理的类图,方便Git管理,多人协作以及查看修改记录。
-
布局自动化,只需要处理类之间的相关关系即可。
-
文档中文化,学习曲线平滑
缺点
-
上手难度相对较高
-
环境配置相对麻烦
环境依赖
-
Java – 运行时
-
GraphViz – 用于绘制UML图
使用方式
Web在线编辑
使用官方编辑器
Tips:
不推荐使用此方式编辑Filmora的类图,有网络安全风险,可以用来学习。工作中更推荐使用VS Code在本地编辑。
本地预览
-
运行plantuml.jar指定目录就会自动扫描目录下的pu文件并生成图片了;
-
Mac 运行方式,终端中执行 java -jar plantuml.jar
-
Win 双击运行
-

VS Code 实时编辑
-
安装Java(同上)
-
VS Code 安装插件 PlantUML(自带plantuml.jar与GraphViz)
-
打开类图文件按 Alt+D (Mac上是Option + D)渲染

常见问题
-
无法正常渲染:
-
确保环境配置正确
-
重启VS Code
-
重启电脑
Confluence(公司未启动该插件)
可以在confluence中插入类图代码,这样就不需要插入图片了,但是公司没有安装此插件,暂时无法使用
其他
官方文档的最后的集成能力章节中提到可以在GitLab集成,后面如果有需求可以做进一步的集成工作。

参考文档
示例
Demo
@startuml
header 表头
title 标题
caption 图例
legend
说明
end legend
footer 脚注
class A <T>
{
+ publicMember : int
- privateMember : int
# protectedMember : int
+ publicFunc() : void
# protectedFunc() : void
- privateFunc() : void
}
class B
{
{static} +staticMember : int
{abstract} +abstractFunc() : int
}
A <|-- B
' 新一页
newpage
title 第二页
class Foo1 {
You can use
several lines
..
as you want
and group
==
things together.
__
You can have as many groups
as you want
--
End of class
}
class User {
.. Simple Getter ..
+ getName()
+ getAddress()
.. Some setter ..
+ setName()
__ private data __
int age
-- encrypted --
String password
}
note top of User : Top note
note right of User : Right note
note "attach note" as N1
Foo1 .. N1
User .. N1
note left of User::getName()
成员注释
end note
@enduml


如何导出图片

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


评论(0)