chiark / gitweb /
cmd line parsing and control of output style
[trains.git] / layout / informat.txt
1 Locations, angles, etc.
2
3  Key type is a `loc', which is a named location (absolute, 2D) and
4  direction (at the location).  Angles are generally positive
5  anticlockwise; bearings are angles measured from East.  The origin is
6  at the South-West.
7
8 Syntaxes
9  New location
10   <identifier>
11  Existing location
12   [-]<identifier>  (- means reverse the sense)
13  Quantity (length/angle)
14   <number>[<unit>]
15   Angle units: d (degrees,default)  r (radians)
16   Length units: mm (default)  cm  m
17  Identifiers (of locs and objects) start with lc letter, then
18  alphanums and underscores
19
20 Commands
21
22  abs P X Y A
23   Defines loc P given coordinates (distances) and absolute bearing
24
25  rel F T [L R A]
26   Defines loc T: start at loc F, go forward L, translate right R,
27   turn left A (defaults are all 0).
28
29  extend F T len L [R]        length L
30  extend F T upto U [R]       s.t. perpendicular at T passes through U
31  extend F T ang A R          subtending directionally A
32  extend F T uptoang A R      s.t. direction at T is A
33  extend F T parallel U R     s.t. direction at T is same as at U
34   Draws an arc or line from loc F, defining the other end as loc T.
35   If length R specified, draws an arc of radius R; R +ve curves to the
36   right; R -ve to the left.
37
38  join F T R [S ...]
39   Joins one existing loc, F, to another, T.  F's direction points to
40   the new track; T's away - ie the added track leaves F in F's
41   direction and arrives at T in T's direction.  R is the minimum curve
42   radius allowed.  S selects from the available solutions, and may be
43   any of the following
44      long                  prefer longer length solution
45      short                 prefer shorter length solution
46      right|left            prefer mostly bending to the left resp. right
47      beginright|beginleft  prefer first bend to the right
48      endright|endleft      prefer final bend to the right
49      [!]twoarcs            prefer [not] two circular arcs of equal radius
50      [!]arcline            prefer [not] one line and an arc of max radius
51      [!]arcsline           prefer [not] line between two arcs of min radius
52   if this doesn't resolve, will pick the shortest.
53
54  defobj O
55  [commands]
56  enddef
57   Defines the object O.  Inside the definition, the commands do not
58   draw when the object is being defined.  The object has its own
59   coordinate space and its own location namespace.
60
61  obj[flip] O A F [P]
62   Places an instance of object O.  The loc defined inside O as F
63   (`formal parameter', F must be just <identifier>) is placed at
64   existing loc A (`actual parameter').  If prefix P (syntax is that of
65   an identifier) is specified, each other loc L inside O is exported
66   into the global namespace as a new loc PL.  P may be `=' to indicate
67   an empty prefix (default is not to export locs).  If `flip' is used
68   then the object is placed with object-space y coordinates negated
69   (ie, it is mirrored so that the object's North exchanges with
70   South).
71
72 Command-line options
73
74  -D       turn on debug (level 1)  } currently only debug levels are
75  -Dnnn    set debug level to nnn   }  0 (none) and 1 (some)
76
77  -e[ARSCcLlMNOm]...
78           Turn on and off drawing of elements in groups.
79           These are abbreviations for various -E... options.
80             track                                                 -E....
81               A  full track                                         ARSc
82               R  rails only                                         aRsc
83               S  rails and sleepers only                            aRSc
84               C  centrelines only                                   arsC
85               c  swept area and ticks only                          Arsc
86             labels at locs
87               L  label top-level locs (turns on bars for them too)  LM
88               l  do not label any locs                              l
89             bars at locs (thick lines perp to track dir'n)
90               M  bars for top-level locs only                       Mno
91               N  bars for top-level locs and those in obj's         MNo
92               O  bars for everything, including those inside parts  MNO
93               m  no bars (turns off labelling too)                  mnol
94              
95  -E[ARSCLMNOarsclmno]...
96           enable (capitals) or disable (lowercase) drawing of
97           individual elements
98               A  draw track swept area, with ticks
99               R  draw track rails
100               S  draw track sleepers
101               C  draw track centrelines
102               L  label locs
103               M  mark locs with a bar
104               N  mark locs with a bar in objs
105               O  mark locs with a bar in parts