| 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.topology.code.tex}% |
| 8 |
% |
| 9 |
%%%%%%%%%%%%%%% |
| 10 |
% Requirements |
| 11 |
%%%%%%%%%%%%%%% |
| 12 |
\RequirePackage{tikz,etoolbox}% |
| 13 |
\usetikzlibrary{calc,patterns}% |
| 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,% |
| 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 |
%% operation |
| 29 |
operation mode/.store in=\operationmode,% manual, remote OR none |
| 30 |
operation mode=none,% DEFAULT |
| 31 |
/tikz/operation/.forward to=/tikz/trackschematic/operation mode,% |
| 32 |
%% label |
| 33 |
shift label/.store in=\labelcoord,% (coord) |
| 34 |
shift label=(none),% DEFAULT |
| 35 |
/tikz/shift label/.forward to=/tikz/trackschematic/shift label,% |
| 36 |
}% |
| 37 |
\pgfkeys{% |
| 38 |
/tikz/trackschematic/topology/.is family,% |
| 39 |
/tikz/trackschematic/topology/.cd,% |
| 40 |
%% branch |
| 41 |
branch/.value required,% left OR right |
| 42 |
branch/.store in=\branch,% left OR right |
| 43 |
/tikz/branch/.forward to=/tikz/trackschematic/topology/branch,% |
| 44 |
%% fouling point |
| 45 |
fouling point/.value forbidden,% |
| 46 |
fouling point/.code={\settoggle{fouling_point}{true}},% |
| 47 |
/tikz/fouling point/.forward to=/tikz/trackschematic/topology/fouling point,% |
| 48 |
%% points |
| 49 |
points/.store in=\points,% moving, left, right OR none |
| 50 |
points=none,% DEFAULT |
| 51 |
/tikz/points/.forward to=/tikz/trackschematic/topology/points,% |
| 52 |
}% |
| 53 |
% options for turnout and slip turnout |
| 54 |
\newtoggle{fouling_point}\settoggle{fouling_point}{false}% |
| 55 |
% |
| 56 |
%%%%%%%%%%%%%%% |
| 57 |
% symbol track |
| 58 |
%%%%%%%%%%%%%%% |
| 59 |
% |
| 60 |
% commands |
| 61 |
\newcommand\maintrack{}% just for safety |
| 62 |
\def\maintrack{\path[draw=foreground,MainTrack]}% \maintrack (coord1) -- (coord2); |
| 63 |
\newcommand\secondarytrack{}% just for safety |
| 64 |
\def\secondarytrack{\path[draw=foreground,SecondaryTrack]}% \secondarytrack (coord1) -- (coord2); |
| 65 |
\newcommand\sidetrack{}% just for safety |
| 66 |
\def\sidetrack{\path[draw=foreground,SecondaryTrack]}% alias for \secondarytrack |
| 67 |
% |
| 68 |
%% symbol definition |
| 69 |
\tikzset{% |
| 70 |
MainTrack/.style={line width=2pt},% |
| 71 |
% symbology entry |
| 72 |
symbology_main_track/.pic = {\maintrack (0,0) -- (6,0);}% |
| 73 |
}% |
| 74 |
\tikzset{% |
| 75 |
SecondaryTrack/.style={line width=0.7pt},% |
| 76 |
% symbology entry |
| 77 |
symbology_secondary_track/.pic = {\secondarytrack (0,0) -- (6,0);}% |
| 78 |
}% |
| 79 |
% |
| 80 |
%%%%%%%%%%%%%%% |
| 81 |
% symbol track number |
| 82 |
%%%%%%%%%%%%%%% |
| 83 |
% |
| 84 |
%% command |
| 85 |
\newcommand\tracklabel{}% just for safety |
| 86 |
\def\tracklabel#1(#2)#3(#4){% \tracklabel at (coord) label (name); |
| 87 |
\pic at (#2) {track_label={#1/#3/#4}}% symbol |
| 88 |
}% |
| 89 |
%% tikz keys |
| 90 |
% \pgfkeys{% |
| 91 |
% /tikz/trackschematic/.is family,% |
| 92 |
% /tikz/trackschematic/.cd,% |
| 93 |
% }% |
| 94 |
%% symbol definition |
| 95 |
\tikzset{% |
| 96 |
pics/track_label/.default=,% |
| 97 |
pics/track_label/.style args={#1/#2/#3}{code={% |
| 98 |
%% settings |
| 99 |
\def\coordcommand{#1} % beware of leading and tailing spaces! |
| 100 |
\def\labelcommand{#2} % beware of leading and tailing spaces! |
| 101 |
\def\labelcontent{#3} |
| 102 |
%% label |
| 103 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 104 |
\tikzset{every node/.style={fill=background,text=foreground}};% |
| 105 |
\coordinate (ts-tl-l) at (0,0);% |
| 106 |
\ifdefstring{\labelcoord}{(none)}{% default coord |
| 107 |
}{% initialize if NOT default |
| 108 |
\path let \p1=\labelcoord in coordinate (ts-tl-l) at ($(ts-tl-l)+(\x1,\y1)$);% |
| 109 |
}% |
| 110 |
\node at (ts-tl-l) {\labelcontent};% |
| 111 |
}% |
| 112 |
}},% END pics/track_label/.style args={#1/#2/#3} |
| 113 |
% |
| 114 |
% symbology entry |
| 115 |
symbology_track_label/.pic = {% |
| 116 |
\maintrack (0,0) -- (6,0);% |
| 117 |
\tracklabel at (3,0) label (label);% |
| 118 |
},% |
| 119 |
}% |
| 120 |
% |
| 121 |
%%%%%%%%%%%%%%% |
| 122 |
% symbol buffer stop |
| 123 |
%%%%%%%%%%%%%%% |
| 124 |
% |
| 125 |
% command |
| 126 |
\newcommand\bufferstop{}% just for safety |
| 127 |
\def\bufferstop[#1]#2(#3){% \bufferstop[options] at (coord); |
| 128 |
\pic[#1] at (#3) {bufferstop={#2}}% symbol |
| 129 |
}% |
| 130 |
\newlength{\friction}\setlength{\friction}{0.5cm} |
| 131 |
% tikz keys |
| 132 |
\pgfkeys{% |
| 133 |
/tikz/trackschematic/topology/bufferstop/.is family,% |
| 134 |
/tikz/trackschematic/topology/bufferstop/.cd,% |
| 135 |
%% friction |
| 136 |
friction/.store in=\friction,% length OR none |
| 137 |
friction=none,% length OR none |
| 138 |
/tikz/friction/.forward to=/tikz/trackschematic/topology/bufferstop/friction,% |
| 139 |
}% |
| 140 |
% symbol definition |
| 141 |
\tikzset{% |
| 142 |
pics/bufferstop/.default=,% |
| 143 |
pics/bufferstop/.style args={#1}{code={% |
| 144 |
%% settings |
| 145 |
\def\coordcommand{#1} % beware of leading and tailing spaces! |
| 146 |
%% face setup |
| 147 |
\ifdefstring{\face}{forward}{% face |
| 148 |
\pgfmathsetmacro{\facefactor}{1}% |
| 149 |
}{% |
| 150 |
\ifdefstring{\face}{backward}{% face |
| 151 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 152 |
}{% error message |
| 153 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 154 |
}% |
| 155 |
}% end \ifdefstring{\face} |
| 156 |
%% symbol |
| 157 |
\ifdefstring{\friction}{none}{% none friction |
| 158 |
\path[draw=foreground, line width=1pt]% |
| 159 |
($\facefactor*(-0.1,0) + (0,0.2)$) -- ++($\facefactor*( 0.1,0)$) -- ++(0,-0.4) -- ++ ($\facefactor*(-0.1,0)$);% bufferstop marker |
| 160 |
}{% friction |
| 161 |
\path[draw=foreground, line width=1pt]% |
| 162 |
($\facefactor*(-\friction,0) + \facefactor*(-0.05,0) + (0,0.2)$) -- ++($\facefactor*(0.1,0)$) -- ++(0,-0.4) -- ++ ($\facefactor*(-0.1,0)$);% bufferstop marker |
| 163 |
\fill[foreground] (0,0) circle (0.06);% track closure indicator |
| 164 |
}% |
| 165 |
}},% END pics/bufferstop/.style args={#1} |
| 166 |
% |
| 167 |
% symbology entry |
| 168 |
symbology_bufferstop/.pic = {% |
| 169 |
\secondarytrack (0,0) -- (3,0);% |
| 170 |
\bufferstop[forward] at (3,0);% |
| 171 |
},% |
| 172 |
% symbology entry |
| 173 |
symbology_friction_bufferstop/.pic = {% |
| 174 |
\maintrack (0,0) -- (3,0);% |
| 175 |
\bufferstop[forward,friction=.5] at (3,0);% |
| 176 |
},% |
| 177 |
}% |
| 178 |
% |
| 179 |
%%%%%%%%%%%%%%% |
| 180 |
% symbol track closure |
| 181 |
%%%%%%%%%%%%%%% |
| 182 |
% |
| 183 |
%% command |
| 184 |
\newcommand\trackclosure{}% just for safety |
| 185 |
\def\trackclosure#1(#2){% \trackclosure at (coord); |
| 186 |
\pic at (#2) {track_closure={#1}}% symbol |
| 187 |
}% |
| 188 |
% symbol definition |
| 189 |
\tikzset{% |
| 190 |
pics/track_closure/.default=,% |
| 191 |
pics/track_closure/.style args={#1}{code={% |
| 192 |
%% settings |
| 193 |
\def\coordcommand{#1} % beware of leading and tailing spaces! |
| 194 |
%% |
| 195 |
\fill[foreground] (0,0) circle (0.06);% track closure indicator |
| 196 |
% \path[fill=foreground] (0.04,0.02) -- (0.04,-0.02) -- (0.02,-0.04) -- (-0.02,-0.04) -- (-0.04,-0.02) -- (-0.04,0.02) -- (-0.02,0.04) -- (0.02,0.04) -- cycle;% label |
| 197 |
}},% END pics/track_closure/.style args={#1} |
| 198 |
% |
| 199 |
% symbology entry |
| 200 |
symbology_track_closure/.pic = {% |
| 201 |
\maintrack (0,0) -- (3,0);% |
| 202 |
\trackclosure at (3,0);% |
| 203 |
},% |
| 204 |
}% |
| 205 |
% |
| 206 |
%%%%%%%%%%%%%%% |
| 207 |
% symbol turnout |
| 208 |
%%%%%%%%%%%%%%% |
| 209 |
% |
| 210 |
% command |
| 211 |
\newcommand\turnout{}% just for safety |
| 212 |
\def\turnout[#1]#2(#3)#4(#5){% \turnout[options] at (coord) label (name); |
| 213 |
\pic[operation=remote,#1] at (#3) {turnout={#2/#4/#5}}% symbol |
| 214 |
}% |
| 215 |
% tikz keys |
| 216 |
\pgfkeys{% |
| 217 |
/tikz/trackschematic/topology/turnout/.is family,% |
| 218 |
/tikz/trackschematic/topology/turnout/.cd,% |
| 219 |
%% points |
| 220 |
points/.store in=\points,% moving, left, right OR none |
| 221 |
points=none,% moving, left, right OR none |
| 222 |
/tikz/points/.forward to=/tikz/trackschematic/topology/turnout/points,% |
| 223 |
}% |
| 224 |
% symbol definition |
| 225 |
\tikzset{% |
| 226 |
pics/turnout/.default=,% |
| 227 |
pics/turnout/.style args={#1/#2/#3}{code={% |
| 228 |
%% settings |
| 229 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 230 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 231 |
\def\labelcontent{#3}% |
| 232 |
%% face setup |
| 233 |
\ifdefstring{\face}{forward}{% face |
| 234 |
\pgfmathsetmacro{\facefactor}{1}% |
| 235 |
}{% |
| 236 |
\ifdefstring{\face}{backward}{% face |
| 237 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 238 |
}{% error message |
| 239 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 240 |
}% |
| 241 |
}% end \ifdefstring{\face} |
| 242 |
%% branch setup |
| 243 |
\ifdefstring{\branch}{left}{% branch |
| 244 |
\pgfmathsetmacro{\branchfactor}{1}% |
| 245 |
}{% |
| 246 |
\ifdefstring{\branch}{right}{% branch |
| 247 |
\pgfmathsetmacro{\branchfactor}{-1}% |
| 248 |
}{% error message |
| 249 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/branch}{“left“ OR “right“ as key required}}% |
| 250 |
}% |
| 251 |
}% end \ifdefstring{\branch} |
| 252 |
%% turnout marker |
| 253 |
\ifdefstring{\operationmode}{manual}{% operation=manual |
| 254 |
\ifdefstring{\face}{forward}{% |
| 255 |
\ifdefstring{\branch}{left}{% branch |
| 256 |
\def\patterntype{north west lines}% |
| 257 |
}{% |
| 258 |
\def\patterntype{north east lines}% |
| 259 |
}% |
| 260 |
}{% |
| 261 |
\ifdefstring{\branch}{right}{% branch |
| 262 |
\def\patterntype{north west lines}% |
| 263 |
}{% |
| 264 |
\def\patterntype{north east lines}% |
| 265 |
}% |
| 266 |
}% |
| 267 |
\path[draw=foreground,pattern=\patterntype, pattern color=foreground] (0,0) -- ++($\facefactor*(0.4,0)$) -- ++($\branchfactor*(0,0.4)$) -- cycle;% turnout marker |
| 268 |
}{% |
| 269 |
\ifdefstring{\operationmode}{remote}{% operation=remote |
| 270 |
\path[fill=foreground] (0,0) -- ++($\facefactor*(0.4,0)$) -- ++($\branchfactor*(0,0.4)$) -- cycle;% turnout marker |
| 271 |
}{% |
| 272 |
\ifdefstring{\operationmode}{none}{ |
| 273 |
\path[draw=foreground] (0,0) -- ++($\facefactor*(0.4,0)$) -- ++($\branchfactor*(0,0.4)$) -- cycle;% turnout marker |
| 274 |
}{% |
| 275 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/operation}{“manual“, “remote“ OR “none“ as key required}}% |
| 276 |
}% |
| 277 |
} |
| 278 |
}% |
| 279 |
% |
| 280 |
%% label |
| 281 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 282 |
\tikzset{every node/.style={text=foreground}};% |
| 283 |
\coordinate (ts-y-l) at ($\branchfactor*(0,-8pt)$);% |
| 284 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 285 |
\path let \p1=\labelcoord in coordinate (ts-y-l) at ($(ts-y-l)+(\x1,\y1)$);% |
| 286 |
}% |
| 287 |
\node at (ts-y-l) {\footnotesize \labelcontent};% |
| 288 |
}% |
| 289 |
% |
| 290 |
%% fouling point indicator |
| 291 |
\iftoggle{fouling_point}{% |
| 292 |
\path[draw=foreground] ($\facefactor*(0.7,0)$) -- ++($\branchfactor*(0,0.7)$);% fouling point indicator |
| 293 |
}{}% |
| 294 |
% |
| 295 |
%% points |
| 296 |
\ifdefstring{\points}{left}{% points left |
| 297 |
\ifdefstring{\branch}{left}{% |
| 298 |
\path[draw=foreground,line width=1.5pt] ($\facefactor*(-0.035,0)+(0,0.1)$) -- ++($\facefactor*(0.2,0)+(0,0.2)$);% |
| 299 |
}{% |
| 300 |
\path[draw=foreground,line width=1.5pt] ($\facefactor*( 0.035,0)+(0,0.1)$) -- ++($\facefactor*( 0.265,0 )$);% |
| 301 |
}% |
| 302 |
}{% |
| 303 |
\ifdefstring{\points}{right}{% points right |
| 304 |
\ifdefstring{\branch}{left}{% |
| 305 |
\path[draw=foreground,line width=1.5pt] ($\facefactor*( 0.035,0)+(0,-0.1)$) -- ++($\facefactor*( 0.265,0 )$);% |
| 306 |
}{% |
| 307 |
\path[draw=foreground,line width=1.5pt] ($\facefactor*(-0.035,0)+(0,-0.1)$) -- ++($\facefactor*(0.2,0)+(0,-0.2)$);% |
| 308 |
}% |
| 309 |
}{% |
| 310 |
\ifdefstring{\points}{moving}{% moving points |
| 311 |
\fill[foreground] ($\facefactor*(0.075,0) + \branchfactor*(0,-0.1 )$) circle (0.05);% points indicator left |
| 312 |
\fill[foreground] ($\facefactor*(0.225,0) + \branchfactor*(0,-0.1 )$) circle (0.05);% points indicator left |
| 313 |
\fill[foreground] ($\facefactor*(0.015,0) + \branchfactor*(0, 0.15)$) circle (0.05);% points indicator right |
| 314 |
\fill[foreground] ($\facefactor*(0.115,0) + \branchfactor*(0, 0.25)$) circle (0.05);% points indicator right |
| 315 |
}{% error message |
| 316 |
\ifdefstring{\points}{none}{% |
| 317 |
}{% |
| 318 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/turnout/points}{“left“, “right“ OR “moving“ as key required}}% |
| 319 |
}% |
| 320 |
}% |
| 321 |
}% |
| 322 |
}% end \ifdefstring{\points} |
| 323 |
% |
| 324 |
}},% END pics/turnout/.style args={#1/#2/#3} |
| 325 |
% symbology entry |
| 326 |
symbology_turnout/.pic = {% |
| 327 |
\maintrack (0,0) -- (6,0);% |
| 328 |
\maintrack (3,0) -- ++(0.8,0.8);% |
| 329 |
\turnout[forward,branch=left] at (3,0) label ();% |
| 330 |
},% |
| 331 |
symbology_turnout_fouling/.pic = {% |
| 332 |
\maintrack (0,0) -- (6,0);% |
| 333 |
\maintrack (3,0) -- ++(0.8,0.8);% |
| 334 |
\turnout[forward,branch=left,fouling point] at (3,0) label ();% |
| 335 |
},% |
| 336 |
symbology_turnout_manually/.pic = {% |
| 337 |
\secondarytrack (0,0) -- (6,0);% |
| 338 |
\secondarytrack (3,0) -- ++(0.8,0.8);% |
| 339 |
\turnout[forward,branch=left,operation=manual] at (3,0) label ();% |
| 340 |
},% |
| 341 |
symbology_turnout_points_right/.pic = {% |
| 342 |
\maintrack (0,0) -- (6,0);% |
| 343 |
\maintrack (3,0) -- ++(0.8,0.8);% |
| 344 |
\turnout[forward,branch=left,points=right] at (3,0) label ();% |
| 345 |
},% |
| 346 |
symbology_turnout_points_left/.pic = {% |
| 347 |
\maintrack (0,0) -- (6,0);% |
| 348 |
\maintrack (3,0) -- ++(0.8,0.8);% |
| 349 |
\turnout[forward,branch=left,points=left] at (3,0) label ();% |
| 350 |
},% |
| 351 |
symbology_turnout_points_moving/.pic = {% |
| 352 |
\maintrack (0,0) -- (6,0);% |
| 353 |
\maintrack (3,0) -- ++(0.8,0.8);% |
| 354 |
\turnout[forward,branch=left,points=moving] at (3,0) label ();% |
| 355 |
},% |
| 356 |
}% |
| 357 |
% |
| 358 |
%%%%%%%%%%%%%%% |
| 359 |
% symbol slip switch turnout - using parts of turnout |
| 360 |
%%%%%%%%%%%%%%% |
| 361 |
% |
| 362 |
\newcommand\slipturnout{}% just for safety |
| 363 |
\def\slipturnout[#1]#2(#3)#4(#5)(#6){% \slipturnout[options] at (coord) label (name1)(name2); |
| 364 |
\pic[operation=remote,slip=double,#1] at (#3) {slipturnout={#2/#4/#5/#6}}% symbol |
| 365 |
}% |
| 366 |
% tikz keys |
| 367 |
\pgfkeys{% |
| 368 |
/tikz/trackschematic/topology/slipturnout/.is family,% |
| 369 |
/tikz/trackschematic/topology/slipturnout/.cd,% |
| 370 |
%% points |
| 371 |
forward points/.store in=\forwardpoints,% moving, left, right OR none |
| 372 |
forward points=none,% moving, left, right OR none |
| 373 |
/tikz/forward points/.forward to=/tikz/trackschematic/topology/slipturnout/forward points,% |
| 374 |
backward points/.store in=\backwardpoints,% moving, left, right OR none |
| 375 |
backward points=none,% moving, left, right OR none |
| 376 |
/tikz/backward points/.forward to=/tikz/trackschematic/topology/slipturnout/backward points,% |
| 377 |
%% slips |
| 378 |
slip/.store in=\slip,% double, left, right OR none |
| 379 |
slip=none,% double, left, right OR none |
| 380 |
/tikz/slip/.forward to=/tikz/trackschematic/topology/slipturnout/slip,% |
| 381 |
}% |
| 382 |
% symbol definition |
| 383 |
\tikzset{% |
| 384 |
pics/slipturnout/.default=,% |
| 385 |
pics/slipturnout/.style args={#1/#2/#3/#4}{code={% |
| 386 |
%% settings |
| 387 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 388 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 389 |
\def\labelcontentleft{#3}% |
| 390 |
\def\labelcontentright{#4}% |
| 391 |
%% branch setup |
| 392 |
\ifdefstring{\branch}{left}{% branch |
| 393 |
\pgfmathsetmacro{\branchfactor}{1}% |
| 394 |
}{% |
| 395 |
\ifdefstring{\branch}{right}{% branch |
| 396 |
\pgfmathsetmacro{\branchfactor}{-1}% |
| 397 |
}{% error message |
| 398 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/branch}{“left“ OR “right“ as key required}}% |
| 399 |
}% |
| 400 |
}% end \ifdefstring{\branch} |
| 401 |
%% turnout marker |
| 402 |
\ifdefstring{\operationmode}{manual}{% operation=manual |
| 403 |
\ifdefstring{\branch}{left}{% branch |
| 404 |
\def\patterntype{north west lines}% |
| 405 |
}{% |
| 406 |
\def\patterntype{north east lines}% |
| 407 |
}% |
| 408 |
\path[draw,pattern=\patterntype, pattern color=foreground] (0,0) -- ++($( 0.4,0)$) -- ++($\branchfactor*(0, 0.4)$) -- cycle;% turnout marker |
| 409 |
\path[draw,pattern=\patterntype, pattern color=foreground] (0,0) -- ++($(-0.4,0)$) -- ++($\branchfactor*(0,-0.4)$) -- cycle;% turnout marker |
| 410 |
}{% operated automaticly |
| 411 |
\ifdefstring{\operationmode}{remote}{% operation=remote |
| 412 |
\path[fill=foreground] (0,0) -- ++($( 0.4,0)$) -- ++($\branchfactor*(0, 0.4)$) -- cycle;% turnout marker |
| 413 |
\path[fill=foreground] (0,0) -- ++($(-0.4,0)$) -- ++($\branchfactor*(0,-0.4)$) -- cycle;% turnout marker |
| 414 |
}{% |
| 415 |
\ifdefstring{\operationmode}{none}{}{% |
| 416 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/operation}{“manual“, “remote“ OR “none“ as key required}}% |
| 417 |
}% |
| 418 |
}% |
| 419 |
}% |
| 420 |
%% fouling point indicator |
| 421 |
\iftoggle{fouling_point}{% |
| 422 |
\path[draw=foreground] ( 0.7,0) -- ++($\branchfactor*(0, 0.7)$);% fouling point indicator |
| 423 |
\path[draw=foreground] (-0.7,0) -- ++($\branchfactor*(0,-0.7)$);% fouling point indicator |
| 424 |
}{}% |
| 425 |
% |
| 426 |
%% points |
| 427 |
\ifdefstring{\forwardpoints}{left}{% points left |
| 428 |
\ifdefstring{\branch}{left}{% |
| 429 |
\path[draw=foreground,line width=1.5pt] (-0.035,0.1) -- ++(0.2,0.2);% |
| 430 |
}{% |
| 431 |
\path[draw=foreground,line width=1.5pt] ( 0.035,0.1) -- ++(0.265,0);% |
| 432 |
}% |
| 433 |
}{% |
| 434 |
\ifdefstring{\forwardpoints}{right}{% points right |
| 435 |
\ifdefstring{\branch}{left}{% |
| 436 |
\path[draw=foreground,line width=1.5pt] ( 0.035,-0.1) -- ++(0.265,0); |
| 437 |
}{% |
| 438 |
\path[draw=foreground,line width=1.5pt] (-0.035,-0.1) -- ++(0.2,-0.2);% |
| 439 |
}% |
| 440 |
}{% |
| 441 |
\ifdefstring{\forwardpoints}{moving}{% moving points |
| 442 |
\fill[foreground] ($(0.075,0) + \branchfactor*(0,-0.1 )$) circle (0.05);% points indicator left |
| 443 |
\fill[foreground] ($(0.225,0) + \branchfactor*(0,-0.1 )$) circle (0.05);% points indicator left |
| 444 |
\fill[foreground] ($(0.015,0) + \branchfactor*(0, 0.15)$) circle (0.05);% points indicator right |
| 445 |
\fill[foreground] ($(0.115,0) + \branchfactor*(0, 0.25)$) circle (0.05);% points indicator right |
| 446 |
}{% error message |
| 447 |
\ifdefstring{\forwardpoints}{none}{% |
| 448 |
}{% |
| 449 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/slipturnout/forward points}{“left“, “right“ OR “moving“ as key required}}% |
| 450 |
}% |
| 451 |
}% |
| 452 |
}% |
| 453 |
}% end of \ifdefstring{\forwardpoints} |
| 454 |
\ifdefstring{\backwardpoints}{left}{% points left |
| 455 |
\ifdefstring{\branch}{left}{% |
| 456 |
\path[draw=foreground,line width=1.5pt] (0.035,-0.1) -- ++(-0.2,-0.2);% |
| 457 |
}{% |
| 458 |
\path[draw=foreground,line width=1.5pt] (-0.035,-0.1) -- ++(-0.265,0);% |
| 459 |
}% |
| 460 |
}{% |
| 461 |
\ifdefstring{\backwardpoints}{right}{% points right |
| 462 |
\ifdefstring{\branch}{left}{% |
| 463 |
\path[draw=foreground,line width=1.5pt] (-0.035,0.1) -- ++(-0.265,0); |
| 464 |
}{% |
| 465 |
\path[draw=foreground,line width=1.5pt] (0.035,0.1) -- ++(-0.2,0.2);% |
| 466 |
}% |
| 467 |
}{% |
| 468 |
\ifdefstring{\backwardpoints}{moving}{% moving points |
| 469 |
\fill[foreground] ($(-0.075,0) + \branchfactor*(0, 0.1 )$) circle (0.05);% points indicator left |
| 470 |
\fill[foreground] ($(-0.225,0) + \branchfactor*(0, 0.1 )$) circle (0.05);% points indicator left |
| 471 |
\fill[foreground] ($(-0.015,0) + \branchfactor*(0,-0.15)$) circle (0.05);% points indicator right |
| 472 |
\fill[foreground] ($(-0.115,0) + \branchfactor*(0,-0.25)$) circle (0.05);% points indicator right |
| 473 |
}{% error message |
| 474 |
\ifdefstring{\backwardpoints}{none}{% |
| 475 |
}{% |
| 476 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/slipturnout/forward points}{“left“, “right“ OR “moving“ as key required}}% |
| 477 |
}% |
| 478 |
}% |
| 479 |
}% |
| 480 |
}% end of \ifdefstring{\backwardpoints} |
| 481 |
% |
| 482 |
%% slips |
| 483 |
\ifdefstring{\slip}{double}{% slip |
| 484 |
\path[draw=foreground,line width=0.75pt] ($\branchfactor*(-0.4,0) + (0, 0.1)$) -- ($\branchfactor*( 0.3,0) + (0, 0.4)$);% slip |
| 485 |
\path[draw=foreground,line width=0.75pt] ($\branchfactor*( 0.4,0) + (0,-0.1)$) -- ($\branchfactor*(-0.3,0) + (0,-0.4)$);% slip |
| 486 |
}{% |
| 487 |
\ifdefstring{\slip}{left}{% |
| 488 |
\path[draw=foreground,line width=0.75pt] ($\branchfactor*(-0.4,0) + (0,0.1)$) -- ($\branchfactor*(0.3,0) + (0,0.4)$);% slip |
| 489 |
}{% |
| 490 |
\ifdefstring{\slip}{right}{% |
| 491 |
\path[draw=foreground,line width=0.75pt] ($\branchfactor*(0.4,0) + (0,-0.1)$) -- ($\branchfactor*(-0.3,0) + (0,-0.4)$);% slip |
| 492 |
}{% |
| 493 |
\ifdefstring{\slip}{none}{% |
| 494 |
% |
| 495 |
}{%error message |
| 496 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/slipturnout/slip}{“double“, “left“, “right“ OR “none“ as key required}}% |
| 497 |
}% |
| 498 |
}% |
| 499 |
}% |
| 500 |
}% |
| 501 |
% |
| 502 |
%% label |
| 503 |
\tikzset{every node/.style={text=foreground}};% |
| 504 |
\ifdefstring{\labelcontentleft}{}{}{% label NOT empty |
| 505 |
\coordinate (ts-sy-l1) at ($(2pt,0) + \branchfactor*(0, 10pt)$);% |
| 506 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 507 |
\path let \p1=\labelcoord in coordinate (ts-sy-l1) at ($(ts-sy-l1)+(\x1,\y1)$);% |
| 508 |
}% |
| 509 |
\node[left] at (ts-sy-l1) {\footnotesize \labelcontentleft};% |
| 510 |
}% |
| 511 |
\ifdefstring{\labelcontentright}{}{}{% label NOT empty |
| 512 |
\coordinate (ts-sy-l2) at ($(2pt,0) + \branchfactor*(0,-10pt)$);% |
| 513 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 514 |
\path let \p1=\labelcoord in coordinate (ts-sy-l2) at ($(ts-sy-l2)+(\x1,\y1)$);% |
| 515 |
}% |
| 516 |
\node[right] at (ts-sy-l2) {\footnotesize \labelcontentright};% |
| 517 |
}% |
| 518 |
% |
| 519 |
}},% END of pics/slipturnout/.style args={#1/#2/#3/#4} |
| 520 |
% symbology entry |
| 521 |
symbology_slip_turnout/.pic = {% |
| 522 |
\maintrack (0,0) -- (6,0);% |
| 523 |
\maintrack (3,0) -- ++(0.8,0.8);% |
| 524 |
\maintrack (3,0) -- ++(-0.8,-0.8);% |
| 525 |
\slipturnout[branch=left] at (3,0) label ()();% |
| 526 |
},% |
| 527 |
}% |
| 528 |
% |
| 529 |
%%%%%%%%%%%%%%% |
| 530 |
% symbol crossing - using parts of turnout |
| 531 |
%%%%%%%%%%%%%%% |
| 532 |
% command |
| 533 |
\newcommand\crossing{}% just for safety |
| 534 |
\def\crossing[#1]#2(#3)#4(#5){% \crossing[options] at (coord) label (name); |
| 535 |
\pic[#1] at (#3) {crossing={#2/#4/#5}}% symbol |
| 536 |
}% |
| 537 |
% symbol definition |
| 538 |
\tikzset{% |
| 539 |
pics/crossing/.default=,% |
| 540 |
pics/crossing/.style args={#1/#2/#3}{code={% |
| 541 |
%% settings |
| 542 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 543 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 544 |
\def\labelcontent{#3}% |
| 545 |
%% face setup |
| 546 |
%% branch setup |
| 547 |
\ifdefstring{\branch}{left}{% branch |
| 548 |
\pgfmathsetmacro{\branchfactor}{1}% |
| 549 |
}{% |
| 550 |
\ifdefstring{\branch}{right}{% branch |
| 551 |
\pgfmathsetmacro{\branchfactor}{-1}% |
| 552 |
}{% error message |
| 553 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/branch}{“left“ OR “right“ as key required}}% |
| 554 |
}% |
| 555 |
}% |
| 556 |
% |
| 557 |
%% crossing marker |
| 558 |
\path[draw=foreground] (0,0) -- ++( 0.4,0) -- ++($\branchfactor*(0, 0.4)$) -- cycle;% turnout marker |
| 559 |
\path[draw=foreground] (0,0) -- ++(-0.4,0) -- ++($\branchfactor*(0,-0.4)$) -- cycle;% turnout marker |
| 560 |
% |
| 561 |
%% label |
| 562 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 563 |
\tikzset{every node/.style={text=foreground}};% |
| 564 |
\coordinate (ts-x-l) at ($(2pt,0) + \branchfactor*(0,-9pt)$);% |
| 565 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 566 |
\path let \p1=\labelcoord in coordinate (ts-x-l) at ($(ts-x-l)+(\x1,\y1)$);% |
| 567 |
}% |
| 568 |
\node[right] at (ts-x-l) {\footnotesize \labelcontent};% |
| 569 |
}% |
| 570 |
% |
| 571 |
%% fouling point indicator |
| 572 |
\iftoggle{fouling_point}{% |
| 573 |
\path[draw=foreground] ( 0.7,0) -- ++($\branchfactor*(0, 0.7)$);% fouling point indicator |
| 574 |
\path[draw=foreground] (-0.7,0) -- ++($\branchfactor*(0,-0.7)$);% fouling point indicator |
| 575 |
}{}% |
| 576 |
% |
| 577 |
}},% end of pics/crossing/.style args={#1/#2/#3} |
| 578 |
% symbology entry |
| 579 |
symbology_diamond_crossing/.pic = {% |
| 580 |
\maintrack (0,0) -- (6,0);% |
| 581 |
\maintrack (3,0) -- ++(0.8,0.8);% |
| 582 |
\maintrack (3,0) -- ++(-0.8,-0.8);% |
| 583 |
\crossing[branch=left] at (3,0) label ();% |
| 584 |
},% |
| 585 |
}% |
| 586 |
% |
| 587 |
%%%%%%%%%%%%%%% |
| 588 |
% symbol derailer |
| 589 |
%%%%%%%%%%%%%%% |
| 590 |
% |
| 591 |
% command |
| 592 |
\newcommand\derailer{}% just for safety |
| 593 |
\def\derailer[#1]#2(#3)#4(#5){% \derailer[options] at (coord) label (name); |
| 594 |
\pic[#1] at (#3) {derailer={#2/#4/#5}}% symbol |
| 595 |
}% |
| 596 |
% symbol definition |
| 597 |
\tikzset{% |
| 598 |
pics/derailer/.default=,% |
| 599 |
pics/derailer/.style args={#1/#2/#3}{code={% |
| 600 |
%% settings |
| 601 |
\def\coordcommand{#1}% beware of leading and tailing spaces! |
| 602 |
\def\labelcommand{#2}% beware of leading and tailing spaces! |
| 603 |
\def\labelcontent{#3}% |
| 604 |
%% face setup |
| 605 |
\ifdefstring{\face}{forward}{% face |
| 606 |
\pgfmathsetmacro{\facefactor}{1}% |
| 607 |
}{% |
| 608 |
\ifdefstring{\face}{backward}{% face |
| 609 |
\pgfmathsetmacro{\facefactor}{-1}% |
| 610 |
}{% error message |
| 611 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}% |
| 612 |
}% |
| 613 |
}% end \ifdefstring{\face} |
| 614 |
%% branch setup |
| 615 |
\ifdefstring{\branch}{left}{% branch |
| 616 |
\ifdefstring{\face}{forward}{% |
| 617 |
\pgfmathsetmacro{\branchfactor}{1}% |
| 618 |
}{% |
| 619 |
\pgfmathsetmacro{\branchfactor}{-1}% |
| 620 |
}% |
| 621 |
}{% |
| 622 |
\ifdefstring{\branch}{right}{% branch |
| 623 |
\ifdefstring{\face}{forward}{% |
| 624 |
\pgfmathsetmacro{\branchfactor}{-1}% |
| 625 |
}{% |
| 626 |
\pgfmathsetmacro{\branchfactor}{1}% |
| 627 |
}% |
| 628 |
}{% error message |
| 629 |
\pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/branch}{“left“ OR “right“ as key required}}% |
| 630 |
}% |
| 631 |
}% end \ifdefstring{\branch} |
| 632 |
% |
| 633 |
%% symbol |
| 634 |
\path[draw=foreground, line width=1pt] (0,0.1) -- ++(0,-0.2);% derailer marker |
| 635 |
\path[draw=foreground,->,>=latex,line width=1pt,dashed] (0,0) -- ++($\facefactor*(0.4,0) + \branchfactor*(0,0.4)$);% derailer arrow |
| 636 |
% |
| 637 |
%% label |
| 638 |
\ifdefstring{\labelcontent}{}{}{% label NOT empty |
| 639 |
\tikzset{every node/.style={text=foreground}};% |
| 640 |
\coordinate (ts-dr-l) at ($\branchfactor*(0,-0.3)$);% |
| 641 |
\ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default |
| 642 |
\path let \p1=\labelcoord in coordinate (ts-dr-l) at ($(ts-dr-l)+(\x1,\y1)$);% |
| 643 |
}% |
| 644 |
\node at (ts-dr-l) {\footnotesize \labelcontent};% |
| 645 |
}% |
| 646 |
% |
| 647 |
}},% END pics/derailer/.style args={#1/#2/#3} |
| 648 |
% symbology entry |
| 649 |
symbology_derailer/.pic = {% |
| 650 |
\secondarytrack (0,0) -- (6,0);% |
| 651 |
\derailer[forward,branch=left] at (3,0) label ();% |
| 652 |
},% |
| 653 |
}% |
| 654 |
% |
| 655 |
%%%%%%%%%%%%%%% |
| 656 |
\endinput% |
| 657 |
% |