plantuml - PlantUML 类图 - 图例中的字段/方法可见性
问题描述
是否可以使用真实图标在图例中拥有类图的字段/方法可见性标签的键?
即获取下表中的真实图标
@startuml
class Dummy {
-field1
#field2
~method1()
+method2()
}
legend
|= field |= method |= |
| - | - | private |
| # | # | protected |
| ~ | ~ | package private |
| + | + | public |
endlegend
@enduml
我尝试过但没有成功的事情:
- 寻找合适的 openiconic 图标(似乎没有)
- 根据http://plantuml.com/class-diagram上的文件名链接到图像(不存在)
解决方案
这非常好(对于我的目的来说肯定足够好):
@startuml
class Dummy {
-field1
#field2
~method1()
+method2()
}
skinparam legendBackgroundColor #ffffff
legend
|= field |= method |= |
| <img:http://s.plantuml.com/private-field.png> | <img:http://s.plantuml.com/private-method.png> | private |
| <img:http://s.plantuml.com/protected-field.png> | <img:http://s.plantuml.com/protected-method.png> | protected |
| <img:http://s.plantuml.com/package-private-field.png> | <img:http://s.plantuml.com/package-private-method.png> | package private |
| <img:http://s.plantuml.com/public-field.png> | <img:http://s.plantuml.com/public-method.png> | public |
endlegend
@enduml
推荐阅读
- reactjs - 未重定向到所需页面
- html - 我如何将所有内容居中?
- django - 如何分配测试用例审阅者
- javascript - 根据用户选择的下拉菜单选项显示 div
- struct - uncrustify:如何更改结构初始化大括号
- css - 尝试使用 table 来实现 CSS 响应但不起作用
- python - python - 如何将从单个分类变量创建的多个虚拟变量列合并到python中的单个列中?
- jquery - Chrome 表单重置不更改显示选择元素
- perl - 在 Perl 中将包含空格的参数从一个脚本传递到另一个脚本
- arrays - 我们如何在postgresql中提取json数组元素