mirror of
https://github.com/plantuml-stdlib/C4-PlantUML.git
synced 2022-10-18 01:14:54 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -749,11 +749,52 @@ skinparam defaultFontName "Comic Sans MS"
|
||||
center footer <font color=red>Warning:</font> Created for discussion, needs to be validated
|
||||
!endprocedure
|
||||
|
||||
!global $fix_direction=%false()
|
||||
|
||||
!function $down($start,$end)
|
||||
!if ($fix_direction)
|
||||
!return $start+"RIGHT"+$end
|
||||
!else
|
||||
!return $start+"DOWN"+$end
|
||||
!endif
|
||||
!endfunction
|
||||
|
||||
!function $up($start,$end)
|
||||
!if ($fix_direction)
|
||||
!return $start+"LEFT"+$end
|
||||
!else
|
||||
!return $start+"UP"+$end
|
||||
!endif
|
||||
!endfunction
|
||||
|
||||
!function $left($start,$end)
|
||||
!if ($fix_direction)
|
||||
!return $start+"UP"+$end
|
||||
!else
|
||||
!return $start+"LEFT"+$end
|
||||
!endif
|
||||
!endfunction
|
||||
|
||||
!function $right($start,$end)
|
||||
!if ($fix_direction)
|
||||
!return $start+"DOWN"+$end
|
||||
!else
|
||||
!return $start+"RIGHT"+$end
|
||||
!endif
|
||||
!endfunction
|
||||
|
||||
!procedure LAYOUT_TOP_DOWN()
|
||||
!global $fix_direction=%false()
|
||||
top to bottom direction
|
||||
!endprocedure
|
||||
|
||||
!procedure LAYOUT_LEFT_RIGHT()
|
||||
!procedure LAYOUT_LEFT_RIGHT()
|
||||
!global $fix_direction=%false()
|
||||
left to right direction
|
||||
!endprocedure
|
||||
|
||||
!procedure LAYOUT_LANDSCAPE()
|
||||
!global $fix_direction=%true()
|
||||
left to right direction
|
||||
!endprocedure
|
||||
|
||||
@@ -863,59 +904,59 @@ $getRel("<<-", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($down("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($down("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure BiRel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("<<-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($down("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure BiRel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("<<-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($down("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($up("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($up("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure BiRel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("<<-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($up("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure BiRel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("<<-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($up("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($left("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($left("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure BiRel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("<<-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($left("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure BiRel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("<<-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($left("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($right("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($right("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure BiRel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("<<-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($right("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure BiRel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("<<-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($right("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
' Layout Helpers
|
||||
|
||||
+16
-16
@@ -94,53 +94,53 @@ $getRel("<<-", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $t
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($down("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($down("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure RelIndex_D($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure RelIndex_Down($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($up("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($up("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure RelIndex_U($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure RelIndex_Up($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($left("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($left("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure RelIndex_L($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure RelIndex_Left($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($right("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($right("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure RelIndex_R($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($right("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
!unquoted procedure RelIndex_Right($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
|
||||
$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
$getRel($right("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
|
||||
!endprocedure
|
||||
|
||||
+36
-3
@@ -6,7 +6,7 @@ PlantUML uses [Graphviz](https://www.graphviz.org/) for its graph visualization.
|
||||
|
||||
For this reason, C4-PlantUML also comes with some layout options.
|
||||
|
||||
## LAYOUT_TOP_DOWN() or LAYOUT_LEFT_RIGHT()
|
||||
## LAYOUT_TOP_DOWN() or LAYOUT_LEFT_RIGHT() or LAYOUT_LANDSCAPE()
|
||||
|
||||
With the two macros `LAYOUT_TOP_DOWN()` and `LAYOUT_LEFT_RIGHT()` it is possible to easily change the flow visualization of the diagram. `LAYOUT_TOP_DOWN()` is the default.
|
||||
|
||||
@@ -30,8 +30,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
|
||||
|
||||

|
||||
|
||||
|
||||
Using `LAYOUT_LEFT_RIGHT()`
|
||||
`LAYOUT_LEFT_RIGHT()` rotates the flow visualization to *from Left to Right* and directed relations like `Rel_Left()`, `Rel_Right()`, `Rel_Up()` and `Rel_Down()` are rotated too.
|
||||
|
||||
```csharp
|
||||
@startuml LAYOUT_LEFT_RIGHT Sample
|
||||
@@ -52,6 +51,40 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
|
||||
|
||||

|
||||
|
||||
`LAYOUT_LANDSCAPE()` rotates the default flow visualization to *from Left to Right* like `LAYOUT_LEFT_RIGHT()` additional **directed relations** like Rel_Left(), Rel_Right(), Rel_Up() and Rel_Down() **are not rotated** anymore.
|
||||
|
||||
```csharp
|
||||
@startuml LAYOUT_LANDSCAPE Sample
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
|
||||
LAYOUT_LANDSCAPE()
|
||||
|
||||
Person(admin, "Administrator")
|
||||
System_Boundary(c1, 'Sample') {
|
||||
Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines")
|
||||
}
|
||||
System(twitter, "Twitter")
|
||||
|
||||
Rel(admin, web_app, "Uses", "HTTPS")
|
||||
Rel(web_app, twitter, "Gets tweets from", "HTTPS")
|
||||
|
||||
System(S,"S")
|
||||
System(SU,"S Up")
|
||||
System(SD,"S Down")
|
||||
System(SL,"S Left")
|
||||
System(SR,"S Right")
|
||||
|
||||
Rel_Up(S, SU, "Up")
|
||||
Rel_Down(S, SD, "Down")
|
||||
Rel_Left(S, SL, "Left")
|
||||
Rel_Right(S, SR, "Right")
|
||||
|
||||
SHOW_LEGEND()
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||

|
||||
|
||||
## LAYOUT_WITH_LEGEND() or SHOW_LEGEND(?hideStereotype)
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ Lay_Distance(LEGEND(), db, 1)
|
||||
|
||||
C4-PlantUML also comes with some layout options to make it easy and reusable to create nice and useful diagrams:
|
||||
|
||||
* [LAYOUT_TOP_DOWN() or LAYOUT_LEFT_RIGHT()](LayoutOptions.md#layout_top_down-or-layout_left_right)
|
||||
* [LAYOUT_TOP_DOWN() or LAYOUT_LEFT_RIGHT() or LAYOUT_LANDSCAPE()](LayoutOptions.md#layout_top_down-or-layout_left_right-or-layout_landscape)
|
||||
* [LAYOUT_WITH_LEGEND() or SHOW_LEGEND(?hideStereotype)](LayoutOptions.md#layout_with_legend-or-show_legend)
|
||||
* [SHOW_FLOATING_LEGEND(?alias, ?hideStereotype) and LEGEND()](LayoutOptions.md#show_floating_legendalias-hidestereotype-and-legend)
|
||||
* [LAYOUT_AS_SKETCH()](LayoutOptions.md#layout_as_sketch)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
@startuml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Component.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
|
||||
!endif
|
||||
|
||||
LAYOUT_LANDSCAPE()
|
||||
|
||||
Person(admin, "Administrator")
|
||||
System_Boundary(c1, 'Sample') {
|
||||
Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines")
|
||||
}
|
||||
System(twitter, "Twitter")
|
||||
|
||||
Rel(admin, web_app, "Uses", "HTTPS")
|
||||
Rel(web_app, twitter, "Gets tweets from", "HTTPS")
|
||||
|
||||
System(S,"S")
|
||||
System(SU,"S Up")
|
||||
System(SD,"S Down")
|
||||
System(SL,"S Left")
|
||||
System(SR,"S Right")
|
||||
|
||||
Rel_Up(S, SU, "Up")
|
||||
Rel_Down(S, SD, "Down")
|
||||
Rel_Left(S, SL, "Left")
|
||||
Rel_Right(S, SR, "Right")
|
||||
|
||||
SHOW_LEGEND()
|
||||
@enduml
|
||||
@@ -0,0 +1,32 @@
|
||||
@startuml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Dynamic.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Dynamic.puml
|
||||
!endif
|
||||
|
||||
LAYOUT_LANDSCAPE()
|
||||
|
||||
Person(admin, "Administrator")
|
||||
System_Boundary(c1, 'Sample') {
|
||||
Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines")
|
||||
}
|
||||
System(twitter, "Twitter")
|
||||
|
||||
Rel(admin, web_app, "Uses", "HTTPS")
|
||||
Rel(web_app, twitter, "Gets tweets from", "HTTPS")
|
||||
|
||||
System(S,"S")
|
||||
System(SU,"S Up")
|
||||
System(SD,"S Down")
|
||||
System(SL,"S Left")
|
||||
System(SR,"S Right")
|
||||
|
||||
Rel_Up(S, SU, "Up")
|
||||
Rel_Down(S, SD, "Down")
|
||||
Rel_Left(S, SL, "Left")
|
||||
Rel_Right(S, SR, "Right")
|
||||
|
||||
SHOW_LEGEND()
|
||||
@enduml
|
||||
Reference in New Issue
Block a user