Basemap.ps
Jump to navigation
Jump to search
% xm half the length of one side, or 1/3 a column. ym is half a hex height
/ym { 9 mul } def
/xm { 6 mul } def
/cshow {
/txt exch def
txt stringwidth -0.5 mul exch -0.5 mul exch rmoveto
txt show
} def
% place self at left edge of hex
/world {
/y exch def
/x exch def
/added exch def
/uwp exch def
/name exch def
40 y sub 2 mul x 2 mod add 2 add ym /y exch def
x 3 mul 1 add xm /x exch def
x y 4 add moveto
uwp cshow
x y 1 sub moveto
name cshow
x y 6 sub moveto
added cshow
stroke
} def
/circhex {
/y exch def
/x exch def
40 y sub 2 mul x 2 mod add 2 add ym /y exch def
x 3 mul 1 add xm /x exch def
x y moveto
2 setlinewidth
newpath
x y 1 xm 0 360 arc
stroke
} def
/amber {
gsave
0.7 0.7 0 setrgbcolor
circhex
grestore
} def
/redzone {
gsave
1 0 0 setrgbcolor
circhex
grestore
} def
/hexl {
/blue exch def
/green exch def
/red exch def
/y1 exch def
/x1 exch def
/y2 exch def
/x2 exch def
40 y1 sub 2 mul x1 2 mod add 2 add ym /y1 exch def
40 y2 sub 2 mul x2 2 mod add 2 add ym /y2 exch def
gsave
red green blue setrgbcolor
1 setlinewidth
1 setlinecap
x1 3 mul 1 add xm /x1 exch def
x2 3 mul 1 add xm /x2 exch def
x1 y1 moveto
x2 y2 lineto
stroke
1 setlinewidth
0 setlinecap
grestore
} def
% draw 3 border hexes.
/border {
/y exch def
/x exch def
% put ourselves at upper left corner
40 y sub 2 mul x 2 mod add 2 add ym /y exch def
x 3 mul 1 sub xm /x exch def
newpath
x y moveto
gsave 0.5 setgray 2 setlinewidth
1 eq { 1 xm 1 ym rlineto } { 1 xm 1 ym rmoveto } ifelse
1 eq { 2 xm 0 rlineto } { 2 xm 0 rmoveto } ifelse
1 eq { 1 xm -1 ym rlineto } { 1 xm -1 ym rmoveto } ifelse
stroke
grestore
} def
/hexplus {
moveto
1 xm 2 ym rmoveto
1 xm 1 ym rlineto
2 xm 0 rlineto
1 xm -1 ym rlineto
2 xm 0 rlineto
1 xm 1 ym rlineto
0 -2 ym rmoveto
-1 xm 1 ym rlineto
-2 xm 0 rlineto
-1 xm -1 ym rlineto
-2 xm 0 rlineto
-1 xm 1 ym rlineto
stroke
} def
/drawhexes {
newpath
0.5 setlinewidth
% draw the hexes
gsave
0.8 setgray
1 ym 2 ym 80 ym {
/y exch def
1 xm 6 xm 91 xm {
/x exch def
x y hexplus
} for } for
%draw the sector border
1 setlinewidth
2.5 xm 1.5 ym moveto
2.5 xm 81.5 ym lineto
98.5 xm 81.5 ym lineto
98.5 xm 1.5 ym lineto
2.5 xm 1.5 ym lineto
stroke
%draw the subsector border
0.6 setgray
2.5 xm 21.5 ym moveto 98.5 xm 21.5 ym lineto stroke
2.5 xm 41.5 ym moveto 98.5 xm 41.5 ym lineto stroke
2.5 xm 61.5 ym moveto 98.5 xm 61.5 ym lineto stroke
26.5 xm 1.5 ym moveto 26.5 xm 81.5 ym lineto stroke
50.5 xm 1.5 ym moveto 50.5 xm 81.5 ym lineto stroke
74.5 xm 1.5 ym moveto 74.5 xm 81.5 ym lineto stroke
grestore
} def
/namesec {
/Times-Roman findfont 30 scalefont setfont
50.5 xm 82 ym moveto
cshow
} def
/abovesec {
/Times-Roman findfont 10 scalefont setfont
50.5 xm 765 moveto cshow
} def
/belowsec {
/Times-Roman findfont 10 scalefont setfont
50.5 xm 6 moveto cshow
} def
/leftsec {
/Times-Roman findfont 10 scalefont setfont
1.5 xm 41.5 ym moveto 90 rotate cshow -90 rotate
} def
/rightsec {
/Times-Roman findfont 10 scalefont setfont
99.5 xm 41.5 ym moveto -90 rotate cshow 90 rotate
} def
drawhexes
% sector data starts here