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