Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Grouping inheritance arrow ends

0 votes
Hello,

Large inheritance trees would be more readable with all arrow ends merged. It seems that the samehead attribute of dot edges could be used to achieve this.

Is it possible to set something like "samehead=inheritance" on every inheritance link in the generated dot? This could possibly be triggered by an option like "group inheritance".

Additionally, the concentrate attribute of dot would merge even part of the path of inheritance arrows. This could be enabled by the same "group inheritance" option.

 

Thanks,

Fred
asked Mar 5, 2015 in Wanted features by fred (740 points)

2 Answers

0 votes
 
Best answer

Let's use the same thread.

We've put another beta (well, work is still in progress, so you should save the previous beta if you try this one).
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

We decide to disable by default grouping, since it really change the drawings.

@startuml
skinparam groupInheritance 3

A1 <|-- B1

A2 <|-- B2
A2 <|-- C2

A3 <|-- B3
A3 <|-- C3
A3 <|-- D3

A4 <|-- B4
A4 <|-- C4
A4 <|-- D4
A4 <|-- E4
@enduml


We are doing something really tricky here, so even if it's working with the example, it does not work (yet) in general case.

And even with this simple example, the drawing is somehow strange, but I'm afraid that it's the best we can have. Is it still ok for you ?

answered Mar 9, 2015 by plantuml (122,630 points)
selected Mar 10, 2015 by fred
Hello,

This version is indeed nicer. Thanks!

By the way, it seems that setting sametail to the same value for the whole diagram works. It does not seem necessary to set sametail to a different value per superclass as you currently do.

Although this is useless, I tried setting groupInheritance to 1, and it crashes. It should probably silently behave like if it was set to 2.


By playing with svek.dot, one can try different things. Unfortunately, simply using dot's splines=ortho does not produce nice results (notably because it seems incompatible with sametail). Using one invisible node per superclass + splines=ortho (see http://stackoverflow.com/questions/2901233/complicated-graphviz-tree-structure#12406246) results in a nicer output, but this is not perfect yet.


Best regards,

Fred
After trying on a more complex diagram, which worked with the previous beta, I encountered the following exception:

java.lang.NullPointerException
        at net.sourceforge.plantuml.cucadiagram.dot.Neighborhood.drawU(Neighborhood.java:78)
        at net.sourceforge.plantuml.svek.EntityImageProtected.drawUntranslated(EntityImageProtected.java:77)
        at net.sourceforge.plantuml.svek.SvekResult.drawU(SvekResult.java:81)
        at net.sourceforge.plantuml.ugraphic.ImageBuilder.writeImageTOBEMOVED(ImageBuilder.java:125)
        at net.sourceforge.plantuml.ugraphic.ImageBuilder.writeImageTOBEMOVED(ImageBuilder.java:119)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFileInternal(CucaDiagramFileMakerSvek.java:150)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFile(CucaDiagramFileMakerSvek.java:99)
        at net.sourceforge.plantuml.cucadiagram.CucaDiagram.exportDiagramInternal(CucaDiagram.java:314)
        at net.sourceforge.plantuml.classdiagram.ClassDiagram.exportDiagramInternal(ClassDiagram.java:203)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagram(UmlDiagram.java:228)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagramsCuca(PSystemUtils.java:202)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:65)
        at net.sourceforge.plantuml.SourceFileReader.getGeneratedImages(SourceFileReader.java:130)
        at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:394)
        at net.sourceforge.plantuml.Run.processArgs(Run.java:316)
        at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:291)
        at net.sourceforge.plantuml.Run.main(Run.java:135)
Could you send us by mail the source diagram ?
Thanks
Hey guys.

Is this only possible on Generalization?

Best regards,
Timo
Hi,
Sorry, I am not sure to understand your point. Which "Generalization" ?
Could you give an example ?

Thanks!
Hi.
In your example you showed this workaround:

A2 <|-- B2
A2 <|-- C2
A2 <|-- D2

But what I'm looking for if the same reaction on this:

A2 *-- "0..1" B2
A2 *-- "0..1" C2
A2 *-- "0..1" D2

Or that:

A2 -- "0..1" B2
A2 -- "0..1" C2
A2 -- "0..1" D2

And that:

A2 *--> "0..1" B2
A2 *--> "0..1" C2
A2 *--> "0..1" D2

And so on.

Hope these examples are enough.

Best regards,
Timo
0 votes

Hi,

Thanks for the idea : we did not know about the "sametail" feature.

We have made a beta here: https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

This beta starts to group inheritance when there are 3 or more inheritance links.
Merging path inheritance is possible, but this need some works...

Example:
@startuml
A1 <|-- B1

A2 <|-- B2
A2 <|-- C2

A3 <|-- B3
A3 <|-- C3
A3 <|-- D3

A4 <|-- B4
A4 <|-- C4
A4 <|-- D4
A4 <|-- E4
@enduml


We may add a skinparam parameter (like groupInheritance) that would allow to change this hardcoded limit of 3.
If you have ideas of a better syntax, please post here!

Thanks again for your suggestion!
 

answered Mar 9, 2015 by plantuml (122,630 points)
Hi,

Thanks, it works as expected.

I had not thought about setting a limit, and making it changeable, but this seems like a good idea. "groupInheritance 0" could disable grouping (if enabled by default).

My large class diagrams are a bit more readable with this feature.

They should be even more readable with inheritance path merging. Do you want me to start a new thread about that other feature, to make it easier to keep track of it?


Thanks,

Frédéric
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...