我正在尝试绘制一个类图,其中定义了两个类之间的多个关系和多重性。默认情况下,结果很糟糕。
我的问题是:是否有一种方法可以使用PlantUML正确绘制这个图形?
@startuml
class Movie {
genres: String[]
minutes: Integer
movie_id: String
rating: Float
title: String
type: String
votes: Integer
year: Integer
}
class Person {
birthYear: Integer
deathYear: Integer
name: String
person_id: String
}
Person "0..*" -> "1..*" Movie : acted_in
Person "0..*" -> "1..*" Movie : directed
Person "0..*" -> "1..*" Movie : produced
Person "0..*" -> "1..*" Movie : wrote
@enduml
使用skinparam nodesep 200
可以改善一些,但是多重性仍然存在问题:
我还尝试了skinparam linetype ortho
,看起来很有前途,但是一旦我也添加了hide circle
和hide methods
,它就变得混乱了...
这是最终代码:
skinparam nodesep 200
skinparam linetype ortho
hide circle
hide methods
class Movie {
genres: String[]
minutes: Integer
movie_id: String
rating: Float
title: String
type: String
votes: Integer
year: Integer
}
class Person {
birthYear: Integer
deathYear: Integer
name: String
person_id: String
}
Person "0..*" -> "1..*" Movie : acted_in
Person "0..*" -> "1..*" Movie : directed
Person "0..*" -> "1..*" Movie : produced
Person "0..*" -> "1..*" Movie : wrote
(Person,Movie) .. Role
class Role {
name: String
}
@enduml
我的问题是:是否有一种方法可以使用PlantUML正确绘制这个图形?
(人物,电影) .up. 角色
- Fuhrmanator