PlantUML: 有没有办法禁用类图中同一层次结构上元素的垂直对齐?

3
在Plant UML中,我有几个类需要在其中一个类中指定大量属性,但这会导致该类与其兄弟类及其兄弟类的子类之间存在较大的垂直间隔。
有没有办法告诉渲染引擎,如果两个子类没有共同的直接父类,就不要关心它们的垂直对齐?
我的类层次结构的最小示例。
parent <|-- child1
parent <|-- child2
child2 <|-- child2a

class child1 {
    i
    have
    a
    lot
    of
    different
    fields
    that
    need
    to
    be
    included
    which
    makes
    my
    box
    very
    long
}

期望输出:
输出中,child2a可以直接显示在child2下方,而不是被推到child1的高度下方

观察到的输出:
输出中child2和child2a之间有大量的空白空间,导致child2a被迫放在child1的高度下方

1个回答

1
我能做到的最好就是接近你想要的,但并不完全一样。
@startuml
together {
class child1 {
    i
    have
    a
    lot
    of
    different
    fields
    that
    need
    to
    be
    included
    which
    makes
    my
    box
    very
    long
}

class child2
}

child2 <|- child2a
parent <|-- child1
parent <|- child2
@enduml

解释:将child1和child2放在一起,但child1在垂直方向上有位移(在不同的层级)。child2和child2a在水平方向上有位移(在同一层级)。我认为无法实现您的要求,因为GraphViz(PlantUML的引擎)的排名方式导致这是不可能的。

PlantUML diagram with link to live editor


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接