$mid = ($lims[1] - $lims[0]) * 0.5;
}
-sub adjust_nz() {
- my $poly = $region{NZ}{Polygon};
+sub adjust_sea() {
+ # Adjusts the top and bottom edges of the sea
+ my $poly = $region{$c{Sea}}{Polygon};
my %occurs;
foreach my $v (@$poly) {
$occurs{$v->{VxName}}++
}
foreach my $v (@$poly) {
- $v->{NZ_Occurs} = $occurs{$v->{VxName}};
+ $v->{SeaOccurs} = $occurs{$v->{VxName}};
}
- #print STDERR " nz ".(scalar @$poly)."\n";
+ #print STDERR " sea ".(scalar @$poly)."\n";
my $occurs_m = sub {
my ($ei) = @_;
- $poly->[($ei+@$poly) % @$poly]{NZ_Occurs} > 1
+ $poly->[($ei+@$poly) % @$poly]{SeaOccurs} > 1
};
for my $ei (0..$#$poly) {
next if $occurs_m->($ei);
next unless $occurs_m->($ei-1);
next unless $occurs_m->($ei+1);
- #print STDERR " nz would adjust $poly->[$ei]{VxName}\n";
+ #print STDERR " sea would adjust $poly->[$ei]{VxName}\n";
# adjust coord outwards
}
for my $ei (0..$#$poly) {
next unless $occurs_m->($ei);
- #print STDERR " nz occurs_m $ei $poly->[$ei]{VxName}\n";
+ #print STDERR " sea occurs_m $ei $poly->[$ei]{VxName}\n";
next unless $occurs_m->($ei-1);
my $dleft = mkvec(-1000,0);
foreach my $which (0,-1) {
my $posj = \ $poly->[$ej]{Pos};
my $posk = \ $poly->[$ek]{Pos};
my $dout = $$posk - $$posj;
- #print STDERR " nz adj j=$ej ",prvec($$posj)," $poly->[$ej]{VxName}\n";
- #print STDERR " nz adj k=$ek ",prvec($$posk)," $poly->[$ek]{VxName}\n";
+ #print STDERR " sea adj j=$ej ",prvec($$posj)," $poly->[$ej]{VxName}\n";
+ #print STDERR " sea adj k=$ek ",prvec($$posk)," $poly->[$ek]{VxName}\n";
if ($poly->[$ej]{VxName} =~ /Noorderzijlvest/) {
- #print STDERR " nz adj extra\n";
+ #print STDERR " sea adj extra\n";
$$posk = $$posj + 10 * mkvec(100,-50);
}
$$posj = $$posj + $dleft + $dout*10;
read_faces();
calculate_centres();
transform_coordinates();
-adjust_nz();
+adjust_sea();
computeboundings();
preamble();