PlantUML类图 - 图例中的字段/方法可见性

问题描述 投票:0回答:1

是否可以使用真实图标获得图例中类图的字段/方法可见性标签的关键字?

即在图表中获取表格中的真实图标

@startuml
class Dummy {
-field1
#field2
~method1()
+method2()
}

legend
|= field |= method |=  |
|  -     |   -     | private |
|  #     |   #     | protected |
|  ~     |   ~     | package private |
|  +     |   +     | public |

endlegend
@enduml

Example Diagram

我尝试过的事情没有成功:

plantuml
1个回答
0
投票

这非常好(对我的目的来说当然足够好):

@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

Legend with icons

© www.soinside.com 2019 - 2024. All rights reserved.