| 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.electrics.code.tex}% |
| 8 |
% |
| 9 |
%%%%%%%%%%%%%%% |
| 10 |
% global settings |
| 11 |
%%%%%%%%%%%%%%% |
| 12 |
\RequirePackage{tikz,etoolbox}% |
| 13 |
\usetikzlibrary{calc,intersections,arrows.meta}% |
| 14 |
% |
| 15 |
%%%%%%%%%%%%%%% |
| 16 |
% tikz keys for multiple use |
| 17 |
%%%%%%%%%%%%%%% |
| 18 |
% |
| 19 |
\pgfkeys{% |
| 20 |
/tikz/trackschematic/.is family,% |
| 21 |
/tikz/trackschematic/.cd,% |
| 22 |
%% face |
| 23 |
face/.value required,% forward, backward OR bidirectional |
| 24 |
face/.store in=\face,% forward, backward OR bidirectional |
| 25 |
/tikz/face/.forward to=/tikz/trackschematic/face,% |
| 26 |
/tikz/forward/.code={\pgfkeys{/tikz/trackschematic/face=forward}},% |
| 27 |
/tikz/backward/.code={\pgfkeys{/tikz/trackschematic/face=backward}},% |
| 28 |
/tikz/bidirectional/.code={\pgfkeys{/tikz/trackschematic/face=bidirectional}},% |
| 29 |
%% traffic practice |
| 30 |
traffic practice/.value required,% left OR right |
| 31 |
traffic practice/.store in=\trafficpractice,% |
| 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 |
\tikzset{traffic practice=right}% |
| 40 |
% |
| 41 |
\definecolor{ts-signal-blue}{HTML}{013ADF}% |
| 42 |
% tikz keys |
| 43 |
\pgfkeys{% |
| 44 |
/tikz/trackschematic/electrics/.is family,% |
| 45 |
/tikz/trackschematic/electrics/.cd,% |
| 46 |
%% color hectometer |
| 47 |
signal color/.store in=\signalcolor,% |
| 48 |
signal color=ts-signal-blue,% DEFAULT |
| 49 |
/tikz/electrics signal color/.forward to=/tikz/trackschematic/electrics/signal color,% |
| 50 |
}% |
| 51 |
%%%%%%%%%%%%%%%% |
| 52 |
% symbol distant power off |
| 53 |
%%%%%%%%%%%%%%% |
| 54 |
%% command |
| 55 |
\newcommand\distantpoweroff{}% just for safety |
| 56 |
\def\distantpoweroff[#1]#2(#3)#4(#5){% \distantpoweroff[options] at (coord) label (name); |
| 57 |
\pic[#1] at (#3) {distant_power_off={#2/#4/#5}}% symbol |
| 58 |
}% |
| 59 |
%% |
| 60 |
%% symbol definition |
| 61 |
\tikzset{% |
| 62 |
pics/distant_power_off/.default=,% |
| 63 |
pics/distant_power_off/.style args={#1/#2/#3}{code={% |
| 64 |
%% settings |
| 65 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 66 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 67 |
\def\labelcontent{#3}% |
| 68 |
%% symbol marker |
| 69 |
% |
| 70 |
%% traffic practice setup |
| 71 |
\ifdefstring{\trafficpractice}{left}{% branch |
| 72 |
\pgfmathsetmacro{\trafficfactor}{-1}% |
| 73 |
}{% |
| 74 |
\ifdefstring{\trafficpractice}{right}{% branch |
| 75 |
\pgfmathsetmacro{\trafficfactor}{1}% |
| 76 |
}{% error message |
| 77 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}% |
| 78 |
}% |
| 79 |
}% end \ifdefstring{\trafficpractice} |
| 80 |
%% face setup |
| 81 |
\ifdefstring{\face}{forward}{% face |
| 82 |
\pgfmathsetmacro{\facefactor}{1}% |
| 83 |
\def\align{left}% |
| 84 |
}{% |
| 85 |
\ifdefstring{\face}{backward}{% face |
| 86 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 87 |
\def\align{right}% |
| 88 |
}{% error message |
| 89 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 90 |
}% |
| 91 |
}% end \ifdefstring{\face} |
| 92 |
% |
| 93 |
%% signal pole |
| 94 |
\path[draw=foreground,line width=1pt] (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.4,0)$);% signal pole |
| 95 |
%% signal marker |
| 96 |
\path[draw=foreground,line width=0.1pt,double=background,double distance=0.5pt,fill=\signalcolor,rounded corners=0.1pt]% |
| 97 |
($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*( 0.4,0)$) --% |
| 98 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*(-0.25,0)$) --% |
| 99 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*( 0.25,0)$) --% |
| 100 |
++($\trafficfactor*\facefactor*(0, 0.25) + \facefactor*( 0.25,0)$) -- cycle;% sign |
| 101 |
\path[fill=background]% |
| 102 |
($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*( 0.45,0)$) rectangle% |
| 103 |
++($\trafficfactor*\facefactor*(0,-0.05) + \facefactor*(-0.1,0)$)% |
| 104 |
($\trafficfactor*\facefactor*(0,-0.5) + \facefactor*( 0.45,0)$) rectangle% |
| 105 |
++($\trafficfactor*\facefactor*(0, 0.05) + \facefactor*(-0.1,0)$);% symbol |
| 106 |
%% label |
| 107 |
\tikzset{every node/.style={text=foreground,inner sep=1pt}};% |
| 108 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 109 |
\coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% |
| 110 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 111 |
\path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% |
| 112 |
}% |
| 113 |
\node[\align] at (label-coord) {\footnotesize \labelcontent};% |
| 114 |
}% |
| 115 |
}},% END of pics/distant_power_off/.style args={#1/#2/#3} |
| 116 |
% symbology entry |
| 117 |
symbology_distant_power_off/.pic = {% |
| 118 |
\maintrack (0,0) -- (6,0);% |
| 119 |
\distantpoweroff[forward] at (3,0) label ();% |
| 120 |
},% |
| 121 |
}% |
| 122 |
% |
| 123 |
%%%%%%%%%%%%%%%% |
| 124 |
% symbol power off |
| 125 |
%%%%%%%%%%%%%%% |
| 126 |
%% command |
| 127 |
\newcommand\poweroff{}% just for safety |
| 128 |
\def\poweroff[#1]#2(#3)#4(#5){% \poweroff[options] at (coord) label (name); |
| 129 |
\pic[#1] at (#3) {power_off={#2/#4/#5}}% symbol |
| 130 |
}% |
| 131 |
%% |
| 132 |
%% symbol definition |
| 133 |
\tikzset{% |
| 134 |
pics/power_off/.default=,% |
| 135 |
pics/power_off/.style args={#1/#2/#3}{code={% |
| 136 |
%% settings |
| 137 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 138 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 139 |
\def\labelcontent{#3}% |
| 140 |
%% symbol marker |
| 141 |
% |
| 142 |
%% traffic practice setup |
| 143 |
\ifdefstring{\trafficpractice}{left}{% branch |
| 144 |
\pgfmathsetmacro{\trafficfactor}{-1}% |
| 145 |
}{% |
| 146 |
\ifdefstring{\trafficpractice}{right}{% branch |
| 147 |
\pgfmathsetmacro{\trafficfactor}{1}% |
| 148 |
}{% error message |
| 149 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}% |
| 150 |
}% |
| 151 |
}% end \ifdefstring{\trafficpractice} |
| 152 |
%% face setup |
| 153 |
\ifdefstring{\face}{forward}{% face |
| 154 |
\pgfmathsetmacro{\facefactor}{1}% |
| 155 |
\def\align{left}% |
| 156 |
}{% |
| 157 |
\ifdefstring{\face}{backward}{% face |
| 158 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 159 |
\def\align{right}% |
| 160 |
}{% error message |
| 161 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 162 |
}% |
| 163 |
}% end \ifdefstring{\face} |
| 164 |
% |
| 165 |
%% signal pole |
| 166 |
\path[draw=foreground,line width=1pt] (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.4,0)$);% signal pole |
| 167 |
%% signal marker |
| 168 |
\path[draw=foreground,line width=0.1pt,double=background,double distance=0.5pt,fill=\signalcolor,rounded corners=0.1pt]% |
| 169 |
($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*( 0.4,0)$) --% |
| 170 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*(-0.25,0)$) --% |
| 171 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*( 0.25,0)$) --% |
| 172 |
++($\trafficfactor*\facefactor*(0, 0.25) + \facefactor*( 0.25,0)$) -- cycle;% sign |
| 173 |
\path[fill=background]% |
| 174 |
($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*( 0.5,0)$) rectangle% |
| 175 |
++($\trafficfactor*\facefactor*(0,-0.05) + \facefactor*(-0.1,0)$)% |
| 176 |
($\trafficfactor*\facefactor*(0,-0.5) + \facefactor*( 0.5,0)$) rectangle% |
| 177 |
++($\trafficfactor*\facefactor*(0, 0.05) + \facefactor*(-0.1,0)$)% |
| 178 |
($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*( 0.3,0)$) rectangle% |
| 179 |
++($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*( 0.05,0)$);% symbol |
| 180 |
%% label |
| 181 |
\tikzset{every node/.style={text=foreground,inner sep=1pt}};% |
| 182 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 183 |
\coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% |
| 184 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 185 |
\path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% |
| 186 |
}% |
| 187 |
\node[\align] at (label-coord) {\footnotesize \labelcontent};% |
| 188 |
}% |
| 189 |
}},% END of pics/power_off/.style args={#1/#2/#3} |
| 190 |
% symbology entry |
| 191 |
symbology_power_off/.pic = {% |
| 192 |
\maintrack (0,0) -- (6,0);% |
| 193 |
\poweroff[forward] at (3,0) label ();% |
| 194 |
},% |
| 195 |
}% |
| 196 |
% |
| 197 |
%%%%%%%%%%%%%%%% |
| 198 |
% symbol power on |
| 199 |
%%%%%%%%%%%%%%% |
| 200 |
%% command |
| 201 |
\newcommand\poweron{}% just for safety |
| 202 |
\def\poweron[#1]#2(#3)#4(#5){% \poweron[options] at (coord) label (name); |
| 203 |
\pic[#1] at (#3) {power_on={#2/#4/#5}}% symbol |
| 204 |
}% |
| 205 |
%% |
| 206 |
%% symbol definition |
| 207 |
\tikzset{% |
| 208 |
pics/power_on/.default=,% |
| 209 |
pics/power_on/.style args={#1/#2/#3}{code={% |
| 210 |
%% settings |
| 211 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 212 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 213 |
\def\labelcontent{#3}% |
| 214 |
%% symbol marker |
| 215 |
% |
| 216 |
%% traffic practice setup |
| 217 |
\ifdefstring{\trafficpractice}{left}{% branch |
| 218 |
\pgfmathsetmacro{\trafficfactor}{-1}% |
| 219 |
}{% |
| 220 |
\ifdefstring{\trafficpractice}{right}{% branch |
| 221 |
\pgfmathsetmacro{\trafficfactor}{1}% |
| 222 |
}{% error message |
| 223 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}% |
| 224 |
}% |
| 225 |
}% end \ifdefstring{\trafficpractice} |
| 226 |
%% face setup |
| 227 |
\ifdefstring{\face}{forward}{% face |
| 228 |
\pgfmathsetmacro{\facefactor}{1}% |
| 229 |
\def\align{left}% |
| 230 |
}{% |
| 231 |
\ifdefstring{\face}{backward}{% face |
| 232 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 233 |
\def\align{right}% |
| 234 |
}{% error message |
| 235 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 236 |
}% |
| 237 |
}% end \ifdefstring{\face} |
| 238 |
% |
| 239 |
%% signal pole |
| 240 |
\path[draw=foreground,line width=1pt] (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.4,0)$);% signal pole |
| 241 |
%% signal marker |
| 242 |
\path[draw=foreground,line width=0.1pt,double=background,double distance=0.5pt,fill=\signalcolor,rounded corners=0.1pt]% |
| 243 |
($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*( 0.4,0)$) --% |
| 244 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*(-0.25,0)$) --% |
| 245 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*( 0.25,0)$) --% |
| 246 |
++($\trafficfactor*\facefactor*(0, 0.25) + \facefactor*( 0.25,0)$) -- cycle;% sign |
| 247 |
\path[fill=background]% |
| 248 |
($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*( 0.475,0)$) rectangle% |
| 249 |
++($\trafficfactor*\facefactor*(0,-0.05) + \facefactor*(-0.11,0)$)% |
| 250 |
($\trafficfactor*\facefactor*(0,-0.5) + \facefactor*( 0.475,0)$) rectangle% |
| 251 |
++($\trafficfactor*\facefactor*(0, 0.05) + \facefactor*(-0.11,0)$);% symbol part1 |
| 252 |
\path[fill=background]% |
| 253 |
($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*( 0.325,0)$) rectangle% |
| 254 |
++($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*( 0.05,0)$);% symbol part2 |
| 255 |
%% label |
| 256 |
\tikzset{every node/.style={text=foreground,inner sep=1pt}};% |
| 257 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 258 |
\coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% |
| 259 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 260 |
\path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% |
| 261 |
}% |
| 262 |
\node[\align] at (label-coord) {\footnotesize \labelcontent};% |
| 263 |
}% |
| 264 |
}},% END of pics/power_on/.style args={#1/#2/#3} |
| 265 |
% symbology entry |
| 266 |
symbology_power_on/.pic = {% |
| 267 |
\maintrack (0,0) -- (6,0);% |
| 268 |
\poweron[forward] at (3,0) label ();% |
| 269 |
},% |
| 270 |
}% |
| 271 |
% |
| 272 |
%%%%%%%%%%%%%%%% |
| 273 |
% symbol distant pantograph down |
| 274 |
%%%%%%%%%%%%%%% |
| 275 |
%% command |
| 276 |
\newcommand\distantpantographdown{}% just for safety |
| 277 |
\def\distantpantographdown[#1]#2(#3)#4(#5){% \distantpantographdown[options] at (coord) label (name); |
| 278 |
\pic[#1] at (#3) {distant_pantograph_down={#2/#4/#5}}% symbol |
| 279 |
}% |
| 280 |
%% |
| 281 |
%% symbol definition |
| 282 |
\tikzset{% |
| 283 |
pics/distant_pantograph_down/.default=,% |
| 284 |
pics/distant_pantograph_down/.style args={#1/#2/#3}{code={% |
| 285 |
%% settings |
| 286 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 287 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 288 |
\def\labelcontent{#3}% |
| 289 |
%% symbol marker |
| 290 |
% |
| 291 |
%% traffic practice setup |
| 292 |
\ifdefstring{\trafficpractice}{left}{% branch |
| 293 |
\pgfmathsetmacro{\trafficfactor}{-1}% |
| 294 |
}{% |
| 295 |
\ifdefstring{\trafficpractice}{right}{% branch |
| 296 |
\pgfmathsetmacro{\trafficfactor}{1}% |
| 297 |
}{% error message |
| 298 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}% |
| 299 |
}% |
| 300 |
}% end \ifdefstring{\trafficpractice} |
| 301 |
%% face setup |
| 302 |
\ifdefstring{\face}{forward}{% face |
| 303 |
\pgfmathsetmacro{\facefactor}{1}% |
| 304 |
\def\align{left}% |
| 305 |
}{% |
| 306 |
\ifdefstring{\face}{backward}{% face |
| 307 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 308 |
\def\align{right}% |
| 309 |
}{% error message |
| 310 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 311 |
}% |
| 312 |
}% end \ifdefstring{\face} |
| 313 |
% |
| 314 |
%% signal pole |
| 315 |
\path[draw=foreground,line width=1pt] (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.4,0)$);% signal pole |
| 316 |
%% signal marker |
| 317 |
\path[draw=foreground,line width=0.1pt,double=background,double distance=0.5pt,fill=\signalcolor,rounded corners=0.1pt]% |
| 318 |
($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*( 0.4,0)$) --% |
| 319 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*(-0.25,0)$) --% |
| 320 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*( 0.25,0)$) --% |
| 321 |
++($\trafficfactor*\facefactor*(0, 0.25) + \facefactor*( 0.25,0)$) -- cycle;% sign |
| 322 |
\path[fill=background]% |
| 323 |
($\trafficfactor*\facefactor*(0,-0.23) + \facefactor*( 0.35,0)$) --% |
| 324 |
++($\trafficfactor*\facefactor*(0,-0.2)$) -- ++($\facefactor*(-0.05,0)$) --% |
| 325 |
++($\trafficfactor*\facefactor*(0, 0.15)$) -- cycle% |
| 326 |
($\trafficfactor*\facefactor*(0,-0.57) + \facefactor*( 0.45,0)$) --% |
| 327 |
++($\trafficfactor*\facefactor*(0, 0.2)$) -- ++($\facefactor*(0.05,0)$) --% |
| 328 |
++($\trafficfactor*\facefactor*(0,-0.15)$) -- cycle;% symbol |
| 329 |
%% label |
| 330 |
\tikzset{every node/.style={text=foreground,inner sep=1pt}};% |
| 331 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 332 |
\coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% |
| 333 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 334 |
\path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% |
| 335 |
}% |
| 336 |
\node[\align] at (label-coord) {\footnotesize \labelcontent};% |
| 337 |
}% |
| 338 |
}},% END of pics/distant_pantograph_down/.style args={#1/#2/#3} |
| 339 |
% symbology entry |
| 340 |
symbology_distant_pantograph_down/.pic = {% |
| 341 |
\maintrack (0,0) -- (6,0);% |
| 342 |
\distantpantographdown[forward] at (3,0) label ();% |
| 343 |
},% |
| 344 |
}% |
| 345 |
% |
| 346 |
% |
| 347 |
%%%%%%%%%%%%%%%% |
| 348 |
% symbol pantograph down |
| 349 |
%%%%%%%%%%%%%%% |
| 350 |
%% command |
| 351 |
\newcommand\pantographdown{}% just for safety |
| 352 |
\def\pantographdown[#1]#2(#3)#4(#5){% \pantographdown[options] at (coord) label (name); |
| 353 |
\pic[#1] at (#3) {pantograph_down={#2/#4/#5}}% symbol |
| 354 |
}% |
| 355 |
%% |
| 356 |
%% symbol definition |
| 357 |
\tikzset{% |
| 358 |
pics/pantograph_down/.default=,% |
| 359 |
pics/pantograph_down/.style args={#1/#2/#3}{code={% |
| 360 |
%% settings |
| 361 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 362 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 363 |
\def\labelcontent{#3}% |
| 364 |
%% symbol marker |
| 365 |
% |
| 366 |
%% traffic practice setup |
| 367 |
\ifdefstring{\trafficpractice}{left}{% branch |
| 368 |
\pgfmathsetmacro{\trafficfactor}{-1}% |
| 369 |
}{% |
| 370 |
\ifdefstring{\trafficpractice}{right}{% branch |
| 371 |
\pgfmathsetmacro{\trafficfactor}{1}% |
| 372 |
}{% error message |
| 373 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}% |
| 374 |
}% |
| 375 |
}% end \ifdefstring{\trafficpractice} |
| 376 |
%% face setup |
| 377 |
\ifdefstring{\face}{forward}{% face |
| 378 |
\pgfmathsetmacro{\facefactor}{1}% |
| 379 |
\def\align{left}% |
| 380 |
}{% |
| 381 |
\ifdefstring{\face}{backward}{% face |
| 382 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 383 |
\def\align{right}% |
| 384 |
}{% error message |
| 385 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 386 |
}% |
| 387 |
}% end \ifdefstring{\face} |
| 388 |
% |
| 389 |
%% signal pole |
| 390 |
\path[draw=foreground,line width=1pt] (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.4,0)$);% signal pole |
| 391 |
%% signal marker |
| 392 |
\path[draw=foreground,line width=0.1pt,double=background,double distance=0.5pt,fill=\signalcolor,rounded corners=0.1pt]% |
| 393 |
($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*( 0.4,0)$) --% |
| 394 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*(-0.25,0)$) --% |
| 395 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*( 0.25,0)$) --% |
| 396 |
++($\trafficfactor*\facefactor*(0, 0.25) + \facefactor*( 0.25,0)$) -- cycle;% sign |
| 397 |
\path[fill=background]% |
| 398 |
($\trafficfactor*\facefactor*(0,-0.18) + \facefactor*( 0.4 ,0)$) --% |
| 399 |
++($\trafficfactor*\facefactor*(0,-0.03) + \facefactor*( 0.03,0)$) --% |
| 400 |
++($\trafficfactor*\facefactor*(0,-0.38)$) --% |
| 401 |
++($\trafficfactor*\facefactor*(0,-0.03) + \facefactor*(-0.03,0)$) --% |
| 402 |
++($\trafficfactor*\facefactor*(0, 0.03) + \facefactor*(-0.03,0)$) --% |
| 403 |
++($\trafficfactor*\facefactor*(0, 0.38)$) -- cycle;% symbol |
| 404 |
%% label |
| 405 |
\tikzset{every node/.style={text=foreground,inner sep=1pt}};% |
| 406 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 407 |
\coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% |
| 408 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 409 |
\path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% |
| 410 |
}% |
| 411 |
\node[\align] at (label-coord) {\footnotesize \labelcontent};% |
| 412 |
}% |
| 413 |
}},% END of pics/pantograph_down/.style args={#1/#2/#3} |
| 414 |
% symbology entry |
| 415 |
symbology_pantograph_down/.pic = {% |
| 416 |
\maintrack (0,0) -- (6,0);% |
| 417 |
\pantographdown[forward] at (3,0) label ();% |
| 418 |
},% |
| 419 |
}% |
| 420 |
% |
| 421 |
% |
| 422 |
%%%%%%%%%%%%%%%% |
| 423 |
% symbol pantograph up |
| 424 |
%%%%%%%%%%%%%%% |
| 425 |
%% command |
| 426 |
\newcommand\pantographup{}% just for safety |
| 427 |
\def\pantographup[#1]#2(#3)#4(#5){% \pantographup[options] at (coord) label (name); |
| 428 |
\pic[#1] at (#3) {pantograph_up={#2/#4/#5}}% symbol |
| 429 |
}% |
| 430 |
%% |
| 431 |
%% symbol definition |
| 432 |
\tikzset{% |
| 433 |
pics/pantograph_up/.default=,% |
| 434 |
pics/pantograph_up/.style args={#1/#2/#3}{code={% |
| 435 |
%% settings |
| 436 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 437 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 438 |
\def\labelcontent{#3}% |
| 439 |
%% symbol marker |
| 440 |
% |
| 441 |
%% traffic practice setup |
| 442 |
\ifdefstring{\trafficpractice}{left}{% branch |
| 443 |
\pgfmathsetmacro{\trafficfactor}{-1}% |
| 444 |
}{% |
| 445 |
\ifdefstring{\trafficpractice}{right}{% branch |
| 446 |
\pgfmathsetmacro{\trafficfactor}{1}% |
| 447 |
}{% error message |
| 448 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}% |
| 449 |
}% |
| 450 |
}% end \ifdefstring{\trafficpractice} |
| 451 |
%% face setup |
| 452 |
\ifdefstring{\face}{forward}{% face |
| 453 |
\pgfmathsetmacro{\facefactor}{1}% |
| 454 |
\def\align{left}% |
| 455 |
}{% |
| 456 |
\ifdefstring{\face}{backward}{% face |
| 457 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 458 |
\def\align{right}% |
| 459 |
}{% error message |
| 460 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 461 |
}% |
| 462 |
}% end \ifdefstring{\face} |
| 463 |
% |
| 464 |
%% signal pole |
| 465 |
\path[draw=foreground,line width=1pt] (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.4,0)$);% signal pole |
| 466 |
%% signal marker |
| 467 |
\path[draw=foreground,line width=0.1pt,double=background,double distance=0.5pt,fill=\signalcolor,rounded corners=0.1pt]% |
| 468 |
($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*( 0.4,0)$) --% |
| 469 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*(-0.25,0)$) --% |
| 470 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*( 0.25,0)$) --% |
| 471 |
++($\trafficfactor*\facefactor*(0, 0.25) + \facefactor*( 0.25,0)$) -- cycle;% sign |
| 472 |
\path[fill=background]% |
| 473 |
($\trafficfactor*\facefactor*(0,-0.4 ) + \facefactor*( 0.62,0)$) --% |
| 474 |
++($\trafficfactor*\facefactor*(0,-0.03) + \facefactor*(-0.03,0)$) --% |
| 475 |
++($\facefactor*(-0.38,0)$) --% |
| 476 |
++($\trafficfactor*\facefactor*(0, 0.03) + \facefactor*(-0.03,0)$) --% |
| 477 |
++($\trafficfactor*\facefactor*(0, 0.03) + \facefactor*( 0.03,0)$) --% |
| 478 |
++($\facefactor*( 0.38,0)$) -- cycle;% symbol |
| 479 |
%% label |
| 480 |
\tikzset{every node/.style={text=foreground,inner sep=1pt}};% |
| 481 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 482 |
\coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% |
| 483 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 484 |
\path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% |
| 485 |
}% |
| 486 |
\node[\align] at (label-coord) {\footnotesize \labelcontent};% |
| 487 |
}% |
| 488 |
}},% END of pics/pantograph_up/.style args={#1/#2/#3} |
| 489 |
% symbology entry |
| 490 |
symbology_pantograph_up/.pic = {% |
| 491 |
\maintrack (0,0) -- (6,0);% |
| 492 |
\pantographup[forward] at (3,0) label ();% |
| 493 |
},% |
| 494 |
}% |
| 495 |
% |
| 496 |
% |
| 497 |
%%%%%%%%%%%%%%%% |
| 498 |
% symbol wire limit |
| 499 |
%%%%%%%%%%%%%%% |
| 500 |
%% command |
| 501 |
\newcommand\wirelimit{}% just for safety |
| 502 |
\def\wirelimit[#1]#2(#3)#4(#5){% \wirelimit[options] at (coord) label (name); |
| 503 |
\pic[#1] at (#3) {wire_limit={#2/#4/#5}}% symbol |
| 504 |
}% |
| 505 |
%% |
| 506 |
%% symbol definition |
| 507 |
\tikzset{% |
| 508 |
pics/wire_limit/.default=,% |
| 509 |
pics/wire_limit/.style args={#1/#2/#3}{code={% |
| 510 |
%% settings |
| 511 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 512 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 513 |
\def\labelcontent{#3}% |
| 514 |
%% symbol marker |
| 515 |
% |
| 516 |
%% traffic practice setup |
| 517 |
\ifdefstring{\trafficpractice}{left}{% branch |
| 518 |
\pgfmathsetmacro{\trafficfactor}{-1}% |
| 519 |
}{% |
| 520 |
\ifdefstring{\trafficpractice}{right}{% branch |
| 521 |
\pgfmathsetmacro{\trafficfactor}{1}% |
| 522 |
}{% error message |
| 523 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}% |
| 524 |
}% |
| 525 |
}% end \ifdefstring{\trafficpractice} |
| 526 |
%% face setup |
| 527 |
\ifdefstring{\face}{forward}{% face |
| 528 |
\pgfmathsetmacro{\facefactor}{1}% |
| 529 |
\def\align{left}% |
| 530 |
}{% |
| 531 |
\ifdefstring{\face}{backward}{% face |
| 532 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 533 |
\def\align{right}% |
| 534 |
}{% error message |
| 535 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 536 |
}% |
| 537 |
}% end \ifdefstring{\face} |
| 538 |
% |
| 539 |
%% signal pole |
| 540 |
\path[draw=foreground,line width=1pt] (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.4,0)$);% signal pole |
| 541 |
%% signal marker |
| 542 |
\path[draw=foreground,line width=0.1pt,double=background,double distance=0.5pt,fill=\signalcolor,rounded corners=0.1pt]% |
| 543 |
($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*( 0.4,0)$) --% |
| 544 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*(-0.25,0)$) --% |
| 545 |
++($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*( 0.25,0)$) --% |
| 546 |
++($\trafficfactor*\facefactor*(0, 0.25) + \facefactor*( 0.25,0)$) -- cycle;% sign |
| 547 |
\path[fill=background]% |
| 548 |
($\trafficfactor*\facefactor*(0,-0.25) + \facefactor*( 0.4 ,0)$) --% |
| 549 |
++($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*(-0.15,0)$) --% |
| 550 |
++($\trafficfactor*\facefactor*(0,-0.15) + \facefactor*( 0.15,0)$) --% |
| 551 |
++($\trafficfactor*\facefactor*(0, 0.15) + \facefactor*( 0.15,0)$) -- cycle;% symbol |
| 552 |
\path[fill=\signalcolor]% |
| 553 |
($\trafficfactor*\facefactor*(0,-0.3 ) + \facefactor*( 0.4 ,0)$) --% |
| 554 |
++($\trafficfactor*\facefactor*(0,-0.1 ) + \facefactor*(-0.1 ,0)$) --% |
| 555 |
++($\trafficfactor*\facefactor*(0,-0.1 ) + \facefactor*( 0.1 ,0)$) --% |
| 556 |
++($\trafficfactor*\facefactor*(0, 0.1 ) + \facefactor*( 0.1 ,0)$) -- cycle;% symbol |
| 557 |
\path[fill=background]% |
| 558 |
($\trafficfactor*\facefactor*(0,-0.35) + \facefactor*( 0.4 ,0)$) --% |
| 559 |
++($\trafficfactor*\facefactor*(0,-0.05) + \facefactor*(-0.05,0)$) --% |
| 560 |
++($\trafficfactor*\facefactor*(0,-0.05) + \facefactor*( 0.05,0)$) --% |
| 561 |
++($\trafficfactor*\facefactor*(0, 0.05) + \facefactor*( 0.05,0)$) -- cycle;% symbol |
| 562 |
%% label |
| 563 |
\tikzset{every node/.style={text=foreground,inner sep=1pt}};% |
| 564 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 565 |
\coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% |
| 566 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 567 |
\path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% |
| 568 |
}% |
| 569 |
\node[\align] at (label-coord) {\footnotesize \labelcontent};% |
| 570 |
}% |
| 571 |
}},% END of pics/wire_limit/.style args={#1/#2/#3} |
| 572 |
% symbology entry |
| 573 |
symbology_wire_limit/.pic = {% |
| 574 |
\maintrack (0,0) -- (6,0);% |
| 575 |
\wirelimit[forward] at (3,0) label ();% |
| 576 |
},% |
| 577 |
}% |
| 578 |
% |
| 579 |
% |
| 580 |
%%%%%%%%%%%%%%% |
| 581 |
% TODO: |
| 582 |
% * documentation |
| 583 |
% |
| 584 |
%%%%%%%%%%%%%%% |
| 585 |
\endinput% |
| 586 |
% |