From 506922d715251ccca3f5d1ec3ce9523d79caf02b Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Thu, 5 Aug 2021 20:21:38 +0200 Subject: [PATCH 1/7] Legend supports sprites and custom text --- C4.puml | 208 +++++++++++++++++++++++++++++++++------------ C4_Component.puml | 6 ++ C4_Container.puml | 6 ++ C4_Context.puml | 9 +- C4_Deployment.puml | 6 ++ 5 files changed, 182 insertions(+), 53 deletions(-) diff --git a/C4.puml b/C4.puml index bef1de5f..e4ec9fd0 100644 --- a/C4.puml +++ b/C4.puml @@ -137,6 +137,33 @@ skinparam rectangle<> { !return $stereos !endfunction +!unquoted function $toRelSprite($sprite, $tags) + !if ($sprite>"") + !return $sprite + !endif + + !if (%strlen($tags) == 0) + !return $sprite + !endif + !$brPos = %strpos($tags, "+") + !while ($brPos >= 0) + !$tag = %substr($tags, 0, $brPos) + !$newSprite = %get_variable_value("$" + $tag + "RelTagSprite") + !if ($newSprite>"") + !return $newSprite + !endif + !$tags = %substr($tags, $brPos+1) + !$brPos = %strpos($tags, "+") + !endwhile + !if (%strlen($tags)>0) + !$newSprite = %get_variable_value("$" + $tags + "RelTagSprite") + !if ($newSprite>"") + !return $newSprite + !endif + !endif + !return $sprite +!endfunction + ' element specific (unused are hidden based on mask) !unquoted function $toStereos($elementType, $tags) !if (%strlen($tags) == 0) @@ -176,6 +203,38 @@ skinparam rectangle<> { !return $stereos !endfunction +!unquoted function $toSprite($sprite, $elementType, $tags) + !if ($sprite>"") + !return $sprite + !endif + + !if (%strlen($tags) == 0) + !$newSprite = %get_variable_value("$" + $elementType + "ElementTagSprite") + !if ($newSprite>"") + !return $newSprite + !else + !return $sprite + !endif + !endif + !$brPos = %strpos($tags, "+") + !while ($brPos >= 0) + !$tag = %substr($tags, 0, $brPos) + !$newSprite = %get_variable_value("$" + $tag + "ElementTagSprite") + !if ($newSprite>"") + !return $newSprite + !endif + !$tags = %substr($tags, $brPos+1) + !$brPos = %strpos($tags, "+") + !endwhile + !if (%strlen($tags)>0) + !$newSprite = %get_variable_value("$" + $tags + "ElementTagSprite") + !if ($newSprite>"") + !return $newSprite + !endif + !endif + !return $sprite +!endfunction + !function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) !$elementSkin = "skinparam " + $element +"<<" + $tagStereo + ">> {" + %newline() !if ($fontColor!="") @@ -300,18 +359,19 @@ $elementSkin !return "1" !endfunction -!function $tagLegendMask($bgColor, $fontColor, $borderColor, $shadowing, $shape) +!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 "00000" + !return "000000" !endfunction !function $combineMasks($mask1, $mask2) @@ -321,6 +381,7 @@ $elementSkin !$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 @@ -335,7 +396,7 @@ $elementSkin !return $combineMasks($mask1, $mask2) !endfunction -!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) +!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) !$bg = $bgColor !$fo = $fontColor !$bo = $borderColor @@ -380,35 +441,43 @@ $elementSkin ' ..white rectangle !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + "" - !$tagEntry = $tagEntry + " " + $tagStereo + " " - !if ($shadowing == "true") - !$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT - !endif - !if ($shadowing == "false") - !$tagEntry = $tagEntry + $LEGEND_NO_SHADOW_TEXT + !if ($legendSprite != "") + !$tagEntry = $tagEntry + "<$"+$legendSprite+"> " !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 + !if ($legendText == "") + !$tagEntry = $tagEntry + " " + $tagStereo + " " + !if ($shadowing == "true") + !$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT + !endif + !if ($shadowing == "false") + !$tagEntry = $tagEntry + $LEGEND_NO_SHADOW_TEXT !endif - !if ($bgColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_BG_TEXT + !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) +!function $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) !$tc = $textColor !$lc = $lineColor @@ -431,24 +500,32 @@ $elementSkin ' ..white line !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + "" - !$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 + ") " + !if ($legendSprite != "") + !$tagEntry = $tagEntry + "<$"+$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 @@ -458,20 +535,20 @@ $elementSkin !global $LEGEND_DASHED_LINE = "(dashed) " !global $LEGEND_BOLD_LINE = "(bold) " -!unquoted procedure $addTagToLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="") +!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) + !$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) + !$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="") +!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"). @@ -479,7 +556,7 @@ $elementSkin '' 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) + !$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) %set_variable_value("$" + $tagStereo + "_LineLegendEntry", $tagEntry) !$tagCustomLegend = $tagCustomLegend + $tagStereo + "_Line\n" ' !endif @@ -524,24 +601,50 @@ $elementSkin !endfunction ' used by new defined tags -!unquoted procedure AddElementTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="") +!unquoted procedure AddElementTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) -$addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) + !if ($sprite!="") +%set_variable_value("$" + $tagStereo + "ElementTagSprite", $sprite) + !if ($legendSprite == "" && %strpos($sprite, "scale")>=0) + ' element symbols typically 4 times too big + !$legendSprite = $sprite + ",scale=0.25" + !endif + !endif +$addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) !endprocedure ' used by new defined rel tags -!unquoted procedure AddRelTag($tagStereo, $textColor="", $lineColor="", $lineStyle = "") +!unquoted procedure AddRelTag($tagStereo, $textColor="", $lineColor="", $lineStyle = "", $sprite="", $legendText="", $legendSprite="") $defineRelSkinparams($tagStereo, $textColor, $lineColor, $lineStyle) -$addRelTagToLegend($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 +$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="") +!unquoted procedure UpdateElementStyle($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") $defineSkinparams($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - !$tagEntry = $tagLegendEntry($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape) + !if ($sprite!="") +%set_variable_value("$" + $elementName + "ElementTagSprite", $sprite) + !if ($legendSprite == "") + ' ,scale= ... has to be first (...,color=black,scale=0.25... is invalid too) + !if (%strpos($sprite, "=") < 0) + ' element symbols typically 4 times too big + !$legendSprite = $sprite + ",scale=0.25" + !else + !$legendSprite = $sprite + !endif + !endif + !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) + !$tagMask = $tagLegendMask("CHANGED", "CHANGED", $borderColor, $shadowing, $shape, $sprite) %set_variable_value("$" + $elementName + "LegendMask", $tagMask) !endprocedure @@ -802,6 +905,7 @@ rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias ' ################################## !function $getRel($direction, $alias1, $alias2, $label, $techn, $descr, $sprite, $tags, $link) + !$sprite = $toRelSprite($sprite, $tags) !$rel = $alias1 + ' ' + $direction + ' ' + $alias2 !if ($tags != "") !$rel = $rel + ' ' + $toStereos($tags) diff --git a/C4_Component.puml b/C4_Component.puml index 5f660d47..3b0d2629 100644 --- a/C4_Component.puml +++ b/C4_Component.puml @@ -65,25 +65,31 @@ endlegend !endfunction !unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toSprite($sprite, "component", $tags) 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=$toSprite($sprite, "component", $tags) 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=$toSprite($sprite, "component", $tags) 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=$toSprite($sprite, "external_component", $tags) 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=$toSprite($sprite, "external_component", $tags) 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=$toSprite($sprite, "external_component", $tags) queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) !endprocedure diff --git a/C4_Container.puml b/C4_Container.puml index 3b721535..f89f8d22 100644 --- a/C4_Container.puml +++ b/C4_Container.puml @@ -60,26 +60,32 @@ endlegend !endfunction !unquoted procedure Container($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toSprite($sprite, "container", $tags) 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=$toSprite($sprite, "container", $tags) 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=$toSprite($sprite, "container", $tags) 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=$toSprite($sprite, "external_container", $tags) 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=$toSprite($sprite, "external_container", $tags) 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=$toSprite($sprite, "external_container", $tags) queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) !endprocedure diff --git a/C4_Context.puml b/C4_Context.puml index d56d1984..9a65cc3c 100644 --- a/C4_Context.puml +++ b/C4_Context.puml @@ -30,7 +30,6 @@ 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) - ' Sprites ' ################################## @@ -216,6 +215,7 @@ endlegend !endfunction !unquoted procedure Person($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toSprite($sprite, "person", $tags) !if ($portraitPerson == "portrait") && ($sprite == "") actor "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias $getLink($link) !elseif ($portraitPerson == "outline") && ($sprite == "") @@ -226,6 +226,7 @@ rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", !endprocedure !unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toSprite($sprite, "external_person", $tags) !if ($portraitPerson == "portrait") && ($sprite == "") actor "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias $getLink($link) !elseif ($portraitPerson == "outline") && ($sprite == "") @@ -236,26 +237,32 @@ rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_ !endprocedure !unquoted procedure System($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toSprite($sprite, "system", $tags) 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=$toSprite($sprite, "external_system", $tags) 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=$toSprite($sprite, "system", $tags) database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemQueue($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toSprite($sprite, "system", $tags) 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=$toSprite($sprite, "external_system", $tags) 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=$toSprite($sprite, "external_system", $tags) queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure diff --git a/C4_Deployment.puml b/C4_Deployment.puml index 00ca6bdc..ec2647ad 100644 --- a/C4_Deployment.puml +++ b/C4_Deployment.puml @@ -123,25 +123,31 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endfunction !unquoted procedure Deployment_Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toSprite($sprite, "node", $tags) 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=$toSprite($sprite, "node", $tags) 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=$toSprite($sprite, "node", $tags) 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=$toSprite($sprite, "node", $tags) 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=$toSprite($sprite, "node", $tags) 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=$toSprite($sprite, "node", $tags) rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure From 48b2b13666e1811a68958ff2302f387a6c4dbd74 Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Thu, 5 Aug 2021 20:24:07 +0200 Subject: [PATCH 2/7] fix typo --- samples/C4CoreDiagrams.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/C4CoreDiagrams.md b/samples/C4CoreDiagrams.md index 8f52f352..27e0a6bc 100644 --- a/samples/C4CoreDiagrams.md +++ b/samples/C4CoreDiagrams.md @@ -54,7 +54,7 @@ Source: [C4_Deployment Diagram Sample - bigbankplc-details.puml](C4_Deployment%2 ## Styles -Source: [C4_Container Diagram Sample - bigbankplc-icons.puml](C4_Container%20Diagram%20Sample%20-%20bigbankplc-styles.puml) +Source: [C4_Container Diagram Sample - bigbankplc-styles.puml](C4_Container%20Diagram%20Sample%20-%20bigbankplc-styles.puml) ![Container diagram for Internet Banking System](https://www.plantuml.com/plantuml/png/hLPDZzis4BtxLqoT71n0kqQHvb9WWNXjjTd0NhkMj-dD655ZcGX52YIr7oZwtpkaFsXxKwH0UrcOGyvxJq-Fe_teF5hVDQhtWzH2THN1rllM_JmSMdowhgNVTcNdo0gZFMb_BKmpR1Ngq7FbVALaEHp_TBK8fOVPTDYWysIvj1vp1qfDzheD-BtYq_pBUf4lY_dzUlwmcjxTvuDtlL5LvOeQXbvXFUYNABwIha0ScliPlDtmOcoKiJTlysa-o-zNwr_c_6SydywNl5_Mkzt-c_VlFqn67qAFss9BDxcijxwG5LL5M0_UHS8bgKY6xaMBSDZJyu5Wj5oop0EoOWd_k57u5qKt4tHRggQyla0FuCF_Xy9udoXwNdf5SBGNAecrnGOsniATPlSrURX5_LNg6eeNvwdfzHPadT43qJbl6h8PZ8-_-YCubC5im6y9IkxEu8dVFhIn4LMi0GfXEkrTdtNieDUtNAZGlWp4ZunrAQ3_3lxi0K3IEtYYSerjouU_K0cZjbLIe9T6zxdq6HynWwArGVpizt6eJKZ9HvOHfJdFPmNiymYegrW-yfQ71r-CMEGviskHuGhULdIrm9e2-u6r45QsFeEHhZk5DfGNrZnoU1oWKjzcsNHQ1Ecef7y1RzZ9QAI3HucXHLhWvuNIcYT7zfMYnfHIqTwEMLWSDOtVPF07DiXEd6i19Hl9WG3NbOwrcCs_rkPUYTi9W8eUfQ1BUPDoKA774Xs5rx3_6TGKlqtXREsDPMrXKe2bMZflCN23r1pB9lxEO1ll2c37kHAMAj9Ued9PY1Kv1yhKl20lhbyPjHyCx9GCYLtSVJiu4yF7REexTUvx3WLJ63ZULgpTpUjXnAh-EkO-V_O3Qb2gjOi5PiglPho6tO50lTeIoCYA2cPIMEFCnaF-BBQeQu9T9yEUOEx59TGPieaM6xgurCdtaCz330GN3WzuwZvWQJgVCf0Txt86tg9s6Ar8_lUMf4xcHRgr3uvSuFwqMYqAFdX-phNutJCfzOUZExhrFV70BasQ4H4kJO0zKYoU9Y8Hne6RmMV-oWmZUNgTSMkFa1JyDw3rBJSdsOVRSWcw9AmSRAnfui1wijAJ0sy2qPvdSZjco2FcYLiN8IiOrW5TXMh4I48kydYguRAlSvoFH5_CLeiTK7gOi_QBL2QVqcUEnzLiUkbLscRutVy0q_pN_7x2t_wFZDurwcy0 "Container diagram for Internet Banking System") From 636d9f517fa425e9b3b140659b78184f0afd3d07 Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Fri, 6 Aug 2021 00:13:16 +0200 Subject: [PATCH 3/7] Legend supports sprites and custom text (2 - fix Add/UpdateElementStyle) --- C4.puml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/C4.puml b/C4.puml index e4ec9fd0..c6d71ac5 100644 --- a/C4.puml +++ b/C4.puml @@ -231,6 +231,10 @@ skinparam rectangle<> { !if ($newSprite>"") !return $newSprite !endif + !$newSprite = %get_variable_value("$" + $elementType + "ElementTagSprite") + !if ($newSprite>"") + !return $newSprite + !endif !endif !return $sprite !endfunction @@ -605,9 +609,14 @@ $elementSkin $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) !if ($sprite!="") %set_variable_value("$" + $tagStereo + "ElementTagSprite", $sprite) - !if ($legendSprite == "" && %strpos($sprite, "scale")>=0) - ' element symbols typically 4 times too big - !$legendSprite = $sprite + ",scale=0.25" + !if ($legendSprite == "") + ' ,scale= ... has to be first (...,color=black,scale=0.25... is invalid too) + !if (%strpos($sprite, "=") < 0) + ' element symbols typically 4 times too big + !$legendSprite = $sprite + ",scale=0.25" + !else + !$legendSprite = $sprite + !endif !endif !endif $addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) From 0670fc6208c04133c74d799c1641b121c2fbcdc9 Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Fri, 6 Aug 2021 13:07:52 +0200 Subject: [PATCH 4/7] Legend supports sprites and custom text (3 - add element specific AddXxxxxxxStyle() with specific default colors) --- C4_Component.puml | 8 ++++++++ C4_Container.puml | 8 ++++++++ C4_Context.puml | 14 ++++++++++++++ C4_Deployment.puml | 5 +++++ 4 files changed, 35 insertions(+) diff --git a/C4_Component.puml b/C4_Component.puml index 3b0d2629..4aeb4711 100644 --- a/C4_Component.puml +++ b/C4_Component.puml @@ -26,6 +26,14 @@ 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="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddExternalComponentTag($tagStereo, $bgColor=$EXTERNAL_COMPONENT_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_COMPONENT_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!endprocedure + ' Layout ' ################################## diff --git a/C4_Container.puml b/C4_Container.puml index f89f8d22..ee433dd9 100644 --- a/C4_Container.puml +++ b/C4_Container.puml @@ -23,6 +23,14 @@ 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) +' shortcuts with default colors +!unquoted procedure AddContainerTag($tagStereo, $bgColor=$CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddExternalContainerTag($tagStereo, $bgColor=$EXTERNAL_CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!endprocedure + ' Layout ' ################################## diff --git a/C4_Context.puml b/C4_Context.puml index 9a65cc3c..df750fef 100644 --- a/C4_Context.puml +++ b/C4_Context.puml @@ -30,6 +30,20 @@ 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) +' 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 + ' Sprites ' ################################## diff --git a/C4_Deployment.puml b/C4_Deployment.puml index ec2647ad..473ae80c 100644 --- a/C4_Deployment.puml +++ b/C4_Deployment.puml @@ -22,6 +22,11 @@ skinparam rectangle<> { FontStyle normal } +' shortcuts with default colors +!unquoted procedure AddNodeTag($tagStereo, $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!endprocedure + ' Layout ' ################################## From 2d23c1791bfcfdc7e9c9bb125b6622ca1314ed65 Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Fri, 6 Aug 2021 14:20:54 +0200 Subject: [PATCH 5/7] Legend supports sprites and custom text (4 - update ReadMe.md, add test file) --- README.md | 89 +++++++++++++++++++++++++++++++++++-- percy/TestLegendSprite.puml | 74 ++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 percy/TestLegendSprite.puml diff --git a/README.md b/README.md index f2fbae17..2c1e13bf 100644 --- a/README.md +++ b/README.md @@ -374,11 +374,11 @@ C4-PlantUML also comes with some person sprite/portrait options: Additional tags/stereotypes can be added to the existing element stereotypes (component, ...) and highlight,... specific aspects: -* `AddElementTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape)`: +* `AddElementTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)`: Introduces a new element tag. The styles of the tagged elements are updated and the tag is displayed in the calculated legend. -* `AddRelTag(tagStereo, ?textColor, ?lineColor, ?lineStyle)`: +* `AddRelTag(tagStereo, ?textColor, ?lineColor, ?lineStyle, ?sprite, ?legendText, ?legendSprite)`: Introduces a new relation tag. The styles of the tagged relations are updated and the tag is displayed in the calculated legend. -* `UpdateElementStyle(elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape)`: +* `UpdateElementStyle(elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)`: This call updates the default style of the elements (component, ...) and creates no additional legend entry. * `UpdateRelStyle(textColor, lineColor)`: This call updates the default relationship colors and creates no additional legend entry. @@ -391,6 +391,28 @@ Additional tags/stereotypes can be added to the existing element stereotypes (co Each element can be extended with one or multiple custom tags via the keyword argument `$tags="..."`, like `Container(spaAdmin, "Admin SPA", $tags="v1.1")`. Multiple tags can be combined with `+`, like `Container(api, "API", $tags="v1.0+v1.1")`. +**Element specific tag definitions** + +Sometimes an added element tag is element specific and all element specific colors should be used, e.g. a specific user role should be defined as element tag with the specific colors `...PERSON_...` like +```plantuml +AddElementTag("admin", $fontColor=$ELEMENT_FONT_COLOR, $bgColor=$PERSON_BG_COLOR, $borderColor=$PERSON_BORDER_COLOR, $sprite="osa_user_audit", $legendText="administration user") +``` +Therefore element Add...Tag() shortcuts are added which use the specific colors as default values and the call can be simplified like +```plantuml +AddPersonTag("admin", $sprite="osa_user_audit", $legendText="administration user") +``` + +Following calls introduces new element tags with element specific default colors: +* `AddPersonTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddExternalPersonTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddSystemTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddExternalSystemTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddComponentTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddExternalComponentTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddContainerTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddExternalContainerTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddNodeTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` + **Comments** * `SHOW_LEGEND()` supports the customized stereotypes @@ -404,6 +426,8 @@ Multiple tags can be combined with `+`, like `Container(api, "API", $tags="v1.0+ * Colors of relationship tags cannot be automatically merged (PlantUML does not support it). If one tag modifies the line color and the other the text color, an additional combined tag has to be defined and used. +**Sample with different tag combinations** + ```csharp @startuml !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml @@ -446,6 +470,65 @@ SHOW_LEGEND(false) ![merged tags](https://www.plantuml.com/plantuml/png/jLLHRzCm47xlhp01JQswjMkOc8GqQMCh36d0r6xYSRh4byJWs97jTEFVOyTrI9l0nCFwOllkk-_Ed-_ISsr0cRhaerTCfBocI0fZAlr-FbVmECkPAUgargXIAGmACqjbEQyu21Tpf0tbB9bVdXpTEjFzbvjv2TgWigQ7Ini1JA2QLOv_T5zHCBZaM5gUjVd5SLoXqb8SaZUPnLvABjLPb2j44Kr65vHkiNUGZwFDOdOSxI9VqzEtn_6fioPIKLIxza6EnJv7Pdz9rkVmzk4w3WQ9AE2xHP_8s_j46N2UGFgpYSW3-gJvMVG-l6IfaaIZsh0KNOmkeCAp9SiBisOKwTgTnvDU7csaWhmJifAriFWFyYc4XBTP8VVlad1Rs25fbeRGUZoPpzzSq-1JkBn26WtXOeVZJE0pkCL12EWJ3rACskOQwmeEIRI-lOZi0YAlEIYtlIkGb1P2c32eCaYHc08CCTQUrbQL4fNtGMeqUMIc81i693IQWLoV-RQRxAQxe2KJDaEpak7Cu7nC6mLM_lyjGU0Z2ItMbh7OAGCgvYgu_UmI_e0DkFKQ1EMe2N1ExD1QeDQ4ovobPEocUzOo4oin2isaq9DEbj3RKxURkjt-tMElTVnYOa_3N0og7dTbZrzUzr1CqA9RakzOxGJPRbqH1jD2j0HxOzkzKiOuhlrish2FzaJ2gFPfWiTMi4BkUzwtmBtsUPkljlLxjrVh7vY76q-oVL8__ptGgaCLTd-1D_WhtvSTQMgREfmNZSYcO9gam7ddTbk_fNcU9Nw69MvP_X3iQfr8KxJiZUXs6IRjVw2cmJBjv1kjhxzzVxXPVbf-lHfdm3LEHkSegFlV-mq0 "merged tags") +**Sample with tag dependent sprites and custom legend text** + +```plantuml +@startuml +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml + +!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master +!include osaPuml/Common.puml +!include osaPuml/User/all.puml + +!include +!include +!include +!include +!include + +AddExternalPersonTag("anonymous_ext", $sprite="osa_user_black_hat", $legendText="anonymous user") +AddPersonTag("customer", $sprite="osa_user_large_group", $legendText="aggregated user") +AddPersonTag("admin", $sprite="osa_user_audit,color=red", $legendSprite="osa_user_audit,scale=0.25,color=red", $legendText="administration user") + +AddContainerTag("webApp", $sprite="application_server", $legendText="web app container") +AddContainerTag("db", $sprite="database_server", $legendText="database container") +AddContainerTag("files", $sprite="file_server", $legendText="file server container") +AddContainerTag("conApp", $sprite="service_application", $legendText="console app container") + +AddRelTag("firewall", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="firewall,scale=0.3,color=red", $legendText="firewall") + +Person_Ext(anonymous_user, "Bob", $tags="anonymous_ext") +Person(aggregated_user, "Sam, Ivone", $tags="customer") +Person(administration_user, "Bernd", $tags="admin") + +System_Boundary(c1, "techtribes.js"){ + Container(web_app, "Web Application", "Java, Spring MVC, Tomcat 7.x", $tags="webApp") + ContainerDb(rel_db, "Relational Database", "MySQL 5.5.x", $tags="db") + Container(filesystem, "File System", "FAT32", $tags="files") + ContainerDb(nosql, "NoSQL Data Store", "MongoDB 2.2.x", $tags="db") + Container(updater, "Updater", "Java 7 Console App", $tags="conApp") +} + +Rel(anonymous_user, web_app, "Uses", "HTTPS", $tags="firewall") +Rel(aggregated_user, web_app, "Uses", "HTTPS", $tags="firewall") +Rel(administration_user, web_app, "Uses", "HTTPS", $tags="firewall") + +Rel(web_app, rel_db, "Reads from and writes to", "SQL/JDBC, port 3306") +Rel(web_app, filesystem, "Reads from") +Rel(web_app, nosql, "Reads from", "MongoDB wire protocol, port 27017") + +Rel_U(updater, rel_db, "Reads from and writes data to", "SQL/JDBC, port 3306") +Rel_U(updater, filesystem, "Writes to") +Rel_U(updater, nosql, "Reads from and writes to", "MongoDB wire protocol, port 27017") + +Lay_R(rel_db, filesystem) + +SHOW_LEGEND() +@enduml +``` + +![tags with sprites and custom legend](https://www.plantuml.com/plantuml/png/dLJTRkCs4xttKt2DlN00nyewNxu0HRDOnqwxNJYRr3_DfJ0Inx9QYbH9AevHzDqxf6tHiPMVDbSHvvmpXpE7_c8iQ5iLelKXbwceEBAbjQNv8Oeqh7fPRfTLKXdKgP8MfUsbgeXA0T9nJetb8a-YuVzExztH_7OS5M0iQZgAXyI0NABkbKw_zO7ZWZwPCd1F1-_eCzHWbiYBNF9er-1KbIWDffNExHfqkimjfhRIs3_DYMks1i9rjksYeIeA9RsNu-BSa6SGObCEzH_LOf6d64rHFw8s4GSB2HYCZJ_u_39oaOjteA0iHPw2pPLy6Ko3JB6q9d88EeZtMA_15xd65GZnkTKQS7xpP55B4FVKLyaPP9qsI2NNXQfCZ4-stMKVJKbJnQksCX2xPSI9WFIFU0c-AZ13oMU4lGfKvd3j4zTXJpcjZ5K5waPH0Jh3EDEgAezaiqnZ1XPviowuC3IAGiLpsqsLKFfA8m_2qsQaIK7WrLclVn58HsvSjznOxKUzS-GirTdshbQO3CfotzRnNW-rYSC8nTAT4YaV2VDaNpI4hq4nb5-NTBaq-whke5dHbzYczBee5Gy6q13LGtKY6INmQ0fEVeB22-yYxBYMM4E_glR7mMHozn0FxyPt4ozBrAPIC5GhrOi_Vsdl0UlCRC8Nq-lfr9dtEUgozhLAl378pDN1OphP4ZiXqJlM58ek--LHIGpa-hq4thFirHrHInve7kHSJjV6OX5VgqfoqEjE-ed05jEbrNc2flUxQP_yrMBqLo-kGmbqwo7W0sLny6nHxM_m25tctexCsErlmowRgOBAxBBt5FflWt_oN7cKT3IAc2UaGulqcY3OQ9jF9t-xdluwPXUzYtqrdXmgTNnQ_Ts8z9EBu-QcRVSvc9tt0zj36wn8PVuK1F-kN4jdWasjqXiRIcPgTCtwlVuRHggIW_Khc6_-sms9NJgK3x8RHTYeaflH_DrgqH2EmXEcFpTedDhNsUn-6WH223q_vEY_2Xm6wj-AU9MQiBTXu8Ojj2eOICvMxhaPPfKJeub7tqRNb9vIQSlEpy_-lt4JTCA6dsaTmdPR38Zz_Qt89IkriYfLOjkiVtdswN9hEvw71RvXd53mbliWT-3_eRxy4IvSe7bSxxxE6DRnf7vWeJsLfb_fbszyy_FDzr7dfFK59QyAyGy0 "tags with sprites and custom legend") + **Custom schema definition** If the custom (color) schema is defined via `UpdateElementStyle()` then the legend of existing elements is updated too. diff --git a/percy/TestLegendSprite.puml b/percy/TestLegendSprite.puml new file mode 100644 index 00000000..10e32101 --- /dev/null +++ b/percy/TestLegendSprite.puml @@ -0,0 +1,74 @@ +@startuml +' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally +!if %variable_exists("RELATIVE_INCLUDE") + !include ./../C4_Component.puml +!else + !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml +!endif + +!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master +!include osaPuml/Common.puml +!include osaPuml/User/all.puml + +!include +!include +!include +!include +!include + +AddExternalPersonTag("anonymous_ext", $sprite="osa_user_black_hat", $legendText="anonymous user") +AddPersonTag("customer", $sprite="osa_user_large_group", $legendText="aggregated user") +AddPersonTag("admin", $sprite="osa_user_audit,color=red", $legendSprite="osa_user_audit,scale=0.25,color=red", $legendText="administration user") + +AddContainerTag("webApp", $sprite="application_server", $legendText="web application") + +AddContainerTag("db", $sprite="database_server", $legendText="database container") +AddContainerTag("files", $sprite="file_server", $legendText="file server container") + +AddContainerTag("conApp", $sprite="service_application", $legendText="console application") + +AddRelTag("firewall", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="firewall,scale=0.3,color=red", $legendText="firewall") + + +Person_Ext(anonymous_user, "Bob", $tags="anonymous_ext") +Person(aggregated_user, "Sam, Ivone", $tags="customer") +Person(administration_user, "Bernd", $tags="admin") + +System_Boundary(c1, "techtribes.js"){ + + Container(web_app, "Web Application", "Java, Spring MVC, Tomcat 7.x", "Allows users to view people, tribes, content, events, jobs, etc. from the local tech, digital and IT sector", $tags="webApp") + + ContainerDb(rel_db, "Relational Database", "MySQL 5.5.x", "Stores people, tribes, tribe membership, talks, events, jobs, badges, GitHub repos, etc.", $tags="db") + + Container(filesystem, "File System", "FAT32", "Stores search indexes", $tags="files") + + ContainerDb(nosql, "NoSQL Data Store", "MongoDB 2.2.x", "Stores from RSS/Atom feeds (blog posts) and tweets", $tags="db") + + Container(updater, "Updater", "Java 7 Console App", "Updates profiles, tweets, GitHub repos and content on a scheduled basis", $tags="conApp") +} + +System_Ext(twitter, "Twitter") +System_Ext(github, "GitHub") +System_Ext(blogs, "Blogs") + + +Rel(anonymous_user, web_app, "Uses", "HTTPS", $tags="firewall") +Rel(aggregated_user, web_app, "Uses", "HTTPS", $tags="firewall") +Rel(administration_user, web_app, "Uses", "HTTPS", $tags="firewall") + +Rel(web_app, rel_db, "Reads from and writes to", "SQL/JDBC, port 3306") +Rel(web_app, filesystem, "Reads from") +Rel(web_app, nosql, "Reads from", "MongoDB wire protocol, port 27017") + +Rel_U(updater, rel_db, "Reads from and writes data to", "SQL/JDBC, port 3306") +Rel_U(updater, filesystem, "Writes to") +Rel_U(updater, nosql, "Reads from and writes to", "MongoDB wire protocol, port 27017") + +Rel(updater, twitter, "Gets profile information and tweets from", "HTTPS") +Rel(updater, github, "Gets information about public code repositories from", "HTTPS") +Rel(updater, blogs, "Gets content using RSS and Atom feeds from", "HTTP") + +Lay_R(rel_db, filesystem) + +SHOW_LEGEND() +@enduml \ No newline at end of file From 9029269285f8bcf284da559862ecdb83512269a4 Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Sat, 7 Aug 2021 22:01:23 +0200 Subject: [PATCH 6/7] Legend supports sprites and custom text (5 - fix OpenIconic and add image support) --- C4.puml | 56 ++++++++++++++++++++++--------------- C4_Component.puml | 4 +-- C4_Container.puml | 4 +-- C4_Context.puml | 8 +++--- C4_Deployment.puml | 6 ++-- README.md | 6 ++-- percy/TestLegendSprite.puml | 21 ++++++-------- 7 files changed, 56 insertions(+), 49 deletions(-) diff --git a/C4.puml b/C4.puml index c6d71ac5..c4d26f37 100644 --- a/C4.puml +++ b/C4.puml @@ -400,6 +400,33 @@ $elementSkin !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 @@ -446,7 +473,7 @@ $elementSkin !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + "" !if ($legendSprite != "") - !$tagEntry = $tagEntry + "<$"+$legendSprite+"> " + !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " !endif !if ($legendText == "") !$tagEntry = $tagEntry + " " + $tagStereo + " " @@ -505,7 +532,7 @@ $elementSkin !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + "" !if ($legendSprite != "") - !$tagEntry = $tagEntry + "<$"+$legendSprite+"> " + !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " !endif !if ($legendText == "") !$tagEntry = $tagEntry + " " + $tagStereo + " " @@ -610,13 +637,7 @@ $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $s !if ($sprite!="") %set_variable_value("$" + $tagStereo + "ElementTagSprite", $sprite) !if ($legendSprite == "") - ' ,scale= ... has to be first (...,color=black,scale=0.25... is invalid too) - !if (%strpos($sprite, "=") < 0) - ' element symbols typically 4 times too big - !$legendSprite = $sprite + ",scale=0.25" - !else - !$legendSprite = $sprite - !endif + !$legendSprite = $smallVersionSprite($sprite) !endif !endif $addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) @@ -641,13 +662,7 @@ $defineSkinparams($elementName, $bgColor, $fontColor, $borderColor, $shadowing, !if ($sprite!="") %set_variable_value("$" + $elementName + "ElementTagSprite", $sprite) !if ($legendSprite == "") - ' ,scale= ... has to be first (...,color=black,scale=0.25... is invalid too) - !if (%strpos($sprite, "=") < 0) - ' element symbols typically 4 times too big - !$legendSprite = $sprite + ",scale=0.25" - !else - !$legendSprite = $sprite - !endif + !$legendSprite = $smallVersionSprite($sprite) !endif !endif !$tagEntry = $tagLegendEntry($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) @@ -921,13 +936,8 @@ rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias !endif !$rel = $rel + ' : ' !if ($sprite != "") - ' if it starts with & it's a OpenIconic, details see https://useiconic.com/open/ - !if (%substr($sprite, 0, 1) != "&") - !$rel = $rel + '<$'+$sprite+'> ' - !else - !$rel = $rel + '<'+$sprite+'> ' - !endif - !endif + !$rel = $rel + $getSprite($sprite) + ' ' + !endif !if ($link != "") !$rel = $rel + '**[[' + $link + ' ' + $label + ']]**' !else diff --git a/C4_Component.puml b/C4_Component.puml index 4aeb4711..2199b2fa 100644 --- a/C4_Component.puml +++ b/C4_Component.puml @@ -62,13 +62,13 @@ endlegend !return '=='+$label+'\n//['+$techn+']//' !endif !if ($descr == "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n//['+$techn+']//' +!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//' !endif !if ($descr != "") && ($sprite == "") !return '=='+$label+'\n//['+$techn+']//\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n//['+$techn+']//\n\n '+$descr +!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//\n\n '+$descr !endif !endfunction diff --git a/C4_Container.puml b/C4_Container.puml index ee433dd9..3c8304cb 100644 --- a/C4_Container.puml +++ b/C4_Container.puml @@ -57,13 +57,13 @@ endlegend !return '=='+$label+'\n//['+$techn+']//' !endif !if ($descr == "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n//['+$techn+']//' +!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//' !endif !if ($descr != "") && ($sprite == "") !return '=='+$label+'\n//['+$techn+']//\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n//['+$techn+']//\n\n '+$descr +!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//\n\n '+$descr !endif !endfunction diff --git a/C4_Context.puml b/C4_Context.puml index df750fef..fbd525e1 100644 --- a/C4_Context.puml +++ b/C4_Context.puml @@ -203,13 +203,13 @@ endlegend !return '=='+$label !endif !if ($descr == "") && ($sprite != "") - !return '<$'+$sprite+'>\n=='+$label + !return $getSprite($sprite)+'\n=='+$label !endif !if ($descr != "") && ($sprite == "") !return '=='+$label+'\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") - !return '<$'+$sprite+'>\n=='+$label+'\n\n '+$descr + !return $getSprite($sprite)+'\n=='+$label+'\n\n '+$descr !endif !endfunction @@ -218,13 +218,13 @@ endlegend !return '=='+$label !endif !if ($descr == "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label +!return $getSprite($sprite)+'\n=='+$label !endif !if ($descr != "") && ($sprite == "") !return '=='+$label+'\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n\n '+$descr +!return $getSprite($sprite)+'\n=='+$label+'\n\n '+$descr !endif !endfunction diff --git a/C4_Deployment.puml b/C4_Deployment.puml index 473ae80c..dc70b8fe 100644 --- a/C4_Deployment.puml +++ b/C4_Deployment.puml @@ -85,7 +85,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !function $getNode($label, $type, $descr, $sprite) !$nodeText = "" !if ($sprite != "") - !$nodeText = $nodeText + '<$'+$sprite+'>\n' + !$nodeText = $nodeText + $getSprite($sprite) + '\n' !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") @@ -100,7 +100,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !function $getNode_L($label, $type, $descr, $sprite) !$nodeText = "" !if ($sprite != "") - !$nodeText = $nodeText + '<$'+$sprite+'>\l' + !$nodeText = $nodeText + $getSprite($sprite) + '\l' !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") @@ -115,7 +115,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !function $getNode_R($label, $type, $descr, $sprite) !$nodeText = "" !if ($sprite != "") - !$nodeText = $nodeText + '<$'+$sprite+'>\r' + !$nodeText = $nodeText + $getSprite($sprite) + '\r' !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") diff --git a/README.md b/README.md index 2c1e13bf..0fd508e8 100644 --- a/README.md +++ b/README.md @@ -394,11 +394,11 @@ Multiple tags can be combined with `+`, like `Container(api, "API", $tags="v1.0+ **Element specific tag definitions** Sometimes an added element tag is element specific and all element specific colors should be used, e.g. a specific user role should be defined as element tag with the specific colors `...PERSON_...` like -```plantuml +```csharp AddElementTag("admin", $fontColor=$ELEMENT_FONT_COLOR, $bgColor=$PERSON_BG_COLOR, $borderColor=$PERSON_BORDER_COLOR, $sprite="osa_user_audit", $legendText="administration user") ``` Therefore element Add...Tag() shortcuts are added which use the specific colors as default values and the call can be simplified like -```plantuml +```csharp AddPersonTag("admin", $sprite="osa_user_audit", $legendText="administration user") ``` @@ -472,7 +472,7 @@ SHOW_LEGEND(false) **Sample with tag dependent sprites and custom legend text** -```plantuml +```csharp @startuml !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml diff --git a/percy/TestLegendSprite.puml b/percy/TestLegendSprite.puml index 10e32101..d3969d5d 100644 --- a/percy/TestLegendSprite.puml +++ b/percy/TestLegendSprite.puml @@ -9,6 +9,7 @@ !define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master !include osaPuml/Common.puml !include osaPuml/User/all.puml +!include osaPuml/Server/all.puml !include !include @@ -25,25 +26,22 @@ AddContainerTag("webApp", $sprite="application_server", $legendText="web applica AddContainerTag("db", $sprite="database_server", $legendText="database container") AddContainerTag("files", $sprite="file_server", $legendText="file server container") -AddContainerTag("conApp", $sprite="service_application", $legendText="console application") +AddContainerTag("conApp", $sprite="img:http://plantuml.com/logo3.png{scale=0.3}", $legendSprite="img:http://plantuml.com/logo3.png{scale=0.1}", $legendText="console application") -AddRelTag("firewall", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="firewall,scale=0.3,color=red", $legendText="firewall") +UpdateElementStyle("external_system", $bgColor=$EXTERNAL_SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_SYSTEM_BORDER_COLOR, $sprite = "osa_server", , $legendText="external system") +AddRelTag("firewall", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="&envelope-closed", $legendText="firewall") +AddRelTag("plantuml", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="img:http://plantuml.com/logo3.png{scale=0.1}", $legendText="console triggered") Person_Ext(anonymous_user, "Bob", $tags="anonymous_ext") Person(aggregated_user, "Sam, Ivone", $tags="customer") Person(administration_user, "Bernd", $tags="admin") System_Boundary(c1, "techtribes.js"){ - Container(web_app, "Web Application", "Java, Spring MVC, Tomcat 7.x", "Allows users to view people, tribes, content, events, jobs, etc. from the local tech, digital and IT sector", $tags="webApp") - ContainerDb(rel_db, "Relational Database", "MySQL 5.5.x", "Stores people, tribes, tribe membership, talks, events, jobs, badges, GitHub repos, etc.", $tags="db") - Container(filesystem, "File System", "FAT32", "Stores search indexes", $tags="files") - ContainerDb(nosql, "NoSQL Data Store", "MongoDB 2.2.x", "Stores from RSS/Atom feeds (blog posts) and tweets", $tags="db") - Container(updater, "Updater", "Java 7 Console App", "Updates profiles, tweets, GitHub repos and content on a scheduled basis", $tags="conApp") } @@ -51,7 +49,6 @@ System_Ext(twitter, "Twitter") System_Ext(github, "GitHub") System_Ext(blogs, "Blogs") - Rel(anonymous_user, web_app, "Uses", "HTTPS", $tags="firewall") Rel(aggregated_user, web_app, "Uses", "HTTPS", $tags="firewall") Rel(administration_user, web_app, "Uses", "HTTPS", $tags="firewall") @@ -64,11 +61,11 @@ Rel_U(updater, rel_db, "Reads from and writes data to", "SQL/JDBC, port 3306") Rel_U(updater, filesystem, "Writes to") Rel_U(updater, nosql, "Reads from and writes to", "MongoDB wire protocol, port 27017") -Rel(updater, twitter, "Gets profile information and tweets from", "HTTPS") -Rel(updater, github, "Gets information about public code repositories from", "HTTPS") -Rel(updater, blogs, "Gets content using RSS and Atom feeds from", "HTTP") +Rel(updater, twitter, "Gets profile information and tweets from", "HTTPS", $tags="plantuml") +Rel(updater, github, "Gets information about public code repositories from", "HTTPS", $tags="plantuml") +Rel(updater, blogs, "Gets content using RSS and Atom feeds from", "HTTP", $tags="plantuml") Lay_R(rel_db, filesystem) SHOW_LEGEND() -@enduml \ No newline at end of file +@enduml From 6f645d3cd26964fbfaaa0eb53ff6eb095a038578 Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Sun, 22 Aug 2021 23:05:23 +0200 Subject: [PATCH 7/7] Tags support $techn(/$type) too. --- C4.puml | 76 ++++++++++++++----------- C4_Component.puml | 38 +++++++------ C4_Container.puml | 38 +++++++------ C4_Context.puml | 24 ++++---- C4_Deployment.puml | 31 ++++++---- README.md | 42 ++++++++------ percy/TestLegendSprite.puml | 15 ++--- percy/TestTagSupportsSprite.puml | 80 ++++++++++++++++++++++++++ percy/TestTagSupportsSpriteTechn.puml | 81 +++++++++++++++++++++++++++ 9 files changed, 314 insertions(+), 111 deletions(-) create mode 100644 percy/TestTagSupportsSprite.puml create mode 100644 percy/TestTagSupportsSpriteTechn.puml diff --git a/C4.puml b/C4.puml index c4d26f37..d8e5fbbb 100644 --- a/C4.puml +++ b/C4.puml @@ -137,31 +137,32 @@ skinparam rectangle<> { !return $stereos !endfunction -!unquoted function $toRelSprite($sprite, $tags) - !if ($sprite>"") - !return $sprite +' 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 $sprite + !return $arg !endif !$brPos = %strpos($tags, "+") !while ($brPos >= 0) !$tag = %substr($tags, 0, $brPos) - !$newSprite = %get_variable_value("$" + $tag + "RelTagSprite") - !if ($newSprite>"") - !return $newSprite + !$newArg = %get_variable_value("$" + $tag + $varPostfix) + !if ($newArg>"") + !return $newArg !endif !$tags = %substr($tags, $brPos+1) !$brPos = %strpos($tags, "+") !endwhile !if (%strlen($tags)>0) - !$newSprite = %get_variable_value("$" + $tags + "RelTagSprite") - !if ($newSprite>"") - !return $newSprite + !$newArg = %get_variable_value("$" + $tags + $varPostfix) + !if ($newArg>"") + !return $newArg !endif !endif - !return $sprite + !return $arg !endfunction ' element specific (unused are hidden based on mask) @@ -203,40 +204,41 @@ skinparam rectangle<> { !return $stereos !endfunction -!unquoted function $toSprite($sprite, $elementType, $tags) - !if ($sprite>"") - !return $sprite +' 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) - !$newSprite = %get_variable_value("$" + $elementType + "ElementTagSprite") - !if ($newSprite>"") - !return $newSprite + !$newArg = %get_variable_value("$" + $elementType + $varPostfix) + !if ($newArg>"") + !return $newArg !else - !return $sprite + !return $arg !endif !endif !$brPos = %strpos($tags, "+") !while ($brPos >= 0) !$tag = %substr($tags, 0, $brPos) - !$newSprite = %get_variable_value("$" + $tag + "ElementTagSprite") - !if ($newSprite>"") - !return $newSprite + !$newArg = %get_variable_value("$" + $tag + $varPostfix) + !if ($newArg>"") + !return $newArg !endif !$tags = %substr($tags, $brPos+1) !$brPos = %strpos($tags, "+") !endwhile !if (%strlen($tags)>0) - !$newSprite = %get_variable_value("$" + $tags + "ElementTagSprite") - !if ($newSprite>"") - !return $newSprite + !$newArg = %get_variable_value("$" + $tags + $varPostfix) + !if ($newArg>"") + !return $newArg !endif - !$newSprite = %get_variable_value("$" + $elementType + "ElementTagSprite") - !if ($newSprite>"") - !return $newSprite + !$newArg = %get_variable_value("$" + $elementType + $varPostfix) + !if ($newArg>"") + !return $newArg !endif !endif - !return $sprite + !return $arg !endfunction !function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) @@ -632,7 +634,7 @@ $elementSkin !endfunction ' used by new defined tags -!unquoted procedure AddElementTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") +!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) @@ -640,11 +642,14 @@ $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $s !$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="", $legendText="", $legendSprite="") +!unquoted procedure AddRelTag($tagStereo, $textColor="", $lineColor="", $lineStyle = "", $sprite="", $techn="", $legendText="", $legendSprite="") $defineRelSkinparams($tagStereo, $textColor, $lineColor, $lineStyle) !if ($sprite!="") %set_variable_value("$" + $tagStereo + "RelTagSprite", $sprite) @@ -653,11 +658,14 @@ $defineRelSkinparams($tagStereo, $textColor, $lineColor, $lineStyle) !$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="", $legendText="", $legendSprite="") +!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) @@ -665,6 +673,9 @@ $defineSkinparams($elementName, $bgColor, $fontColor, $borderColor, $shadowing, !$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 @@ -929,7 +940,8 @@ rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias ' ################################## !function $getRel($direction, $alias1, $alias2, $label, $techn, $descr, $sprite, $tags, $link) - !$sprite = $toRelSprite($sprite, $tags) + !$sprite = $toRelArg($sprite, $tags, "RelTagSprite") + !$techn = $toRelArg($techn, $tags, "RelTagTechn") !$rel = $alias1 + ' ' + $direction + ' ' + $alias2 !if ($tags != "") !$rel = $rel + ' ' + $toStereos($tags) diff --git a/C4_Component.puml b/C4_Component.puml index 2199b2fa..d7550845 100644 --- a/C4_Component.puml +++ b/C4_Component.puml @@ -27,11 +27,11 @@ UpdateElementStyle("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COM 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="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!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="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!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 @@ -72,32 +72,38 @@ endlegend !endif !endfunction -!unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toSprite($sprite, "component", $tags) +!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=$toSprite($sprite, "component", $tags) +!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=$toSprite($sprite, "component", $tags) +!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=$toSprite($sprite, "external_component", $tags) +!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=$toSprite($sprite, "external_component", $tags) +!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=$toSprite($sprite, "external_component", $tags) +!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/C4_Container.puml b/C4_Container.puml index 3c8304cb..b020232b 100644 --- a/C4_Container.puml +++ b/C4_Container.puml @@ -24,11 +24,11 @@ UpdateElementStyle("container", $CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $CONTA UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR) ' shortcuts with default colors -!unquoted procedure AddContainerTag($tagStereo, $bgColor=$CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!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="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +!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 ' Layout @@ -67,33 +67,39 @@ endlegend !endif !endfunction -!unquoted procedure Container($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toSprite($sprite, "container", $tags) +!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=$toSprite($sprite, "container", $tags) +!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=$toSprite($sprite, "container", $tags) +!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=$toSprite($sprite, "external_container", $tags) +!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=$toSprite($sprite, "external_container", $tags) +!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=$toSprite($sprite, "external_container", $tags) +!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 diff --git a/C4_Context.puml b/C4_Context.puml index fbd525e1..8ae6b85a 100644 --- a/C4_Context.puml +++ b/C4_Context.puml @@ -32,16 +32,16 @@ UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_C ' 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) + 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) + 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) + 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) + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) !endprocedure ' Sprites @@ -229,7 +229,7 @@ endlegend !endfunction !unquoted procedure Person($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toSprite($sprite, "person", $tags) +!$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 == "") @@ -240,7 +240,7 @@ rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", !endprocedure !unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toSprite($sprite, "external_person", $tags) +!$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 == "") @@ -251,32 +251,32 @@ rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_ !endprocedure !unquoted procedure System($alias, $label, $descr="", $sprite="", $tags="", $link="") -!$sprite=$toSprite($sprite, "system", $tags) +!$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=$toSprite($sprite, "external_system", $tags) +!$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=$toSprite($sprite, "system", $tags) +!$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=$toSprite($sprite, "system", $tags) +!$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=$toSprite($sprite, "external_system", $tags) +!$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=$toSprite($sprite, "external_system", $tags) +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure diff --git a/C4_Deployment.puml b/C4_Deployment.puml index dc70b8fe..d4f31764 100644 --- a/C4_Deployment.puml +++ b/C4_Deployment.puml @@ -15,16 +15,15 @@ ' Styling ' ################################## -' orig was without background -'UpdateElementStyle("node", $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR) UpdateElementStyle("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR) skinparam rectangle<> { FontStyle normal } ' shortcuts with default colors -!unquoted procedure AddNodeTag($tagStereo, $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") - AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $legendText, $legendSprite) +' 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 @@ -128,31 +127,43 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endfunction !unquoted procedure Deployment_Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") -!$sprite=$toSprite($sprite, "node", $tags) +!$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=$toSprite($sprite, "node", $tags) +!$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=$toSprite($sprite, "node", $tags) +!$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=$toSprite($sprite, "node", $tags) +!$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=$toSprite($sprite, "node", $tags) +!$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=$toSprite($sprite, "node", $tags) +!$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/README.md b/README.md index 0fd508e8..09f8699c 100644 --- a/README.md +++ b/README.md @@ -158,14 +158,16 @@ SHOW_LEGEND() ## Supported Diagram Types -Diagram types +> * `arg`.. argument required (e.g. `alias`) +> * `?arg`.. argument optional (e.g. `?descr`) +> * `*techn` .. technology argument is required, but if the technology is defined via $tags then no `techn` argument is required * System Context & System Landscape diagrams * Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml` * Macros: - * `Person(alias, label, ?description, ?sprite, ?tags, $link)` + * `Person(alias, label, ?descr, ?sprite, ?tags, $link)` * `Person_Ext` - * `System(alias, label, ?description, ?sprite, ?tags, $link)` + * `System(alias, label, ?descr, ?sprite, ?tags, $link)` * `SystemDb` * `SystemQueue` * `System_Ext` @@ -174,25 +176,28 @@ Diagram types * `Boundary(alias, label, ?type, ?tags, $link)` * `Enterprise_Boundary(alias, label, ?tags, $link)` * `System_Boundary` + * Container diagram * Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml` * Additional Macros: - * `Container(alias, label, technology, ?description, ?sprite, ?tags, $link)` + * `Container(alias, label, *techn, ?descr, ?sprite, ?tags, $link)` * `ContainerDb` * `ContainerQueue` * `Container_Ext` * `ContainerDb_Ext` * `ContainerQueue_Ext` * `Container_Boundary(alias, label, ?tags, $link)` + * Component diagram * Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml` * Additional Macros: - * `Component(alias, label, technology, ?description, ?sprite, ?tags, $link)` + * `Component(alias, label, *techn, ?descr, ?sprite, ?tags, $link)` * `ComponentDb` * `ComponentQueue` * `Component_Ext` * `ComponentDb_Ext` * `ComponentQueue_Ext` + * Dynamic diagram * Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Dynamic.puml` * Additional Macros: @@ -208,16 +213,16 @@ Diagram types * Deployment diagram * Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml` * Additional Macros: - * `Deployment_Node(alias, label, ?type, ?description, ?sprite, ?tags, $link)` - * `Node(alias, label, ?type, ?description, ?sprite, ?tags, $link)`: short name of Deployment_Node() - * `Node_L(alias, label, ?type, ?description, ?sprite, ?tags, $link)`: left aligned Node() - * `Node_R(alias, label, ?type, ?description, ?sprite, ?tags, $link)`: right aligned Node() + * `Deployment_Node(alias, label, ?type, ?descr, ?sprite, ?tags, $link)` + * `Node(alias, label, ?type, ?descr, ?sprite, ?tags, $link)`: short name of Deployment_Node() + * `Node_L(alias, label, ?type, ?descr, ?sprite, ?tags, $link)`: left aligned Node() + * `Node_R(alias, label, ?type, ?descr, ?sprite, ?tags, $link)`: right aligned Node() Take a look at each of the [C4 Model Diagram Samples](samples/C4CoreDiagrams.md). ## Relationship Types -* `Rel(from, to, label, ?technology, ?description, ?sprite, ?tags, $link)` +* `Rel(from, to, label, ?techn, ?descr, ?sprite, ?tags, $link)` * `BiRel` (bidirectional relationship) You can force the direction of a relationship by using: @@ -374,11 +379,11 @@ C4-PlantUML also comes with some person sprite/portrait options: Additional tags/stereotypes can be added to the existing element stereotypes (component, ...) and highlight,... specific aspects: -* `AddElementTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)`: +* `AddElementTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite)`: Introduces a new element tag. The styles of the tagged elements are updated and the tag is displayed in the calculated legend. -* `AddRelTag(tagStereo, ?textColor, ?lineColor, ?lineStyle, ?sprite, ?legendText, ?legendSprite)`: +* `AddRelTag(tagStereo, ?textColor, ?lineColor, ?lineStyle, ?sprite, ?techn, ?legendText, ?legendSprite)`: Introduces a new relation tag. The styles of the tagged relations are updated and the tag is displayed in the calculated legend. -* `UpdateElementStyle(elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)`: +* `UpdateElementStyle(elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite)`: This call updates the default style of the elements (component, ...) and creates no additional legend entry. * `UpdateRelStyle(textColor, lineColor)`: This call updates the default relationship colors and creates no additional legend entry. @@ -407,11 +412,12 @@ Following calls introduces new element tags with element specific default colors * `AddExternalPersonTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` * `AddSystemTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` * `AddExternalSystemTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` -* `AddComponentTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` -* `AddExternalComponentTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` -* `AddContainerTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` -* `AddExternalContainerTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` -* `AddNodeTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?legendText, ?legendSprite)` +* `AddComponentTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite)` +* `AddExternalComponentTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite)` +* `AddContainerTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite)` +* `AddExternalContainerTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?techn, ?sprite, ?legendText, ?legendSprite)` +* `AddNodeTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite)` + (node specific: $type reuses $techn definition of $tags) **Comments** diff --git a/percy/TestLegendSprite.puml b/percy/TestLegendSprite.puml index d3969d5d..59fbac63 100644 --- a/percy/TestLegendSprite.puml +++ b/percy/TestLegendSprite.puml @@ -23,14 +23,15 @@ AddPersonTag("admin", $sprite="osa_user_audit,color=red", $legendSprite="osa_use AddContainerTag("webApp", $sprite="application_server", $legendText="web application") -AddContainerTag("db", $sprite="database_server", $legendText="database container") +AddContainerTag("mysql_db", $sprite="database_server", $techn="MySQL 5.5.x", $legendText="MySQL database container") +AddContainerTag("mongo_db", $sprite="database_server", $techn="MongoDB 2.2.x", $legendText="MongoDb database container") AddContainerTag("files", $sprite="file_server", $legendText="file server container") AddContainerTag("conApp", $sprite="img:http://plantuml.com/logo3.png{scale=0.3}", $legendSprite="img:http://plantuml.com/logo3.png{scale=0.1}", $legendText="console application") UpdateElementStyle("external_system", $bgColor=$EXTERNAL_SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_SYSTEM_BORDER_COLOR, $sprite = "osa_server", , $legendText="external system") -AddRelTag("firewall", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="&envelope-closed", $legendText="firewall") +AddRelTag("firewall", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="&envelope-closed", $techn="HTTPS", $legendText="firewall") AddRelTag("plantuml", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="img:http://plantuml.com/logo3.png{scale=0.1}", $legendText="console triggered") Person_Ext(anonymous_user, "Bob", $tags="anonymous_ext") @@ -39,9 +40,9 @@ Person(administration_user, "Bernd", $tags="admin") System_Boundary(c1, "techtribes.js"){ Container(web_app, "Web Application", "Java, Spring MVC, Tomcat 7.x", "Allows users to view people, tribes, content, events, jobs, etc. from the local tech, digital and IT sector", $tags="webApp") - ContainerDb(rel_db, "Relational Database", "MySQL 5.5.x", "Stores people, tribes, tribe membership, talks, events, jobs, badges, GitHub repos, etc.", $tags="db") + ContainerDb(rel_db, "Relational Database", "", "Stores people, tribes, tribe membership, talks, events, jobs, badges, GitHub repos, etc.", $tags="mysql_db") Container(filesystem, "File System", "FAT32", "Stores search indexes", $tags="files") - ContainerDb(nosql, "NoSQL Data Store", "MongoDB 2.2.x", "Stores from RSS/Atom feeds (blog posts) and tweets", $tags="db") + ContainerDb(nosql, "NoSQL Data Store", $descr = "Stores from RSS/Atom feeds (blog posts) and tweets", $tags="mongo_db") Container(updater, "Updater", "Java 7 Console App", "Updates profiles, tweets, GitHub repos and content on a scheduled basis", $tags="conApp") } @@ -49,9 +50,9 @@ System_Ext(twitter, "Twitter") System_Ext(github, "GitHub") System_Ext(blogs, "Blogs") -Rel(anonymous_user, web_app, "Uses", "HTTPS", $tags="firewall") -Rel(aggregated_user, web_app, "Uses", "HTTPS", $tags="firewall") -Rel(administration_user, web_app, "Uses", "HTTPS", $tags="firewall") +Rel(anonymous_user, web_app, "Uses", $descr="description", $tags="firewall") +Rel(aggregated_user, web_app, "Uses", "techn", "description", $tags="firewall") +Rel(administration_user, web_app, "Uses", "", "description", $tags="firewall") Rel(web_app, rel_db, "Reads from and writes to", "SQL/JDBC, port 3306") Rel(web_app, filesystem, "Reads from") diff --git a/percy/TestTagSupportsSprite.puml b/percy/TestTagSupportsSprite.puml new file mode 100644 index 00000000..59a32800 --- /dev/null +++ b/percy/TestTagSupportsSprite.puml @@ -0,0 +1,80 @@ +@startuml +' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally +!if %variable_exists("RELATIVE_INCLUDE") + !include ./../C4_Component.puml +!else + !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml +!endif + +!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master +!include osaPuml/Common.puml +!include osaPuml/User/all.puml +!include osaPuml/Server/all.puml + +!include +!include +!include +!include +!include + +!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons +!include DEVICONS/mysql.puml +!include DEVICONS/mongodb.puml + +AddExternalPersonTag("anonymous_ext", $sprite="osa_user_black_hat", $legendText="anonymous user") +AddPersonTag("customer", $sprite="osa_user_large_group", $legendText="aggregated user") +AddPersonTag("admin", $sprite="osa_user_audit,color=red", $legendSprite="osa_user_audit,scale=0.25,color=red", $legendText="administration user") + +AddContainerTag("webApp", $sprite="application_server", $legendText="web application") + +AddContainerTag("mongo_db", $sprite="mongodb", $legendText="MongoDB container") +AddContainerTag("mysql_db", $sprite="mysql", $legendText="MySQL container") +AddContainerTag("files", $sprite="file_server", $legendText="file server container") + +AddContainerTag("conApp", $sprite="img:http://plantuml.com/logo3.png{scale=0.3}", $legendSprite="img:http://plantuml.com/logo3.png{scale=0.1}", $legendText="console application") + +UpdateElementStyle("external_system", $bgColor=$EXTERNAL_SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_SYSTEM_BORDER_COLOR, $sprite = "osa_server", , $legendText="external system") + +AddRelTag("firewall", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="firewall,scale=0.3,color=red", $legendText="firewall") +AddRelTag("plantuml", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $sprite="img:http://plantuml.com/logo3.png{scale=0.1}", $legendText="console triggered") + +LAYOUT_LEFT_RIGHT() +' LAYOUT_LANDSCAPE() + +Person_Ext(anonymous_user, "Bob", $tags="anonymous_ext") +Person(aggregated_user, "Sam, Ivone", $tags="customer") +Person(administration_user, "Bernd", $tags="admin") + +System_Boundary(c1, "techtribes.js"){ + Container(web_app, "Web Application", "Java, Spring MVC, Tomcat 7.x", "Allows users to view people, tribes, content, events, jobs, etc. from the local tech, digital and IT sector", $tags="webApp") + ContainerDb(rel_db, "Relational Database", "MySQL 5.5.x", "Stores people, tribes, tribe membership, talks, events, jobs, badges, GitHub repos, etc.", $tags="mysql_db") + Container(filesystem, "File System", "FAT32", "Stores search indexes", $tags="files") + ContainerDb(nosql, "NoSQL Data Store", "MongoDB 2.2.x", "Stores from RSS/Atom feeds (blog posts) and tweets", $tags="mongo_db") + Container(updater, "Updater", "Java 7 Console App", "Updates profiles, tweets, GitHub repos and content on a scheduled basis", $tags="conApp") +} + +System_Ext(twitter, "Twitter") +System_Ext(github, "GitHub") +System_Ext(blogs, "Blogs") + +Rel(anonymous_user, web_app, "Uses", "HTTPS", $tags="firewall") +Rel(aggregated_user, web_app, "Uses", "HTTPS", $tags="firewall") +Rel(administration_user, web_app, "Uses", "HTTPS", $tags="firewall") + +Rel(web_app, rel_db, "Reads from and writes to", "SQL/JDBC, port 3306") +Rel(web_app, filesystem, "Reads from") +Rel(web_app, nosql, "Reads from", "MongoDB wire protocol, port 27017") + +Rel_U(updater, rel_db, "Reads from and writes data to", "SQL/JDBC, port 3306") +Rel_U(updater, filesystem, "Writes to") +Rel_U(updater, nosql, "Reads from and writes to", "MongoDB wire protocol, port 27017") + +Rel(updater, twitter, "Gets profile information and tweets from", "HTTPS", $tags="plantuml") +Rel(updater, github, "Gets information about public code repositories from", "HTTPS", $tags="plantuml") +Rel(updater, blogs, "Gets content using RSS and Atom feeds from", "HTTP", $tags="plantuml") + +' Lay_R(rel_db, filesystem) + +' HIDE_STEREOTYPE() +SHOW_LEGEND() +@enduml diff --git a/percy/TestTagSupportsSpriteTechn.puml b/percy/TestTagSupportsSpriteTechn.puml new file mode 100644 index 00000000..9951f0e1 --- /dev/null +++ b/percy/TestTagSupportsSpriteTechn.puml @@ -0,0 +1,81 @@ +@startuml +' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally +!if %variable_exists("RELATIVE_INCLUDE") + !include ./../C4_Component.puml +!else + !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml +!endif + +!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master +!include osaPuml/Common.puml +!include osaPuml/User/all.puml +!include osaPuml/Server/all.puml + +!include +!include +!include +!include +!include + +!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons +!include DEVICONS/mysql.puml +!include DEVICONS/mongodb.puml + +AddExternalPersonTag("anonymous_ext", $sprite="osa_user_black_hat", $legendText="anonymous user") +AddPersonTag("customer", $sprite="osa_user_large_group", $legendText="aggregated user") +AddPersonTag("admin", $sprite="osa_user_audit,color=red", $legendSprite="osa_user_audit,scale=0.25,color=red", $legendText="administration user") + +AddContainerTag("webApp", $sprite="application_server", $legendText="web application") + +AddContainerTag("mongo_db", $techn = "MongoDB 2.2.x", $sprite="mongodb", $legendText="MongoDB container") +AddContainerTag("mysql_db", $techn="MySQL 5.5.x", $sprite="mysql", $legendText="MySQL container") +AddContainerTag("files", $sprite="file_server", $legendText="file server container") + +AddContainerTag("conApp", $sprite="img:http://plantuml.com/logo3.png{scale=0.3}", $legendSprite="img:http://plantuml.com/logo3.png{scale=0.1}", $legendText="console application") + +UpdateElementStyle("external_system", $bgColor=$EXTERNAL_SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_SYSTEM_BORDER_COLOR, $sprite = "osa_server", , $legendText="external system") + +AddRelTag("firewall", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $techn="HTTPS", $sprite="firewall,scale=0.3,color=red", $legendText="firewall") +AddRelTag("plantuml", $textColor="$ARROW_COLOR", $lineColor="$ARROW_COLOR", $techn="HTTPS", $sprite="img:http://plantuml.com/logo3.png{scale=0.1}", $legendText="console triggered") + +LAYOUT_LEFT_RIGHT() +' LAYOUT_LANDSCAPE() + +Person_Ext(anonymous_user, "Bob", $tags="anonymous_ext") +Person(aggregated_user, "Sam, Ivone", $tags="customer") +Person(administration_user, "Bernd", $tags="admin") + +System_Boundary(c1, "techtribes.js"){ + Container(web_app, "Web Application", "Java, Spring MVC, Tomcat 7.x", "Allows users to view people, tribes, content, events, jobs, etc. from the local tech, digital and IT sector", $tags="webApp") + ContainerDb(rel_db, "Relational Database", $tags="mysql_db", $descr = "Stores people, tribes, tribe membership, talks, events, jobs, badges, GitHub repos, etc.") + Container(filesystem, "File System", "FAT32", "Stores search indexes", $tags="files") + ContainerDb(nosql, "NoSQL Data Store", $tags="mongo_db", $descr = "Stores from RSS/Atom feeds (blog posts) and tweets") + Container(updater, "Updater", "Java 7 Console App", "Updates profiles, tweets, GitHub repos and content on a scheduled basis", $tags="conApp") +} + +System_Ext(twitter, "Twitter") +System_Ext(github, "GitHub") +System_Ext(blogs, "Blogs") + +Rel(anonymous_user, web_app, "Uses", $tags="firewall") +Rel(aggregated_user, web_app, "Uses", $tags="firewall") +Rel(administration_user, web_app, "Uses", $tags="firewall") + +Rel(web_app, rel_db, "Reads from and writes to", "SQL/JDBC, port 3306") +Rel(web_app, filesystem, "Reads from") +Rel(web_app, nosql, "Reads from", "MongoDB wire protocol, port 27017") + +Rel_U(updater, rel_db, "Reads from and writes data to", "SQL/JDBC, port 3306") +Rel_U(updater, filesystem, "Writes to") +Rel_U(updater, nosql, "Reads from and writes to", "MongoDB wire protocol, port 27017") + +Rel(updater, twitter, "Gets profile information and tweets from", $tags="plantuml") +Rel(updater, github, "Gets information about public code repositories from", $tags="plantuml") +' don't use the default techn. "HTTPS" which is defined via tags, define techn "HTTP" too +Rel(updater, blogs, "Gets content using RSS and Atom feeds from", "HTTP", $tags="plantuml") + +' Lay_R(rel_db, filesystem) + +' HIDE_STEREOTYPE() +SHOW_LEGEND() +@enduml