Defines loc T: start at loc F, go forward L, translate right R,
turn left A (defaults are all 0).
- segment [K*] [S0 D0 ...] Sn
+ segment [K*] [[-]S0 D0 ...] [-]Sn
Specifies that arcs and lines in layer kind K are part of subsegment
- Sn.
+ Sn. `-' preceding the segment indicates that the Q rail is on the
+ left as the line is drawn; without `-' the T rail is on the left.
If additional Di and Si are provided then each Si apart from the
last is followed by a distance Di saying how much track it applies
our $psu_sleeperlw= 15;
our $psu_raillw= 1.0;
our $psu_thinlw= 1.0;
-our $psu_subseglw= 2.0;
+our $psu_subseglw= 10.0;
our $lmu_marklw= 4;
our $lmu_marktpt= 11;
# # = $drawchrs_we_should_use_due_to_obj_etc
# $ctx->{SegName} # initial segment name (at start of object or file)
# # or nonexistent if in object in unknown segment
+# # may have leading `-'
# $ctx->{SavedSegment} # exists iff segment command used, is a $csss
# $ctx->{Layer}{Level}
# $ctx->{Layer}{Kind}
# $eopts[]{DrawMods} # modifier chars for drawing
#
# @segments= ( $csss0, $dist0, $csss1, $dist1, ..., $csssn )
+# # here each csss may have preceding `-'
#
# $subsegcmap{$csss} = "$green $blue"
# # $csss is canonical subseg spec; always has '/'
sub cva_subsegspec ($) {
my ($sp)=@_;
die "invalid subsegment spec" unless
- $sp =~ m,^([0-9A-Za-z_]*)(?:/(?:([A-Za-z_]+)(\d+))?)?$,;
- my ($segname,$movfeat,$movconf)=($1,$2,$3);
+ $sp =~ m,^(\-?)([0-9A-Za-z_]*)(?:/(?:([A-Za-z_]+)(\d+))?)?$,;
+ my ($sign,$segname,$movfeat,$movconf)=($1,$2,$3,$4);
$segname= exists $ctx->{SegName} ?
- $ctx->{SegName}.$segname
+ $sign.$ctx->{SegName}.$segname
: '';
+ $segname =~ s/^\-(.*)\-/$1/;
return $segname.'/'.
(defined $movfeat ? sprintf "%s%d", $movfeat, $movconf : '');
}
print DEBUG "ps $p0 $p1 $lenperp ($ppu)\n";
$draw= current_draw();
if ($draw =~ m/G/) {
- my ($pt,$going,$red);
+ my ($pt,$going,$red,$csegbare);
$going=0;
+ o("% segments @segments\n");
o(" $psu_subseglw setlinewidth\n");
$param=$p0;
$pt= &$calcfn;
for (;;) {
+ $csegbare= $segments[0];
+ $csegbare =~ s/^\-//;
if ($subsegcmapreq) {
- if (!exists $subsegcmap{$segments[0]}) {
- print "$segments[0]\n" or die $!;
- $subsegcmap{$segments[0]}++;
+ if (!exists $subsegcmap{$csegbare}) {
+ print "$csegbare\n" or die $!;
+ $subsegcmap{$csegbare}++;
}
- } elsif (exists $subsegcmap{$segments[0]}) {
+ } elsif (exists $subsegcmap{$csegbare}) {
$red= $pt->{A} / (2*$pi);
$red *= 64;
+ $red += 128;
+ $red += 32 if $segments[0] =~ m/^\-/;
$red %= 64;
$red /= 64.0;
$red= sprintf("%f", $red);
- o(" $red $subsegcmap{$segments[0]} setrgbcolor\n");
+ o(" $red $subsegcmap{$csegbare} setrgbcolor\n");
} else {
- die "unknown subsegment colour for $segments[0]\n";
+ die "unknown subsegment colour for $csegbare\n";
}
o_path_begin();
parametric__o_pt($pt);
} else {
$ctx->{InRunObj}= $ctx_save->{InRunObj}."${obj_id}::";
}
- $ctx->{SegName}= $1 if $segments[0] =~ m,^(.+)/,;
+ $ctx->{SegName}= $1 if $segments[0] =~ m,([^-]+)/,;
$ctx->{DrawMap}= sub {
my ($i) = @_;
$i= &{ $ctx_save->{DrawMap} }($i);