Skip to content

Commit ee1f559

Browse files
authored
Merge pull request #58 from jeanmarc-contrib/master
Reintroduce special shapes for some ArchiMate elements
2 parents 47c5a3d + 856c6de commit ee1f559

14 files changed

+368
-165
lines changed

README.md

Lines changed: 93 additions & 6 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
@@ -164,12 +167,89 @@ For example
164167
| Grouping | ![Grouping](./images/Example-Grouping.png) |
165168
| Other_Grouping | ![Other_Grouping](./images/Example-OtherGrouping.png) |
166169

170+
### Special shapes
171+
By default, all shapes are rectangular (either with sharp, rounded, or beveled corners) and show a stereotype icon in the
172+
top right. Some elements can be shown in a different shape, without the stereotype. This is controlled by setting
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 Actor<sup>*</sup>
178+
* Business Role
179+
* Business Service<sup>*</sup>
180+
* Business Product
181+
* Application Service<sup>*</sup>
182+
* Technology Node
183+
* Technology Artifact
184+
* Technology Service<sup>*</sup>
185+
* Motivation Stakeholder
186+
* Motivation Meaning
187+
* Motivation Value<sup>*</sup>
188+
* Strategy Value Stream
189+
190+
> [!IMPORTANT]
191+
> The special shapes marked with <sup>*</sup> do not support nesting other elements within them, so you need to add a
192+
> `$nest=%true()` parameter when nesting using these elements with special shapes.
193+
194+
```plantuml
195+
@startuml
196+
197+
!global $ARCH_SPECIAL_SHAPES = %true()
198+
199+
!include <archimate/Archimate>
200+
201+
Motivation_Stakeholder(MS, "Motivation Stakeholder") {
202+
Motivation_Stakeholder(MSI, "Inner Stakeholder", $special=%true())
203+
Motivation_Stakeholder(MSI2, "Another Inner Stakeholder", $special=%false())
204+
}
205+
Motivation_Meaning(MM, "Motivation Meaning") {
206+
Motivation_Meaning(MMI, "Inner Meaning", $special=%true())
207+
Motivation_Meaning(MMI2, "Another Inner Meaning", $special=%false())
208+
}
209+
Motivation_Value(MV, "Motivation Value", $nest=%true()) {
210+
Motivation_Value(MVI, "Inner Value", $special=%true())
211+
Motivation_Value(MVI2, "Another Inner Value", $special=%false())
212+
}
213+
Strategy_ValueStream(SV, "Strategy Value Stream", $nest=%true()) {
214+
Strategy_ValueStream(SVI, "Inner Value Stream", $special=%true())
215+
Strategy_ValueStream(SVI2, "Another Inner Value Stream", $special=%false())
216+
}
217+
218+
Business_Actor(BA, "Business Actor", $nest=%true()) {
219+
Business_Actor(BAI, "Inner Actor", $special=%true())
220+
Business_Actor(BAI2, "Another Inner Actor", $special=%false())
221+
}
222+
Business_Service(BS, "Business Service", $nest=%true()) {
223+
Business_Service(BSI, "Inner Service", $special=%true())
224+
Business_Service(BSI2, "Another Inner Service", $special=%false())
225+
}
226+
Business_Product(BP, "Business Product", $nest=%true()) {
227+
Business_Product(BPI, "Inner Product", $special=%true())
228+
Business_Product(BPI2, "Another Inner Product", $special=%false())
229+
}
230+
231+
Technology_Node(TN, "Technology Node"){
232+
Technology_Node(TNI, "Inner Node", $special=%true())
233+
Technology_Node(TNI2, "Another Inner Node", $special=%false())
234+
}
235+
236+
Technology_Artifact(TA, "Technology Artifact") {
237+
Technology_Artifact(TAI, "Inner Artifact", $special=%true())
238+
Technology_Artifact(TAI2, "Another Inner Artifact", $special=%false())
239+
}
240+
241+
@enduml
242+
```
243+
244+
Result:
245+
246+
![Special Shapes for some types](./images/SpecialShapes.png)
167247

168248
### Nesting of Components
169249
Nesting allows grouping components hierarchically, improving diagram clarity. There are no limitations on the number of levels of nesting.
170250
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.
171251

172-
Nesting is automatic, just add the nested elements between curly braces `{ ... }`:
252+
Nesting is automatic by default, just add the nested elements between curly braces `{ ... }`:
173253
```plantuml
174254
Category_ElementName(nameOfTheElement, "description") {
175255
Category_ElementName(uniqueName, "description)
@@ -199,6 +279,13 @@ Output:
199279

200280
![Nesting Example](./images/Example-Nesting.png)
201281

282+
#### Nesting with special shapes
283+
284+
> [!IMPORTANT]
285+
> As mentioned above, some elements support special shapes. However, when using special shapes, nesting is not always possible using the
286+
> special shape. This applies to all `Service` elements, the `Motivation_Value` element, and the `Business_Actor` element. If you have
287+
> special shapes active, you have to add a `$nest=%true()` parameter to these elements to avoid errors or unexpected results.
288+
202289
### Theme Support
203290
Theme support is enabled and 5 variations are available. All the themes are based on Archimate specifications.
204291

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

Lines changed: 80 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
' Version
44
'######################################
55
!function ArchimateVersion()
6-
!$archimateVersion = "3.2.0"
6+
!$archimateVersion = "3.2.1"
77
!return $archimateVersion
88
!endfunction
99

@@ -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
@@ -88,16 +88,28 @@
8888
!unquoted procedure Strategy_CourseOfAction($alias, $label, $nest=0)
8989
archimate $ARCH_STRATEGY_FILLCOLOR "$label" <<strategy-courseofaction>> as $alias
9090
!endprocedure
91-
!unquoted procedure Strategy_ValueStream($alias, $label, $nest=0)
92-
archimate $ARCH_STRATEGY_FILLCOLOR "$label" <<strategy-valuestream>> as $alias
91+
!unquoted procedure Strategy_ValueStream($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
92+
!if ($special == %true())
93+
process "$label" as $alias $ARCH_STRATEGY_FILLCOLOR
94+
!else
95+
archimate $ARCH_STRATEGY_FILLCOLOR "$label" <<strategy-valuestream>> as $alias
96+
!endif
9397
!endprocedure
9498

9599
'Business Elements
96-
!unquoted procedure Business_Actor($alias, $label, $nest=0)
97-
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-actor>> as $alias
98-
!endprocedure
99-
!unquoted procedure Business_Role($alias, $label, $nest=0)
100-
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-role>> as $alias
100+
!unquoted procedure Business_Actor($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
101+
!if ($special == %true() && $nest == %false())
102+
actor "$label" as $alias $ARCH_BUSINESS_FILLCOLOR
103+
!else
104+
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-actor>> as $alias
105+
!endif
106+
!endprocedure
107+
!unquoted procedure Business_Role($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
108+
!if ($special == %true())
109+
queue "%n()$label%n()" as $alias $ARCH_BUSINESS_FILLCOLOR
110+
!else
111+
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-role>> as $alias
112+
!endif
101113
!endprocedure
102114
!unquoted procedure Business_Collaboration($alias, $label, $nest=0)
103115
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-collaboration>> as $alias
@@ -117,8 +129,12 @@
117129
!unquoted procedure Business_Event($alias, $label, $nest=0)
118130
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-event>> as $alias
119131
!endprocedure
120-
!unquoted procedure Business_Service($alias, $label, $nest=0)
121-
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-service>> as $alias
132+
!unquoted procedure Business_Service($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
133+
!if ($special == %true() && $nest == %false())
134+
rectangle "$label" <<service-special>> as $alias $ARCH_BUSINESS_FILLCOLOR
135+
!else
136+
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-service>> as $alias
137+
!endif
122138
!endprocedure
123139
!unquoted procedure Business_Object($alias, $label, $nest=0)
124140
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-object>> as $alias
@@ -129,8 +145,12 @@
129145
!unquoted procedure Business_Representation($alias, $label, $nest=0)
130146
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-representation>> as $alias
131147
!endprocedure
132-
!unquoted procedure Business_Product($alias, $label, $nest=0)
133-
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-product>> as $alias
148+
!unquoted procedure Business_Product($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
149+
!if ($special == %true())
150+
frame "%n()$label%n()" as $alias $ARCH_BUSINESS_FILLCOLOR
151+
!else
152+
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-product>> as $alias
153+
!endif
134154
!endprocedure
135155
!unquoted procedure Business_Location($alias, $label, $nest=0)
136156
archimate $ARCH_BUSINESS_FILLCOLOR "$label" <<business-location>> as $alias
@@ -158,16 +178,24 @@
158178
!unquoted procedure Application_Event($alias, $label, $nest=0)
159179
archimate $ARCH_APPLICATION_FILLCOLOR "$label" <<application-event>> as $alias
160180
!endprocedure
161-
!unquoted procedure Application_Service($alias, $label, $nest=0)
162-
archimate $ARCH_APPLICATION_FILLCOLOR "$label" <<application-service>> as $alias
181+
!unquoted procedure Application_Service($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
182+
!if ($special == %true() && $nest == %false())
183+
rectangle "$label" <<service-special>> as $alias $ARCH_APPLICATION_FILLCOLOR
184+
!else
185+
archimate $ARCH_APPLICATION_FILLCOLOR "$label" <<application-service>> as $alias
186+
!endif
163187
!endprocedure
164188
!unquoted procedure Application_DataObject($alias, $label, $nest=0)
165189
archimate $ARCH_APPLICATION_FILLCOLOR "$label" <<application-dataobject>> as $alias
166190
!endprocedure
167191

168192
'Technology Elements
169-
!unquoted procedure Technology_Node($alias, $label, $nest=0)
170-
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-node>> as $alias
193+
!unquoted procedure Technology_Node($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
194+
!if ($special == %true())
195+
node "$label" as $alias $ARCH_TECHNOLOGY_FILLCOLOR
196+
!else
197+
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-node>> as $alias
198+
!endif
171199
!endprocedure
172200
!unquoted procedure Technology_Device($alias, $label, $nest=0)
173201
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-device>> as $alias
@@ -199,11 +227,19 @@
199227
!unquoted procedure Technology_Event($alias, $label, $nest=0)
200228
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-event>> as $alias
201229
!endprocedure
202-
!unquoted procedure Technology_Service($alias, $label, $nest=0)
203-
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-service>> as $alias
230+
!unquoted procedure Technology_Service($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
231+
!if ($special == %true() && $nest == %false())
232+
rectangle "$label" <<service-special>> as $alias $ARCH_TECHNOLOGY_FILLCOLOR
233+
!else
234+
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-service>> as $alias
235+
!endif
204236
!endprocedure
205-
!unquoted procedure Technology_Artifact($alias, $label, $nest=0)
206-
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-artifact>> as $alias
237+
!unquoted procedure Technology_Artifact($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
238+
!if ($special == %true())
239+
file "$label" as $alias $ARCH_TECHNOLOGY_FILLCOLOR
240+
!else
241+
archimate $ARCH_TECHNOLOGY_FILLCOLOR "$label" <<technology-artifact>> as $alias
242+
!endif
207243
!endprocedure
208244

209245
'Physical Elements
@@ -221,8 +257,12 @@
221257
!endprocedure
222258

223259
'Motivation Elements
224-
!unquoted procedure Motivation_Stakeholder($alias, $label, $nest=0)
225-
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-stakeholder>> as $alias
260+
!unquoted procedure Motivation_Stakeholder($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
261+
!if ($special == %true())
262+
queue "%n()$label%n()" as $alias $ARCH_MOTIVATION_FILLCOLOR
263+
!else
264+
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-stakeholder>> as $alias
265+
!endif
226266
!endprocedure
227267
!unquoted procedure Motivation_Driver($alias, $label, $nest=0)
228268
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-driver>> as $alias
@@ -245,11 +285,19 @@
245285
!unquoted procedure Motivation_Constraint($alias, $label, $nest=0)
246286
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-constraint>> as $alias
247287
!endprocedure
248-
!unquoted procedure Motivation_Meaning($alias, $label, $nest=0)
249-
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-meaning>> as $alias
250-
!endprocedure
251-
!unquoted procedure Motivation_Value($alias, $label, $nest=0)
252-
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-value>> as $alias
288+
!unquoted procedure Motivation_Meaning($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
289+
!if ($special == %true())
290+
cloud "$label" as $alias $ARCH_MOTIVATION_FILLCOLOR
291+
!else
292+
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-meaning>> as $alias
293+
!endif
294+
!endprocedure
295+
!unquoted procedure Motivation_Value($alias, $label, $nest=0, $special = $ARCH_SPECIAL_SHAPES)
296+
!if ($special == %true() && $nest == %false())
297+
usecase "%n()$label%n()" as $alias $ARCH_MOTIVATION_FILLCOLOR
298+
!else
299+
archimate $ARCH_MOTIVATION_FILLCOLOR "$label" <<motivation-value>> as $alias
300+
!endif
253301
!endprocedure
254302

255303
'Implementation Elements

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>

0 commit comments

Comments
 (0)