Debian Codegraph @

texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.trafficcontrol.code.tex

raw
1 %% symbol library for TikZ track schematics
2 %
3 % Copyright (c) 2018 - 2022, Martin Scheidt (ISC license)
4 %
5 % 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.
6 %
7 \ProvidesFileRCS{tikzlibrarytrackschematic.trafficcontrol.code.tex}%
8 %
9 %%%%%%%%%%%%%%%
10 % Requirements
11 %%%%%%%%%%%%%%%
12 \RequirePackage{tikz,etoolbox}%
13 \usetikzlibrary{calc}%
14 %
15 %%%%%%%%%%%%%%%
16 % tikz keys for multiple use
17 %%%%%%%%%%%%%%%
18 \pgfkeys{%
19 /tikz/trackschematic/.is family,%
20 /tikz/trackschematic/.cd,%
21 %% face
22 face/.value required,% forward OR backward
23 face/.store in=\face,% forward OR backward
24 /tikz/face/.forward to=/tikz/trackschematic/face,%
25 /tikz/forward/.code={\pgfkeys{/tikz/trackschematic/face=forward}},%
26 /tikz/backward/.code={\pgfkeys{/tikz/trackschematic/face=backward}},%
27 /tikz/bidirectional/.code={\pgfkeys{/tikz/trackschematic/face=bidirectional}},%
28 %% traffic practice
29 traffic practice/.value required,% left OR right
30 traffic practice/.store in=\trafficpractice,%
31 traffic practice=right,% DEFAULT
32 /tikz/traffic practice/.forward to=/tikz/trackschematic/traffic practice,%
33 /tikz/position/.forward to=/tikz/trackschematic/traffic practice,%
34 %% label
35 shift label/.store in=\labelcoord,% (coord)
36 shift label=(none),% DEFAULT
37 /tikz/shift label/.forward to=/tikz/trackschematic/shift label,%
38 }%
39 %
40 \pgfkeys{%
41 /tikz/trackschematic/trafficcontrol/.is family,%
42 /tikz/trackschematic/trafficcontrol/.cd,%
43 %% type
44 type/.value required,% balise OR loop
45 type/.store in=\type,% balise OR loop
46 /tikz/type/.forward to=/tikz/trackschematic/trafficcontrol/type,%
47 %% block signal type
48 block type/.value forbidden,%
49 block type/.code={\settoggle{is_block_type}{true}},%
50 /tikz/block/.forward to=/tikz/trackschematic/trafficcontrol/block type,%
51 %% route signal type
52 route type/.value forbidden,%
53 route type/.code={\settoggle{is_route_type}{true}},%
54 /tikz/route/.forward to=/tikz/trackschematic/trafficcontrol/route type,%
55 }%
56 % options
57 \newtoggle{is_block_type}\settoggle{is_block_type}{false}%
58 \newtoggle{is_route_type}\settoggle{is_route_type}{false}%
59 %%%%%%%%%%%%%%%
60 % symbol signal
61 %%%%%%%%%%%%%%%
62 % command
63 \newcommand\signal{}% just for safety
64 \def\signal[#1]#2(#3)#4(#5){% \signal[options] at (coord) label (name);
65 \pic[#1] at (#3) {signal={#2/#4/#5}}% symbol
66 }%
67 \newcommand\distantsignal{}% just for safety
68 \def\distantsignal[#1]#2(#3)#4(#5){% \distantsignal[options] at (coord) label (name);
69 \pic[distant,#1] at (#3) {signal={#2/#4/#5}}% symbol
70 }%
71 \newcommand\speedsign{}% just for safety
72 \def\speedsign[#1]#2(#3)#4(#5){% \speedsign[options] at (coord) label (name);
73 \pic[speed type,#1] at (#3) {signal={#2/#4/#5}}% symbol
74 }%
75 \newcommand\speedsignal{}% just for safety
76 \def\speedsignal[#1]#2(#3)#4(#5){% \speedsignal[options] at (coord) label (name);
77 \pic[speed type,#1] at (#3) {signal={#2/#4/#5}}% symbol
78 }%
79 \newcommand\speeddistantsignal{}% just for safety
80 \def\speeddistantsignal[#1]#2(#3)#4(#5){% \speedsignal[options] at (coord) label (name);
81 \pic[speed type,distant,#1] at (#3) {signal={#2/#4/#5}}% symbol
82 }%
83 \newcommand\blocksignal{}% just for safety
84 \def\blocksignal[#1]#2(#3)#4(#5){% \blocksignal[options] at (coord) label (name);
85 \pic[block,#1] at (#3) {signal={#2/#4/#5}}% symbol
86 }%
87 \newcommand\routesignal{}% just for safety
88 \def\routesignal[#1]#2(#3)#4(#5){% \routesignal[options] at (coord) label (name);
89 \pic[route,#1] at (#3) {signal={#2/#4/#5}}% symbol
90 }%
91 \newcommand\shuntsignal{}% just for safety
92 \def\shuntsignal[#1]#2(#3)#4(#5){% \shuntsignal[options] at (coord) label (name);
93 \pic[shunting,#1] at (#3) {signal={#2/#4/#5}}% symbol
94 }%
95 \newcommand\shuntlimit{}% just for safety
96 \def\shuntlimit[#1]#2(#3)#4(#5){% \shuntlimit[options] at (coord) label (name);
97 \pic[shunt limit,#1] at (#3) {signal={#2/#4/#5}}% symbol
98 }%
99 \newcommand\berthsignal{}% just for safety
100 \def\berthsignal[#1]#2(#3)#4(#5){% \berthsignal[options] at (coord) label (name);
101 \pic[berth,#1] at (#3) {signal={#2/#4/#5}}% symbol
102 }%
103 \newcommand\berthsign{}% just for safety
104 \def\berthsign[#1]#2(#3)#4(#5){% \berthsign[options] at (coord) label (name);
105 \pic[berth,#1] at (#3) {signal={#2/#4/#5}}% symbol
106 }%
107 % tikz keys
108 \pgfkeys{%
109 /tikz/trackschematic/trafficcontrol/signal/.is family,%
110 /tikz/trackschematic/trafficcontrol/signal/.cd,%
111 %% distant signal type
112 distant type/.value forbidden,%
113 distant type/.code={\settoggle{is_distant_type}{true}},%
114 /tikz/distant/.forward to=/tikz/trackschematic/trafficcontrol/signal/distant type,%
115 %% block signal type
116 speed type/.value forbidden,%
117 speed type/.code={\settoggle{is_speed_type}{true}},%
118 /tikz/speed type/.forward to=/tikz/trackschematic/trafficcontrol/signal/speed type,%
119 %% shunting signal type
120 shunting type/.value forbidden,%
121 shunting type/.code={\settoggle{is_shunting_type}{true}},%
122 /tikz/shunting/.forward to=/tikz/trackschematic/trafficcontrol/signal/shunting type,%
123 %% shunting signal type
124 shunt limit/.value forbidden,%
125 shunt limit/.code={\settoggle{is_shunt_limit}{true}},%
126 /tikz/shunt limit/.forward to=/tikz/trackschematic/trafficcontrol/signal/shunt limit,%
127 %% berth signal type
128 berth type/.value forbidden,%
129 berth type/.code={\settoggle{is_berth_type}{true}},%
130 /tikz/berth/.forward to=/tikz/trackschematic/trafficcontrol/signal/berth type,%
131 %% speed value
132 speed/.store in=\speed,% number
133 speed=,% number
134 /tikz/speed/.forward to=/tikz/trackschematic/trafficcontrol/signal/speed,%
135 %% speed value
136 distant speed/.store in=\distantspeed,% number
137 distant speed=,% number
138 /tikz/distant speed/.forward to=/tikz/trackschematic/trafficcontrol/signal/distant speed,%
139 %% locked signal
140 locked/.value forbidden,%
141 locked/.code={\settoggle{is_locked}{true}},%
142 /tikz/locked/.forward to=/tikz/trackschematic/trafficcontrol/signal/locked,%
143 }%
144 % options
145 \newtoggle{is_distant_type}\settoggle{is_distant_type}{false}%
146 \newtoggle{is_speed_type}\settoggle{is_speed_type}{false}%
147 \newtoggle{is_shunting_type}\settoggle{is_shunting_type}{false}%
148 \newtoggle{is_shunt_limit}\settoggle{is_shunt_limit}{false}%
149 \newtoggle{is_berth_type}\settoggle{is_berth_type}{false}%
150 \newtoggle{is_locked}\settoggle{is_locked}{false}%
151 % symbol definition
152 \tikzset{% generic symbol
153 pics/signal/.default=,%
154 pics/signal/.style args={#1/#2/#3}{code={%
155 %% settings
156 \def\coordcommand{#1}% beware of leading and tailing spaces!
157 \def\labelcommand{#2}% beware of leading and tailing spaces!
158 \def\labelcontent{#3}%
159 %
160 %% traffic practice setup
161 \ifdefstring{\trafficpractice}{left}{% branch
162 \pgfmathsetmacro{\trafficfactor}{-1}%
163 }{%
164 \ifdefstring{\trafficpractice}{right}{% branch
165 \pgfmathsetmacro{\trafficfactor}{1}%
166 }{% error message
167 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
168 }%
169 }% end \ifdefstring{\trafficpractice}
170 %% face setup
171 \ifdefstring{\face}{forward}{% face
172 \pgfmathsetmacro{\facefactor}{1}%
173 \def\align{left}%
174 \def\rotate{-90}%
175 }{%
176 \ifdefstring{\face}{backward}{% face
177 \pgfmathsetmacro{\facefactor}{-1}%
178 \def\align{right}%
179 \def\rotate{90}%
180 }{% error message
181 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
182 }%
183 }% end \ifdefstring{\face}
184 \tikzset{every path/.style={draw=foreground,line width=1pt}};%
185 \tikzset{every node/.style={text=foreground,inner sep=1pt}};%
186 %% signal pole
187 \path (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.7,0)$);% signal pole
188 %
189 %% label
190 \ifdefstring{\labelcontent}{}{}{% label NOT empty
191 \coordinate (ts-s-l) at ($\trafficfactor*\facefactor*(0,-0.4)$);%
192 \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
193 \path let \p1=\labelcoord in coordinate (ts-s-l) at ($(ts-s-l)+(\x1,\y1)$);%
194 }%
195 \node[\align] at (ts-s-l) {\footnotesize \labelcontent};%
196 }%
197 \tikzset{every path/.style={draw=foreground,line width=1pt,fill=background},rounded corners=0.1pt};%
198 %% signal marker
199 \iftoggle{is_distant_type}{% marker for distant signal
200 \path ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.35,0)$) --%
201 ++($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.35,0)$) --%
202 ++($\trafficfactor*\facefactor*(0, 0.4)$) -- cycle;% signal marker
203 %
204 }{}%
205 \iftoggle{is_speed_type}{% marker for speed signal
206 \path ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.35,0)$) --%
207 ++($\trafficfactor*\facefactor*(0,-0.4)$) --%
208 ++($\trafficfactor*\facefactor*(0, 0.2) + \facefactor*(0.35,0)$) -- cycle;% signal marker
209 %
210 }{}%
211 \iftoggle{is_block_type}{% marker for block signal
212 \path ($\trafficfactor*\facefactor*(0,-0.6) + \facefactor*(0.7,0)$) rectangle%
213 ++($\trafficfactor*\facefactor*(0, 0.4) + \facefactor*(0.4,0)$);% signal marker
214 %
215 }{}%
216 \iftoggle{is_route_type}{% marker for route signal
217 \path ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.9,0)$) circle (0.2);% signal marker
218 %
219 }{}%
220 \iftoggle{is_shunting_type}{% marker for shunting signal
221 \path ($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*(0.6,0)$) circle (0.1);% signal marker
222 %
223 }{}%
224 \iftoggle{is_shunt_limit}{% marker for shunting signal
225 \tikzset{semicircle/.pic={\path (0,0) arc (180:0:0.1) -- cycle;};}%
226 \pgfmathsetmacro{\trafficfactorTEST}{-1}%
227 \ifdefequal{\trafficfactor}{\trafficfactorTEST}{%
228 \pgfmathsetmacro{\trafficfactorX}{-2}%
229 }{%
230 \pgfmathsetmacro{\trafficfactorX}{1}%
231 }%
232 \pic[rotate=\rotate] at ($\trafficfactorX*\facefactor*(0,-0.2) + \facefactor*(0.6,0)$) {semicircle}; % signal marker
233 %
234 }{}%
235 \iftoggle{is_berth_type}{% marker for berth signal
236 \path ($\trafficfactor*\facefactor*(0,-0.575) + \facefactor*(0.3,0)$) rectangle%
237 ++($\trafficfactor*\facefactor*(0, 0.35 ) + \facefactor*(0.5,0)$);% % signal marker
238 \path[line width=0.75pt] ($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*(0.375,0)$) -- ++($\facefactor*(0.35,0)$);%
239 \path[line width=0.75pt] ($\trafficfactor*\facefactor*(0,-0.5) + \facefactor*(0.55 ,0)$) -- ++($\trafficfactor*\facefactor*(0,0.2)$);%
240 \path[line width=0.75pt] ($\trafficfactor*\facefactor*(0,-0.5) + \facefactor*(0.375,0)$) -- ++($\facefactor*(0.35,0)$);%
241 %
242 }{}%
243 %% speed indicator
244 \ifdefstring{\speed}{}{}{% speed NOT empty
245 \tikzset{every node/.style={font=\sffamily,text=foreground}};%
246 \iftoggle{is_speed_type}{% marker for speed signal
247 \node[rotate=\rotate] at ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.85,0)$) {\speed};%
248 }{%
249 \iftoggle{is_shunting_type}{}{% is NOT shunting tyoe
250 \node[rotate=\rotate] at ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(1.3,0)$) {\speed};%
251 }%
252 }%
253 }%
254 \ifdefstring{\distantspeed}{}{}{% distant speed NOT empty
255 \tikzset{every node/.style={font=\sffamily,text=foreground,fill=background,inner sep=0.5pt}};%
256 \node[rotate=\rotate] at ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.2,0)$) {\distantspeed};%
257 }%
258 %% locked
259 \iftoggle{is_locked}{% marker for route signal
260 \iftoggle{is_block_type}{% marker for block signal
261 \path ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.9,0)$) --%
262 ++($\trafficfactor*\facefactor*(0,-0.4)$);% signal aspect
263 }{}%
264 \iftoggle{is_route_type}{% marker for route signal
265 \path ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.9,0)$) --%
266 ++($\trafficfactor*\facefactor*(0,-0.4)$);% signal aspect
267 }{}%
268 \iftoggle{is_shunting_type}{%
269 \path ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.6,0)$) --%
270 ++($\trafficfactor*\facefactor*(0,-0.2)$);% signal aspect
271 }{}%
272 }{}%
273 }},% end pics/signal/.style args={#1/#2/#3}
274 % symbology entry
275 symbology_distant_signal/.pic = {%
276 \maintrack (0,0) -- (6,0);%
277 \distantsignal[forward] at (3,0) label ();%
278 },%
279 % symbology entry
280 symbology_distant_speed_signal/.pic = {%
281 \maintrack (0,0) -- (6,0);%
282 \distantsignal[forward,distant speed={s}] at (3,0) label ();%
283 },%
284 % symbology entry
285 symbology_speed_signal/.pic = {%
286 \maintrack (0,0) -- (6,0);%
287 \speedsignal[forward,speed={s}] at (3,0) label ();%
288 },%
289 % symbology entry
290 symbology_block_signal/.pic = {%
291 \maintrack (0,0) -- (6,0);%
292 \blocksignal[forward] at (3,0) label ();%
293 },%
294 % symbology entry
295 symbology_route_signal/.pic = {%
296 \maintrack (0,0) -- (6,0);%
297 \routesignal[forward] at (3,0) label ();%
298 },%
299 % symbology entry
300 symbology_combined_signal/.pic = {%
301 \maintrack (0,0) -- (6,0);%
302 \signal[distant,block,route,forward,distant speed={ds},speed={s}] at (3,0) label ();%
303 },%
304 % symbology entry
305 symbology_shunt_signal/.pic = {%
306 \maintrack (0,0) -- (6,0);%
307 \shuntsignal[forward] at (3,0) label ();%
308 },%
309 % symbology entry
310 symbology_locked_shunt_signal/.pic = {%
311 \maintrack (0,0) -- (6,0);%
312 \shuntsignal[forward,locked] at (3,0) label ();%
313 },%
314 % symbology entry
315 symbology_shunt_limit/.pic = {%
316 \maintrack (0,0) -- (6,0);%
317 \shuntlimit[forward] at (3,0) label ();%
318 },%
319 % symbology entry
320 symbology_train_berth_sign/.pic = {%
321 \maintrack (0,0) -- (6,0);%
322 \berthsignal[forward] at (3,0) label ();%
323 },%
324 }%
325 %
326 %%%%%%%%%%%%%%%
327 % symbol clearing point
328 %%%%%%%%%%%%%%%
329 % command
330 \newcommand\clearingpoint{}% just for safety
331 \def\clearingpoint[#1]#2(#3)#4(#5){% \clearingpoint[options] at (coord) label (name);
332 \pic[standard,#1] at (#3) {clearing_point={#2/#4/#5}}% symbol
333 }%
334 \newcommand\blockclearing{}% just for safety
335 \def\blockclearing[#1]#2(#3)#4(#5){% \blockclearing[options] at (coord) label (name);
336 \pic[block,#1] at (#3) {clearing_point={#2/#4/#5}}% symbol
337 }%
338 \newcommand\routeclearing{}% just for safety
339 \def\routeclearing[#1]#2(#3)#4(#5){% \routeclearing[options] at (coord) label (name);
340 \pic[route,#1] at (#3) {clearing_point={#2/#4/#5}}% symbol
341 }%
342 \pgfkeys{%
343 /tikz/trackschematic/trafficcontrol/clearing point/.is family,%
344 /tikz/trackschematic/trafficcontrol/clearing point/.cd,%
345 %% standard type
346 standard type/.value forbidden,%
347 standard type/.code={\settoggle{is_standard_type}{true}},%
348 /tikz/standard/.forward to=/tikz/trackschematic/trafficcontrol/clearing point/standard type,%
349 }%
350 % options
351 \newtoggle{is_standard_type}\settoggle{is_standard_type}{false}%
352 % symbol definition
353 \tikzset{%
354 pics/clearing_point/.default=,%
355 pics/clearing_point/.style args={#1/#2/#3}{code={%
356 %% settings
357 \def\coordcommand{#1}% beware of leading and tailing spaces!
358 \def\labelcommand{#2}% beware of leading and tailing spaces!
359 \def\labelcontent{#3}%
360 %
361 %% traffic practice setup
362 \ifdefstring{\trafficpractice}{left}{% branch
363 \pgfmathsetmacro{\trafficfactor}{-1}%
364 }{%
365 \ifdefstring{\trafficpractice}{right}{% branch
366 \pgfmathsetmacro{\trafficfactor}{1}%
367 }{% error message
368 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
369 }%
370 }% end \ifdefstring{\trafficpractice}
371 %% face setup
372 \ifdefstring{\face}{backward}{% face
373 \pgfmathsetmacro{\facefactor}{-1}%
374 }{% default case
375 \pgfmathsetmacro{\facefactor}{1}%
376 }% end \ifdefstring{\face}
377 \tikzset{every path/.style={draw=foreground,line width=1pt}};%
378 %% marker
379 \path ($\trafficfactor*\facefactor*(0,-0.1)$) -- ++($\trafficfactor*\facefactor*(0,0.2)$);% marker
380 %% sign
381 \iftoggle{is_standard_type}{% marker for block signal
382 \path ($\trafficfactor*\facefactor*(0,-0.1) + \facefactor*(0.1,0)$) -- ++($\facefactor*(-0.2,0)$);% sign
383 }{}%
384 \iftoggle{is_block_type}{% marker for block signal
385 \path ($\trafficfactor*\facefactor*(0,-0.1)$) --%
386 ++($\trafficfactor*\facefactor*(0,-0.1) + \facefactor*(-0.1,0)$) --%
387 ++($\trafficfactor*\facefactor*(0,-0.1) + \facefactor*( 0.1,0)$) --%
388 ++($\trafficfactor*\facefactor*(0, 0.1) + \facefactor*( 0.1,0)$) -- cycle;% sign
389 }{}%
390 \iftoggle{is_route_type}{% marker for route signal
391 \path ($\trafficfactor*\facefactor*(0,-0.2)$) circle (0.1);% sign
392 }{}%
393 %% label
394 \ifdefstring{\labelcontent}{}{}{% label NOT empty
395 \tikzset{every node/.style={font=\sffamily,text=foreground}};%
396 \coordinate (ts-cp-l) at ($\trafficfactor*\facefactor*(0,0.25)$);%
397 \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
398 \path let \p1=\labelcoord in coordinate (ts-cp-l) at ($(ts-cp-l)+(\x1,\y1)$);%
399 }%
400 \node at (ts-cp-l) {\footnotesize \labelcontent};%
401 }%
402 }},% end pics/clearing_point/.style args={#1/#2/#3}
403 % symbology entry
404 symbology_clearing_point/.pic = {%
405 \maintrack (0,0) -- (6,0);%
406 \clearingpoint[forward] at (3,0) label ();%
407 },%
408 % symbology entry
409 symbology_block_clearing_point/.pic = {%
410 \maintrack (0,0) -- (6,0);%
411 \blockclearing[forward] at (3,0) label ();%
412 },%
413 % symbology entry
414 symbology_route_clearing_point/.pic = {%
415 \maintrack (0,0) -- (6,0);%
416 \routeclearing[forward] at (3,0) label ();%
417 },%
418 }%
419 %
420 %%%%%%%%%%%%%%%
421 % symbol trackloop
422 %%%%%%%%%%%%%%%
423 % command
424 \newcommand\trackloop{}% just for safety
425 \def\trackloop[#1]#2(#3)#4(#5){% \trackloop[options] at (coord) label (name);
426 \pic[#1] at (#3) {trackloop={#2/#4/#5}}% symbol
427 }%
428 % symbol definition
429 \tikzset{%
430 pics/trackloop/.default=,%
431 pics/trackloop/.style args={#1/#2/#3}{code={%
432 %% settings
433 \def\coordcommand{#1}% beware of leading and tailing spaces!
434 \def\labelcommand{#2}% beware of leading and tailing spaces!
435 \def\labelcontent{#3}%
436 %% traffic practice setup
437 \ifdefstring{\trafficpractice}{left}{% branch
438 \pgfmathsetmacro{\trafficfactor}{-1}%
439 }{%
440 \ifdefstring{\trafficpractice}{right}{% branch
441 \pgfmathsetmacro{\trafficfactor}{1}%
442 }{% error message
443 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
444 }%
445 }% end \ifdefstring{\trafficpractice}
446 %% marker
447 \tikzset{every path/.style={draw=foreground}};%
448 \path[line width=1pt] ($\trafficfactor*(0,-0.175)$) -- ++(-0.0625,-0.0625) -- ++(-0.2,0) -- ++(-0.125,0.125) -- ++(-0.1,0) -- ++(0,-0.125) -- ++(0.1,0) -- ++(0.125,0.125) -- ++(0.2,0) -- ++(0.125,-0.125) -- ++(0.2,0) -- ++(0.125,0.125) -- ++(0.1,0) -- ++(0,-0.125) -- ++(-0.1,0) -- ++(-0.125,0.125) -- ++(-0.2,0) -- cycle;% loop marker
449 %% label
450 \ifdefstring{\labelcontent}{}{}{% label NOT empty
451 \tikzset{every node/.style={font=\sffamily,text=foreground}};%
452 \coordinate (ts-tm-l) at ($\trafficfactor*(0,0.25)$);%
453 \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
454 \path let \p1=\labelcoord in coordinate (ts-tm-l) at ($(ts-tm-l)+(\x1,\y1)$);%
455 }%
456 \node at (ts-tm-l) {\footnotesize \labelcontent};%
457 }%
458 }},% end pics/transmitter/.style args={#1/#2/#3}
459 % symbology entry
460 symbology_trackloop/.pic = {%
461 \maintrack (0,0) -- (6,0);%
462 \trackloop[forward] at (3,0) label ();%
463 },%
464 }%
465 %
466 %%%%%%%%%%%%%%%
467 % symbol balise
468 %%%%%%%%%%%%%%%
469 % command
470 \newcommand\balise{}% just for safety
471 \def\balise[#1]#2(#3)#4(#5){% \balise[options] at (coord) label (name);
472 \pic[#1] at (#3) {balise={#2/#4/#5}}% symbol
473 }%
474 \pgfkeys{%
475 /tikz/trackschematic/trafficcontrol/.is family,%
476 /tikz/trackschematic/trafficcontrol/.cd,%
477 %% route signal type
478 switched/.value forbidden,%
479 switched/.code={\settoggle{switched}{true}},%
480 /tikz/switched/.forward to=/tikz/trackschematic/trafficcontrol/switched,%
481 %% balises along the direction
482 along/.store in=\along,% array of integer
483 along=none,% DEFAULT
484 /tikz/along/.forward to=/tikz/trackschematic/trafficcontrol/along,%
485 %% balises oppose the direction
486 oppose/.store in=\oppose,% array of integer
487 oppose=none,% DEFAULT
488 /tikz/oppose/.forward to=/tikz/trackschematic/trafficcontrol/oppose,%
489 %% balises along the direction
490 along switched/.store in=\alongswitched,% array of integer
491 along switched=none,% DEFAULT
492 /tikz/along switched/.forward to=/tikz/trackschematic/trafficcontrol/along switched,%
493 %% balises oppose the direction
494 oppose switched/.store in=\opposeswitched,% array of integer
495 oppose switched=none,% DEFAULT
496 /tikz/oppose switched/.forward to=/tikz/trackschematic/trafficcontrol/oppose switched,%
497 %% display index number
498 index number/.value forbidden,%
499 index number/.code={\settoggle{index_number}{true}},%
500 /tikz/index/.forward to=/tikz/trackschematic/trafficcontrol/index number,%
501 }%
502 % options
503 \newtoggle{unnumberd}\settoggle{unnumberd}{true}% DEFAULT
504 \newtoggle{switched}\settoggle{switched}{false}%
505 \newtoggle{index_number}\settoggle{index_number}{false}%
506 % symbol definition
507 \tikzset{%
508 pics/balise/.default=,%
509 pics/balise/.style args={#1/#2/#3}{code={%
510 %%
511 %%%%%%%[steps]%%%%%%
512 %% 0. setup settings
513 %% 1. draw marker
514 %% 2. draw label
515 %%%%%%%%%%%%%%%%%%%%
516 %% 0. settings
517 \def\coordcommand{#1}% beware of leading and tailing spaces!
518 \def\labelcommand{#2}% beware of leading and tailing spaces!
519 \def\labelcontent{#3}%
520 %%
521 %% face setup
522 \ifdefstring{\face}{forward}{% face
523 \pgfmathsetmacro{\facefactor}{1}%
524 }{%
525 \ifdefstring{\face}{backward}{% face
526 \pgfmathsetmacro{\facefactor}{-1}%
527 }{% error message
528 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
529 }%
530 }% end \ifdefstring{\face}
531 %%
532 %% traffic practice setup
533 \ifdefstring{\trafficpractice}{left}{% branch
534 \pgfmathsetmacro{\trafficfactor}{-1}%
535 }{%
536 \ifdefstring{\trafficpractice}{right}{% branch
537 \pgfmathsetmacro{\trafficfactor}{1}%
538 }{% error message
539 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
540 }%
541 }% end \ifdefstring{\trafficpractice}
542 %%
543 %% number of balises known?
544 \ifdefstring{\along}{none}{}{% a number has been set
545 \settoggle{unnumberd}{false}%
546 }%
547 %% number of balises known?
548 \ifdefstring{\oppose}{none}{}{% a number has been set
549 \settoggle{unnumberd}{false}%
550 }%
551 %% number of balises known?
552 \ifdefstring{\alongswitched}{none}{}{% a number has been set
553 \settoggle{unnumberd}{false}%
554 }%
555 %% number of balises known?
556 \ifdefstring{\opposeswitched}{none}{}{% a number has been set
557 \settoggle{unnumberd}{false}%
558 }%
559 %%
560 %%%%%%%%%%%%%%%%%%%%
561 %% 1. marker
562 \tikzset{every path/.style={draw=foreground,line width=0.75pt,rounded corners=0.2pt}};%
563 %%
564 \iftoggle{unnumberd}{% no number has been set
565 %% marker for undefined balises
566 \path[fill=background] ($(-0.3,0)$) rectangle ($\trafficfactor*\facefactor*(0,-0.25) + (0.3,0)$);% balise marker
567 \iftoggle{switched}{% balises can be switched
568 \path[fill=foreground] ($\trafficfactor*\facefactor*(0,-0.075) + (-0.225,0)$) rectangle%
569 ($\trafficfactor*\facefactor*(0,-0.175) + ( 0.225,0)$);% switch marker
570 }{}%
571 }{% a number has been set
572 %% marker for numbered balises
573 \ifdefstring{\along}{none}{}{
574 \foreach \n in \along{%
575 \path[fill=background] ($\n*\facefactor*(0.2,0)$) rectangle%
576 ($\n*\facefactor*(0.2,0) + (0.2 ,0) + \trafficfactor*\facefactor*(0,-0.25)$);% balise marker
577 \iftoggle{index_number}{%
578 \node[text=foreground] at ($\n*\facefactor*(0.2,0) + (0.1,0) + \trafficfactor*\facefactor*(0,-0.125)$) {\tiny\n};%
579 }{}%
580 }%
581 }%
582 \ifdefstring{\oppose}{none}{}{
583 \foreach \n in \oppose{%
584 \path[fill=background] ($\n*\facefactor*(0.2,0)$) rectangle%
585 ($\n*\facefactor*(0.2,0) + (0.2 ,0) + \trafficfactor*\facefactor*(0,0.25)$);% balise marker
586 \iftoggle{index_number}{%
587 \node[text=foreground] at ($\n*\facefactor*(0.2,0) + (0.1,0) + \trafficfactor*\facefactor*(0,0.125)$) {\tiny\n};%
588 }{}%
589 }%
590 }%
591 \ifdefstring{\alongswitched}{none}{}{
592 \foreach \n in \alongswitched{%
593 \path[fill=background] ($\n*\facefactor*(0.2,0)$) rectangle%
594 ($\n*\facefactor*(0.2,0) + (0.2 ,0) + \trafficfactor*\facefactor*(0,-0.25)$);% balise marker
595 \path[fill=foreground] ($\n*\facefactor*(0.2,0) + (0.05,0) + \trafficfactor*\facefactor*(0,-0.05)$) rectangle%
596 ($\n*\facefactor*(0.2,0) + (0.15,0) + \trafficfactor*\facefactor*(0,-0.2)$);% switch marker
597 \iftoggle{index_number}{%
598 \node[text=background] at ($\n*\facefactor*(0.2,0) + (0.1,0) + \trafficfactor*\facefactor*(0,-0.125)$) {\tiny\n};%
599 }{}%
600 }%
601 }%
602 \ifdefstring{\opposeswitched}{none}{}{
603 \foreach \n in \opposeswitched{%
604 \path[fill=background] ($\n*\facefactor*(0.2,0)$) rectangle%
605 ($\n*\facefactor*(0.2,0) + (0.2 ,0) + \trafficfactor*\facefactor*(0,0.25)$);% balise marker
606 \path[fill=foreground] ($\n*\facefactor*(0.2,0) + (0.05,0) + \trafficfactor*\facefactor*(0,0.05)$) rectangle%
607 ($\n*\facefactor*(0.2,0) + (0.15,0) + \trafficfactor*\facefactor*(0,0.2)$);% switch marker
608 \iftoggle{index_number}{%
609 \node[text=background] at ($\n*\facefactor*(0.2,0) + (0.1,0) + \trafficfactor*\facefactor*(0,0.125)$) {\tiny\n};%
610 }{}%
611 }%
612 }%
613 }%
614 %%
615 %%%%%%%%%%%%%%%%%%%%
616 %% 2. label
617 \ifdefstring{\labelcontent}{}{}{% label NOT empty
618 %% coord
619 \iftoggle{unnumberd}{% no number has been set
620 \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.25)$);%
621 }{%
622 \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.25) + (0.1,0)$);%
623 }%
624 \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
625 \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);%
626 }%
627 %% label style
628 \tikzset{every node/.style={font=\sffamily,text=foreground}};%
629 %
630 \ifdefstring{\trafficpractice}{left}{%
631 \tikzset{every node/.append style={left,align=right}};%
632 }{%
633 \tikzset{every node/.append style={right,align=left}};%
634 }%
635 \ifdefstring{\face}{forward}{%
636 \tikzset{every node/.append style={rotate=270}};%
637 }{%
638 \tikzset{every node/.append style={rotate=90}};%
639 }%
640 %% label
641 \node at (label-coord) {\footnotesize \labelcontent};%
642 }%
643 }},% end pics/balise/.style args={#1/#2/#3}
644 % symbology entry
645 symbology_balise_group/.pic = {%
646 \maintrack (0,0) -- (6,0);%
647 \balise[forward] at (2,0) label (A);%
648 \balise[forward,switched] at (4,0) label (B);%
649 },%
650 symbology_balise_individual/.pic = {%
651 \maintrack (0,0) -- (6,0);%
652 \balise[forward,along={0,1,2}] at (2,0) label (A);%
653 \balise[forward,along switched={0,1,2}] at (4,0) label (B);%
654 },%
655 }%
656 %
657 %%%%%%%%%%%%%%%
658 % symbol view point
659 %%%%%%%%%%%%%%%
660 % command
661 \newcommand\viewpoint{}% just for safety
662 \def\viewpoint[#1]#2(#3){% \viewpoint[options] at (coord);
663 \pic[#1] at (#3) {view_point={#2}};% symbol
664 }%
665 % symbol definition
666 \tikzset{%
667 pics/view_point/.default=,%
668 pics/view_point/.style args={#1}{code={%
669 %% face setup
670 \ifdefstring{\face}{forward}{% face
671 \pgfmathsetmacro{\facefactor}{1}%
672 }{%
673 \ifdefstring{\face}{backward}{% face
674 \pgfmathsetmacro{\facefactor}{-1}%
675 }{% error message
676 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
677 }%
678 }% end \ifdefstring{\face}
679 %% traffic practice setup
680 \ifdefstring{\trafficpractice}{left}{% branch
681 \pgfmathsetmacro{\trafficfactor}{-1}%
682 }{%
683 \ifdefstring{\trafficpractice}{right}{% branch
684 \pgfmathsetmacro{\trafficfactor}{1}%
685 }{% error message
686 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
687 }%
688 }% end \ifdefstring{\trafficpractice}
689 %% arrow
690 \path[draw=foreground,<-,>=latex,line width=1pt]%
691 ($\facefactor*\trafficfactor*(0,-0.1)$) -- ++($\facefactor*\trafficfactor*(0,-0.3)$) -- ++($\facefactor*(0.2,0)$);% arrow
692 %% eye
693 \filldraw[foreground] ($\facefactor*(0.4,0) + \facefactor*\trafficfactor*(0,-0.4)$) circle (0.1);% pupil
694 \path[draw=foreground, line width=1pt]% eye contour
695 ($\facefactor*(0.4, 0) + \facefactor*\trafficfactor*(0,-0.15)$) .. controls%
696 ($\facefactor*(0.25,0) + \facefactor*\trafficfactor*(0,-0.25)$) and%
697 ($\facefactor*(0.25,0) + \facefactor*\trafficfactor*(0,-0.55)$) ..%
698 ($\facefactor*(0.4, 0) + \facefactor*\trafficfactor*(0,-0.65)$) .. controls%
699 ($\facefactor*(0.55,0) + \facefactor*\trafficfactor*(0,-0.55)$) and%
700 ($\facefactor*(0.55,0) + \facefactor*\trafficfactor*(0,-0.25)$) ..%
701 ($\facefactor*(0.4, 0) + \facefactor*\trafficfactor*(0,-0.15)$) --cycle;% eye contour
702 }},% END pics/view_point/.style args={#1}
703 % symbology entry
704 symbology_view_point/.pic = {%
705 \maintrack (0,0) -- (6,0);%
706 \viewpoint[forward] at (3,0);%
707 },%
708 }%
709 %
710 %%%%%%%%%%%%%%%
711 % symbol end of authority marker
712 %%%%%%%%%%%%%%%
713 % command
714 \newcommand\movementauthority{}% just for safety
715 \def\movementauthority[#1]#2(#3)#4(#5){% \movementauthority[options] at (coord) label (name);
716 \pic[#1] at (#3) {movement_authority_marker={#2/#4/#5}}% symbol
717 }%
718 % symbol definition
719 \tikzset{%
720 pics/movement_authority_marker/.default=,%
721 pics/movement_authority_marker/.style args={#1/#2/#3}{code={%
722 %% settings
723 \def\coordcommand{#1}% beware of leading and tailing spaces!
724 \def\labelcommand{#2}% beware of leading and tailing spaces!
725 \def\labelcontent{#3}%
726 %
727 %% traffic practice setup
728 \ifdefstring{\trafficpractice}{left}{% branch
729 \pgfmathsetmacro{\trafficfactor}{-1}%
730 }{%
731 \ifdefstring{\trafficpractice}{right}{% branch
732 \pgfmathsetmacro{\trafficfactor}{1}%
733 }{% error message
734 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
735 }%
736 }% end \ifdefstring{\trafficpractice}
737 %% face setup
738 \ifdefstring{\face}{forward}{% face
739 \pgfmathsetmacro{\facefactor}{1}%
740 \def\align{left}%
741 }{%
742 \ifdefstring{\face}{backward}{% face
743 \pgfmathsetmacro{\facefactor}{-1}%
744 \def\align{right}%
745 }{% error message
746 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
747 }%
748 }% end \ifdefstring{\face}
749 \tikzset{every path/.style={draw=foreground,line width=1pt}};%
750 %% marker
751 \path ($\trafficfactor*\facefactor*(0,-0.55) + \facefactor*(0.3,0)$) rectangle%
752 ++($\trafficfactor*\facefactor*(0, 0.3) + \facefactor*(0.3,0)$);%
753 %% arrow
754 \path[draw=foreground,<-,>=latex,line width=1pt]%
755 ($\facefactor*\trafficfactor*(0,-0.1)$) -- ++($\facefactor*\trafficfactor*(0,-0.3)$) -- ++($\facefactor*(0.2,0)$);% arrow
756 %% label
757 \ifdefstring{\labelcontent}{}{}{% label NOT empty
758 \tikzset{every node/.style={font=\sffamily,text=foreground}};%
759 \coordinate (ts-ma-l) at ($\trafficfactor*\facefactor*(0,-0.6) + \facefactor*(0.3,0)$);%
760 \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
761 \path let \p1=\labelcoord in coordinate (ts-ma-l) at ($(ts-ma-l)+(\x1,\y1)$);%
762 }%
763 \node[\align] at (ts-ma-l) {\footnotesize \labelcontent};%
764 }%
765 }},% END pics/movement_authority_marker/.style args={#1/#2/#3}
766 % symbology entry
767 symbology_end_of_authority/.pic = {%
768 \maintrack (0,0) -- (6,0);%
769 \movementauthority[forward] at (3,0) label ();%
770 },%
771 }%
772 %
773 %%%%%%%%%%%%%%%
774 % symbol braking point
775 %%%%%%%%%%%%%%%
776 % command
777 \newcommand\brakingpoint{}% just for safety
778 \def\brakingpoint[#1]#2(#3)#4(#5){% \brakingpoint[options] at (coord) label (name);
779 \pic[#1] at (#3) {braking_point_marker={#2/#4/#5}}% symbol
780 }%
781 % symbol definition
782 \tikzset{%
783 pics/braking_point_marker/.default=,%
784 pics/braking_point_marker/.style args={#1/#2/#3}{code={%
785 %% settings
786 \def\coordcommand{#1}% beware of leading and tailing spaces!
787 \def\labelcommand{#2}% beware of leading and tailing spaces!
788 \def\labelcontent{#3}%
789 %
790 %% traffic practice setup
791 \ifdefstring{\trafficpractice}{left}{% branch
792 \pgfmathsetmacro{\trafficfactor}{-1}%
793 }{%
794 \ifdefstring{\trafficpractice}{right}{% branch
795 \pgfmathsetmacro{\trafficfactor}{1}%
796 }{% error message
797 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
798 }%
799 }% end \ifdefstring{\trafficpractice}
800 %% face setup
801 \ifdefstring{\face}{forward}{% face
802 \pgfmathsetmacro{\facefactor}{1}%
803 \def\align{left}%
804 }{%
805 \ifdefstring{\face}{backward}{% face
806 \pgfmathsetmacro{\facefactor}{-1}%
807 \def\align{right}%
808 }{% error message
809 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
810 }%
811 }% end \ifdefstring{\face}
812 \tikzset{every path/.style={draw=foreground,line width=1pt}};%
813 %% marker
814 \path ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.3,0)$) --%
815 ++($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*(0.25,0)$) --%
816 ++($\trafficfactor*\facefactor*(0, 0.3)$) -- cycle;% signal marker
817 %% arrow
818 \path[draw=foreground,<-,>=latex,line width=1pt]%
819 ($\facefactor*\trafficfactor*(0,-0.1)$) -- ++($\facefactor*\trafficfactor*(0,-0.3)$) -- ++($\facefactor*(0.2,0)$);% arrow
820 %% label
821 \ifdefstring{\labelcontent}{}{}{% label NOT empty
822 \tikzset{every node/.style={font=\sffamily,text=foreground}};%
823 \coordinate (ts-bp-l) at ($\trafficfactor*\facefactor*(0,-0.6) + \facefactor*(0.3,0)$);%
824 \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
825 \path let \p1=\labelcoord in coordinate (ts-bp-l) at ($(ts-bp-l)+(\x1,\y1)$);%
826 }%
827 \node[\align] at (ts-bp-l) {\footnotesize \labelcontent};%
828 }%
829 }},% END pics/braking_point_marker/.style args={#1/#2/#3}
830 % symbology entry
831 symbology_braking_point/.pic = {%
832 \maintrack (0,0) -- (6,0);%
833 \brakingpoint[forward] at (3,0) label ();%
834 },%
835 }%
836 %
837 %%%%%%%%%%%%%%%
838 % symbol danger point
839 %%%%%%%%%%%%%%%
840 % command
841 \newcommand\dangerpoint{}% just for safety
842 \def\dangerpoint[#1]#2(#3)#4(#5){% \dangerpoint[options] at (coord) label (name);
843 \pic[#1] at (#3) {danger_point_marker={#2/#4/#5}}% symbol
844 }%
845 % symbol definition
846 \tikzset{%
847 pics/danger_point_marker/.default=,%
848 pics/danger_point_marker/.style args={#1/#2/#3}{code={%
849 %% settings
850 \def\coordcommand{#1}% beware of leading and tailing spaces!
851 \def\labelcommand{#2}% beware of leading and tailing spaces!
852 \def\labelcontent{#3}%
853 %
854 %% traffic practice setup
855 \ifdefstring{\trafficpractice}{left}{% branch
856 \pgfmathsetmacro{\trafficfactor}{-1}%
857 }{%
858 \ifdefstring{\trafficpractice}{right}{% branch
859 \pgfmathsetmacro{\trafficfactor}{1}%
860 }{% error message
861 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
862 }%
863 }% end \ifdefstring{\trafficpractice}
864 %% face setup
865 \ifdefstring{\face}{forward}{% face
866 \pgfmathsetmacro{\facefactor}{1}%
867 \def\align{left}%
868 }{%
869 \ifdefstring{\face}{backward}{% face
870 \pgfmathsetmacro{\facefactor}{-1}%
871 \def\align{right}%
872 }{% error message
873 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
874 }%
875 }% end \ifdefstring{\face}
876 \tikzset{every path/.style={draw=foreground,line width=1pt}};%
877 %% marker
878 \path ($\trafficfactor*\facefactor*(0,-0.4)$) --%
879 ++($\trafficfactor*\facefactor*(0,-0.1) + \facefactor*(-0.1,0)$) --%
880 ++($\trafficfactor*\facefactor*(0,-0.1) + \facefactor*( 0.1,0)$) --%
881 ++($\trafficfactor*\facefactor*(0, 0.1) + \facefactor*( 0.1,0)$) -- cycle;% sign
882 %% arrow
883 \path[draw=foreground,<-,>=latex,line width=1pt]%
884 ($\facefactor*\trafficfactor*(0,-0.1)$) -- ++($\facefactor*\trafficfactor*(0,-0.25)$);% arrow
885 %% label
886 \ifdefstring{\labelcontent}{}{}{% label NOT empty
887 \tikzset{every node/.style={font=\sffamily,text=foreground}};%
888 \coordinate (ts-dp-l) at ($\trafficfactor*\facefactor*(0,0.25)$);%
889 \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
890 \path let \p1=\labelcoord in coordinate (ts-dp-l) at ($(ts-dp-l)+(\x1,\y1)$);%
891 }%
892 \node at (ts-dp-l) {\footnotesize \labelcontent};%
893 }%
894 }},% END pics/danger_point_marker/.style args={#1/#2/#3}
895 % symbology entry
896 symbology_danger_point/.pic = {%
897 \maintrack (0,0) -- (6,0);%
898 \dangerpoint[forward] at (3,0) label ();%
899 },%
900 }%
901 %
902 %%%%%%%%%%%%%%%
903 % symbol route
904 %%%%%%%%%%%%%%%
905 % command
906 \newcommand\route{}% just for safety
907 \def\route[#1]#2(#3){% \route[options] at (coord);
908 \pic[#1] at (#3) {route={#2}}% symbol
909 }%
910 % symbol definition
911 \tikzset{%
912 pics/route/.default=,%
913 pics/route/.style args={#1}{code={%
914 %% settings
915 \def\coordcommand{#1} % beware of leading and tailing spaces!
916 %% face setup
917 \ifdefstring{\face}{forward}{% face
918 \pgfmathsetmacro{\facefactor}{1}%
919 }{%
920 \ifdefstring{\face}{backward}{% face
921 \pgfmathsetmacro{\facefactor}{-1}%
922 }{% error message
923 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
924 }%
925 }% end \ifdefstring{\face}
926 %% symbol
927 \fill[foreground] ($\facefactor*(-0.175,0)+(0,-0.15)$) --%
928 ($\facefactor*(-0.175,0)+(0, 0.15)$) --%
929 ($\facefactor*( 0.175,0)+(0, 0 )$) -- cycle;%
930 }},% END pics/route/.style args={#1}
931 % symbology entry
932 symbology_route/.pic = {%
933 \maintrack (0,0) -- (6,0);%
934 \route[forward] at (3,0);%
935 },%
936 }%
937 %
938 %%%%%%%%%%%%%%%
939 % symbol direction control
940 %%%%%%%%%%%%%%%
941 % command
942 \newcommand\directioncontrol{}% just for safety
943 \def\directioncontrol[#1]#2(#3){% \directioncontrol[options] at (coord);
944 \pic[#1] at (#3) {direction_control={#2}}% symbol
945 }%
946 % symbol definition
947 \tikzset{%
948 pics/direction_control/.default=,%
949 pics/direction_control/.style args={#1}{code={%
950 %% settings
951 \def\coordcommand{#1}% beware of leading and tailing spaces!
952 %
953 %% traffic practice setup
954 \ifdefstring{\trafficpractice}{left}{% branch
955 \pgfmathsetmacro{\trafficfactor}{-1}%
956 }{%
957 \ifdefstring{\trafficpractice}{right}{% branch
958 \pgfmathsetmacro{\trafficfactor}{1}%
959 }{% error message
960 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
961 }%
962 }% end \ifdefstring{\trafficpractice}
963 %
964 %% face setup
965 \ifdefstring{\face}{forward}{% face
966 \path[draw=foreground,line width=0.5pt,densely dotted]%
967 ($\trafficfactor*(0,0.1) + (-0.0125,0)$) -- ($\trafficfactor*(0,0.25) + (-0.2125,0)$) -- ($\trafficfactor*(0,0.4) + (-0.0125,0)$) --%
968 ($\trafficfactor*(0,0.325) + (-0.0125,0)$) -- ($\trafficfactor*(0,0.325) + (0.1875,0)$) -- ($\trafficfactor*(0,0.175) + (0.1875,0)$) --%
969 ($\trafficfactor*(0,0.175) + (-0.0125,0)$) -- cycle;% arrow backward
970 \fill[foreground]%
971 ($\trafficfactor*(0,-0.1) + (0.0125,0)$) -- ($\trafficfactor*(0,-0.25) + (0.2125,0)$) -- ($\trafficfactor*(0,-0.4) + (0.0125,0)$) --%
972 ($\trafficfactor*(0,-0.325) + (0.0125,0)$) -- ($\trafficfactor*(0,-0.325)+(-0.1875,0)$) -- ($\trafficfactor*(0,-0.175) + (-0.1875,0)$) --%
973 ($\trafficfactor*(0,-0.175) + (0.0125,0)$) -- cycle;% arrow forward
974 }{%
975 \ifdefstring{\face}{backward}{% face
976 \fill[foreground]%
977 ($\trafficfactor*(0,0.1) + (-0.0125,0)$) -- ($\trafficfactor*(0,0.25) + (-0.2125,0)$) -- ($\trafficfactor*(0,0.4) + (-0.0125,0)$) --%
978 ($\trafficfactor*(0,0.325) + (-0.0125,0)$) -- ($\trafficfactor*(0,0.325) + (0.1875,0)$) -- ($\trafficfactor*(0,0.175) + (0.1875,0)$) --%
979 ($\trafficfactor*(0,0.175) + (-0.0125,0)$) -- cycle;% arrow backward
980 \path[draw=foreground,line width=0.5pt,densely dotted]%
981 ($\trafficfactor*(0,-0.1) + (0.0125,0)$) -- ($\trafficfactor*(0,-0.25) + (0.2125,0)$) -- ($\trafficfactor*(0,-0.4) + (0.0125,0)$) --%
982 ($\trafficfactor*(0,-0.325)+(0.0125,0)$) -- ($\trafficfactor*(0,-0.325)+(-0.1875,0)$) -- ($\trafficfactor*(0,-0.175) + (-0.1875,0)$) --%
983 ($\trafficfactor*(0,-0.175) + (0.0125,0)$) -- cycle;% arrow forward
984 }{
985 \ifdefstring{\face}{bidirectional}{% face
986 \path[draw=foreground,line width=0.5pt]%
987 ($\trafficfactor*(0,0.1) + (-0.0125,0)$) -- ($\trafficfactor*(0,0.25) + (-0.2125,0)$) -- ($\trafficfactor*(0,0.4) + (-0.0125,0)$) --%
988 ($\trafficfactor*(0,0.325) +(-0.0125,0)$) -- ($\trafficfactor*(0,0.325) +(0.1875,0)$) -- ($\trafficfactor*(0,0.175) + (0.1875,0)$) --%
989 ($\trafficfactor*(0,0.175) + (-0.0125,0)$) -- cycle;% arrow backward
990 \path[draw=foreground,line width=0.5pt]%
991 ($\trafficfactor*(0,-0.1) + (0.0125,0)$) -- ($\trafficfactor*(0,-0.25) + (0.2125,0)$) -- ($\trafficfactor*(0,-0.4) + (0.0125,0)$) --%
992 ($\trafficfactor*(0,-0.325)+(0.0125,0)$) -- ($\trafficfactor*(0,-0.325)+(-0.1875,0)$) -- ($\trafficfactor*(0,-0.175)+(-0.1875,0)$) --%
993 ($\trafficfactor*(0,-0.175) + (0.0125,0)$) -- cycle;% arrow forward
994 }{% error message
995 \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“, “backward“ OR “bidirectional“ as key required}}%
996 }%
997 }%
998 }% end \ifdefstring{\face}
999 %% frame
1000 % \path[draw=foreground,line width=0.5pt]%
1001 % (-0.3, 0.1) -- (-0.3, 0.5) -- (0.3, 0.5) -- (0.3, 0.1)
1002 % (-0.3,-0.1) -- (-0.3,-0.5) -- (0.3,-0.5) -- (0.3,-0.1);
1003 }},% END pics/direction_control/.style args={#1}
1004 % symbology entry
1005 symbology_direction_control/.pic = {%
1006 \maintrack (0,0) -- (2.9,0);%
1007 \maintrack (3.1,0) -- (6,0);%
1008 \directioncontrol[bidirectional] at (2,0);%
1009 \directioncontrol[forward] at (4,0);%
1010 },%
1011 }%
1012 %
1013 %%%%%%%%%%%%%%%
1014 \endinput%
1015 %