Skip to content

Commit 87661bc

Browse files
author
JeanMarc van Leerdam
committed
use %true() and %false() functions; handle special shapes and nesting; update README.md to explain how to combine nesting and special shapes
1 parent 1aa7ba7 commit 87661bc

File tree

10 files changed

+105
-60
lines changed

10 files changed

+105
-60
lines changed

README.md

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ You will need to:
5555
1. download the latest version of `Archimate.puml`, including the themes folder and store them some place locally
5656
* `./dist/plantuml/plantuml-stdlib/stdlib/archimate/Archimate.puml`
5757
* `./dist/plantuml/plantuml-stdlib/stdlib/archimate/themes/` folder plus files
58-
2. Add a `!global $ARCH_LOCAL = true` to your PlantUML file prior to the include statement
58+
2. Add a `!global $ARCH_LOCAL = %true()` to your PlantUML file prior to the include statement
5959

6060
```plantuml
6161
62-
!global $ARCH_LOCAL = true
62+
!global $ARCH_LOCAL = %true()
6363
!$LOCAL_FOLDER = "[path to the folder that holds Archimate.puml]"
6464
!include $LOCAL_FOLDER/Archimate.puml
6565
@@ -74,16 +74,19 @@ You will need to:
7474
> [!IMPORTANT]
7575
> Using `!include` on `https://raw.githubusercontent.com/plantuml-stdlib/Archimate-PlantUML/master/dist/plantuml-stdlib/stdlib/archimate/Archimate.puml`
7676
> **may** not work, because that file by default relies on the built-in themes, which may not be compatible with the latest version of `Archimate.puml`
77-
> on `master`._
77+
> on `master`.
7878
7979
## Usage
8080
After you have included `Archimate.puml` you can use the defined macros for ArchiMate elements.
8181

8282
### ArchiMate Elements
83-
The ArchiMate elements are defined in the following pattern:
83+
The ArchiMate elements are defined in the following pattern, with two mandatory parameters and two optional parameters:
8484
```plantuml
85-
Category_ElementName(nameOfTheElement, "description")
85+
Category_ElementName(nameOfTheElement, "description", $nest=%false(), $special=$ARCH_SPECIAL_SHAPES)
8686
```
87+
88+
Nesting and special shapes are explained further down this page.
89+
8790
For example:
8891
* To define a `Stakeholder` element, which is part of `Motivation` category, the syntax will be
8992
```plantuml
@@ -167,32 +170,55 @@ For example
167170
### Special shapes
168171
By default, all shapes are rectangular (either with sharp, rounded, or beveled corners) and show a stereotype icon in the
169172
top right. Some elements can be shown in a different shape, without the stereotype. This is controlled by setting
170-
`$ARCH_SPECIAL_SHAPES` to `true` (default is `false`). The supported elements have an optional third parameter that allows
171-
you to override the setting for an individual shape:
173+
`$ARCH_SPECIAL_SHAPES` to `%true()` (default is `%false()`). The supported elements have an optional named parameter that allows
174+
you to override the setting for an individual shape.
175+
176+
Shapes that support special shapes are:
177+
* Business Role
178+
* Business Service(*)
179+
* Application Service(*)
180+
* Technology Node
181+
* Technology Artifact
182+
* Technology Service(*)
183+
* Motivation Stakeholder
184+
* Motivation Meaning
185+
* Motivation Value(*)
186+
187+
> [!IMPORTANT]
188+
> Note: the special shapes marked with (*) do not support nesting other elements within them, so you need to add a
189+
> `$nest=%false()` parameter when using these elements with special shapes.
172190
173191
```plantuml
174192
@startuml
175193
176-
!global $ARCH_SPECIAL_SHAPES = true
194+
!global $ARCH_SPECIAL_SHAPES = %true()
177195
178196
!include <archimate/Archimate>
179197
180-
Business_Service(BS, "Business Service") {
181-
Business_Service(BSI, "Inner Service", true)
182-
Business_Service(BSI2, "Another Inner Service", false)
198+
Motivation_Stakeholder(MS, "Motivation Stakeholder") {
199+
Motivation_Stakeholder(MSI, "Inner Stakeholder", $special=%true())
200+
Motivation_Stakeholder(MSI2, "Another Inner Stakeholder", $special=%false())
183201
}
184202
Motivation_Meaning(MM, "Motivation Meaning") {
185-
Motivation_Meaning(MMI, "Inner Meaning", true)
186-
Motivation_Meaning(MMI2, "Another Inner Meaning", false)
203+
Motivation_Meaning(MMI, "Inner Meaning", $special=%true())
204+
Motivation_Meaning(MMI2, "Another Inner Meaning", $special=%false())
205+
}
206+
Motivation_Value(MV, "Motivation Value", $nest=%true()) {
207+
Motivation_Value(MVI, "Inner Value", $special=%true())
208+
Motivation_Value(MVI2, "Another Inner Value", $special=%false())
209+
}
210+
Business_Service(BS, "Business Service", $nest=%true()) {
211+
Business_Service(BSI, "Inner Service", $special=%true())
212+
Business_Service(BSI2, "Another Inner Service", $special=%false())
187213
}
188214
Technology_Node(TN, "Technology Node"){
189-
Technology_Node(TNI, "Inner Node", true)
190-
Technology_Node(TNI2, "Another Inner Node", false)
215+
Technology_Node(TNI, "Inner Node", $special=%true())
216+
Technology_Node(TNI2, "Another Inner Node", $special=%false())
191217
}
192218
193219
Technology_Artifact(TA, "Technology Artifact") {
194-
Technology_Artifact(TAI, "Inner Artifact", true)
195-
Technology_Artifact(TAI2, "Another Inner Artifact", false)
220+
Technology_Artifact(TAI, "Inner Artifact", $special=%true())
221+
Technology_Artifact(TAI2, "Another Inner Artifact", $special=%false())
196222
}
197223
198224
@enduml
@@ -206,7 +232,7 @@ Result:
206232
Nesting allows grouping components hierarchically, improving diagram clarity. There are no limitations on the number of levels of nesting.
207233
The implementation allows nesting of any components inside any other components. When nesting, the element will be displayed in its normal shape, with the archimate archetype on the top right corner.
208234

209-
Nesting is automatic, just add the nested elements between curly braces `{ ... }`:
235+
Nesting is automatic by default, just add the nested elements between curly braces `{ ... }`:
210236
```plantuml
211237
Category_ElementName(nameOfTheElement, "description") {
212238
Category_ElementName(uniqueName, "description)
@@ -236,6 +262,13 @@ Output:
236262

237263
![Nesting Example](./images/Example-Nesting.png)
238264

265+
#### Nesting with special shapes
266+
267+
> [!IMPORTANT]
268+
> As mentioned above, some elements support special shapes. However, when using special shapes, nesting is not always possible using the
269+
> special shape. This applies to all `Service` elements, and the `Motivation_Value` element. If you have special shapes active, you have
270+
> to add a `$nest=%false()` parameter to these elements to avoid errors or unexpected results.
271+
239272
### Theme Support
240273
Theme support is enabled and 5 variations are available. All the themes are based on Archimate specifications.
241274

dist/plantuml-stdlib/stdlib/archimate/Archimate.puml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@
1818
' Styling
1919
'######################################
2020

21-
!global $ARCH_DEBUG ?= false
22-
!global $ARCH_LOCAL ?= false
21+
!global $ARCH_DEBUG ?= %false()
22+
!global $ARCH_LOCAL ?= %false()
2323

24-
!if ($ARCH_LOCAL == true)
24+
!if ($ARCH_LOCAL == %true())
2525
!include themes/shared_style.puml
2626
!else
2727
!include <archimate/themes/shared_style>
2828
!endif
2929

30-
!if ($ARCH_DEBUG == true)
30+
!if ($ARCH_DEBUG == %true())
3131
left header "Created using Archimate.puml version ArchimateVersion()"
3232
!endif
3333

3434
' Layout
3535
' ##################################
3636
!procedure LAYOUT_AS_SKETCH()
37-
!option handwritten true
37+
!option handwritten %true()
3838
<style>
3939
root {
4040
BackgroundColor #EEEBDC
@@ -97,7 +97,7 @@
9797
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-actor>> as $alias
9898
!endprocedure
9999
!unquoted procedure Business_Role($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
100-
!if ($special == true)
100+
!if ($special == %true())
101101
queue "%n()$label%n()" as $alias $ARCH_BUSINESS_FILLCOLOR
102102
!else
103103
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-role>> as $alias
@@ -122,7 +122,7 @@
122122
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-event>> as $alias
123123
!endprocedure
124124
!unquoted procedure Business_Service($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
125-
!if ($special == true)
125+
!if ($special == %true() && $nest == %false())
126126
rectangle "$label" <<service-special>> as $alias $ARCH_BUSINESS_FILLCOLOR
127127
!else
128128
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-service>> as $alias
@@ -167,7 +167,7 @@
167167
archimate $ARCH_APPLICATION_FILLCOLOR "$label" <<application-event>> as $alias
168168
!endprocedure
169169
!unquoted procedure Application_Service($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
170-
!if ($special == true)
170+
!if ($special == %true() && $nest == %false())
171171
rectangle "$label" <<service-special>> as $alias $ARCH_APPLICATION_FILLCOLOR
172172
!else
173173
archimate $ARCH_APPLICATION_FILLCOLOR "$label" <<application-service>> as $alias
@@ -179,7 +179,7 @@
179179

180180
'Technology Elements
181181
!unquoted procedure Technology_Node($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
182-
!if ($special == true)
182+
!if ($special == %true())
183183
node "$label" as $alias $ARCH_TECHNOLOGY_FILLCOLOR
184184
!else
185185
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-node>> as $alias
@@ -216,14 +216,14 @@
216216
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-event>> as $alias
217217
!endprocedure
218218
!unquoted procedure Technology_Service($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
219-
!if ($special == true)
219+
!if ($special == %true() && $nest == %false())
220220
rectangle "$label" <<service-special>> as $alias $ARCH_TECHNOLOGY_FILLCOLOR
221221
!else
222222
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-service>> as $alias
223223
!endif
224224
!endprocedure
225225
!unquoted procedure Technology_Artifact($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
226-
!if ($special == true)
226+
!if ($special == %true())
227227
file "$label" as $alias $ARCH_TECHNOLOGY_FILLCOLOR
228228
!else
229229
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-artifact>> as $alias
@@ -246,7 +246,7 @@
246246

247247
'Motivation Elements
248248
!unquoted procedure Motivation_Stakeholder($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
249-
!if ($special == true)
249+
!if ($special == %true())
250250
queue "%n()$label%n()" as $alias $ARCH_MOTIVATION_FILLCOLOR
251251
!else
252252
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-stakeholder>> as $alias
@@ -274,14 +274,14 @@
274274
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-constraint>> as $alias
275275
!endprocedure
276276
!unquoted procedure Motivation_Meaning($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
277-
!if ($special == true)
277+
!if ($special == %true())
278278
cloud "$label" as $alias $ARCH_MOTIVATION_FILLCOLOR
279279
!else
280280
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-meaning>> as $alias
281281
!endif
282282
!endprocedure
283283
!unquoted procedure Motivation_Value($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
284-
!if ($special == true)
284+
!if ($special == %true() && $nest == %false())
285285
usecase "%n()$label%n()" as $alias $ARCH_MOTIVATION_FILLCOLOR
286286
!else
287287
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-value>> as $alias

dist/plantuml-stdlib/stdlib/archimate/_examples_/example.puml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
@startuml
22

3-
!global $ARCH_LOCAL = true
4-
!global $ARCH_DEBUG = true
3+
!global $ARCH_LOCAL = %true()
4+
!global $ARCH_DEBUG = %true()
55

66
'!global $ARCH_LINETYPE = curve
77
'!global $ARCH_LINETYPE = polyline
88
'!global $ARCH_LINETYPE = ortho
99

10-
!if ($ARCH_LOCAL == false)
10+
!if ($ARCH_LOCAL == %false())
1111
!include <archimate/Archimate>
1212
'!theme archimate-alternate from <archimate/themes>
1313
'!theme archimate-handwriting from <archimate/themes>

dist/plantuml-stdlib/stdlib/archimate/themes/puml-theme-archimate-alternate.puml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
!global $ARCH_RELATIONSHIP_LINECOLOR = "#Black"
1717
!global $ARCH_RELATIONSHIP_FONTCOLOR = "#Black"
1818

19-
!global $ARCH_LOCAL ?= false
19+
!global $ARCH_LOCAL ?= %false()
2020

21-
!if ($ARCH_LOCAL == true)
21+
!if ($ARCH_LOCAL == %true())
2222
!include shared_style.puml
2323
!else
2424
!include <archimate/themes/shared_style>

dist/plantuml-stdlib/stdlib/archimate/themes/puml-theme-archimate-handwriting.puml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
!global $ARCH_DEFAULT_FONT = "Comic Sans MS"
66
!global $ARCH_DEFAULT_FONTSIZE = 14
77

8-
!option handwritten true
8+
!option handwritten %true()
99

1010
center footer <font color=red>Warning:</font> Created for discussion, needs to be validated
1111

@@ -19,9 +19,9 @@ center footer <font color=red>Warning:</font> Created for discussion, needs to b
1919
}
2020
</style>
2121

22-
!global $ARCH_LOCAL ?= false
22+
!global $ARCH_LOCAL ?= %false()
2323

24-
!if ($ARCH_LOCAL == true)
24+
!if ($ARCH_LOCAL == %true())
2525
!include shared_style.puml
2626
!else
2727
!include <archimate/themes/shared_style>

dist/plantuml-stdlib/stdlib/archimate/themes/puml-theme-archimate-lowsaturation.puml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
!global $ARCH_RELATIONSHIP_LINECOLOR = "#Black"
1717
!global $ARCH_RELATIONSHIP_FONTCOLOR = "#Black"
1818

19-
!global $ARCH_LOCAL ?= false
19+
!global $ARCH_LOCAL ?= %false()
2020

21-
!if ($ARCH_LOCAL == true)
21+
!if ($ARCH_LOCAL == %true())
2222
!include shared_style.puml
2323
!else
2424
!include <archimate/themes/shared_style>

dist/plantuml-stdlib/stdlib/archimate/themes/puml-theme-archimate-saturated.puml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
!global $ARCH_RELATIONSHIP_LINECOLOR = "#Black"
1717
!global $ARCH_RELATIONSHIP_FONTCOLOR = "#Black"
1818

19-
!global $ARCH_LOCAL ?= false
19+
!global $ARCH_LOCAL ?= %false()
2020

21-
!if ($ARCH_LOCAL == true)
21+
!if ($ARCH_LOCAL == %true())
2222
!include shared_style.puml
2323
!else
2424
!include <archimate/themes/shared_style>

dist/plantuml-stdlib/stdlib/archimate/themes/puml-theme-archimate-standard.puml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
!global $ARCH_RELATIONSHIP_LINECOLOR = "#Black"
1717
!global $ARCH_RELATIONSHIP_FONTCOLOR = "#Black"
1818

19-
!global $ARCH_LOCAL ?= false
19+
!global $ARCH_LOCAL ?= %false()
2020

21-
!if ($ARCH_LOCAL == true)
21+
!if ($ARCH_LOCAL == %true())
2222
!include shared_style.puml
2323
!else
2424
!include <archimate/themes/shared_style>

dist/plantuml-stdlib/stdlib/archimate/themes/shared_style.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ skinparam lineType $ARCH_LINETYPE
4444
' $ARCH_SPECIAL_SHAPES drives the usage of special shapes for some elements.
4545
' Note that we only use plantuml shapes that support nesting
4646
' This means that we do not use actor, queue (for role and stakeholder), or usecase (for value)
47-
!global $ARCH_SPECIAL_SHAPES ?= false
47+
!global $ARCH_SPECIAL_SHAPES ?= %false()
4848

4949
<style>
5050
archimate {

samples/SpecialShapes.puml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@startuml
22

3-
!global $ARCH_DEBUG = false
4-
!global $ARCH_LOCAL = false
5-
!global $ARCH_SPECIAL_SHAPES = true
3+
!global $ARCH_DEBUG = %false()
4+
!global $ARCH_LOCAL = %true()
5+
!global $ARCH_SPECIAL_SHAPES = %true()
66

7-
!if ($ARCH_LOCAL == false)
7+
!if ($ARCH_LOCAL == %false())
88
!include <archimate/Archimate>
99
'!theme archimate-alternate from <archimate/themes>
1010
'!theme archimate-handwriting from <archimate/themes>
@@ -23,22 +23,34 @@
2323
'!theme archimate-standard from $LOCAL_FOLDER/themes
2424
!endif
2525

26-
Business_Service(BS, "Business Service") {
27-
Business_Service(BSI, "Inner Service", true)
28-
Business_Service(BSI2, "Another Inner Service", false)
26+
27+
Motivation_Stakeholder(MS, "Motivation Stakeholder") {
28+
Motivation_Stakeholder(MSI, "Inner Stakeholder", $special=%true())
29+
Motivation_Stakeholder(MSI2, "Another Inner Stakeholder", $special=%false())
2930
}
3031
Motivation_Meaning(MM, "Motivation Meaning") {
31-
Motivation_Meaning(MMI, "Inner Meaning", true)
32-
Motivation_Meaning(MMI2, "Another Inner Meaning", false)
32+
Motivation_Meaning(MMI, "Inner Meaning", $special=%true())
33+
Motivation_Meaning(MMI2, "Another Inner Meaning", $special=%false())
34+
}
35+
Motivation_Value(MV, "Motivation Value", $nest=%true()) {
36+
Motivation_Value(MVI, "Inner Value", $special=%true())
37+
Motivation_Value(MVI2, "Another Inner Value", $special=%false())
38+
}
39+
Business_Service(BS, "Business Service", $nest=%true()) {
40+
Business_Service(BSI, "Inner Service", $special=%true())
41+
Business_Service(BSI2, "Another Inner Service", $special=%false())
3342
}
3443
Technology_Node(TN, "Technology Node"){
35-
Technology_Node(TNI, "Inner Node", true)
36-
Technology_Node(TNI2, "Another Inner Node", false)
44+
Technology_Node(TNI, "Inner Node", $special=%true())
45+
Technology_Node(TNI2, "Another Inner Node", $special=%false())
3746
}
3847

3948
Technology_Artifact(TA, "Technology Artifact") {
40-
Technology_Artifact(TAI, "Inner Artifact", true)
41-
Technology_Artifact(TAI2, "Another Inner Artifact", false)
49+
Technology_Artifact(TAI, "Inner Artifact", $special=%true())
50+
Technology_Artifact(TAI2, "Another Inner Artifact", $special=%false())
4251
}
4352

53+
MS -[hidden]- BS
54+
MM -[hidden]- TN
55+
MV -[hidden]- TA
4456
@enduml

0 commit comments

Comments
 (0)