From 39008249342729222b13944874452975ad577ee5 Mon Sep 17 00:00:00 2001 From: Nafiur Rahman Khadem Date: Sun, 18 Sep 2022 21:21:59 +0600 Subject: [PATCH 1/2] sync with C4-plantuml --- base/C4.puml | 175 +++++++++++++++++++++++++++++++++++----- base/C4_Component.puml | 33 ++++---- base/C4_Container.puml | 47 +++++++---- base/C4_Context.puml | 35 +++++++- base/C4_Deployment.puml | 9 ++- base/C4_Dynamic.puml | 7 +- readme.md | 12 ++- setup-macos.sh | 6 +- 8 files changed, 265 insertions(+), 59 deletions(-) diff --git a/base/C4.puml b/base/C4.puml index 3f82416..e7cead3 100644 --- a/base/C4.puml +++ b/base/C4.puml @@ -3,7 +3,7 @@ 'Version ' ################################## !function C4Version() - !return "2.4.0" + !return "2.5.0beta1" !end function !procedure C4VersionDetails() @@ -29,6 +29,11 @@ rectangle C4VersionDetailsArea <> [ !global $LEGEND_DARK_COLOR = "#66622E" !global $LEGEND_LIGHT_COLOR = "#khaki" +!global $SKETCH_BG_COLOR = "#EEEBDC" +!global $SKETCH_FONT_COLOR = "" +!global $SKETCH_WARNING_COLOR = "red" +!global $SKETCH_FONT_NAME = "Comic Sans MS" + ' Labels ' ################################## @@ -43,6 +48,11 @@ rectangle C4VersionDetailsArea <> [ !global $LEGEND_DOTTED_LINE = "(dotted) " !global $LEGEND_DASHED_LINE = "(dashed) " !global $LEGEND_BOLD_LINE = "(bold) " +!global $LEGEND_DASHED_BOUNDARY = "boundary (dashed) " +!global $LEGEND_DASHED_TRANSPARENT_BOUNDARY = "boundary (dashed, transparent) " + +!global $SKETCH_FOOTER_WARNING = "Warning:" +!global $SKETCH_FOOTER_TEXT = "Created for discussion, needs to be validated" ' Styling ' ################################## @@ -107,21 +117,19 @@ skinparam person { } ' Some boundary skinparams have to be set as package skinparams too (PlantUML uses internal packages) -skinparam package { +' UpdateBoundaryStyle() called in boundary section below +skinparam rectangle<> { + Shadowing false StereotypeFontSize 6 StereotypeFontColor $BOUNDARY_BG_COLOR - FontStyle plain - BackgroundColor $BOUNDARY_BG_COLOR + BorderStyle dashed } -skinparam rectangle<> { - Shadowing false +skinparam package { StereotypeFontSize 6 StereotypeFontColor $BOUNDARY_BG_COLOR - FontColor $BOUNDARY_COLOR - BorderColor $BOUNDARY_COLOR + FontStyle plain BackgroundColor $BOUNDARY_BG_COLOR - BorderStyle dashed } ' Legend and Tags @@ -257,7 +265,7 @@ skinparam rectangle<> { !function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) !$elementSkin = "skinparam " + $element + "<<" + $tagStereo + ">> {" + %newline() !if ($fontColor != "") - !if ($tagStereo != "boundary") + !if (%strpos($tagStereo, "boundary") < 0) !$elementSkin = $elementSkin + " StereotypeFontColor " + $fontColor + %newline() !endif !$elementSkin = $elementSkin + " FontColor " + $fontColor + %newline() @@ -296,9 +304,9 @@ skinparam rectangle<> { ' actor has style awesome, therefore $fontColor is ignored and text uses $bgColor too !$tagSkin = $tagSkin + $elementTagSkinparams("actor", $tagStereo, $bgColor, $bgColor, $borderColor, $shadowing, "") !$tagSkin = $tagSkin + $elementTagSkinparams("person", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, "") - !if ($tagStereo == "boundary" && $bgColor != "") - !$tagSkin = $tagSkin + "skinparam package<>StereotypeFontColor " + $bgColor + %newline() - !$tagSkin = $tagSkin + "skinparam rectangle<>StereotypeFontColor " + $bgColor + %newline() + !if (%strpos($tagStereo, "boundary") >= 0 && $bgColor != "") + !$tagSkin = $tagSkin + "skinparam package<<" + $tagStereo + ">>StereotypeFontColor " + $bgColor + %newline() + !$tagSkin = $tagSkin + "skinparam rectangle<<" + $tagStereo + ">>StereotypeFontColor " + $bgColor + %newline() !endif $tagSkin !endprocedure @@ -491,7 +499,26 @@ $elementSkin !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " !endif !if ($legendText == "") - !$tagEntry = $tagEntry + " " + $tagStereo + " " + !if ($tagStereo == "boundary") + !if ($bgColor == "#00000000" || %lower($bgColor) == "transparent") + !$tagEntry = $tagEntry + " " + $LEGEND_DASHED_TRANSPARENT_BOUNDARY + !else + !$tagEntry = $tagEntry + " " + $LEGEND_DASHED_BOUNDARY + !endif + !elseif (%strpos($tagStereo, "boundary") >= 0) + ' if contains/ends with _boundary remove _boundary and add "boundary (dashed)" + !$pos = %strpos($tagStereo, "_boundary") + !if ($pos > 0) + !$tagEntry = $tagEntry + " " + %substr($tagStereo, 0 ,$pos) + !if ($bgColor == "#00000000" || %lower($bgColor) == "transparent") + !$tagEntry = $tagEntry + " " + $LEGEND_DASHED_TRANSPARENT_BOUNDARY + !else + !$tagEntry = $tagEntry + " " + $LEGEND_DASHED_BOUNDARY + !endif + !endif + !else + !$tagEntry = $tagEntry + " " + $tagStereo + " " + !endif !if ($shadowing == "true") !$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT !endif @@ -893,11 +920,58 @@ $getLegendTable() hide stereotype !endprocedure +!unquoted procedure SET_SKETCH_STYLE($bgColor="_dont_change_", $fontColor="_dont_change_", $warningColor="_dont_change_", $fontName="_dont_change_", $footerWarning="_dont_change_", $footerText="_dont_change_") +!if $bgColor != "_dont_change_" + !global $SKETCH_BG_COLOR = $bgColor +!endif +!if $fontColor != "_dont_change_" + !global $SKETCH_FONT_COLOR = $fontColor +!endif +!if $warningColor != "_dont_change_" + !global $SKETCH_WARNING_COLOR = $warningColor +!endif +!if $fontName != "_dont_change_" + !global $SKETCH_FONT_NAME = $fontName +!endif +!if $footerWarning != "_dont_change_" + !global $SKETCH_FOOTER_WARNING = $footerWarning +!endif +!if $footerText != "_dont_change_" + !global $SKETCH_FOOTER_TEXT = $footerText +!endif +!endprocedure + !procedure LAYOUT_AS_SKETCH() -skinparam backgroundColor #EEEBDC -skinparam handwritten true -skinparam defaultFontName "Comic Sans MS" -center footer Warning: Created for discussion, needs to be validated + skinparam handwritten true +!if $SKETCH_BG_COLOR > "" + skinparam backgroundColor $SKETCH_BG_COLOR +!endif +!if $SKETCH_FONT_COLOR > "" + skinparam footer { + FontColor $SKETCH_FONT_COLOR + } + !if $ARROW_COLOR == "#666666" + !global $ARROW_COLOR = $SKETCH_FONT_COLOR + skinparam arrow { + Color $ARROW_COLOR + FontColor $ARROW_COLOR + } + !endif + !if $BOUNDARY_COLOR == "#444444" + !global $BOUNDARY_COLOR = $SKETCH_FONT_COLOR + skinparam rectangle<> { + FontColor $BOUNDARY_COLOR + BorderColor $BOUNDARY_COLOR + } + !endif +!endif +!if $SKETCH_FONT_NAMES > "" + skinparam defaultFontName $SKETCH_FONT_NAME +!endif +!if $SKETCH_FOOTER_WARNING > "" || $SKETCH_FOOTER_TEXT > "" + !$line = "footer "+ $SKETCH_FOOTER_WARNING + " " + $SKETCH_FOOTER_TEXT + $line +!endif !endprocedure !global $fix_direction=%false() @@ -977,6 +1051,43 @@ $getLegendArea($alias, $hideStereotype) ' Boundaries ' ################################## +!unquoted procedure UpdateBoundaryStyle($elementName="", $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $type="", $legendText="") + !if ($elementName != "") + !$elementBoundary = $elementName + '_boundary' + UpdateElementStyle($elementBoundary, $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "") + !else + UpdateElementStyle("boundary", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "") + ' simulate color inheritance + UpdateBoundaryStyle("enterprise", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "Enterprise", "") + UpdateBoundaryStyle("system", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "System", "") + UpdateBoundaryStyle("container", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "Container", "") + !endif +!endprocedure + +!unquoted procedure AddBoundaryTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $type="", $legendText="") + !$tagBoundary = $tagStereo + '_boundary' + AddElementTag($tagBoundary, $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "") +!endprocedure + +' add _boundary to all tags that short tag version can be used +!unquoted function $addBoundaryPostfix($tags) + !if (%strlen($tags) == 0) + !return '' + !endif + !$boundaryTags = '' + !$brPos = %strpos($tags, "+") + !while ($brPos >= 0) + !$tag = %substr($tags, 0, $brPos) + !$boundaryTags = $boundaryTags + $tag + '_boundary+' + !$tags = %substr($tags, $brPos+1) + !$brPos = %strpos($tags, "+") + !endwhile + !if (%strlen($tags) > 0) + !$boundaryTags = $boundaryTags + $tags + '_boundary' + !endif + !return $boundaryTags +!endfunction + !function $getBoundary($label, $type) !if ($type == "") !return '==' + $label @@ -987,9 +1098,15 @@ $getLegendArea($alias, $hideStereotype) !endfunction !unquoted procedure Boundary($alias, $label, $type="", $tags="", $link="") -rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias $getLink($link) +!$boundaryTags = $addBoundaryPostfix($tags) +' nodes $type reuses $techn definition of $boundaryTags +!$type=$toElementArg($type, $boundaryTags, "ElementTagTechn", "boundary") +rectangle "$getBoundary($label, $type)" $toStereos("boundary", $boundaryTags) as $alias $getLink($link) !endprocedure +' Boundary Styling +UpdateBoundaryStyle("", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR) + ' Relationship ' ################################## @@ -1017,6 +1134,11 @@ rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias ' line break is not deterministic, calculate it !$rel = $rel + '\n\n' + $breakDescr($descr, $REL_DESCR_MAX_CHAR_WIDTH) !endif + !$prop = $getProps() + !if ($prop != "") + ' reuse table + !$rel = $rel + $prop + !endif !return $rel !endfunction @@ -1117,15 +1239,30 @@ $getRel($right("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, !unquoted procedure Lay_D($from, $to) $from -[hidden]D- $to !endprocedure +!unquoted procedure Lay_Down($from, $to) +$from -[hidden]D- $to +!endprocedure + !unquoted procedure Lay_U($from, $to) $from -[hidden]U- $to !endprocedure +!unquoted procedure Lay_Up($from, $to) +$from -[hidden]U- $to +!endprocedure + !unquoted procedure Lay_R($from, $to) $from -[hidden]R- $to !endprocedure +!unquoted procedure Lay_Right($from, $to) +$from -[hidden]R- $to +!endprocedure + !unquoted procedure Lay_L($from, $to) $from -[hidden]L- $to !endprocedure +!unquoted procedure Lay_Left($from, $to) +$from -[hidden]L- $to +!endprocedure ' PlantUML bug: lines which does "not match" with the orientation/direction of the diagram ' uses the same length therefore the method offers no direction at all. diff --git a/base/C4_Component.puml b/base/C4_Component.puml index 2f54173..ef65914 100644 --- a/base/C4_Component.puml +++ b/base/C4_Component.puml @@ -1,4 +1,9 @@ -!include C4_Container.puml +' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml +!else + !include C4_Container.puml +!endif ' Scope: A single container. ' Primary elements: Components within the container in scope. @@ -32,7 +37,7 @@ UpdateElementStyle("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONEN ' Layout ' ################################## -SetDefaultLegendEntries("person\nsystem\ncontainer\ncomponent\nexternal_person\nexternal_system\nexternal_container\nexternal_component") +SetDefaultLegendEntries("person\nsystem\ncontainer\ncomponent\nexternal_person\nexternal_system\nexternal_container\nexternal_component\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary") !procedure LAYOUT_WITH_LEGEND() hide stereotype @@ -53,18 +58,18 @@ endlegend ' ################################## !function $getComponent($label, $techn, $descr, $sprite) -!if ($descr == "") && ($sprite == "") -!return '=='+$label+'\n//['+$techn+']//' -!endif -!if ($descr == "") && ($sprite != "") -!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//' -!endif -!if ($descr != "") && ($sprite == "") -!return '=='+$label+'\n//['+$techn+']//\n\n '+$descr -!endif -!if ($descr != "") && ($sprite != "") -!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//\n\n '+$descr -!endif + !$component = "" + !if ($sprite != "") + !$component = $component + $getSprite($sprite) + '\n' + !endif + !$component = $component + '==' + $label + !if ($techn != "") + !$component = $component + '\n//[' + $techn + ']//' + !endif + !if ($descr != "") + !$component = $component + '\n\n' + $descr + !endif + !return $component !endfunction !unquoted procedure Component($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") diff --git a/base/C4_Container.puml b/base/C4_Container.puml index 3a5e09d..f9e86ba 100644 --- a/base/C4_Container.puml +++ b/base/C4_Container.puml @@ -1,4 +1,9 @@ -!include C4_Context.puml +' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4_Context.puml +!else + !include C4_Context.puml +!endif ' Scope: A single software system. ' Primary elements: Containers within the software system in scope. @@ -18,6 +23,8 @@ UpdateElementStyle("container", $CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $CONTAINER_BORDER_COLOR) UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR) +UpdateBoundaryStyle("container", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="Container") + ' shortcuts with default colors !unquoted procedure AddContainerTag($tagStereo, $bgColor=$CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) @@ -26,10 +33,14 @@ UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_ AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) !endprocedure +!unquoted procedure UpdateContainerBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="Container", $legendText="") + UpdateBoundaryStyle("container", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText) +!endprocedure + ' Layout ' ################################## -SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container") +SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary") !procedure LAYOUT_WITH_LEGEND() hide stereotype @@ -48,18 +59,18 @@ endlegend ' ################################## !function $getContainer($label, $techn, $descr, $sprite) -!if ($descr == "") && ($sprite == "") -!return '=='+$label+'\n//['+$techn+']//' -!endif -!if ($descr == "") && ($sprite != "") -!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//' -!endif -!if ($descr != "") && ($sprite == "") -!return '=='+$label+'\n//['+$techn+']//\n\n '+$descr -!endif -!if ($descr != "") && ($sprite != "") -!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//\n\n '+$descr -!endif + !$container = "" + !if ($sprite != "") + !$container = $container + $getSprite($sprite) + '\n' + !endif + !$container = $container + '==' + $label + !if ($techn != "") + !$container = $container + '\n//[' + $techn + ']//' + !endif + !if ($descr != "") + !$container = $container + '\n\n' + $descr + !endif + !return $container !endfunction !unquoted procedure Container($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") @@ -102,5 +113,11 @@ queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("ex ' ################################## !unquoted procedure Container_Boundary($alias, $label, $tags="", $link="") -Boundary($alias, $label, "Container", $tags, $link) + !if ($tags != "") + !$allTags = $tags + '+container' + !else + !$allTags = 'container' + !endif + ' $type defined via $tag style + Boundary($alias, $label, "", $allTags, $link) !endprocedure diff --git a/base/C4_Context.puml b/base/C4_Context.puml index ac8e7c4..8781b7c 100644 --- a/base/C4_Context.puml +++ b/base/C4_Context.puml @@ -1,4 +1,9 @@ -!include C4.puml +' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4.puml +!else + !include C4.puml +!endif ' Scope: A single software system. ' Primary elements: The software system in scope. @@ -25,6 +30,9 @@ UpdateElementStyle("external_person", $EXTERNAL_PERSON_BG_COLOR, $ELEMENT_FONT_C UpdateElementStyle("system", $SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $SYSTEM_BORDER_COLOR) UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR) +UpdateBoundaryStyle("enterprise", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="Enterprise") +UpdateBoundaryStyle("system", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="System") + ' shortcuts with default colors !unquoted procedure AddPersonTag($tagStereo, $bgColor=$PERSON_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$PERSON_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) @@ -39,6 +47,13 @@ UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_C AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) !endprocedure +!unquoted procedure UpdateEnterpriseBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="Enterprise", $legendText="") + UpdateBoundaryStyle("enterprise", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText) +!endprocedure +!unquoted procedure UpdateSystemBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="System", $legendText="") + UpdateBoundaryStyle("system", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText) +!endprocedure + ' Sprites ' ################################## @@ -147,7 +162,7 @@ sprite $person2 [48x48/16] { ' Layout ' ################################## -SetDefaultLegendEntries("person\nsystem\nexternal_person\nexternal_system") +SetDefaultLegendEntries("person\nsystem\nexternal_person\nexternal_system\nenterprise_boundary\nsystem_boundary\nboundary") !procedure LAYOUT_WITH_LEGEND() hide stereotype @@ -279,9 +294,21 @@ queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_syst ' ################################## !unquoted procedure Enterprise_Boundary($alias, $label, $tags="", $link="") -Boundary($alias, $label, "Enterprise", $tags, $link) + !if ($tags != "") + !$allTags = $tags + '+enterprise' + !else + !$allTags = 'enterprise' + !endif + ' $type defined via $tag style + Boundary($alias, $label, "", $allTags, $link) !endprocedure !unquoted procedure System_Boundary($alias, $label, $tags="", $link="") -Boundary($alias, $label, "System", $tags, $link) + !if ($tags != "") + !$allTags = $tags + '+system' + !else + !$allTags = 'system' + !endif + ' $type defined via $tag style + Boundary($alias, $label, "", $allTags, $link) !endprocedure diff --git a/base/C4_Deployment.puml b/base/C4_Deployment.puml index 4243cd5..f3dd6db 100644 --- a/base/C4_Deployment.puml +++ b/base/C4_Deployment.puml @@ -1,4 +1,9 @@ -!include C4_Container.puml +' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml +!else + !include C4_Container.puml +!endif ' Colors ' ################################## @@ -25,7 +30,7 @@ skinparam rectangle<> { ' ################################## ' comment if node should not be added to legend. No calculated legend extension required -SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nnode") +SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nnode\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary") ' Line breaks ' ################################## diff --git a/base/C4_Dynamic.puml b/base/C4_Dynamic.puml index 8f4aeec..4b22212 100644 --- a/base/C4_Dynamic.puml +++ b/base/C4_Dynamic.puml @@ -1,4 +1,9 @@ -!include C4_Component.puml +' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4_Component.puml +!else + !include C4_Component.puml +!endif ' Scope: Interactions in an enterprise, software system or container. ' Primary and supporting elements: Depends on the diagram scope - diff --git a/readme.md b/readme.md index bd6a5bf..8491a55 100644 --- a/readme.md +++ b/readme.md @@ -108,8 +108,18 @@ The script will try to install all the dependencies if not present but there mig ## Usage -1. Start with [C4](https://c4model.com/) diagrams using PlantUML. Follow the examples [Context](context.puml), [Container](container.puml) and [Component](component.puml) in this repo. +1. Start with [C4](https://c4model.com/) diagrams using PlantUML. Run the PlantUML server using `docker run --name plantuml -d -p 8089:8080 plantuml/plantuml-server:latest`. Follow the examples [Context](context.puml), [Container](container.puml) and [Component](component.puml) in this repo. Also check out the [samples](https://github.com/plantuml-stdlib/C4-PlantUML/tree/master/samples) in [C4-PlantUML](https://github.com/plantuml-stdlib/C4-PlantUML). Sync with that repo using: + + ```bash + git clone https://github.com/plantuml-stdlib/C4-PlantUML ~/C4-PlantUML + cp ~/C4-PlantUML/*.puml ./base + cp -r ~/C4-PlantUML/.vscode . + grep -rl '' | xargs -d '\n' sed -i 's/https:\/\/raw.githubusercontent.com\/plantuml-stdlib\/C4-PlantUML\/master\///g' + ``` + - To preview the diagrams : Open [VS Code Command Pallette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and Select `PlantUML : Preview current diagram` + - To generate images using scripts, download plantuml jar file from [github](https://github.com/plantuml/plantuml/releases) and use `java -Dplantuml.include.path='base' -jar plantuml.jar ...`, see [documentation](https://plantuml.com/command-line) for details. + 3. End with system diagrams using [Diagrams](https://diagrams.mingrammer.com/). Follow the example [diagram](diagram.ipynb) in this repo. - To preview simply `Run All` the Jupyter notebook from top toolbar diff --git a/setup-macos.sh b/setup-macos.sh index 009637c..ee2455d 100644 --- a/setup-macos.sh +++ b/setup-macos.sh @@ -31,9 +31,9 @@ then exit fi -# run plantuml server -echo "docker run plantuml-server" -docker run -d -p 8089:8080 plantuml/plantuml-server:jetty +# pull plantuml server +echo "docker pull plantuml-server" +docker pull plantuml/plantuml-server:latest # install graphviz echo "install graphviz" From d26d9e40b940836a3276d9e253ac5077fb20a3c1 Mon Sep 17 00:00:00 2001 From: Nafiur Rahman Khadem Date: Sun, 18 Sep 2022 21:41:01 +0600 Subject: [PATCH 2/2] Import C4 from stdlib instead of copying source --- .vscode/settings.json | 1 - Container.puml | 4 +- Context.puml | 4 +- base/C4.puml | 1272 --------------------------------------- base/C4_Component.puml | 109 ---- base/C4_Container.puml | 123 ---- base/C4_Context.puml | 314 ---------- base/C4_Deployment.puml | 169 ------ base/C4_Dynamic.puml | 146 ----- readme.md | 13 +- 10 files changed, 7 insertions(+), 2148 deletions(-) delete mode 100644 base/C4.puml delete mode 100644 base/C4_Component.puml delete mode 100644 base/C4_Container.puml delete mode 100644 base/C4_Context.puml delete mode 100644 base/C4_Deployment.puml delete mode 100644 base/C4_Dynamic.puml diff --git a/.vscode/settings.json b/.vscode/settings.json index 7233980..c1c895a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,4 @@ { "plantuml.server": "http://localhost:8089", "plantuml.render": "PlantUMLServer", - "plantuml.diagramsRoot": "base", } \ No newline at end of file diff --git a/Container.puml b/Container.puml index c6bdcae..369d339 100644 --- a/Container.puml +++ b/Container.puml @@ -1,5 +1,5 @@ @startuml Visa Card To Wallet - Middleware -!include C4_Container.puml +!include System(mobileAppRef, "Customer App") System(fintechRef, "Fintech") @@ -19,4 +19,4 @@ BiRel(apiRef, dbRef, "Read/Write", "SDK") Rel(apiRef, cacheRef, "Read", "SDK") Rel(apiRef, logsRef, "Write", "SDK") Rel(visaRef, apiRef, "Transaction Response", "WebHook") -@enduml \ No newline at end of file +@enduml diff --git a/Context.puml b/Context.puml index c66700c..3f639e7 100644 --- a/Context.puml +++ b/Context.puml @@ -1,5 +1,5 @@ @startuml Visa Card To Wallet - System -!include C4_Context.puml +!include Person(customerRef, "Customer") System(mainRef, "Mainframe") @@ -9,4 +9,4 @@ Rel(customerRef, mainRef, "Requests Top-up from Visa Card") Rel(mainRef, visaRef, "Redirects Customer to Visa Gateway") Rel(visaRef, mainRef, "Saves Transaction Data") Rel(mainRef, customerRef, "Result") -@enduml \ No newline at end of file +@enduml diff --git a/base/C4.puml b/base/C4.puml deleted file mode 100644 index e7cead3..0000000 --- a/base/C4.puml +++ /dev/null @@ -1,1272 +0,0 @@ -' C4-PlantUML - -'Version -' ################################## -!function C4Version() - !return "2.5.0beta1" -!end function - -!procedure C4VersionDetails() -rectangle C4VersionDetailsArea <> [ -| PlantUML | **%version()** | -| C4-PlantUML | **C4Version()** | -] -!end procedure - -' Colors -' ################################## - -!global $ELEMENT_FONT_COLOR = "#FFFFFF" - -!global $ARROW_COLOR = "#666666" - -!global $BOUNDARY_COLOR = "#444444" -!global $BOUNDARY_BG_COLOR = "transparent" - -!global $LEGEND_FONT_COLOR = "#FFFFFF" -!global $LEGEND_TITLE_COLOR = "#000000" -' %darken(darkkhaki,50), #khaki -!global $LEGEND_DARK_COLOR = "#66622E" -!global $LEGEND_LIGHT_COLOR = "#khaki" - -!global $SKETCH_BG_COLOR = "#EEEBDC" -!global $SKETCH_FONT_COLOR = "" -!global $SKETCH_WARNING_COLOR = "red" -!global $SKETCH_FONT_NAME = "Comic Sans MS" - -' Labels -' ################################## - -!global $LEGEND_SHADOW_TEXT = "(shadow) " -!global $LEGEND_NO_SHADOW_TEXT = "(no shadow) " -!global $LEGEND_NO_FONT_BG_TEXT = "(no text, no back color) " -!global $LEGEND_NO_FONT_TEXT = "(no text color) " -!global $LEGEND_NO_BG_TEXT = "(no back color) " -!global $LEGEND_NO_LINE_TEXT = "(no line color) " -!global $LEGEND_ROUNDED_BOX = "(rounded box) " -!global $LEGEND_EIGHT_SIDED = "(eight sided) " -!global $LEGEND_DOTTED_LINE = "(dotted) " -!global $LEGEND_DASHED_LINE = "(dashed) " -!global $LEGEND_BOLD_LINE = "(bold) " -!global $LEGEND_DASHED_BOUNDARY = "boundary (dashed) " -!global $LEGEND_DASHED_TRANSPARENT_BOUNDARY = "boundary (dashed, transparent) " - -!global $SKETCH_FOOTER_WARNING = "Warning:" -!global $SKETCH_FOOTER_TEXT = "Created for discussion, needs to be validated" - -' Styling -' ################################## - -!global $TECHN_FONT_SIZE = 12 -!global $ROUNDED_BOX_SIZE = 25 -!global $EIGHT_SIDED_SIZE = 18 - -!global $ROUNDED_BOX = "roundedBox" -!global $EIGHT_SIDED = "eightSided" - -!global $DOTTED_LINE = "dotted" -!global $DASHED_LINE = "dashed" -!global $BOLD_LINE = "bold" - -skinparam defaultTextAlignment center - -skinparam wrapWidth 200 -skinparam maxMessageSize 150 - -skinparam LegendBorderColor transparent -skinparam LegendBackgroundColor transparent -skinparam LegendFontColor $LEGEND_FONT_COLOR - -skinparam shadowing<> false -' #00000000 is transparent -skinparam rectangle<> { - backgroundcolor #00000000 - bordercolor #00000000 -} - -skinparam rectangle { - StereotypeFontSize 12 - shadowing false -} - -skinparam database { - StereotypeFontSize 12 - shadowing false -} - -skinparam queue { - StereotypeFontSize 12 - shadowing false -} - -skinparam arrow { - Color $ARROW_COLOR - FontColor $ARROW_COLOR - FontSize 12 -} - -skinparam actor { - StereotypeFontSize 12 - shadowing false - style awesome -} - -skinparam person { - StereotypeFontSize 12 - shadowing false -} - -' Some boundary skinparams have to be set as package skinparams too (PlantUML uses internal packages) -' UpdateBoundaryStyle() called in boundary section below -skinparam rectangle<> { - Shadowing false - StereotypeFontSize 6 - StereotypeFontColor $BOUNDARY_BG_COLOR - BorderStyle dashed -} - -skinparam package { - StereotypeFontSize 6 - StereotypeFontColor $BOUNDARY_BG_COLOR - FontStyle plain - BackgroundColor $BOUNDARY_BG_COLOR -} - -' Legend and Tags -' ################################## -!global $tagDefaultLegend = "" -!global $tagCustomLegend = "" - -' rel specific -!unquoted function $toStereos($tags) - !if (%strlen($tags) == 0) - !return '' - !endif - !$stereos = '' - !$brPos = %strpos($tags, "+") - !while ($brPos >= 0) - !$tag = %substr($tags, 0, $brPos) - !$stereos = $stereos + '<<' + $tag + '>>' -%set_variable_value("$" + $tag + "_LineLegend", %true()) - !$tags = %substr($tags, $brPos+1) - !$brPos = %strpos($tags, "+") - !endwhile - !if (%strlen($tags) > 0) - !$stereos = $stereos + '<<' + $tags + '>>' -%set_variable_value("$" + $tags + "_LineLegend", %true()) - !endif - !return $stereos -!endfunction - -' if $sprite/$techn is an empty argument, try to calculate it via the defined $tag -!unquoted function $toRelArg($arg, $tags, $varPostfix) - !if ($arg > "") - !return $arg - !endif - - !if (%strlen($tags) == 0) - !return $arg - !endif - !$brPos = %strpos($tags, "+") - !while ($brPos >= 0) - !$tag = %substr($tags, 0, $brPos) - !$newArg = %get_variable_value("$" + $tag + $varPostfix) - !if ($newArg > "") - !return $newArg - !endif - !$tags = %substr($tags, $brPos+1) - !$brPos = %strpos($tags, "+") - !endwhile - !if (%strlen($tags) > 0) - !$newArg = %get_variable_value("$" + $tags + $varPostfix) - !if ($newArg > "") - !return $newArg - !endif - !endif - !return $arg -!endfunction - -' element specific (unused are hidden based on mask) -!unquoted function $toStereos($elementType, $tags) - !if (%strlen($tags) == 0) - !$stereos = '<<' + $elementType + '>>' -%set_variable_value("$" + $elementType + "Legend", %true()) - !return $stereos - !endif - !$stereos = '' - !$mask = $resetMask() - !$brPos = %strpos($tags, "+") - !while ($brPos >= 0) - !$tag = %substr($tags, 0, $brPos) - !$stereos = $stereos + '<<' + $tag + '>>' - !$mergedMask = $combineMaskWithTag($mask, $tag) - !if ($mergedMask != $mask) -%set_variable_value("$" + $tag + "Legend", %true()) - !$mask = $mergedMask - !endif - !$tags = %substr($tags, $brPos+1) - !$brPos = %strpos($tags, "+") - !endwhile - !if (%strlen($tags) > 0) - !$stereos = $stereos + '<<' + $tags + '>>' - !$mergedMask = $combineMaskWithTag($mask, $tags) - !if ($mergedMask != $mask) -%set_variable_value("$" + $tags + "Legend", %true()) - !$mask = $mergedMask - !endif - !endif - ' has to be last, otherwise PlantUML overwrites all tag specific skinparams - !$stereos = $stereos + '<<' + $elementType + '>>' - !$mergedMask = $combineMaskWithTag($mask, $elementType) - !if ($mergedMask != $mask) -%set_variable_value("$" + $elementType + "Legend", %true()) - !$mask = $mergedMask - !endif - !return $stereos -!endfunction - -' if $sprite/$techn is an empty argument, try to calculate it via the defined $tag -!unquoted function $toElementArg($arg, $tags, $varPostfix, $elementType) - !if ($arg > "") - !return $arg - !endif - - !if (%strlen($tags) == 0) - !$newArg = %get_variable_value("$" + $elementType + $varPostfix) - !if ($newArg > "") - !return $newArg - !else - !return $arg - !endif - !endif - !$brPos = %strpos($tags, "+") - !while ($brPos >= 0) - !$tag = %substr($tags, 0, $brPos) - !$newArg = %get_variable_value("$" + $tag + $varPostfix) - !if ($newArg > "") - !return $newArg - !endif - !$tags = %substr($tags, $brPos+1) - !$brPos = %strpos($tags, "+") - !endwhile - !if (%strlen($tags) > 0) - !$newArg = %get_variable_value("$" + $tags + $varPostfix) - !if ($newArg > "") - !return $newArg - !endif - !$newArg = %get_variable_value("$" + $elementType + $varPostfix) - !if ($newArg > "") - !return $newArg - !endif - !endif - !return $arg -!endfunction - -!function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - !$elementSkin = "skinparam " + $element + "<<" + $tagStereo + ">> {" + %newline() - !if ($fontColor != "") - !if (%strpos($tagStereo, "boundary") < 0) - !$elementSkin = $elementSkin + " StereotypeFontColor " + $fontColor + %newline() - !endif - !$elementSkin = $elementSkin + " FontColor " + $fontColor + %newline() - !endif - !if ($bgColor != "") - !$elementSkin = $elementSkin + " BackgroundColor " + $bgColor + %newline() - !endif - !if ($borderColor != "") - !$elementSkin = $elementSkin + " BorderColor " + $borderColor+ %newline() - !endif - !if ($shadowing == "true") - !$elementSkin = $elementSkin + " Shadowing<<" + $tagStereo + ">> " + "true" + %newline() - !endif - !if ($shadowing == "false") - !$elementSkin = $elementSkin + " Shadowing<<" + $tagStereo + ">> " + "false" + %newline() - !endif - ' only rectangle supports shape(d corners), define both skinparam that overlays are working - !if ($shape != "" && $element == "rectangle") - !if ($shape == $ROUNDED_BOX) - !$elementSkin = $elementSkin + " RoundCorner " + $ROUNDED_BOX_SIZE+ %newline() - !$elementSkin = $elementSkin + " DiagonalCorner " + "0" + %newline() - !elseif ($shape == $EIGHT_SIDED) - !$elementSkin = $elementSkin + " RoundCorner " + "0" + %newline() - !$elementSkin = $elementSkin + " DiagonalCorner " + $EIGHT_SIDED_SIZE+ %newline() - !endif - !endif - !$elementSkin = $elementSkin + "}" + %newline() - !return $elementSkin -!endfunction - -!unquoted procedure $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - ' only rectangle supports shape(d corners) - !$tagSkin = $elementTagSkinparams("rectangle", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - !$tagSkin = $tagSkin + $elementTagSkinparams("database", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, "") - !$tagSkin = $tagSkin + $elementTagSkinparams("queue", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, "") - ' actor has style awesome, therefore $fontColor is ignored and text uses $bgColor too - !$tagSkin = $tagSkin + $elementTagSkinparams("actor", $tagStereo, $bgColor, $bgColor, $borderColor, $shadowing, "") - !$tagSkin = $tagSkin + $elementTagSkinparams("person", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, "") - !if (%strpos($tagStereo, "boundary") >= 0 && $bgColor != "") - !$tagSkin = $tagSkin + "skinparam package<<" + $tagStereo + ">>StereotypeFontColor " + $bgColor + %newline() - !$tagSkin = $tagSkin + "skinparam rectangle<<" + $tagStereo + ">>StereotypeFontColor " + $bgColor + %newline() - !endif -$tagSkin -!endprocedure - -' arrow colors cannot start with # (legend background has to start with #) -!function $colorWithoutHash($c) - !if (%substr($c, 0, 1) == "#") - !$c = %substr($c,1) - !endif - !return $c -!endfunction - -!unquoted procedure $defineRelSkinparams($tagStereo, $textColor, $lineColor, $lineStyle) - !$elementSkin = "skinparam arrow<<" + $tagStereo + ">> {" + %newline() - !$elementSkin = $elementSkin + " Color " - !if ($lineColor != "") - !$elementSkin = $elementSkin + $colorWithoutHash($lineColor) - !endif - !if ($textColor != "") - !$elementSkin = $elementSkin + ";text:" + $colorWithoutHash($textColor) - !endif - !if ($lineStyle != "") - !$elementSkin = $elementSkin + ";line." + $lineStyle - !endif - !$elementSkin = $elementSkin + %newline() - !$elementSkin = $elementSkin + "}" + %newline() -$elementSkin -!endprocedure - -' %is_dark() requires PlantUML version >= 1.2021.6 -!if (%function_exists("%is_dark")) - !$PlantUMLSupportsDynamicLegendColor = %true() -!else - !$PlantUMLSupportsDynamicLegendColor = %false() - !log "dynamic undefined legend colors" requires PlantUML version >= 1.2021.6, therefore only static assigned colors are used -!endif - -!unquoted function $contrastLegend($color) - !if (%is_dark($color)) - !$value = $LEGEND_LIGHT_COLOR - !else - !$value = $LEGEND_DARK_COLOR - !endif - !return $value -!endfunction - -!unquoted function $flatLegend($color) - !if (%is_dark($color)) - !$value = $LEGEND_DARK_COLOR - !else - !$value = $LEGEND_LIGHT_COLOR - !endif - !return $value -!endfunction - -' legend background has to start with # -!function $colorWithHash($c) - !if (%substr($c, 0, 1) != "#") - !$c = "#" + $c - !endif - !return $c -!endfunction - -!function $addMaskFlag($mask, $attr) - !if ($attr == "") - !$mask = $mask + "0" - !else - !$mask = $mask + "1" - !endif - !return $mask -!endfunction - -!function $orFlags($flag1, $flag2) - !if ($flag1 == "0" && $flag2 == "0") - !return "0" - !endif - !return "1" -!endfunction - -!function $tagLegendMask($bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite) - !$mask = "" - !$mask = $addMaskFlag($mask, $bgColor) - !$mask = $addMaskFlag($mask, $fontColor) - !$mask = $addMaskFlag($mask, $borderColor) - !$mask = $addMaskFlag($mask, $shadowing) - !$mask = $addMaskFlag($mask, $shape) - !$mask = $addMaskFlag($mask, $sprite) - !return $mask -!endfunction - -!function $resetMask() - !return "000000" -!endfunction - -!function $combineMasks($mask1, $mask2) - !$mask = "" - !$mask = $mask + $orFlags(%substr($mask1, 0, 1), %substr($mask2, 0, 1)) - !$mask = $mask + $orFlags(%substr($mask1, 1, 1), %substr($mask2, 1, 1)) - !$mask = $mask + $orFlags(%substr($mask1, 2, 1), %substr($mask2, 2, 1)) - !$mask = $mask + $orFlags(%substr($mask1, 3, 1), %substr($mask2, 3, 1)) - !$mask = $mask + $orFlags(%substr($mask1, 4, 1), %substr($mask2, 4, 1)) - !$mask = $mask + $orFlags(%substr($mask1, 5, 1), %substr($mask2, 5, 1)) - !return $mask -!endfunction - -!function $combineMaskWithTag($mask1, $tag) - !$mask2 = %get_variable_value("$" + $tag+ "LegendMask") - !if ($mask2 == "") - ' !log combineMaskWithTag $mask1, $tag, ... only $mask1 - !return $mask1 - !endif - - ' !log combineMaskWithTag $mask1, $tag, $mask2 ... $combineMasks($mask1, $mask2) - !return $combineMasks($mask1, $mask2) -!endfunction - -' element symbols typically 4 times too big in legend -!function $smallVersionSprite($sprite) - ' ,scale= ... has to be first (...,color=black,scale=0.25... is invalid too) - !if (%strpos($sprite, "=") < 0) - !if (%substr($sprite, 0, 4) == "img:") - !$smallSprite = $sprite + "{scale=0.25}" - !else - !$smallSprite = $sprite + ",scale=0.25" - !endif - !else - !$smallSprite = $sprite - !endif - !return $smallSprite -!endfunction - -' format sprite that it can be used in diagram -!function $getSprite($sprite) - ' if it starts with & it's a OpenIconic, details see https://useiconic.com/open/ - ' if it starts with img: it's an image, details see https://plantuml.com/creole - !if (%substr($sprite, 0, 1) != "&" && %substr($sprite, 0, 4) != "img:") - !$formatted = "<$" + $sprite + ">" - !else - !$formatted = "<" + $sprite + ">" - !endif - !return $formatted -!endfunction - -!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) - !$bg = $bgColor - !$fo = $fontColor - !$bo = $borderColor - - !if ($fo == "") - !if ($bg != "") -!if ($PlantUMLSupportsDynamicLegendColor) - !$fo = $contrastLegend($bg) -!else - !$fo = $LEGEND_DARK_COLOR -!endif - !else - !if ($bo == "") - !$fo = $LEGEND_DARK_COLOR - !$bg = $LEGEND_LIGHT_COLOR - !else -!if ($PlantUMLSupportsDynamicLegendColor) - !$fo = $flatLegend($bo) - !$bg = $contrastLegend($bo) -!else - !$fo = $LEGEND_DARK_COLOR - !$bg = $LEGEND_LIGHT_COLOR -!endif - !endif - !endif - !else - !if ($bg == "") -!if ($PlantUMLSupportsDynamicLegendColor) - !$bg = $contrastLegend($fo) -!else - !$bg = $LEGEND_LIGHT_COLOR -!endif - !endif - !endif - - !if ($bo == "") - !$bo = $bg - !endif - - !$tagEntry = "|" - !$tagEntry = $tagEntry + "<" + $colorWithHash($bg) +">" - ' ..white rectangle - !$tagEntry = $tagEntry + " " - !$tagEntry = $tagEntry + "" - !if ($legendSprite != "") - !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " - !endif - !if ($legendText == "") - !if ($tagStereo == "boundary") - !if ($bgColor == "#00000000" || %lower($bgColor) == "transparent") - !$tagEntry = $tagEntry + " " + $LEGEND_DASHED_TRANSPARENT_BOUNDARY - !else - !$tagEntry = $tagEntry + " " + $LEGEND_DASHED_BOUNDARY - !endif - !elseif (%strpos($tagStereo, "boundary") >= 0) - ' if contains/ends with _boundary remove _boundary and add "boundary (dashed)" - !$pos = %strpos($tagStereo, "_boundary") - !if ($pos > 0) - !$tagEntry = $tagEntry + " " + %substr($tagStereo, 0 ,$pos) - !if ($bgColor == "#00000000" || %lower($bgColor) == "transparent") - !$tagEntry = $tagEntry + " " + $LEGEND_DASHED_TRANSPARENT_BOUNDARY - !else - !$tagEntry = $tagEntry + " " + $LEGEND_DASHED_BOUNDARY - !endif - !endif - !else - !$tagEntry = $tagEntry + " " + $tagStereo + " " - !endif - !if ($shadowing == "true") - !$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT - !endif - !if ($shadowing == "false") - !$tagEntry = $tagEntry + $LEGEND_NO_SHADOW_TEXT - !endif - !if ($shape == $ROUNDED_BOX) - !$tagEntry = $tagEntry + $LEGEND_ROUNDED_BOX - !endif - !if ($shape == $EIGHT_SIDED) - !$tagEntry = $tagEntry + $LEGEND_EIGHT_SIDED - !endif - !if ($fontColor == "" && $bgColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_FONT_BG_TEXT - !else - !if ($fontColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT - !endif - !if ($bgColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_BG_TEXT - !endif - !endif - !else - !$tagEntry = $tagEntry + " " + $legendText + " " - !endif - - !$tagEntry = $tagEntry + " " - !$tagEntry = $tagEntry + "|" - !return $tagEntry -!endfunction - -!function $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) - !$tc = $textColor - !$lc = $lineColor - - !if ($tc == "") - !if ($PlantUMLSupportsDynamicLegendColor) - !$tc = $flatLegend($ARROW_COLOR) - !else - !$tc = $LEGEND_DARK_COLOR - !endif - !endif - !if ($lc == "") - !if ($PlantUMLSupportsDynamicLegendColor) - !$lc = $flatLegend($ARROW_COLOR) - !else - !$lc = $LEGEND_DARK_COLOR - !endif - !endif - - !$tagEntry = "|" - ' ..white line - !$tagEntry = $tagEntry + " " - !$tagEntry = $tagEntry + "" - !if ($legendSprite != "") - !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " - !endif - !if ($legendText == "") - !$tagEntry = $tagEntry + " " + $tagStereo + " " - !if ($textColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT - !endif - !if ($lineColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_LINE_TEXT - !endif - !if ($lineStyle != "") - !if ($lineStyle == $DOTTED_LINE) - !$tagEntry = $tagEntry + $LEGEND_DOTTED_LINE - !elseif ($lineStyle == $DASHED_LINE) - !$tagEntry = $tagEntry + $LEGEND_DASHED_LINE - !elseif ($lineStyle == $BOLD_LINE) - !$tagEntry = $tagEntry + $LEGEND_BOLD_LINE - !else - !$tagEntry = $tagEntry + "(" + $lineStyle + ") " - !endif - !endif - !else - !$tagEntry = $tagEntry + " " + $legendText + " " - !endif - - !$tagEntry = $tagEntry + " " - !$tagEntry = $tagEntry + "|" - !return $tagEntry -!endfunction - -!global $LEGEND_DOTTED_LINE = "(dotted) " -!global $LEGEND_DASHED_LINE = "(dashed) " -!global $LEGEND_BOLD_LINE = "(bold) " - -!unquoted procedure $addTagToLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $legendText="", $legendSprite="") -'' if a combined element tag is defined (e.g. "v1.0&v1.1") then it is typically a merged color, -'' like a new $fontColor="#fdae61" therefore it should be added to the legend -'' and the & combined tags will be not removed -' !if (%strpos($tagStereo, "&") < 0) - !$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) -%set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry) - !$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n" - !$tagMask = $tagLegendMask( $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite) -%set_variable_value("$" + $tagStereo + "LegendMask", $tagMask) -' !endif -!endprocedure - -!unquoted procedure $addRelTagToLegend($tagStereo, $textColor="", $lineColor="", $lineStyle="", $legendText="", $legendSprite="") -'' Arrows have a bug with stereotype/skinparams and cannot combine text colors of one stereotype -'' and the line color of another stereotype. Therefore the text color of one tag and the line color -'' of another tag have to be combined via a "workaround" tag ("v1.0&v1.1"). -'' This workaround tag could be theoretically removed in the legend but after that there would -'' be an inconsistency between the element tags and the rel tags and therefore -'' & combined workaround tags are not removed too (and in unlikely cases the color itself could be changed) -' !if (%strpos($tagStereo, "&") < 0) - !$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) -%set_variable_value("$" + $tagStereo + "_LineLegendEntry", $tagEntry) - !$tagCustomLegend = $tagCustomLegend + $tagStereo + "_Line\n" -' !endif -!endprocedure - -!procedure $showActiveLegendEntries($allDefined) - !$brPos = %strpos($allDefined, "\n") - !while ($brPos >= 0) - !$tagStereo = %substr($allDefined, 0, $brPos) - !$allDefined = %substr($allDefined, $brPos+2) - !$brPos = %strpos($allDefined, "\n") - !if (%variable_exists("$" + $tagStereo + "Legend")) -%get_variable_value("$" + $tagStereo + "LegendEntry") - !endif - !endwhile - !if (%strlen($allDefined) > 0) - !$tagStereo = $allDefined - !if (%variable_exists("$" + $tagStereo + "Legend")) -%get_variable_value("$" + $tagStereo + "LegendEntry") - !endif - !endif -!endprocedure - -!function RoundedBoxShape() -!return $ROUNDED_BOX -!endfunction - -!function EightSidedShape() -!return $EIGHT_SIDED -!endfunction - -!function DottedLine() -!return $DOTTED_LINE -!endfunction - -!function DashedLine() -!return $DASHED_LINE -!endfunction - -!function BoldLine() -!return $BOLD_LINE -!endfunction - -' used by new defined tags -!unquoted procedure AddElementTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") -$defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - !if ($sprite!="") -%set_variable_value("$" + $tagStereo + "ElementTagSprite", $sprite) - !if ($legendSprite == "") - !$legendSprite = $smallVersionSprite($sprite) - !endif - !endif - !if ($techn != "") -%set_variable_value("$" + $tagStereo + "ElementTagTechn", $techn) - !endif -$addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) -!endprocedure - -' used by new defined rel tags -!unquoted procedure AddRelTag($tagStereo, $textColor="", $lineColor="", $lineStyle = "", $sprite="", $techn="", $legendText="", $legendSprite="") -$defineRelSkinparams($tagStereo, $textColor, $lineColor, $lineStyle) - !if ($sprite != "") -%set_variable_value("$" + $tagStereo + "RelTagSprite", $sprite) - !if ($legendSprite == "") - ' relation symbols typically 1:1 no additional scale required - !$legendSprite = $sprite - !endif - !endif - !if ($techn != "") -%set_variable_value("$" + $tagStereo + "RelTagTechn", $techn) - !endif -$addRelTagToLegend($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) -!endprocedure - -' update the style of existing elements like person, ... -!unquoted procedure UpdateElementStyle($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") -$defineSkinparams($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - !if ($sprite != "") -%set_variable_value("$" + $elementName + "ElementTagSprite", $sprite) - !if ($legendSprite == "") - !$legendSprite = $smallVersionSprite($sprite) - !endif - !endif - !if ($techn != "") -%set_variable_value("$" + $elementName + "ElementTagTechn", $techn) - !endif - !$tagEntry = $tagLegendEntry($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) -%set_variable_value("$" + $elementName + "LegendEntry", $tagEntry) - ' default tags sets at least bgColor and fontColor - !$tagMask = $tagLegendMask("CHANGED", "CHANGED", $borderColor, $shadowing, $shape, $sprite) -%set_variable_value("$" + $elementName + "LegendMask", $tagMask) -!endprocedure - -/' @deprecated in favor of UpdateElementStyle '/ -!unquoted procedure UpdateSkinparamsAndLegendEntry($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="") -UpdateElementStyle($elementName, $bgColor, $fontColor, $borderColor, $shadowing) -!endprocedure - -' update the style of default relation, it has to set both properties (combined statement not working) -!unquoted procedure UpdateRelStyle($textColor, $lineColor) - !$elementSkin = "skinparam arrow {" + %newline() - !$elementSkin = $elementSkin + " Color " + $lineColor + %newline() - !$elementSkin = $elementSkin + " FontColor " + $textColor + %newline() - !$elementSkin = $elementSkin + "}" + %newline() -$elementSkin -!endprocedure - -' tags/stereotypes have to be delimited with \n -!unquoted procedure SetDefaultLegendEntries($tagStereoEntries) - !$tagDefaultLegend = $tagStereoEntries -!endprocedure - -' Links -' ################################## - -!function $getLink($link) - !if ($link != "") - !return "[[" + $link + "]]" - !else - !return "" - !endif -!endfunction - -' Line breaks -' ################################## - -' PlantUML supports no DETERMINISTIC/automatic line breaks of "PlantUML line" (C4 Relashionships) -' therefore Rel...() implements an automatic line break based on spaces (like in all other objects). -' If a $type contains \n then these are used (and no automatic space based line breaks are done) -' $REL_TECHN_MAX_CHAR_WIDTH defines the automatic line break position -!global $REL_TECHN_MAX_CHAR_WIDTH = 35 -!global $REL_DESCR_MAX_CHAR_WIDTH = 32 - -!unquoted function $breakDescr($descr, $widthStr) -!$width = %intval($widthStr) -!$multiLine = "" -!if (%strpos($descr, "\n") >= 0) -!else - !while (%strlen($descr) > $width) - !$brPos = $width - !while ($brPos > 0 && %substr($descr, $brPos, 1) != ' ') - !$brPos = $brPos - 1 - !endwhile - - !if ($brPos < 1) - !$brPos = %strpos($descr, " ") - !else - !endif - - !if ($brPos > 0) - !$multiLine = $multiLine + %substr($descr, 0, $brPos) + "\n" - !$descr = %substr($descr, $brPos + 1) - !else - !$multiLine = $multiLine+ $descr - !$descr = "" - !endif - !endwhile -!endif -!if (%strlen($descr) > 0) - !$multiLine = $multiLine + $descr -!endif -!return $multiLine -!endfunction - -' $breakTechn() supports //...//; $breakNode() in C4_Deployment supports no //....// -!unquoted function $breakTechn($techn, $widthStr) -!$width = %intval($widthStr) -!$multiLine = "" -!if (%strpos($techn, "\n") >= 0) - !while (%strpos($techn, "\n") >= 0) - !$brPos = %strpos($techn, "\n") - !$multiLine = $multiLine + %substr($techn, 0, $brPos) + '//\n//' - !$techn = %substr($techn, $brPos+2) - !endwhile -!else - !while (%strlen($techn) > $width) - !$brPos = $width - !while ($brPos > 0 && %substr($techn, $brPos, 1) != ' ') - !$brPos = $brPos - 1 - !endwhile - - !if ($brPos < 1) - !$brPos = %strpos($techn, " ") - !else - !endif - - !if ($brPos > 0) - !$multiLine = $multiLine + %substr($techn, 0, $brPos) + '//\n//' - !$techn = %substr($techn, $brPos + 1) - !else - !$multiLine = $multiLine+ $techn - !$techn = "" - !endif - !endwhile -!endif -!if (%strlen($techn) > 0) - !$multiLine = $multiLine + $techn -!endif -!return $multiLine -!endfunction - -' Element properties -' ################################## - -' collect all defined properties as table rows -!global $propTable = "" -!global $propTableCaption = "" -!global $propColCaption = "=" - -!unquoted function SetPropertyHeader($col1Name, $col2Name, $col3Name = "", $col4Name = "") - !$propColCaption = "" - !$propTableCaption = "|= " + $col1Name + " |= " + $col2Name + " |" - !if ($col3Name != "") - !$propTableCaption = $propTableCaption + "= " + $col3Name + " |" - !endif - !if ($col4Name != "") - !$propTableCaption = $propTableCaption + "= " + $col4Name + " |" - !endif - !return "" -!endfunction - -!unquoted function WithoutPropertyHeader() - !$propTableCaption = "" - !$propColCaption = "=" - !return "" -!endfunction - -!unquoted function AddProperty($col1, $col2, $col3 = "", $col4 = "") - !if ($propTable == "") - !if ($propTableCaption != "") - !$propTable = $propTableCaption + "\n" - !endif - !else - !$propTable = $propTable + "\n" - !endif - !$propTable = $propTable + "| " + $col1 + " |" + $propColCaption + " " + $col2 + " |" - !if ($col3 != "") - !$propTable = $propTable + " " + $col3 + " |" - !endif - !if ($col4 != "") - !$propTable = $propTable + " " + $col4 + " |" - !endif - !return "" -!endfunction - -!unquoted function $getProps($alignedNL = "\n") - !if ($propTable != "") - !$retTable = $alignedNL + $propTable - !$propTable = "" - !return $retTable - !endif - !return "" -!endfunction - -!unquoted function $getProps_L() - !return $getProps("\l") -!endfunction - -!unquoted function $getProps_R() - !return $getProps("\r") -!endfunction - -SetPropertyHeader("Property","Value") - -' Layout -' ################################## - -!procedure $getHideStereotype($hideStereotype) -!if ($hideStereotype == "true") -hide stereotype -!endif -!endprocedure - -!procedure $getLegendTable() -<#00000000,#00000000>|**Legend** | -$showActiveLegendEntries($tagDefaultLegend) -$showActiveLegendEntries($tagCustomLegend) -!endprocedure - -!procedure $getLegendArea($areaAlias, $hideStereotype) -$getHideStereotype($hideStereotype) -rectangle $areaAlias<> [ -$getLegendTable() -] -!endprocedure - -!procedure HIDE_STEREOTYPE() -hide stereotype -!endprocedure - -!unquoted procedure SET_SKETCH_STYLE($bgColor="_dont_change_", $fontColor="_dont_change_", $warningColor="_dont_change_", $fontName="_dont_change_", $footerWarning="_dont_change_", $footerText="_dont_change_") -!if $bgColor != "_dont_change_" - !global $SKETCH_BG_COLOR = $bgColor -!endif -!if $fontColor != "_dont_change_" - !global $SKETCH_FONT_COLOR = $fontColor -!endif -!if $warningColor != "_dont_change_" - !global $SKETCH_WARNING_COLOR = $warningColor -!endif -!if $fontName != "_dont_change_" - !global $SKETCH_FONT_NAME = $fontName -!endif -!if $footerWarning != "_dont_change_" - !global $SKETCH_FOOTER_WARNING = $footerWarning -!endif -!if $footerText != "_dont_change_" - !global $SKETCH_FOOTER_TEXT = $footerText -!endif -!endprocedure - -!procedure LAYOUT_AS_SKETCH() - skinparam handwritten true -!if $SKETCH_BG_COLOR > "" - skinparam backgroundColor $SKETCH_BG_COLOR -!endif -!if $SKETCH_FONT_COLOR > "" - skinparam footer { - FontColor $SKETCH_FONT_COLOR - } - !if $ARROW_COLOR == "#666666" - !global $ARROW_COLOR = $SKETCH_FONT_COLOR - skinparam arrow { - Color $ARROW_COLOR - FontColor $ARROW_COLOR - } - !endif - !if $BOUNDARY_COLOR == "#444444" - !global $BOUNDARY_COLOR = $SKETCH_FONT_COLOR - skinparam rectangle<> { - FontColor $BOUNDARY_COLOR - BorderColor $BOUNDARY_COLOR - } - !endif -!endif -!if $SKETCH_FONT_NAMES > "" - skinparam defaultFontName $SKETCH_FONT_NAME -!endif -!if $SKETCH_FOOTER_WARNING > "" || $SKETCH_FOOTER_TEXT > "" - !$line = "footer "+ $SKETCH_FOOTER_WARNING + " " + $SKETCH_FOOTER_TEXT - $line -!endif -!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() -!global $fix_direction = %false() -left to right direction -!endprocedure - -!procedure LAYOUT_LANDSCAPE() -!global $fix_direction = %true() -left to right direction -!endprocedure - -' has to be last call in diagram -!unquoted procedure SHOW_LEGEND($hideStereotype="true") -$getHideStereotype($hideStereotype) -legend right -$getLegendTable() -endlegend -!endprocedure - -/' @deprecated in favor of SHOW_LEGEND '/ -!unquoted procedure SHOW_DYNAMIC_LEGEND($hideStereotype="true") -SHOW_LEGEND($hideStereotype) -!endprocedure - -' legend is reserved and cannot be uses as alias of SHOW_FLOATING_LEGEND() therefore -' LEGEND() is introduced. It returns the default name of the floating alias "floating_legend_alias" -' and can be used in the Lay_Distance() calls -!function LEGEND() -!return "floating_legend_alias" -!endfunction - -' enables that legend can be located in drawing area of the diagram. It has to be last call in diagram followed by Lay_Distance() -!unquoted procedure SHOW_FLOATING_LEGEND($alias=LEGEND(), $hideStereotype="true") -$getLegendArea($alias, $hideStereotype) -!endprocedure - -' Boundaries -' ################################## - -!unquoted procedure UpdateBoundaryStyle($elementName="", $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $type="", $legendText="") - !if ($elementName != "") - !$elementBoundary = $elementName + '_boundary' - UpdateElementStyle($elementBoundary, $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "") - !else - UpdateElementStyle("boundary", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "") - ' simulate color inheritance - UpdateBoundaryStyle("enterprise", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "Enterprise", "") - UpdateBoundaryStyle("system", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "System", "") - UpdateBoundaryStyle("container", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "Container", "") - !endif -!endprocedure - -!unquoted procedure AddBoundaryTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $type="", $legendText="") - !$tagBoundary = $tagStereo + '_boundary' - AddElementTag($tagBoundary, $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "") -!endprocedure - -' add _boundary to all tags that short tag version can be used -!unquoted function $addBoundaryPostfix($tags) - !if (%strlen($tags) == 0) - !return '' - !endif - !$boundaryTags = '' - !$brPos = %strpos($tags, "+") - !while ($brPos >= 0) - !$tag = %substr($tags, 0, $brPos) - !$boundaryTags = $boundaryTags + $tag + '_boundary+' - !$tags = %substr($tags, $brPos+1) - !$brPos = %strpos($tags, "+") - !endwhile - !if (%strlen($tags) > 0) - !$boundaryTags = $boundaryTags + $tags + '_boundary' - !endif - !return $boundaryTags -!endfunction - -!function $getBoundary($label, $type) - !if ($type == "") - !return '==' + $label - !endif - !if (type != "") - !return '==' + $label + '\n[' + $type + ']' - !endif -!endfunction - -!unquoted procedure Boundary($alias, $label, $type="", $tags="", $link="") -!$boundaryTags = $addBoundaryPostfix($tags) -' nodes $type reuses $techn definition of $boundaryTags -!$type=$toElementArg($type, $boundaryTags, "ElementTagTechn", "boundary") -rectangle "$getBoundary($label, $type)" $toStereos("boundary", $boundaryTags) as $alias $getLink($link) -!endprocedure - -' Boundary Styling -UpdateBoundaryStyle("", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR) - -' Relationship -' ################################## - -!function $getRel($direction, $alias1, $alias2, $label, $techn, $descr, $sprite, $tags, $link) - !$sprite = $toRelArg($sprite, $tags, "RelTagSprite") - !$techn = $toRelArg($techn, $tags, "RelTagTechn") - !$rel = $alias1 + ' ' + $direction + ' ' + $alias2 - !if ($tags != "") - !$rel = $rel + ' ' + $toStereos($tags) - !endif - !$rel = $rel + ' : ' - !if ($sprite != "") - !$rel = $rel + $getSprite($sprite) + ' ' - !endif - !if ($link != "") - !$rel = $rel + '**[[' + $link + ' ' + $label + ']]**' - !else - !$rel = $rel + '**' + $label + '**' - !endif - !if ($techn != "") - ' line break is not deterministic, calculate it - !$rel = $rel + '\n//[' + $breakTechn($techn, $REL_TECHN_MAX_CHAR_WIDTH) + ']//' - !endif - !if ($descr != "") - ' line break is not deterministic, calculate it - !$rel = $rel + '\n\n' + $breakDescr($descr, $REL_DESCR_MAX_CHAR_WIDTH) - !endif - !$prop = $getProps() - !if ($prop != "") - ' reuse table - !$rel = $rel + $prop - !endif - !return $rel -!endfunction - -!unquoted procedure Rel_($alias1, $alias2, $label, $direction) -$alias1 $direction $alias2 : **$label** -!endprocedure -!unquoted procedure Rel_($alias1, $alias2, $label, $techn, $direction) -$alias1 $direction $alias2 : **$label**\n//[$techn]// -!endprocedure - -!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure BiRel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<--", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure BiRel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$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) -!endprocedure -!unquoted procedure Rel_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) -!endprocedure -!unquoted procedure BiRel_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) -!endprocedure -!unquoted procedure Rel_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) -!endprocedure -!unquoted procedure BiRel_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) -!endprocedure -!unquoted procedure Rel_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) -!endprocedure -!unquoted procedure BiRel_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) -!endprocedure -!unquoted procedure Rel_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) -!endprocedure -!unquoted procedure BiRel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($right("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -' Layout Helpers -' ################################## - -!function $getHiddenLine($distance) - !return '-[hidden]' + %substr('------------', 0, %intval($distance) + 1) -!endfunction - -!unquoted procedure Lay_D($from, $to) -$from -[hidden]D- $to -!endprocedure -!unquoted procedure Lay_Down($from, $to) -$from -[hidden]D- $to -!endprocedure - -!unquoted procedure Lay_U($from, $to) -$from -[hidden]U- $to -!endprocedure -!unquoted procedure Lay_Up($from, $to) -$from -[hidden]U- $to -!endprocedure - -!unquoted procedure Lay_R($from, $to) -$from -[hidden]R- $to -!endprocedure -!unquoted procedure Lay_Right($from, $to) -$from -[hidden]R- $to -!endprocedure - -!unquoted procedure Lay_L($from, $to) -$from -[hidden]L- $to -!endprocedure -!unquoted procedure Lay_Left($from, $to) -$from -[hidden]L- $to -!endprocedure - -' PlantUML bug: lines which does "not match" with the orientation/direction of the diagram -' uses the same length therefore the method offers no direction at all. -' If a direction is required the Lay_...() methods can be used -!unquoted procedure Lay_Distance($from, $to, $distance="0") -$from $getHiddenLine($distance) $to -!endprocedure diff --git a/base/C4_Component.puml b/base/C4_Component.puml deleted file mode 100644 index ef65914..0000000 --- a/base/C4_Component.puml +++ /dev/null @@ -1,109 +0,0 @@ -' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -!if %variable_exists("RELATIVE_INCLUDE") - !include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml -!else - !include C4_Container.puml -!endif - -' Scope: A single container. -' Primary elements: Components within the container in scope. -' Supporting elements: Containers (within the software system in scope) plus people and software systems directly connected to the components. -' Intended audience: Software architects and developers. - -' Colors -' ################################## - -!global $COMPONENT_FONT_COLOR = "#000000" - -!global $COMPONENT_BG_COLOR = "#85BBF0" -!global $COMPONENT_BORDER_COLOR = "#78A8D8" -!global $EXTERNAL_COMPONENT_BG_COLOR = "#CCCCCC" -!global $EXTERNAL_COMPONENT_BORDER_COLOR = "#BFBFBF" - -' Styling -' ################################## - -UpdateElementStyle("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR) -UpdateElementStyle("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR) - -' shortcuts with default colors -!unquoted procedure AddComponentTag($tagStereo, $bgColor=$COMPONENT_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$COMPONENT_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) -!endprocedure -!unquoted procedure AddExternalComponentTag($tagStereo, $bgColor=$EXTERNAL_COMPONENT_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_COMPONENT_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) -!endprocedure - -' Layout -' ################################## - -SetDefaultLegendEntries("person\nsystem\ncontainer\ncomponent\nexternal_person\nexternal_system\nexternal_container\nexternal_component\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary") - -!procedure LAYOUT_WITH_LEGEND() -hide stereotype -legend right -|**Legend** | -|<$PERSON_BG_COLOR> person | -|<$SYSTEM_BG_COLOR> system | -|<$CONTAINER_BG_COLOR> container | -|<$COMPONENT_BG_COLOR> component | -|<$EXTERNAL_PERSON_BG_COLOR> external person | -|<$EXTERNAL_SYSTEM_BG_COLOR> external system | -|<$EXTERNAL_CONTAINER_BG_COLOR> external container | -|<$EXTERNAL_COMPONENT_BG_COLOR> external component | -endlegend -!endprocedure - -' Elements -' ################################## - -!function $getComponent($label, $techn, $descr, $sprite) - !$component = "" - !if ($sprite != "") - !$component = $component + $getSprite($sprite) + '\n' - !endif - !$component = $component + '==' + $label - !if ($techn != "") - !$component = $component + '\n//[' + $techn + ']//' - !endif - !if ($descr != "") - !$component = $component + '\n\n' + $descr - !endif - !return $component -!endfunction - -!unquoted procedure Component($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "component") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "component") -rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure ComponentDb($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "component") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "component") -database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure ComponentQueue($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "component") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "component") -queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure Component_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_component") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_component") -rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure ComponentDb_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_component") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_component") -database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure ComponentQueue_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_component") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_component") -queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) -!endprocedure diff --git a/base/C4_Container.puml b/base/C4_Container.puml deleted file mode 100644 index f9e86ba..0000000 --- a/base/C4_Container.puml +++ /dev/null @@ -1,123 +0,0 @@ -' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -!if %variable_exists("RELATIVE_INCLUDE") - !include %get_variable_value("RELATIVE_INCLUDE")/C4_Context.puml -!else - !include C4_Context.puml -!endif - -' Scope: A single software system. -' Primary elements: Containers within the software system in scope. -' Supporting elements: People and software systems directly connected to the containers. -' Intended audience: Technical people inside and outside of the software development team; including software architects, developers and operations/support staff. - -' Colors -' ################################## - -!global $CONTAINER_BG_COLOR = "#438DD5" -!global $CONTAINER_BORDER_COLOR = "#3C7FC0" -!global $EXTERNAL_CONTAINER_BG_COLOR = "#B3B3B3" -!global $EXTERNAL_CONTAINER_BORDER_COLOR = "#A6A6A6" - -' Styling -' ################################## -UpdateElementStyle("container", $CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $CONTAINER_BORDER_COLOR) -UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR) - -UpdateBoundaryStyle("container", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="Container") - -' shortcuts with default colors -!unquoted procedure AddContainerTag($tagStereo, $bgColor=$CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) -!endprocedure -!unquoted procedure AddExternalContainerTag($tagStereo, $bgColor=$EXTERNAL_CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) -!endprocedure - -!unquoted procedure UpdateContainerBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="Container", $legendText="") - UpdateBoundaryStyle("container", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText) -!endprocedure - -' Layout -' ################################## - -SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary") - -!procedure LAYOUT_WITH_LEGEND() -hide stereotype -legend right -|**Legend** | -|<$PERSON_BG_COLOR> person | -|<$SYSTEM_BG_COLOR> system | -|<$CONTAINER_BG_COLOR> container | -|<$EXTERNAL_PERSON_BG_COLOR> external person | -|<$EXTERNAL_SYSTEM_BG_COLOR> external system | -|<$EXTERNAL_CONTAINER_BG_COLOR> external container | -endlegend -!endprocedure - -' Elements -' ################################## - -!function $getContainer($label, $techn, $descr, $sprite) - !$container = "" - !if ($sprite != "") - !$container = $container + $getSprite($sprite) + '\n' - !endif - !$container = $container + '==' + $label - !if ($techn != "") - !$container = $container + '\n//[' + $techn + ']//' - !endif - !if ($descr != "") - !$container = $container + '\n\n' + $descr - !endif - !return $container -!endfunction - -!unquoted procedure Container($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "container") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "container") -rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure ContainerDb($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "container") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "container") -database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure ContainerQueue($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "container") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "container") -queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure Container_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_container") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_container") -rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure ContainerDb_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_container") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_container") -database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure ContainerQueue_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_container") -!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_container") -queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) -!endprocedure - -' Boundaries -' ################################## - -!unquoted procedure Container_Boundary($alias, $label, $tags="", $link="") - !if ($tags != "") - !$allTags = $tags + '+container' - !else - !$allTags = 'container' - !endif - ' $type defined via $tag style - Boundary($alias, $label, "", $allTags, $link) -!endprocedure diff --git a/base/C4_Context.puml b/base/C4_Context.puml deleted file mode 100644 index 8781b7c..0000000 --- a/base/C4_Context.puml +++ /dev/null @@ -1,314 +0,0 @@ -' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -!if %variable_exists("RELATIVE_INCLUDE") - !include %get_variable_value("RELATIVE_INCLUDE")/C4.puml -!else - !include C4.puml -!endif - -' Scope: A single software system. -' Primary elements: The software system in scope. -' Supporting elements: People and software systems directly connected to the software system in scope. -' Intended audience: Everybody, both technical and non-technical people, inside and outside of the software development team. - -' Colors -' ################################## - -!global $PERSON_BG_COLOR = "#08427B" -!global $PERSON_BORDER_COLOR = "#073B6F" -!global $EXTERNAL_PERSON_BG_COLOR = "#686868" -!global $EXTERNAL_PERSON_BORDER_COLOR = "#8A8A8A" -!global $SYSTEM_BG_COLOR = "#1168BD" -!global $SYSTEM_BORDER_COLOR = "#3C7FC0" -!global $EXTERNAL_SYSTEM_BG_COLOR = "#999999" -!global $EXTERNAL_SYSTEM_BORDER_COLOR = "#8A8A8A" - -' Styling -' ################################## - -UpdateElementStyle("person", $PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $PERSON_BORDER_COLOR) -UpdateElementStyle("external_person", $EXTERNAL_PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_PERSON_BORDER_COLOR) -UpdateElementStyle("system", $SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $SYSTEM_BORDER_COLOR) -UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR) - -UpdateBoundaryStyle("enterprise", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="Enterprise") -UpdateBoundaryStyle("system", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="System") - -' shortcuts with default colors -!unquoted procedure AddPersonTag($tagStereo, $bgColor=$PERSON_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$PERSON_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) -!endprocedure -!unquoted procedure AddExternalPersonTag($tagStereo, $bgColor=$EXTERNAL_PERSON_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_PERSON_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) -!endprocedure -!unquoted procedure AddSystemTag($tagStereo, $bgColor=$SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$SYSTEM_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) -!endprocedure -!unquoted procedure AddExternalSystemTag($tagStereo, $bgColor=$EXTERNAL_SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_SYSTEM_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) -!endprocedure - -!unquoted procedure UpdateEnterpriseBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="Enterprise", $legendText="") - UpdateBoundaryStyle("enterprise", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText) -!endprocedure -!unquoted procedure UpdateSystemBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="System", $legendText="") - UpdateBoundaryStyle("system", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText) -!endprocedure - -' Sprites -' ################################## - -sprite $person [48x48/16] { -000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000 -0000000000000000000049BCCA7200000000000000000000 -0000000000000000006EFFFFFFFFB3000000000000000000 -00000000000000001CFFFFFFFFFFFF700000000000000000 -0000000000000001EFFFFFFFFFFFFFF80000000000000000 -000000000000000CFFFFFFFFFFFFFFFF6000000000000000 -000000000000007FFFFFFFFFFFFFFFFFF100000000000000 -00000000000001FFFFFFFFFFFFFFFFFFF900000000000000 -00000000000006FFFFFFFFFFFFFFFFFFFF00000000000000 -0000000000000BFFFFFFFFFFFFFFFFFFFF40000000000000 -0000000000000EFFFFFFFFFFFFFFFFFFFF70000000000000 -0000000000000FFFFFFFFFFFFFFFFFFFFF80000000000000 -0000000000000FFFFFFFFFFFFFFFFFFFFF80000000000000 -0000000000000DFFFFFFFFFFFFFFFFFFFF60000000000000 -0000000000000AFFFFFFFFFFFFFFFFFFFF40000000000000 -00000000000006FFFFFFFFFFFFFFFFFFFE00000000000000 -00000000000000EFFFFFFFFFFFFFFFFFF800000000000000 -000000000000007FFFFFFFFFFFFFFFFFF100000000000000 -000000000000000BFFFFFFFFFFFFFFFF5000000000000000 -0000000000000001DFFFFFFFFFFFFFF70000000000000000 -00000000000000000BFFFFFFFFFFFF500000000000000000 -0000000000000000005DFFFFFFFFA1000000000000000000 -0000000000000000000037ABB96100000000000000000000 -000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000 -000000000000025788300000000005886410000000000000 -000000000007DFFFFFFD9643347BFFFFFFFB400000000000 -0000000004EFFFFFFFFFFFFFFFFFFFFFFFFFFB1000000000 -000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFD200000000 -00000006FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE10000000 -0000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0000000 -000000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5000000 -000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD000000 -000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF200000 -00000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600000 -00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000 -00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA00000 -00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB00000 -00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB00000 -00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB00000 -00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA00000 -00000EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF700000 -000006FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE100000 -0000008FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD3000000 -000000014555555555555555555555555555555300000000 -000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000 -} - -sprite $person2 [48x48/16] { -0000000000000000000049BCCA7200000000000000000000 -0000000000000000006EFFFFFFFFB3000000000000000000 -00000000000000001CFFFFFFFFFFFF700000000000000000 -0000000000000001EFFFFFFFFFFFFFF80000000000000000 -000000000000000CFFFFFFFFFFFFFFFF6000000000000000 -000000000000007FFFFFFFFFFFFFFFFFF100000000000000 -00000000000001FFFFFFFFFFFFFFFFFFF900000000000000 -00000000000006FFFFFFFFFFFFFFFFFFFF00000000000000 -0000000000000BFFFFFFFFFFFFFFFFFFFF40000000000000 -0000000000000EFFFFFFFFFFFFFFFFFFFF70000000000000 -0000000000000FFFFFFFFFFFFFFFFFFFFF80000000000000 -0000000000000FFFFFFFFFFFFFFFFFFFFF80000000000000 -0000000000000DFFFFFFFFFFFFFFFFFFFF60000000000000 -0000000000000AFFFFFFFFFFFFFFFFFFFF40000000000000 -00000000000006FFFFFFFFFFFFFFFFFFFE00000000000000 -00000000000000EFFFFFFFFFFFFFFFFFF800000000000000 -000000000000007FFFFFFFFFFFFFFFFFF100000000000000 -000000000000000BFFFFFFFFFFFFFFFF5000000000000000 -0000000000000001DFFFFFFFFFFFFFF70000000000000000 -00000000000000000BFFFFFFFFFFFF500000000000000000 -0000000000000000005DFFFFFFFFA1000000000000000000 -0000000000000000000037ABB96100000000000000000000 -000000000002578888300000000005888864100000000000 -0000000007DFFFFFFFFD9643347BFFFFFFFFFB4000000000 -00000004EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB10000000 -0000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2000000 -000006FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE100000 -00003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB00000 -0000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF50000 -0003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0000 -0009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2000 -000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000 -000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000 -001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 -001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 -001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 -001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA000 -000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000 -000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000 -0009FFFFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFFFF2000 -0003FFFFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFFFD0000 -0000BFFFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFFF50000 -00003FFFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFFB00000 -000006FFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFE100000 -0000007FFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFD2000000 -00000004EFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFB10000000 -0000000007DF8FFFFFFFFFFFFFFFFFFFFFF8FB4000000000 -000000000002578888888888888888888864100000000000 -} - -' Layout -' ################################## - -SetDefaultLegendEntries("person\nsystem\nexternal_person\nexternal_system\nenterprise_boundary\nsystem_boundary\nboundary") - -!procedure LAYOUT_WITH_LEGEND() -hide stereotype -legend right -|**Legend** | -|<$PERSON_BG_COLOR> person | -|<$SYSTEM_BG_COLOR> system| -|<$EXTERNAL_PERSON_BG_COLOR> external person | -|<$EXTERNAL_SYSTEM_BG_COLOR> external system | -endlegend -!endprocedure - -!global $defaultPersonSprite = "person" -!global $portraitPerson = "false" - -!procedure HIDE_PERSON_SPRITE() - !$defaultPersonSprite = "" - !$portraitPerson = "false" -!endprocedure - -!unquoted procedure SHOW_PERSON_SPRITE($sprite="") - !if ($sprite == "") - !$defaultPersonSprite = "person" - !else - !$defaultPersonSprite = $sprite - !endif - !$portraitPerson = "false" -!endprocedure - -!unquoted procedure SHOW_PERSON_PORTRAIT() - !$defaultPersonSprite = "" - !$portraitPerson = "portrait" -!endprocedure - -!unquoted procedure SHOW_PERSON_OUTLINE() - !$defaultPersonSprite = "" - !$portraitPerson = "outline" -!endprocedure - -' Elements -' ################################## - -!function $getPerson($label, $descr, $sprite) -!if ($sprite == "") && ($defaultPersonSprite != "") - !$sprite = $defaultPersonSprite -!endif -!if ($descr == "") && ($sprite == "") - !return '=='+$label -!endif -!if ($descr == "") && ($sprite != "") - !return $getSprite($sprite)+'\n=='+$label -!endif -!if ($descr != "") && ($sprite == "") - !return '=='+$label+'\n\n '+$descr -!endif -!if ($descr != "") && ($sprite != "") - !return $getSprite($sprite)+'\n=='+$label+'\n\n '+$descr -!endif -!endfunction - -!function $getSystem($label, $descr, $sprite) -!if ($descr == "") && ($sprite == "") -!return '=='+$label -!endif -!if ($descr == "") && ($sprite != "") -!return $getSprite($sprite)+'\n=='+$label -!endif -!if ($descr != "") && ($sprite == "") -!return '=='+$label+'\n\n '+$descr -!endif -!if ($descr != "") && ($sprite != "") -!return $getSprite($sprite)+'\n=='+$label+'\n\n '+$descr -!endif -!endfunction - -!unquoted procedure Person($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "person") -!if ($portraitPerson == "portrait") && ($sprite == "") -actor "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias $getLink($link) -!elseif ($portraitPerson == "outline") && ($sprite == "") -person "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias $getLink($link) -!else -rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias $getLink($link) -!endif -!endprocedure - -!unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_person") -!if ($portraitPerson == "portrait") && ($sprite == "") -actor "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias $getLink($link) -!elseif ($portraitPerson == "outline") && ($sprite == "") -person "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias $getLink($link) -!else -rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias $getLink($link) -!endif -!endprocedure - -!unquoted procedure System($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") -rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure System_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") -rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure SystemDb($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") -database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure SystemQueue($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") -queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure SystemDb_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") -database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure SystemQueue_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") -queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) -!endprocedure - -' Boundaries -' ################################## - -!unquoted procedure Enterprise_Boundary($alias, $label, $tags="", $link="") - !if ($tags != "") - !$allTags = $tags + '+enterprise' - !else - !$allTags = 'enterprise' - !endif - ' $type defined via $tag style - Boundary($alias, $label, "", $allTags, $link) -!endprocedure - -!unquoted procedure System_Boundary($alias, $label, $tags="", $link="") - !if ($tags != "") - !$allTags = $tags + '+system' - !else - !$allTags = 'system' - !endif - ' $type defined via $tag style - Boundary($alias, $label, "", $allTags, $link) -!endprocedure diff --git a/base/C4_Deployment.puml b/base/C4_Deployment.puml deleted file mode 100644 index f3dd6db..0000000 --- a/base/C4_Deployment.puml +++ /dev/null @@ -1,169 +0,0 @@ -' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -!if %variable_exists("RELATIVE_INCLUDE") - !include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml -!else - !include C4_Container.puml -!endif - -' Colors -' ################################## - -!global $NODE_FONT_COLOR = "#000000" -!global $NODE_BG_COLOR = "#FFFFFF" -!global $NODE_BORDER_COLOR = "#A2A2A2" - -' Styling -' ################################## - -UpdateElementStyle("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR) -skinparam rectangle<> { - FontStyle normal -} - -' shortcuts with default colors -' node specific: $type reuses $techn definition of $tags -!unquoted procedure AddNodeTag($tagStereo, $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) -!endprocedure - -' Layout -' ################################## - -' comment if node should not be added to legend. No calculated legend extension required -SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nnode\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary") - -' Line breaks -' ################################## - -' PlantUML supports no automatic line breaks of "PlantUML containers" (C4 Deployment_Node is a "PlantUML container") -' therefore (Deployment_)Node() implements an automatic line break based on spaces (like in all other objects). -' If a $type contains \n then these are used (and no automatic space based line breaks are done) -' $NODE_TYPE_MAX_CHAR_WIDTH defines the automatic line break position -!global $NODE_TYPE_MAX_CHAR_WIDTH = 35 -!global $NODE_DESCR_MAX_CHAR_WIDTH = 32 - -!unquoted function $breakNode($type, $widthStr) -!$width = %intval($widthStr) -!$multiLine = "" -!if (%strpos($type, "\n") >= 0) - !while (%strpos($type, "\n") >= 0) - !$brPos = %strpos($type, "\n") - !$multiLine = $multiLine + %substr($type, 0, $brPos) + '\n' - !$type = %substr($type, $brPos+2) - !endwhile -!else - !while (%strlen($type) > $width) - !$brPos = $width - !while ($brPos > 0 && %substr($type, $brPos, 1) != ' ') - !$brPos = $brPos - 1 - !endwhile - - !if ($brPos < 1) - !$brPos = %strpos($type, " ") - !else - !endif - - !if ($brPos > 0) - !$multiLine = $multiLine + %substr($type, 0, $brPos) + '\n' - !$type = %substr($type, $brPos + 1) - !else - !$multiLine = $multiLine+ $type - !$type = "" - !endif - !endwhile -!endif -!if (%strlen($type) > 0) - !$multiLine = $multiLine + $type -!endif -!return $multiLine -!endfunction - -' Elements -' ################################## - -!function $getNode($label, $type, $descr, $sprite) - !$nodeText = "" - !if ($sprite != "") - !$nodeText = $nodeText + $getSprite($sprite) + '\n' - !endif - !$nodeText = $nodeText + '==' + $label - !if ($type != "") - !$nodeText = $nodeText + '\n[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' - !endif - !if ($descr != "") - !$nodeText = $nodeText + '\n\n' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH) - !endif - !return $nodeText -!endfunction - -!function $getNode_L($label, $type, $descr, $sprite) - !$nodeText = "" - !if ($sprite != "") - !$nodeText = $nodeText + $getSprite($sprite) + '\l' - !endif - !$nodeText = $nodeText + '==' + $label - !if ($type != "") - !$nodeText = $nodeText + '\l[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' - !endif - !if ($descr != "") - !$nodeText = $nodeText + '\l\l' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH) - !endif - !return $nodeText -!endfunction - -!function $getNode_R($label, $type, $descr, $sprite) - !$nodeText = "" - !if ($sprite != "") - !$nodeText = $nodeText + $getSprite($sprite) + '\r' - !endif - !$nodeText = $nodeText + '==' + $label - !if ($type != "") - !$nodeText = $nodeText + '\r[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' - !endif - !if ($descr != "") - !$nodeText = $nodeText + '\r\r' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH) - !endif - !return $nodeText -!endfunction - -!unquoted procedure Deployment_Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") -' nodes $type reuses $techn definition of $tags -!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") -rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure Deployment_Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") -' nodes $type reuses $techn definition of $tags -!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") -rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure Deployment_Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") -' nodes $type reuses $techn definition of $tags -!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") -rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") -' nodes $type reuses $techn definition of $tags -!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") -rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") -' nodes $type reuses $techn definition of $tags -!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") -rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias $getLink($link) -!endprocedure - -!unquoted procedure Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") -' nodes $type reuses $techn definition of $tags -!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") -rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) -!endprocedure diff --git a/base/C4_Dynamic.puml b/base/C4_Dynamic.puml deleted file mode 100644 index 4b22212..0000000 --- a/base/C4_Dynamic.puml +++ /dev/null @@ -1,146 +0,0 @@ -' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -!if %variable_exists("RELATIVE_INCLUDE") - !include %get_variable_value("RELATIVE_INCLUDE")/C4_Component.puml -!else - !include C4_Component.puml -!endif - -' Scope: Interactions in an enterprise, software system or container. -' Primary and supporting elements: Depends on the diagram scope - -' enterprise - people and software systems Related to the enterprise in scope -' software system - see system context or container diagrams, -' container - see component diagram. -' Intended audience: Technical and non-technical people, inside and outside of the software development team. - -' Dynamic diagram introduces (automatically) numbered interactions: -' (lowercase) increment($offset=1): increase current index (procedure which has no direct output) -' (lowercase) setIndex($new_index): set the new index (procedure which has no direct output) -' -' (Uppercase) LastIndex(): return the last used index (function which can be used as argument) -' (Uppercase) Index($offset=1): returns current index and calculates next index (function which can be used as argument) -' (Uppercase) SetIndex($new_index): returns new set index and calculates next index (function which can be used as argument) - -' Index -' ################################## - -!$lastIndex = 0 -!$index = 1 - -!procedure increment($offset=1) - !$lastIndex = $index - !$index = $index + $offset -!endprocedure - -!procedure setIndex($new_index) - !$lastIndex = $index - !$index = $new_index -!endprocedure - -!function Index($offset=1) - !$lastIndex = $index - !$index = $lastIndex + $offset - !return $lastIndex -!endfunction - -!function LastIndex() - !return $lastIndex -!endfunction - -!function SetIndex($new_index, $offset=1) - !$lastIndex = $new_index - !$index = $new_index + $offset - !return $lastIndex -!endfunction - -' Relationship override -' ################################## - -' Relationship -' ################################## - -!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $direction) -$alias1 $direction $alias2 : **$e_index: $label** -!endprocedure -!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $techn, $direction) -$alias1 $direction $alias2 : **$e_index: $label**\n//[$techn]// -!endprocedure - -!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure -!unquoted procedure RelIndex($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<--", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure -!unquoted procedure RelIndex_Back($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<--", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure -!unquoted procedure RelIndex_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure -!unquoted procedure RelIndex_Back_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure - -!unquoted procedure Rel_D($from, $to, $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) -!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) -!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) -!endprocedure - -!unquoted procedure Rel_U($from, $to, $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) -!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) -!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) -!endprocedure - -!unquoted procedure Rel_L($from, $to, $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) -!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) -!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) -!endprocedure - -!unquoted procedure Rel_R($from, $to, $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) -!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) -!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) -!endprocedure diff --git a/readme.md b/readme.md index 8491a55..f5a181e 100644 --- a/readme.md +++ b/readme.md @@ -108,19 +108,12 @@ The script will try to install all the dependencies if not present but there mig ## Usage -1. Start with [C4](https://c4model.com/) diagrams using PlantUML. Run the PlantUML server using `docker run --name plantuml -d -p 8089:8080 plantuml/plantuml-server:latest`. Follow the examples [Context](context.puml), [Container](container.puml) and [Component](component.puml) in this repo. Also check out the [samples](https://github.com/plantuml-stdlib/C4-PlantUML/tree/master/samples) in [C4-PlantUML](https://github.com/plantuml-stdlib/C4-PlantUML). Sync with that repo using: - - ```bash - git clone https://github.com/plantuml-stdlib/C4-PlantUML ~/C4-PlantUML - cp ~/C4-PlantUML/*.puml ./base - cp -r ~/C4-PlantUML/.vscode . - grep -rl '' | xargs -d '\n' sed -i 's/https:\/\/raw.githubusercontent.com\/plantuml-stdlib\/C4-PlantUML\/master\///g' - ``` +1. Start with [C4](https://c4model.com/) diagrams using PlantUML. Run the PlantUML server using `docker run --name plantuml -d -p 8089:8080 plantuml/plantuml-server:latest` (port 8089 to match `plantuml.server` in vscode settings). Follow the examples [Context](context.puml), [Container](container.puml) and [Component](component.puml) in this repo. Also check out the [samples](https://github.com/plantuml-stdlib/C4-PlantUML/tree/master/samples) in [C4-PlantUML](https://github.com/plantuml-stdlib/C4-PlantUML). C4-PlantUML is part of [plantuml's rich standard library](https://github.com/plantuml/plantuml-stdlib). - To preview the diagrams : Open [VS Code Command Pallette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and Select `PlantUML : Preview current diagram` - - To generate images using scripts, download plantuml jar file from [github](https://github.com/plantuml/plantuml/releases) and use `java -Dplantuml.include.path='base' -jar plantuml.jar ...`, see [documentation](https://plantuml.com/command-line) for details. + - To generate images using terminal / shell scripts, download plantuml jar file from [github](https://github.com/plantuml/plantuml/releases) and use `java -jar plantuml.jar ...`, see [documentation](https://plantuml.com/command-line) for details. -3. End with system diagrams using [Diagrams](https://diagrams.mingrammer.com/). Follow the example [diagram](diagram.ipynb) in this repo. +2. End with system diagrams using [Diagrams](https://diagrams.mingrammer.com/). Follow the example [diagram](diagram.ipynb) in this repo. - To preview simply `Run All` the Jupyter notebook from top toolbar

(back to top)