diff --git a/C4.puml b/C4.puml index 146acde1..3f824160 100644 --- a/C4.puml +++ b/C4.puml @@ -143,13 +143,41 @@ skinparam rectangle<> { !$tags = %substr($tags, $brPos+1) !$brPos = %strpos($tags, "+") !endwhile - !if (%strlen($tags)>0) + !if (%strlen($tags) > 0) !$stereos = $stereos + '<<' + $tags + '>>' %set_variable_value("$" + $tags + "_LineLegend", %true()) !endif !return $stereos !endfunction +' if $sprite/$techn is an empty argument, try to calculate it via the defined $tag +!unquoted function $toRelArg($arg, $tags, $varPostfix) + !if ($arg > "") + !return $arg + !endif + + !if (%strlen($tags) == 0) + !return $arg + !endif + !$brPos = %strpos($tags, "+") + !while ($brPos >= 0) + !$tag = %substr($tags, 0, $brPos) + !$newArg = %get_variable_value("$" + $tag + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !$tags = %substr($tags, $brPos+1) + !$brPos = %strpos($tags, "+") + !endwhile + !if (%strlen($tags) > 0) + !$newArg = %get_variable_value("$" + $tags + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !endif + !return $arg +!endfunction + ' element specific (unused are hidden based on mask) !unquoted function $toStereos($elementType, $tags) !if (%strlen($tags) == 0) @@ -171,7 +199,7 @@ skinparam rectangle<> { !$tags = %substr($tags, $brPos+1) !$brPos = %strpos($tags, "+") !endwhile - !if (%strlen($tags)>0) + !if (%strlen($tags) > 0) !$stereos = $stereos + '<<' + $tags + '>>' !$mergedMask = $combineMaskWithTag($mask, $tags) !if ($mergedMask != $mask) @@ -189,18 +217,55 @@ skinparam rectangle<> { !return $stereos !endfunction +' if $sprite/$techn is an empty argument, try to calculate it via the defined $tag +!unquoted function $toElementArg($arg, $tags, $varPostfix, $elementType) + !if ($arg > "") + !return $arg + !endif + + !if (%strlen($tags) == 0) + !$newArg = %get_variable_value("$" + $elementType + $varPostfix) + !if ($newArg > "") + !return $newArg + !else + !return $arg + !endif + !endif + !$brPos = %strpos($tags, "+") + !while ($brPos >= 0) + !$tag = %substr($tags, 0, $brPos) + !$newArg = %get_variable_value("$" + $tag + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !$tags = %substr($tags, $brPos+1) + !$brPos = %strpos($tags, "+") + !endwhile + !if (%strlen($tags) > 0) + !$newArg = %get_variable_value("$" + $tags + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !$newArg = %get_variable_value("$" + $elementType + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !endif + !return $arg +!endfunction + !function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - !$elementSkin = "skinparam " + $element +"<<" + $tagStereo + ">> {" + %newline() - !if ($fontColor!="") + !$elementSkin = "skinparam " + $element + "<<" + $tagStereo + ">> {" + %newline() + !if ($fontColor != "") !if ($tagStereo != "boundary") !$elementSkin = $elementSkin + " StereotypeFontColor " + $fontColor + %newline() !endif !$elementSkin = $elementSkin + " FontColor " + $fontColor + %newline() !endif - !if ($bgColor!="") + !if ($bgColor != "") !$elementSkin = $elementSkin + " BackgroundColor " + $bgColor + %newline() !endif - !if ($borderColor!="") + !if ($borderColor != "") !$elementSkin = $elementSkin + " BorderColor " + $borderColor+ %newline() !endif !if ($shadowing == "true") @@ -210,7 +275,7 @@ skinparam rectangle<> { !$elementSkin = $elementSkin + " Shadowing<<" + $tagStereo + ">> " + "false" + %newline() !endif ' only rectangle supports shape(d corners), define both skinparam that overlays are working - !if ($shape!="" && $element == "rectangle") + !if ($shape != "" && $element == "rectangle") !if ($shape == $ROUNDED_BOX) !$elementSkin = $elementSkin + " RoundCorner " + $ROUNDED_BOX_SIZE+ %newline() !$elementSkin = $elementSkin + " DiagonalCorner " + "0" + %newline() @@ -231,7 +296,7 @@ skinparam rectangle<> { ' actor has style awesome, therefore $fontColor is ignored and text uses $bgColor too !$tagSkin = $tagSkin + $elementTagSkinparams("actor", $tagStereo, $bgColor, $bgColor, $borderColor, $shadowing, "") !$tagSkin = $tagSkin + $elementTagSkinparams("person", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, "") - !if ($tagStereo == "boundary" && $bgColor!="") + !if ($tagStereo == "boundary" && $bgColor != "") !$tagSkin = $tagSkin + "skinparam package<>StereotypeFontColor " + $bgColor + %newline() !$tagSkin = $tagSkin + "skinparam rectangle<>StereotypeFontColor " + $bgColor + %newline() !endif @@ -249,13 +314,13 @@ $tagSkin !unquoted procedure $defineRelSkinparams($tagStereo, $textColor, $lineColor, $lineStyle) !$elementSkin = "skinparam arrow<<" + $tagStereo + ">> {" + %newline() !$elementSkin = $elementSkin + " Color " - !if ($lineColor!="") + !if ($lineColor != "") !$elementSkin = $elementSkin + $colorWithoutHash($lineColor) !endif - !if ($textColor!="") + !if ($textColor != "") !$elementSkin = $elementSkin + ";text:" + $colorWithoutHash($textColor) !endif - !if ($lineStyle!="") + !if ($lineStyle != "") !$elementSkin = $elementSkin + ";line." + $lineStyle !endif !$elementSkin = $elementSkin + %newline() @@ -263,7 +328,7 @@ $tagSkin $elementSkin !endprocedure -' %is_dark() requires PlantUML version >=1.2021.6 +' %is_dark() requires PlantUML version >= 1.2021.6 !if (%function_exists("%is_dark")) !$PlantUMLSupportsDynamicLegendColor = %true() !else @@ -313,18 +378,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) @@ -334,12 +400,13 @@ $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 !function $combineMaskWithTag($mask1, $tag) !$mask2 = %get_variable_value("$" + $tag+ "LegendMask") - !if ($mask2=="") + !if ($mask2 == "") ' !log combineMaskWithTag $mask1, $tag, ... only $mask1 !return $mask1 !endif @@ -348,7 +415,34 @@ $elementSkin !return $combineMasks($mask1, $mask2) !endfunction -!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) +' element symbols typically 4 times too big in legend +!function $smallVersionSprite($sprite) + ' ,scale= ... has to be first (...,color=black,scale=0.25... is invalid too) + !if (%strpos($sprite, "=") < 0) + !if (%substr($sprite, 0, 4) == "img:") + !$smallSprite = $sprite + "{scale=0.25}" + !else + !$smallSprite = $sprite + ",scale=0.25" + !endif + !else + !$smallSprite = $sprite + !endif + !return $smallSprite +!endfunction + +' format sprite that it can be used in diagram +!function $getSprite($sprite) + ' if it starts with & it's a OpenIconic, details see https://useiconic.com/open/ + ' if it starts with img: it's an image, details see https://plantuml.com/creole + !if (%substr($sprite, 0, 1) != "&" && %substr($sprite, 0, 4) != "img:") + !$formatted = "<$" + $sprite + ">" + !else + !$formatted = "<" + $sprite + ">" + !endif + !return $formatted +!endfunction + +!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) !$bg = $bgColor !$fo = $fontColor !$bo = $borderColor @@ -393,75 +487,91 @@ $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 - !endif - !if ($shape == $ROUNDED_BOX) - !$tagEntry = $tagEntry + $LEGEND_ROUNDED_BOX - !endif - !if ($shape == $EIGHT_SIDED) - !$tagEntry = $tagEntry + $LEGEND_EIGHT_SIDED + !if ($legendSprite != "") + !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " !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 ($shape == $ROUNDED_BOX) + !$tagEntry = $tagEntry + $LEGEND_ROUNDED_BOX + !endif + !if ($shape == $EIGHT_SIDED) + !$tagEntry = $tagEntry + $LEGEND_EIGHT_SIDED !endif - !if ($bgColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_BG_TEXT + !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 - !if ($tc=="") -!if ($PlantUMLSupportsDynamicLegendColor) - !$tc = $flatLegend($ARROW_COLOR) -!else - !$tc = $LEGEND_DARK_COLOR -!endif + !if ($tc == "") + !if ($PlantUMLSupportsDynamicLegendColor) + !$tc = $flatLegend($ARROW_COLOR) + !else + !$tc = $LEGEND_DARK_COLOR + !endif !endif - !if ($lc=="") -!if ($PlantUMLSupportsDynamicLegendColor) - !$lc = $flatLegend($ARROW_COLOR) -!else - !$lc = $LEGEND_DARK_COLOR -!endif + !if ($lc == "") + !if ($PlantUMLSupportsDynamicLegendColor) + !$lc = $flatLegend($ARROW_COLOR) + !else + !$lc = $LEGEND_DARK_COLOR + !endif !endif !$tagEntry = "|" ' ..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 + !if ($legendSprite != "") + !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " !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 ($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 @@ -471,28 +581,28 @@ $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) +' !if (%strpos($tagStereo, "&") < 0) + !$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) %set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry) - !$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n" - !$tagMask = $tagLegendMask( $bgColor, $fontColor, $borderColor, $shadowing, $shape) + !$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"). '' This workaround tag could be theoretically removed in the legend but after that there would '' be an inconsistency between the element tags and the rel tags and therefore '' & combined workaround tags are not removed too (and in unlikely cases the color itself could be changed) -' !if (%strpos($tagStereo, "&")<0) - !$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle) +' !if (%strpos($tagStereo, "&") < 0) + !$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) %set_variable_value("$" + $tagStereo + "_LineLegendEntry", $tagEntry) !$tagCustomLegend = $tagCustomLegend + $tagStereo + "_Line\n" ' !endif @@ -508,7 +618,7 @@ $elementSkin %get_variable_value("$" + $tagStereo + "LegendEntry") !endif !endwhile - !if (%strlen($allDefined)>0) + !if (%strlen($allDefined) > 0) !$tagStereo = $allDefined !if (%variable_exists("$" + $tagStereo + "Legend")) %get_variable_value("$" + $tagStereo + "LegendEntry") @@ -537,24 +647,52 @@ $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="", $techn="", $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 == "") + !$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 = "") +!unquoted procedure AddRelTag($tagStereo, $textColor="", $lineColor="", $lineStyle = "", $sprite="", $techn="", $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 + !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="") +!unquoted procedure UpdateElementStyle($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $techn="", $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 == "") + !$legendSprite = $smallVersionSprite($sprite) + !endif + !endif + !if ($techn != "") +%set_variable_value("$" + $elementName + "ElementTagTechn", $techn) + !endif + !$tagEntry = $tagLegendEntry($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) %set_variable_value("$" + $elementName + "LegendEntry", $tagEntry) ' default tags sets at least bgColor and fontColor - !$tagMask = $tagLegendMask("CHANGED", "CHANGED", $borderColor, $shadowing, $shape) + !$tagMask = $tagLegendMask("CHANGED", "CHANGED", $borderColor, $shadowing, $shape, $sprite) %set_variable_value("$" + $elementName + "LegendMask", $tagMask) !endprocedure @@ -581,7 +719,7 @@ $elementSkin ' ################################## !function $getLink($link) - !if ($link!="") + !if ($link != "") !return "[[" + $link + "]]" !else !return "" @@ -603,9 +741,9 @@ $elementSkin !$multiLine = "" !if (%strpos($descr, "\n") >= 0) !else - !while (%strlen($descr)>$width) + !while (%strlen($descr) > $width) !$brPos = $width - !while ($brPos>0 && %substr($descr, $brPos, 1)!= ' ') + !while ($brPos > 0 && %substr($descr, $brPos, 1) != ' ') !$brPos = $brPos - 1 !endwhile @@ -623,7 +761,7 @@ $elementSkin !endif !endwhile !endif -!if (%strlen($descr)>0) +!if (%strlen($descr) > 0) !$multiLine = $multiLine + $descr !endif !return $multiLine @@ -640,9 +778,9 @@ $elementSkin !$techn = %substr($techn, $brPos+2) !endwhile !else - !while (%strlen($techn)>$width) + !while (%strlen($techn) > $width) !$brPos = $width - !while ($brPos>0 && %substr($techn, $brPos, 1)!= ' ') + !while ($brPos > 0 && %substr($techn, $brPos, 1) != ' ') !$brPos = $brPos - 1 !endwhile @@ -660,7 +798,7 @@ $elementSkin !endif !endwhile !endif -!if (%strlen($techn)>0) +!if (%strlen($techn) > 0) !$multiLine = $multiLine + $techn !endif !return $multiLine @@ -733,7 +871,7 @@ SetPropertyHeader("Property","Value") ' ################################## !procedure $getHideStereotype($hideStereotype) -!if ($hideStereotype=="true") +!if ($hideStereotype == "true") hide stereotype !endif !endprocedure @@ -802,12 +940,12 @@ top to bottom direction !endprocedure !procedure LAYOUT_LEFT_RIGHT() -!global $fix_direction=%false() +!global $fix_direction = %false() left to right direction !endprocedure !procedure LAYOUT_LANDSCAPE() -!global $fix_direction=%true() +!global $fix_direction = %true() left to right direction !endprocedure @@ -856,18 +994,15 @@ rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias ' ################################## !function $getRel($direction, $alias1, $alias2, $label, $techn, $descr, $sprite, $tags, $link) + !$sprite = $toRelArg($sprite, $tags, "RelTagSprite") + !$techn = $toRelArg($techn, $tags, "RelTagTechn") !$rel = $alias1 + ' ' + $direction + ' ' + $alias2 !if ($tags != "") !$rel = $rel + ' ' + $toStereos($tags) !endif !$rel = $rel + ' : ' !if ($sprite != "") - ' 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 + !$rel = $rel + $getSprite($sprite) + ' ' !endif !if ($link != "") !$rel = $rel + '**[[' + $link + ' ' + $label + ']]**' diff --git a/C4_Component.puml b/C4_Component.puml index 5f660d47..d7550845 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="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddExternalComponentTag($tagStereo, $bgColor=$EXTERNAL_COMPONENT_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_COMPONENT_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure + ' Layout ' ################################## @@ -54,36 +62,48 @@ 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 -!unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!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="") +!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="") +!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="") +!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="") +!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="") +!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 3b721535..b020232b 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="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddExternalContainerTag($tagStereo, $bgColor=$EXTERNAL_CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure + ' Layout ' ################################## @@ -49,37 +57,49 @@ 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 -!unquoted procedure Container($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!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="") +!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="") +!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="") +!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="") +!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="") +!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 d56d1984..ff23a660 100644 --- a/C4_Context.puml +++ b/C4_Context.puml @@ -30,6 +30,19 @@ 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 ' ################################## @@ -183,20 +196,20 @@ endlegend ' ################################## !function $getPerson($label, $descr, $sprite) -!if ($sprite == "") && ($defaultPersonSprite!="") +!if ($sprite == "") && ($defaultPersonSprite != "") !$sprite = $defaultPersonSprite !endif !if ($descr == "") && ($sprite == "") !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 @@ -205,17 +218,18 @@ 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 !unquoted procedure Person($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "person") !if ($portraitPerson == "portrait") && ($sprite == "") actor "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias $getLink($link) !elseif ($portraitPerson == "outline") && ($sprite == "") @@ -226,6 +240,7 @@ rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", !endprocedure !unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_person") !if ($portraitPerson == "portrait") && ($sprite == "") actor "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias $getLink($link) !elseif ($portraitPerson == "outline") && ($sprite == "") @@ -236,26 +251,32 @@ rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_ !endprocedure !unquoted procedure System($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure System_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemDb($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemQueue($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemDb_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemQueue_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure diff --git a/C4_Deployment.puml b/C4_Deployment.puml index 00ca6bdc..0f225f29 100644 --- a/C4_Deployment.puml +++ b/C4_Deployment.puml @@ -15,13 +15,17 @@ ' 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 +' 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 ' ################################## @@ -36,7 +40,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy ' If a $type contains \n then these are used (and no automatic space based line breaks are done) ' $NODE_TYPE_MAX_CHAR_WIDTH defines the automatic line break position !global $NODE_TYPE_MAX_CHAR_WIDTH = 35 -!global $NODE_DESCR_MAX_CHAR_WIDTH=32 +!global $NODE_DESCR_MAX_CHAR_WIDTH = 32 !unquoted function $breakNode($type, $widthStr) !$width = %intval($widthStr) @@ -48,9 +52,9 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !$type = %substr($type, $brPos+2) !endwhile !else - !while (%strlen($type)>$width) + !while (%strlen($type) > $width) !$brPos = $width - !while ($brPos>0 && %substr($type, $brPos, 1)!= ' ') + !while ($brPos > 0 && %substr($type, $brPos, 1) != ' ') !$brPos = $brPos - 1 !endwhile @@ -68,7 +72,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endif !endwhile !endif -!if (%strlen($type)>0) +!if (%strlen($type) > 0) !$multiLine = $multiLine + $type !endif !return $multiLine @@ -80,7 +84,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 != "") @@ -95,7 +99,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 != "") @@ -110,7 +114,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 != "") @@ -123,25 +127,43 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endfunction !unquoted procedure Deployment_Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Deployment_Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Deployment_Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure diff --git a/C4_Dynamic.puml b/C4_Dynamic.puml index 8ba4a09a..e8f506af 100644 --- a/C4_Dynamic.puml +++ b/C4_Dynamic.puml @@ -33,7 +33,7 @@ !procedure setIndex($new_index) !$lastIndex = $index - !$index= $new_index + !$index = $new_index !endprocedure !function Index($offset=1) diff --git a/README.md b/README.md index c32f4193..4806e4bf 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)`: +* `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)`: +* `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)`: +* `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. @@ -391,6 +396,29 @@ 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, ?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** * `SHOW_LEGEND()` supports the customized stereotypes @@ -404,6 +432,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** + ```plantuml @startuml !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml @@ -446,6 +476,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. @@ -540,7 +629,7 @@ C4-PlantUML offers version information like PlantUML with its `%version()` call. * `C4Version()`: Current C4-PlantUML version (e.g. `2.4.0beta1`). * `C4VersionDetails()`: (Floating) version details with the current PlantUML and C4-PlantUML version. (It can be referenced via the alias `C4VersionDetailsArea`.) -``` +```plantuml @startuml !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml diff --git a/percy/TestLegendSprite.puml b/percy/TestLegendSprite.puml new file mode 100644 index 00000000..59fbac63 --- /dev/null +++ b/percy/TestLegendSprite.puml @@ -0,0 +1,72 @@ +@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 + +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("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", $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") +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", "", "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", $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") +} + +System_Ext(twitter, "Twitter") +System_Ext(github, "GitHub") +System_Ext(blogs, "Blogs") + +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") +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) + +SHOW_LEGEND() +@enduml 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 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")