I use plantuml to draw class diagram, but connect line position are not my expect(there are huddled together), the code as follow:
@startuml "mediator module"
' 默认线是圆弧状
' 多段线
' skinparam linetype polyline
' ortho 是垂直线
skinparam linetype ortho
class Mediator {
+{abstract} createCtrl() : void
+{abstract} ctrlChanged(CtrlParent*) : void
}
class ConcrMediator {
+virtual createCtrl() : void
+virtual ctrlChanged(CtrlParent*) : void
}
class CtrlParent {
#m_pmediator : Mediator
+virtual Changed() : void
+{abstract} Enable(bool) : void
}
together {
class Button {
+virtual Enable(bool) : void
}
class RadioBtn {
+Selected(bool) : void
+virtual Enable(bool) : void
}
class EditCtrl {
+virtual Enable(bool) : void
+isContentEmpty : bool
}
}
Mediator <|---down ConcrMediator
CtrlParent <|---right Button
CtrlParent <|---down RadioBtn
CtrlParent <|---down EditCtrl
CtrlParent o-left-> Mediator
ConcrMediator o-> RadioBtn
note on link : mp_rbtn1、mp_rbtn2
ConcrMediator o-right-> EditCtrl
note on link : mp_edtctrl1, mp_edtctrl2
ConcrMediator o-> Button
note on link : mp_login、mp_logout
@enduml
and draw result:
I`ve try to switch line style ortho/polyline and default, add toghter (Button, RadioBtn, EditCtrl), but not work, my expecting ConcrMediator connect lines hava some gap, just like:
When the subclasses of CtrlParent are at the same (vertical) level, it's very messy (especially with the note on link
). So, I staggered the vertical distance of those subclasses (it's not exactly what you want, but I hope it's better):
@startuml "mediator module"
' 默认线是圆弧状
' 多段线
' skinparam linetype polyline
' ortho 是垂直线
skinparam linetype ortho
skinparam nodesep 150
together {
class CtrlParent {
#m_pmediator : Mediator
+virtual Changed() : void
+{abstract} Enable(bool) : void
}
class Button {
+virtual Enable(bool) : void
}
class RadioBtn {
+Selected(bool) : void
+virtual Enable(bool) : void
}
class EditCtrl {
+virtual Enable(bool) : void
+isContentEmpty : bool
}
}
class Mediator {
+{abstract} createCtrl() : void
+{abstract} ctrlChanged(CtrlParent*) : void
}
class ConcrMediator {
+virtual createCtrl() : void
+virtual ctrlChanged(CtrlParent*) : void
}
Mediator <|-- ConcrMediator
' vary the vertical distance by making line longer
CtrlParent <|---- Button
CtrlParent <|--- EditCtrl
CtrlParent <|-- RadioBtn
CtrlParent o-l-> Mediator
ConcrMediator o-> RadioBtn
note on link: mp_rbtn, mp_rbtn2
ConcrMediator o-r-> EditCtrl
note on link: mp_edtctrl1, mp_edtctrl2
ConcrMediator o-> Button
note on link: mp_login, mp_logout
@enduml