Line direction breaks line lenght

0 votes
asked Nov 30 in bug by hukameniz (680 points)

When I hint a line direction for object placement, ex: o-r- I also would like to hint the line lenght, ex: o---r--- should generate longer lines, but it doesn't seem to work.

Example code:

@startuml

skinparam groupInheritance 2

together {
             class User
    abstract class Group
             class Activity
             class Item
}

User     "*" o-r- "1" Group    : < has
Group    "1" o-r- "*" Activity : < has
Activity "1" -r-o "*" Item     :   has >


/'
********************************************************************************

   Inheritances

********************************************************************************
'/
together {
    class Apartment
    class Events
    class Travels
}

together {
    object Type1
    object Type2
    object Type3
}

together {
    object Type01
    object Type02
    object Type03
}

Group <|-d- Apartment
Group <|-d- Events
Group <|-d- Travels

Activity <|-d- Type1
Activity <|-d- Type2
Activity <|-d- Type3

Item <|-d- Type01
Item <|-d- Type02
Item <|-d- Type03


@enduml

Generates:

And the following generates the same diagram:

@startuml

skinparam groupInheritance 2

together {
             class User
    abstract class Group
             class Activity
             class Item
}

User     "*" o---r--- "1" Group    : < has
Group    "1" o---r--- "*" Activity : < has
Activity "1" ---r---o "*" Item     :   has >


/'
********************************************************************************

   Inheritances

********************************************************************************
'/
together {
    class Apartment
    class Events
    class Travels
}

together {
    object Type1
    object Type2
    object Type3
}

together {
    object Type01
    object Type02
    object Type03
}

Group <|-d- Apartment
Group <|-d- Events
Group <|-d- Travels

Activity <|-d- Type1
Activity <|-d- Type2
Activity <|-d- Type3

Item <|-d- Type01
Item <|-d- Type02
Item <|-d- Type03


@enduml

I would like the lines between my main classes to have separated wider as to fill the whole width.

1 Answer

0 votes
answered Dec 1 by hukameniz (680 points)

I created a hack to solve this , but it's quite ugly. It uses invisible text to increase the distance between elements.

The code is all in one file for simplicity, I think that if someone is going to use to put in a separate file and import it.

@startuml

!define INV_S(s)       <color:#FFFFFFF>s<color:Black>
!define S              |
!define SPACE_01       INV_S(S)
!define SPACE_02       INV_S(SS)
!define SPACE_03       INV_S(SSS)
!define SPACE_04       INV_S(SSSS)
!define SPACE_05       INV_S(SSSSS)
!define SPACE_06       INV_S(SSSSSS)
!define SPACE_07       INV_S(SSSSSSS)
!define SPACE_08       INV_S(SSSSSSSS)
!define SPACE_09       INV_S(SSSSSSSSS)
!define SPACE_10       INV_S(SSSSSSSSSS)
!define SPACER_C(s, l) l s l

together {
             class User
    abstract class Group
             class Activity
             class Item
}

User     "*" o-r- "1" Group    :  SPACER_C(<&caret-left> has,  SPACE_10)
Group    "1" o-r- "*" Activity :  SPACER_C(<&caret-left> has,  SPACE_10)
Activity "1" -r-o "*" Item     :  SPACER_C(has <&caret-right>, SPACE_10)


/'
********************************************************************************

   Inheritances

********************************************************************************
'/

together {
    class Apartment
    class Events
    class Travels
}

together {
    object Type1
    object Type2
    object Type3
}

together {
    object Type01
    object Type02
    object Type03
}

Group <|-d- Apartment
Group <|-d- Events
Group <|-d- Travels


Activity <|-d- Type1
Activity <|-d- Type2
Activity <|-d- Type3

Item <|-d- Type01
Item <|-d- Type02
Item <|-d- Type03

@enduml

This generates:

...