【问题标题】:UML - How to get the same class box width?UML - 如何获得相同的类框宽度?
【发布时间】:2020-12-08 14:09:48
【问题描述】:

如何指定 UML 类图的框宽度。在示例中,我使用 classA 和 classB 并希望它们具有相同的框 witdh(黄色),以便宽度与方法/属性名称无关。

请在下面找到 UML 代码以及附带的屏幕截图,其中包含当前结果(左)和首选结果(右)。

非常感谢您的支持:)

@startuml testWidth
class classA {
{field}  - attributeA : int
{field}  - attributeB : int
{method} + methodA()
{method} + methodB()
{method} + veeeeeeery_looooong_named_method()
}
class classB {
{field}  - attributeC : int    
}
classA <|-- classB
@enduml

【问题讨论】:

    标签: uml class-diagram plantuml


    【解决方案1】:

    存在用于植物的皮肤参数minClassWidthSameClassWidth 。据我所知,SameClassWidth 就是您要找的那个

    @startuml
    skinparam SameClassWidth true
    class classA {
    {field}  - attributeA : int
    {field}  - attributeB : int
    {method} + methodA()
    {method} + methodB()
    {method} + veeeeeeery_looooong_named_method()
    }
    class classB {
    {field}  - attributeC : int    
    }
    classA <|-- classB
    @enduml
    

    查看结果:http://www.plantuml.com/plantuml/umla/ROvD2i8m48NtESLRAj8BY8kcFO8BboMQqGQJL9A98BLtjpKM5FiM8VD-u2iZgy39MH6lnjzKK0vxvQYsAiQ3qTo2Go9nccwyNubUYFvioEe1AA2OWpac9eajZEV5h9epHznsOxX1_idL-j-iViqxPOL7Oxj9_j9uvKWtkJEsXs_22lqYH9qXC6eUIEoUHV6PYPAyJiw-0000

    可以通过命令获取所有皮肤参数:

    java -Djava.awt.headless=true -jar plantuml.jar -language

    【讨论】:

    • SameClassWidth 命令正是我想要的!非常感谢:)
    猜你喜欢
    • 2018-01-28
    • 1970-01-01
    • 2021-06-02
    • 1970-01-01
    • 2017-02-02
    • 2016-04-14
    • 1970-01-01
    • 2016-11-12
    • 2011-07-29
    相关资源
    最近更新 更多