From: Ian Jackson Date: Fri, 1 Mar 2019 23:32:49 +0000 (+0000) Subject: layout-test X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=431633a5b0d3bd8f47782d0182f063504df7c349;p=pandemic-rising-tide.git layout-test --- diff --git a/.gitignore b/.gitignore index 6c8bb5f..70b6e50 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ faces.plag .opt.plag.sums *.tmp test.ps +layout-test.ps diff --git a/Makefile b/Makefile index da99ce3..e8f3a45 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ PLANAR_GRAPH=planar-graph default: all -all: test.ps +all: test.ps layout-test.ps map.plag: generate-plag input-graph Parse.pm ./$< input-graph $o @@ -28,7 +28,10 @@ faces.plag: opt.plag $(PLANAR_GRAPH) Makefile $(PLANAR_GRAPH) RF $< W-FACES $@.tmp && $i test.ps: generate-board faces.plag input-graph misc-data.pl - ./$(filter-out misc-data.pl,$^) $o + ./generate-board -XS faces.plag input-graph $o + +layout-test.ps: test.ps Makefile + ./generate-board -XW faces.plag input-graph $o #map.ps: map.dot # neato -Tps $^ $o diff --git a/generate-board b/generate-board index 6554c2b..bd680f0 100755 --- a/generate-board +++ b/generate-board @@ -16,6 +16,7 @@ BEGIN { unshift @INC, qw(.); } use Parse; +our $xopts; our $facesf; our %vxname2pos; # $vxname2pos{VXNAME} = Math::GSL::Vector @@ -295,13 +296,15 @@ sub pscolour ($;$) { sub preamble() { o("%!\n"); - o(" 0.52 dup scale\n"); # xxx bodge, want boundingbox or something + o(" 0.52 dup scale\n") if $xopts =~ m/S/; + # xxx bodge, want boundingbox or something } sub facepscolour ($) { my ($colourname) = @_; - pscolour($c{Colours}{$colourname}, - sub { $_ = 1.0 - 0.75 * (1.0 - $_) foreach @_ }); + $xopts =~ m/W/ ? '1 setgray' + : pscolour($c{Colours}{$colourname}, + sub { $_ = 1.0 - 0.75 * (1.0 - $_) foreach @_ }); } sub fill_faces() { @@ -398,8 +401,14 @@ END } } +sub postamble () { + o("showpage\n"); +} + #----- main program ----- +$xopts = shift @ARGV if $ARGV[0] =~ s/^-X//; + ($facesf, @ARGV) = @ARGV or die; parse_input_graph(); prep_region_rmap(); @@ -412,6 +421,7 @@ preamble(); fill_faces(); edge_faces(); label_faces(); +postamble(); print STDERR Dumper(\%region) if $ENV{'GENERATE_BOARD_DUP'};