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

时间:2019-02-26 09:58:15

标签: plantuml

是否可以使用真实图标在图例中具有指向类图的字段/方法可见性标签的键?

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

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

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

endlegend
@enduml

Example Diagram

我尝试过的事没有成功:

1 个答案:

答案 0 :(得分: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