summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.vehicles.code.tex
blob: cdb1c127f87ef42396c081cfbbd8b7088ac2256e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
%% symbol library for TikZ track schematics
%
% Copyright (c) 2018 - 2022, Martin Scheidt (ISC license)
%
% Permission to use, copy, modify, and/or distribute this file for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
%
\ProvidesFileRCS{tikzlibrarytrackschematic.vehicles.code.tex}%
%
%%%%%%%%%%%%%%%
% Requirements
%%%%%%%%%%%%%%%
\RequirePackage{tikz,etoolbox}%
\usetikzlibrary{calc}%
%
\ifdeflength{\objectlength}{}{% Not defined, so define it!
  \newlength{\objectlength}%
}%
\setlength{\objectlength}{4cm}%
%
%%%%%%%%%%%%%%%
% tikz keys for multiple use
%%%%%%%%%%%%%%%
\pgfkeys{%
  /tikz/trackschematic/.is family,%
  /tikz/trackschematic/.cd,%
  %% face
  face/.value required,% forward OR backward
  face/.store in=\face,%
  /tikz/face/.forward to=/tikz/trackschematic/face,%
  /tikz/forward/.code={\pgfkeys{/tikz/trackschematic/face=forward}},%
  /tikz/backward/.code={\pgfkeys{/tikz/trackschematic/face=backward}},%
  /tikz/bidirectional/.code={\pgfkeys{/tikz/trackschematic/face=bidirectional}},%
  %% operation
  operation mode/.store in=\operationmode,% manual, automatic OR undefined
  operation mode=none,% DEFAULT
  /tikz/operation/.forward to=/tikz/trackschematic/operation mode,%
  %% length
  length/.store in=\objectlength,% default length 4cm
  /tikz/length/.forward to=/tikz/trackschematic/length,%
  %% label
  shift label/.store in=\labelcoord,% (coord)
  shift label=(none),% DEFAULT
  /tikz/shift label/.forward to=/tikz/trackschematic/shift label,%
}%
%
%%%%%%%%%%%%%%%
% commands
%%%%%%%%%%%%%%%
%
%% command: parked vehicles
\newcommand\parkedvehicles{}% just for safety
\def\parkedvehicles[#1]#2(#3)#4(#5){% \parkedvehicles[options] at (coord) label (name);
  \pic[parked,operation=undefined,forward,#1] at (#3) {vehicles={#2/#4/#5}}% symbol
}%
%% command: shunting movements
\newcommand\shunting{}% just for safety
\def\shunting[#1]#2(#3)#4(#5){% \shunting[options] at (coord) label (name);
  \pic[shunting mode,operation=undefined,#1] at (#3) {vehicles={#2/#4/#5}}% symbol
}%
%% command: train run
\newcommand\train{}% just for safety
\def\train[#1]#2(#3)#4(#5){% \train[options] at (coord) label (name);
  \pic[train mode,operation=undefined,#1] at (#3) {vehicles={#2/#4/#5}}% symbol
}%
%
%%%%%%%%%%%%%%%
% tikz keys
%%%%%%%%%%%%%%%
\pgfkeys{%
  /tikz/trackschematic/vehicles/.is family,%
  /tikz/trackschematic/vehicles/.cd,%
  %% parked vehicles
  parked/.value forbidden,%
  parked/.code={\settoggle{is_parked}{true}},%
  /tikz/parked/.forward to=/tikz/trackschematic/vehicles/parked,%
  %% shunting mode
  shunting mode/.value forbidden,%
  shunting mode/.code={\settoggle{in_shunting_mode}{true}},%
  /tikz/shunting mode/.forward to=/tikz/trackschematic/vehicles/shunting mode,%
  %% shunting movement
  movement/.value forbidden,%
  movement/.code={\settoggle{is_shunting}{true}},%
  /tikz/movement/.forward to=/tikz/trackschematic/vehicles/movement,%
  %% train mode
  train mode/.value forbidden,%
  train mode/.code={\settoggle{in_train_mode}{true}},%
  /tikz/train mode/.forward to=/tikz/trackschematic/vehicles/train mode,%
  %% ghost train
  ghost train/.value forbidden,%
  ghost train/.code={\settoggle{train_is_a_ghost}{true}},%
  /tikz/ghost/.forward to=/tikz/trackschematic/vehicles/ghost train,%
  %% train run
  run/.store in=\trainrun,% slow, normal, fast OR none
  run=none,% DEFAULT
  /tikz/run/.forward to=/tikz/trackschematic/vehicles/run,%
  %% label
  label align/.store in=\labelalign,% left, right OR center
  label align=center,% DEFAULT
  /tikz/label align/.forward to=/tikz/trackschematic/vehicles/label align,%
  %% train bend
  bend right at/.store in=\bendrightcoord,% (coord)
  bend right at=(none),% DEFAULT
  /tikz/bend right at/.forward to=/tikz/trackschematic/vehicles/bend right at,%
  bend left at/.store in=\bendleftcoord,% (coord)
  bend left at=(none),% DEFAULT
  /tikz/bend left at/.forward to=/tikz/trackschematic/vehicles/bend left at,%
}%
% options
\newtoggle{is_parked}\settoggle{is_parked}{false}%
\newtoggle{in_shunting_mode}\settoggle{in_shunting_mode}{false}%
\newtoggle{is_shunting}\settoggle{is_shunting}{false}%
\newtoggle{in_train_mode}\settoggle{in_train_mode}{false}%
\newtoggle{train_is_a_ghost}\settoggle{train_is_a_ghost}{false}%
\newtoggle{single_bend}\settoggle{single_bend}{false}%
\newtoggle{double_bend}\settoggle{double_bend}{false}%
%
%%%%%%%%%%%%%%%
% symbol definition
%%%%%%%%%%%%%%%
%
\tikzset{%
  pics/vehicles/.default=,%
  pics/vehicles/.style args={#1/#2/#3}{code={%
    %%
    %%%%%%%[steps]%%%%%%
    %%
    %% 0. setup settings
    %% 1. calculate coordinates
    %% - calculation of vehicle coordinates:
    %%
    %%                rear bend   front bend
    %%                (ts-b-r1)   (ts-b-f1)
    %%   (ts-v-r1)•__________•_______•__________•(ts-v-f1)
    %%            |                              \
    %%            |         label•(ts-v-l)        •(ts-v-f) front tip
    %%            |__________ _______ __________ /
    %%   (ts-v-r2)•          •       •          •(ts-v-f2)
    %%                (ts-b-r2)   (ts-b-f2)
    %%
    %% - the base coord is depend on usage
    %%      for parked: (ts-v-l)
    %%            else: (ts-v-f)
    %%
    %% 2. set style for line and background
    %% 3. draw arrows for speed indication
    %% 4. draw vehicle shape
    %% 5. draw operation mode
    %% 6. draw label
    %%
    %%%%%%%%%%%%%%%%%%%%
    %% 0. settings
    \def\coordcommand{#1}% beware of leading and tailing spaces!
    \def\labelcommand{#2}% beware of leading and tailing spaces!
    \def\labelcontent{#3}%
    %% face setup
    \ifdefstring{\face}{forward}{% face
      \pgfmathsetmacro{\facefactor}{1}%
    }{%
      \ifdefstring{\face}{backward}{% face
        \pgfmathsetmacro{\facefactor}{-1}%
      }{% error message
        \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
      }%
    }% end \ifdefstring{\face}
    %% bend setup
    % determine number of bends and find front and rear bend from left to right
    \ifdefstring{\bendleftcoord}{(none)}{}{% NOT default
      \settoggle{single_bend}{true}%
      \path \bendleftcoord;\pgfgetlastxy{\bendX}{\bendY}% absolut coord
      \pgfmathsetmacro\bendfactor{1}%
    }%
    \ifdefstring{\bendrightcoord}{(none)}{}{% NOT default
      \iftoggle{single_bend}{%
        \settoggle{double_bend}{true}%
        \settoggle{single_bend}{false}%
        \path \bendrightcoord;\pgfgetlastxy{\bendrightX}{\bendrightY}
        \ifdimcomp{\bendrightX}{>}{\bendX}{% which one comes first?
          \ifdefstring{\face}{forward}{%
            \pgfmathsetmacro\frontBendfactor{1}%
            \pgfmathsetmacro\rearBendfactor{-1}%
            \pgfmathsetlengthmacro\frontBendX{\bendrightX}%
            \pgfmathsetlengthmacro\rearBendX{\bendX}%
            \pgfmathsetlengthmacro\rearBendY{\bendY}%
          }{% face backward
            \pgfmathsetmacro\frontBendfactor{-1}%
            \pgfmathsetmacro\rearBendfactor{1}%
            \pgfmathsetlengthmacro\frontBendX{\bendX}%
            \pgfmathsetlengthmacro\rearBendX{\bendrightX}%
            \pgfmathsetlengthmacro\rearBendY{\bendrightY}%
          }%
        }{% {\bendrightX}{<}{\bendleftX}%
          \ifdefstring{\face}{forward}{%
            \pgfmathsetmacro\frontBendfactor{-1}%
            \pgfmathsetmacro\rearBendfactor{1}%
            \pgfmathsetlengthmacro\frontBendX{\bendX}%
            \pgfmathsetlengthmacro\rearBendX{\bendrightX}%
            \pgfmathsetlengthmacro\rearBendY{\bendrightY}%
          }{% face backward
            \pgfmathsetmacro\frontBendfactor{1}%
            \pgfmathsetmacro\rearBendfactor{-1}%
            \pgfmathsetlengthmacro\frontBendX{\bendrightX}%
            \pgfmathsetlengthmacro\rearBendX{\bendX}%
            \pgfmathsetlengthmacro\rearBendY{\bendY}%
          }%
        }%
      }{% NOT double bend
        \settoggle{single_bend}{true}%
        \path \bendrightcoord;\pgfgetlastxy{\bendX}{\bendY}% absolut coord
        \pgfmathsetmacro\bendfactor{-1}%
      }%
    }%
    %%%%%%%%%%%%%%%%%%%%
    %% 1. coordinate calculations
    %% basic coords for corners
    \iftoggle{is_parked}{%
      \coordinate (ts-v-f1) at ($ 0.5*(\objectlength,0) + (0, 0.3)$);%
      \coordinate (ts-v-f2) at ($ 0.5*(\objectlength,0) + (0,-0.3)$);%
      \coordinate (ts-v-r1) at ($-0.5*(\objectlength,0) + (0, 0.3)$);%
      \coordinate (ts-v-r2) at ($-0.5*(\objectlength,0) + (0,-0.3)$);%
    }{%
      \coordinate (ts-v-f1) at ($\facefactor*(-0.3,0) + (0, 0.3)$);%
      \coordinate (ts-v-f2) at ($\facefactor*(-0.3,0) + (0,-0.3)$);%
      \coordinate (ts-v-r1) at ($\facefactor*(-\objectlength,0) + (0, 0.3)$);%
      \coordinate (ts-v-r2) at ($\facefactor*(-\objectlength,0) + (0,-0.3)$);%
    }%
    %% front tip for traveling direction
    \iftoggle{is_parked}{%
      \coordinate (ts-v-f) at ($ 0.5*(\objectlength,0) + (0, 0  )$);%
    }{%
      \coordinate (ts-v-f) at (0,0);%
    }%
    %% bend - DEFAULT: no bend
    \coordinate (ts-b-f1) at (ts-v-f1);%
    \coordinate (ts-b-f2) at (ts-v-f2);%
    \coordinate (ts-b-r1) at (ts-v-r1);%
    \coordinate (ts-b-r2) at (ts-v-r2);%
    %
    \iftoggle{single_bend}{%
      % \bendX is a absolut coordinate
      % make them relative to  base
      \path (0,0);\pgfgetlastxy{\baseX}{\baseY}% absolut coord
      % calc bend position
      \coordinate (ts-b-r1) at ($(-\baseX,0) + (\bendX, 0.3) + \facefactor*\bendfactor*( 0.1,0)$);%
      \coordinate (ts-b-r2) at ($(-\baseX,0) + (\bendX,-0.3) + \facefactor*\bendfactor*(-0.1,0)$);%
      % calc length from bend to end with factor ~0.7071 at 45 degree to a projected length
      \pgfmathsetlengthmacro\bendlength{(\facefactor*\objectlength - \baseX + \bendX)*0.7071}%
      \coordinate (ts-v-r1) at ($(ts-b-r1) + (-\bendlength,0) + \facefactor*\bendfactor*( 0.1,\bendlength) + (0,-0.1)$);%
      \coordinate (ts-v-r2) at ($(ts-b-r2) + (-\bendlength,0) + \facefactor*\bendfactor*(-0.1,\bendlength) + (0, 0.1)$);%
    }{}%
    \iftoggle{double_bend}{%
      % \bendX and \bendY are absolut coords
      % make them relative to  base
      \path (0,0);\pgfgetlastxy{\baseX}{\baseY}% absolut coord
      % calc bend position
      \coordinate (ts-b-f1) at ($(-\baseX,0) + (\frontBendX, 0.3) + \facefactor*\frontBendfactor*(-0.1,0)$);%
      \coordinate (ts-b-f2) at ($(-\baseX,0) + (\frontBendX,-0.3) + \facefactor*\frontBendfactor*( 0.1,0)$);%
      \coordinate (ts-b-r1) at ($(-\baseX,0) + (\rearBendX, 0.3) + (0,-\baseY) + (0,\rearBendY) + \facefactor*\rearBendfactor*( 0.1,0)$);%
      \coordinate (ts-b-r2) at ($(-\baseX,0) + (\rearBendX,-0.3) + (0,-\baseY) + (0,\rearBendY) + \facefactor*\rearBendfactor*(-0.1,0)$);%
      % calc length from bend to end with factor ~1.4142 at 45 degree to a projected length
      \pgfmathsetlengthmacro\bendlength{\facefactor*\objectlength - (\frontBendX - \rearBendX)*1.4142 - (\baseX - \frontBendX)}%
      \coordinate (ts-v-r1) at ($(ts-b-r1) + (-\bendlength,0) + \facefactor*\rearBendfactor*(-0.1,0)$);%
      \coordinate (ts-v-r2) at ($(ts-b-r2) + (-\bendlength,0) + \facefactor*\rearBendfactor*( 0.1,0)$);%
    }{}%
    %%
    %%%%%%%%%%%%%%%%%%%%
    %% 2. vehicle style
    \iftoggle{in_train_mode}{% train mode
      \iftoggle{train_is_a_ghost}{% ghost train
        \tikzset{every path/.style={draw=foreground, line width=0.8pt, dashed}};%
      }{% normal train
        \tikzset{every path/.style={draw=foreground, line width=1pt, fill=background}};%
      }%
    }{% shunting mode
      \tikzset{every path/.style={draw=foreground, double, double distance=0.5mm, line width=0.3pt, fill=background}};%
    }%
    %%
    %%%%%%%%%%%%%%%%%%%%
    %% 3. arrow shapes
    %% (order before vehicle shape due to background fill!)
    \iftoggle{is_shunting}{% arrow for shunting
      \iftoggle{in_shunting_mode}{% shunting mode
        \fill[draw=none,fill=background] ($\facefactor*(-0.3, 0.3)$) --%
                                          ($\facefactor*(-0.1, 0.3)$) --%
                                          ($\facefactor*( 0.2, 0  )$) --%
                                          ($\facefactor*(-0.1,-0.3)$) --%
                                          ($\facefactor*(-0.3,-0.3)$) -- cycle;% background fill
        \path[line cap=rect,fill=none] ($\facefactor*(-0.1, 0.3)$) --%
                                       ($\facefactor*( 0.2, 0  )$) --%
                                       ($\facefactor*(-0.1,-0.3)$);% arrow shape
      }{% train mode
        \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/vehicle/movement}{movement can only be combined with shunting}}%
      }%
    }{}% end \iftoggle{shunting_movement}
    \ifdefstring{\trainrun}{none}{}{% DEFAULT no arrow for train
      \iftoggle{in_train_mode}{% train mode
        \ifdefstring{\trainrun}{slow}{%
          \fill[draw=none,fill=background] ($\facefactor*(-0.3, 0.3)$) --%
                                            ($\facefactor*(-0.1, 0.3)$) --%
                                            ($\facefactor*( 0.2, 0  )$) --%
                                            ($\facefactor*(-0.1,-0.3)$) --%
                                            ($\facefactor*(-0.3,-0.3)$) -- cycle;% background fill
          \path[fill=none] ($\facefactor*(-0.15, 0.3)$) --%
                           ($\facefactor*(-0.1 , 0.3)$) --%
                           ($\facefactor*( 0.2 , 0  )$) --%
                           ($\facefactor*(-0.1 ,-0.3)$) --%
                           ($\facefactor*(-0.15,-0.3)$);% arrow shape
        }{%
          \ifdefstring{\trainrun}{normal}{%
            \fill[draw=none,fill=background] ($\facefactor*(-0.3, 0.3)$) --%
                                              ($\facefactor*( 0.1, 0.3)$) --%
                                              ($\facefactor*( 0.4, 0  )$) --%
                                              ($\facefactor*( 0.1,-0.3)$) --%
                                              ($\facefactor*(-0.3,-0.3)$) -- cycle;% background fill
            \path[fill=none] ($\facefactor*(-0.15, 0.3)$) --%
                             ($\facefactor*(-0.1 , 0.3)$) --%
                             ($\facefactor*( 0.2 , 0  )$) --%
                             ($\facefactor*(-0.1 ,-0.3)$) --%
                             ($\facefactor*(-0.15,-0.3)$);% arrow shape part 1
            \path[fill=none] ($\facefactor*( 0.05, 0.3)$) --%
                             ($\facefactor*( 0.1 , 0.3)$) --%
                             ($\facefactor*( 0.4 , 0  )$) --%
                             ($\facefactor*( 0.1 ,-0.3)$) --%
                             ($\facefactor*( 0.05,-0.3)$);% arrow shape part 2
            %
          }{%
            \ifdefstring{\trainrun}{fast}{%
              \fill[draw=none,fill=background] ($\facefactor*(-0.3, 0.3)$) --%
                                                ($\facefactor*( 0.3, 0.3)$) --%
                                                ($\facefactor*( 0.6, 0  )$) --%
                                                ($\facefactor*( 0.3,-0.3)$) --%
                                                ($\facefactor*(-0.3,-0.3)$) -- cycle;% background fill
              \path[fill=none] ($\facefactor*(-0.15, 0.3)$) --%
                               ($\facefactor*(-0.1 , 0.3)$) --%
                               ($\facefactor*( 0.2 , 0  )$) --%
                               ($\facefactor*(-0.1 ,-0.3)$) --%
                               ($\facefactor*(-0.15,-0.3)$);% arrow shape part 1
              \path[fill=none] ($\facefactor*( 0.05, 0.3)$) --%
                               ($\facefactor*( 0.1 , 0.3)$) --%
                               ($\facefactor*( 0.4 , 0  )$) --%
                               ($\facefactor*( 0.1 ,-0.3)$) --%
                               ($\facefactor*( 0.05,-0.3)$);% arrow shape part 2
              \path[fill=none] ($\facefactor*( 0.25, 0.3)$) --%
                               ($\facefactor*( 0.3 , 0.3)$) --%
                               ($\facefactor*( 0.6 , 0  )$) --%
                               ($\facefactor*( 0.3 ,-0.3)$) --%
                               ($\facefactor*( 0.25,-0.3)$);% arrow shape part 3
              %
            }{%error message
              \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/vehicles/run}{“normal“, “slow“, “fast“ OR “none“ as key required}}%
            }%
          }%
        }%
      }{% shunting mode
        \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/vehicle/run}{run can only be combined with train}}%
      }% end \iftoggle{in_train_mode}
    }% end \ifdefstring{\trainrun}{none} % end arrow shapes
    %%
    %%%%%%%%%%%%%%%%%%%%
    %% 4. vehicle shape
    \path (ts-v-f)%
      -- (ts-v-f1) -- (ts-b-f1) -- (ts-b-r1) -- (ts-v-r1)%
      -- (ts-v-r2) -- (ts-b-r2) -- (ts-b-f2) -- (ts-v-f2)%
      -- cycle;% vehicle shape
    %%
    %%%%%%%%%%%%%%%%%%%%
    %% 5. operation mode
    \iftoggle{is_parked}{}{% vehicle NOT parked
      \ifdefstring{\operationmode}{manual}{%
        \path[draw=none, fill=foreground] ($\facefactor*(-0.4,0)$) circle (0.15);% dot
      }{
        \ifdefstring{\operationmode}{automatic}{%
          \path[draw=none, fill=foreground] ($\facefactor*(-0.15,0)$) -- ++($\facefactor*(-0.15,0) +(0,0.15)$) -- ++(0,-0.3) -- cycle;% triangle
        }{%
          \ifdefstring{\operationmode}{undefined}{}{%
            \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/operation}{“manual“, “automatic“ OR “undefined“ as key required}}%
          }%
        }% end automatically_operated
      }% end manually_operated
    }%
    %%
    %%%%%%%%%%%%%%%%%%%%
    %% 6. label
    \iftoggle{is_parked}{%
      \coordinate (ts-v-l)  at (0,0);% DEFAULT center
    }{%
      \coordinate (ts-v-l) at ($\facefactor*-0.5*(\objectlength,0)$);% DEFAULT center
    }%
    \iftoggle{train_is_a_ghost}{% ghost train
      \coordinate (ts-v-l) at ($(ts-v-l) + (0,0.16)$);%
    }{}%
    \ifdefstring{\operationmode}{manual}{%
      \coordinate (ts-v-l) at ($(ts-v-l) + \facefactor*(-0.25,0)$);%
    }{}%
    \ifdefstring{\operationmode}{automatic}{%
      \coordinate (ts-v-l) at ($(ts-v-l) + \facefactor*(-0.15,0)$);%
    }{}%
    \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
      \path let \p1=\labelcoord in coordinate (ts-v-l) at ($(ts-v-l)+(\x1,\y1)$);%
    }%
    \ifdefstring{\labelcontent}{}{}{% label NOT empty
      \ifdefstring{\labelalign}{center}{% DEFAULT label align center
        \def\labelanchor{center}
      }{% label align NOT default
        \ifdefstring{\labelalign}{left}{% label align left
          \def\labelanchor{east}
        }{%
          \ifdefstring{\labelalign}{right}{% label align left
            \def\labelanchor{west}
          }{% NOT center, left, or right
            \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/label align}{“center“, “left“ OR “right“ as key required}}%
          }% \ifdefstring{\labelalign}{right}
        }% \ifdefstring{\labelalign}{left}
      }% \ifdefstring{\labelalign}{center}
      \node[text=foreground,anchor=\labelanchor,align=\labelalign] at (ts-v-l) {\footnotesize \labelcontent};% label
    }%
  }},% END pics/vehicles/.style args={#1/#2/#3}
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % symbology entry
  symbology_parked_vehicles/.pic = {%
    \secondarytrack (0,0) -- (6,0);%
    \parkedvehicles[] at (3,0) label ();%
  },%
  % symbology entry
  symbology_train_shunt_mode/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \shunting[forward] at (5,0) label ();%
  },%
  % symbology entry
  symbology_train_shunting/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \shunting[movement,forward] at (5,0) label ();%
  },%
  % symbology entry
  symbology_train/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \train[forward] at (5,0) label ();%
  },%
  % symbology entry
  symbology_train_moving_slow/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \train[run=slow,forward] at (5,0) label ();%
  },%
  % symbology entry
  symbology_train_moving/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \train[run=normal,forward] at (5,0) label ();%
  },%
  % symbology entry
  symbology_train_moving_fast/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \train[run=fast,forward] at (5,0) label ();%
  },%
  % symbology entry
  symbology_train_ghost/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \train[ghost,forward] at (5,0) label ();%
  },%
  % symbology entry
  symbology_train_drive_automatic/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \train[operation=automatic,forward] at (5,0) label ();%
  },%
  % symbology entry
  symbology_train_drive_human/.pic = {%
    \maintrack (0,0) -- (6,0);%
    \train[operation=manual,forward] at (5,0) label ();%
  },%
}%
%
%%%%%%%%%%%%%%%
\endinput%
%