sub prs2r ($) {
# bodgery for the sea and land
- return 'NZ' if m/ \| / && !grep { !m{^(?:NZ|L2?)$} } split / \| /, $_[0];
+ return $c{Sea} if m/ \| / && !grep { !m{^$c{OuterfaceRe}$} } split / \| /, $_[0];
$prs2region{$_[0]} // confess "@_ ?"
}
sub prs2rr ($) { $region{prs2r($_[0])} }
my @edges;
my $process_rr = sub {
my $last_ai;
- if ($rr->{Name} eq 'NZ') {
- # We combined L and NZ; now we must split them again
- # in fact, we just throw away L and L2 entirely.
- # Here, when processing NZ, we keep only vertices that
- # are part of NZ.
+ if ($rr->{Name} eq $c{Sea}) {
+ # We combined land and sea; now we must split them again
+ # in fact, we just throw away all L entirely.
+ # Here, when processing sea, we keep only vertices that
+ # are part of the sea.
@edges = grep {
my $evxname = $_->{VxName};
my @eregions = split / \| ?/, $evxname;
- grep { $_ eq 'NZ' } @eregions
+ grep { $_ eq $c{Sea} } @eregions
} @edges;
}
$rr->{Polygon} = [ @edges ];
- if ($rr->{Name} ne 'NZ') {
+ if ($rr->{Name} ne $c{Sea}) {
for my $ei (0..$#edges) {
if (!defined $last_ai) {
my $ai;
}
$process_rr->();
- $region{$_}{Special} = 1 foreach qw(NZ L L2);
+ $region{$_}{Special} = 1 foreach @{ $c{SpecialRegions} };
}
#----- geometry mangling -----
}
}
-sub afsluitdijk() {
- my ($adj) = grep { $_->{Name} eq 'NZ' } @{ $region{'ZZ'}{Adj} };
+sub afsluitdijk ($$) {
+ my ($inner, $comment) = @_;
+ my ($adj) = grep { $_->{Name} eq $c{Sea} } @{ $region{$inner}{Adj} };
my $dash = 20;
my (@pos) = adj_ends($adj);
my $mid = 0.5 * ($pos[0] + $pos[1]);
my $r = 0.5 * ($pos[1] - $pos[0])->norm();
- o(sprintf <<'END', facepscolour('sea'), psvec($mid), $r);
- %% Afsluitdijk
+ o(sprintf <<'END', $comment, facepscolour('sea'), psvec($mid), $r);
+ %% %s
%s %s %s 0 360 arc closepath fill
END
some_edge_faces(()); # just sets the colour
one_hs('purple', $mid);
}
+sub afsluitdijken() {
+ afsluitdijk($_->{Region}, $_->{Comment}) foreach @{ $c{DashedHsInners} };
+}
+
sub edge_faces() {
- some_edge_faces($region{'NZ'});
- afsluitdijk();
+ some_edge_faces($region{$c{Sea}});
+ afsluitdijken();
some_edge_faces(grep {
$_->{Name} !~ m{^(?:L2?|NZ|ZZ)$}
} values %region);
next if $rr->{Name} =~ m/^L\d?$/;
my $words = $rr->{DisplayName};
my $pos;
- if ($rr->{Name} eq 'NZ') {
+ if ($rr->{Name} eq $c{Sea}) {
$pos = mkvec(90, 1280);
} else {
$pos = $rr->{Centre} + mkvec( 0, 0.5 * $sz * @$words );
$pos += $sz * &mkvec(@$adjust);
}
my $w = $rr->{Water};
- $w = 2 if $rr->{Special} || $rr->{Name} eq 'ZZ';
+ $w = 2 if $rr->{Name} eq $c{Sea};
if ($w) {
#print STDERR " water $w in $rr->{Name}\n";
my $down = water_cubes_sz(2) - water_cubes_sz(1) + $cube_gap;
$pos -= mkvec(0, -0.5 * $down);
my $cube_y = -($sz * @$words);
- if ($rr->{Name} eq 'Wieringermeer') {
+ if (grep { $_ eq $rr->{Name} } @{ $c{CubeAbove} }) {
$pos -= mkvec(0,+$sz);
$cube_y = 0;
$down = 0;