Component diagram (want many links to passthrough a component)

0 votes
asked Mar 21 in Wanted features by boshka (3,960 points)
edited Mar 22 by boshka
Hello Plantuml team!

Is it possible to provide a syntax which would instruct a link to passthrough a component?

For example:
 

@startuml

component A
component B
component C
component "Gateway" as GW

'now I want the link from A to C to go through the Gateway:
A -[passthrough:GW]-> C

'and the link from B to C to go through the Gateway:
B -[passthrough:GW]-> C

@enduml

Note, I know that I can do:

A->GW

GW->C

B->GW

GW->C

But sometimes it would be really helpful if one could just to say "passthrough" for a bunch of links, such as in my case when I need to quickly add, for example, a GATEWAY component and want many links to pass through it.

Thank you!

1 Answer

+1 vote
answered Mar 22 by chiarld (480 points)
selected Mar 23 by boshka
 
Best answer

The best way I can think of solving this is by utilizing a procedure. For your example, it would look somewhat like this:

@startuml
!procedure $passthrough($a, $b, $gw)
  $a -> $gw
  $gw -> $b
!endprocedure

component A
component B
component C
component "Gateway" as GW

$passthrough(A, C, GW)
$passthrough(B, C, GW)
@enduml




PS Sorry, just realized this had the 'Wanted Feature' tag - In any case, hope this answer can serve as an aid before the feature is implemented :) 

commented Mar 23 by boshka (3,960 points)

Hi chiarld!

Great! Thank you!

Using the procedure will do just perfect for my specific needs for now.

However, having the support in the syntax would be good too in future.

...