I wrote a while ago asking about sector mapping utilities that could
generate postscript output from datafiles such as those on the archive
site. There are a number of nifty subsector mapping tools; however,
none of them quite fit the bill. I've been working on a tool, it is
based upon the mapsub.c programme written by James T. Perkins.
Basically I took his postscript header file, reworked it, and then
wrote a new C programme driver for header file. I have enclosed
the output below of my test data sector. I will post the programme
to the archive after I get it working all the way. I welcome comments
Matt
- --
Matthew Goldman E-mail: [email removed]
Fax: [phone removed] Work: [phone removed]
"Say George, I don't mean to interrupt, but
there's a glowing red dot on your forehead."
- ----- cut here ----- cut here ----- cut here ----- cut here -----
%!PS-Adobe-1.0
% Traveller subsector map and mapping functions
% Most of this was taken from James Perkin's earlier program
% for mapping subsectors.
% @(#)mapsector.pro 1.5; Matt Goldman ([email removed]) 11/16/92
%-----Constants-----
/cm { 28 mul 2.54 div } def % cm >> points
/unit { 1 cm mul } def
/topOfPageX 3 cm def
/topOfPageY 70.1 cm def
/nameFontSize 5 def
/nameWidthLimit 1.9 unit def
/nameFont /Helvetica findfont nameFontSize scalefont def
/portFont /Helvetica findfont 4 scalefont def
/numberFont /Helvetica findfont 4 scalefont def
%-----Basic Functions-----
/xboat {
/A exch def
/B exch def
/C exch def
/D exch def
gsave
.75 setgray
5 setlinewidth
newpath
B A mapCoords
getCoords moveto
D C mapCoords
getCoords lineto
stroke
grestore
} def
/hexSegV {
currentpoint translate
1 unit 0 lineto
60 rotate
currentpoint translate
1 unit 0 lineto
-60 rotate
} def
/hexLineV {
%Now move to the upper left corner of
%first hex.
gsave
newpath
curX curY moveto
120 rotate
currentpoint translate
1 unit 0 moveto
120 rotate
%Now print a segment for each
%side of the hex
40 {
hexSegV
} repeat
stroke
grestore
}def
/hexSidesV {% - >> -
gsave
2 setlinewidth
0 setgray
%go to the defined top of page
%this will be the center of the
%first hex
/curX topOfPageX def
/curY topOfPageY def
5 {
hexLineV
/curX curX 12 unit add def
} repeat
grestore
} def
/hexSegH {
1 unit 0 lineto
-60 rotate
currentpoint translate
1 unit 0 lineto
60 rotate
currentpoint translate
1 unit 0 lineto
60 rotate
currentpoint translate
1 unit 0 lineto
-60 rotate
currentpoint translate
} def
/hexLineH {
gsave
curX curY moveto
%Now move to the upper left corner of
%first hex.
120 rotate
currentpoint translate
1 unit 0 moveto
%Orient yourself so that you are facing
%along the hex row
-120 rotate
currentpoint translate
16 {
hexSegH
} repeat
stroke
grestore
} def
/hexSidesH {
gsave
2 setlinewidth
0 setgray
newpath
%go to the defined top of page
%this will be the center of the
%first hex
/curX topOfPageX def
/curY topOfPageY def
5 {
hexLineH
/curY curY 3 sqrt unit 10 mul sub def
} repeat
grestore
} def
/hex { % - >> -
gsave
-1 unit 0 rmoveto
currentpoint translate
60 rotate
5 {
1 unit 0 lineto
currentpoint translate
-60 rotate
} repeat
closepath
stroke
grestore
} def
/rowOfHex { % x y >> -
moveto
40 {
hex
0 0 3 sqrt unit sub rmoveto
} repeat
} def
/hexMap { % - >> -
gsave
.3 setlinewidth
0 setgray
/curX topOfPageX def
/curY topOfPageY def
16 {
curX curY rowOfHex
/curX curX 1.5 unit add def
/curY curY 3 sqrt 2 div unit sub def
curX curY rowOfHex
/curX curX 1.5 unit add def
/curY curY 3 sqrt 2 div unit add def
} repeat
grestore
} def
/hexGrid {
hexMap
hexSidesV
hexSidesH
} def
/mapCoords { % HexX HexY >> -
/actY exch 1 sub 40 mod 3 sqrt unit mul topOfPageY exch sub def
dup 2 mod 0 eq {
/actY actY 3 sqrt 2 div unit sub def % displace column if HexX is even
} if
/actX exch 1 sub 32 mod 1.5 unit mul topOfPageX add def
} def
/getCoords { % - >> x y
actX actY
} def
/liqPlnt {
gsave%%%%
newpath
gsave
1 setgray%%%%%
getCoords .65 unit 0 360 arc fill
grestore
0 setgray
getCoords .15 unit 0 360 arc fill
grestore%%%%
} def
/desPlnt {
gsave
newpath
gsave
1 setgray%%%%%
getCoords .65 unit 0 360 arc fill
grestore
0 setgray
getCoords .15 unit 0 360 arc
gsave
1 setgray fill
grestore
.5 setlinewidth stroke
grestore
} def
/asteroids {
gsave%%%%
newpath
gsave
1 setgray%%%%%
getCoords .65 unit 0 360 arc fill
grestore
0 setgray
getCoords .1 unit add .04 unit 0 360 arc fill
getCoords exch .15 unit add exch .02 unit 0 360 arc fill
getCoords .15 unit sub exch .1 unit add exch .03 unit 0 360 arc fill
getCoords .04 unit sub exch .15 unit sub exch .05 unit 0 360 arc fill
getCoords .05 unit sub .02 unit 0 360 arc fill
grestore%%%%
} def
/name { % name >> -
getCoords moveto
nameFont setfont
gsave
0 -.65 unit rmoveto
dup stringwidth pop
dup dup nameWidthLimit gt
{nameWidthLimit exch div 1 scale}
{pop}
ifelse
neg 2 div 0 rmoveto
gsave
0 nameFontSize -6 div rmoveto
dup stringwidth pop 0 rlineto
0 nameFontSize rlineto
dup stringwidth pop neg 0 rlineto
closepath
1 setgray fill
grestore
show
grestore
} def
/starPort { % code >> -
getCoords moveto
portFont setfont
dup stringwidth pop 2 div 0 exch sub
.2 unit rmoveto
show
} def
/navalBase { % - >> -
gsave
getCoords moveto
-.5 unit .3 unit rmoveto
currentpoint translate
4 {
.2 unit 0 lineto
currentpoint translate
-144 rotate
} repeat
closepath
fill
grestore
} def
/scoutBase {
gsave
newpath
getCoords moveto
-.5 unit -.125 unit rmoveto
currentpoint translate
60 rotate
.15 unit 0 lineto
currentpoint translate
-120 rotate
.15 unit 0 lineto
closepath
fill
grestore
} def
/gasGiant {
gsave
newpath
getCoords moveto
.4 unit .3 unit rmoveto
currentpoint translate
gsave
1 setgray
0 0 .1 unit 0 360 arc fill
grestore
0 0 .05 unit 0 360 arc fill
grestore
} def
/redZone {
gsave
newpath
.8 setlinewidth
0 setgray
getCoords 2 3 div unit 130 220 arc stroke
getCoords 2 3 div unit -40 50 arc stroke
0 setgray
grestore
} def
/amberZone {
gsave
newpath
.2 setlinewidth
0 setgray
getCoords 2 3 div unit 130 220 arc stroke
getCoords 2 3 div unit -40 50 arc stroke
0 setgray
grestore
} def
/hexNumber { % (XX YY) >> -
getCoords moveto
numberFont setfont
dup stringwidth pop 2 div 0 exch sub
.5 unit rmoveto
show
} def
/SectorTitle {
gsave
0 setgray
/Times-Roman findfont
32 scalefont
setfont
590 36 moveto
90 rotate
currentpoint translate
show
grestore
} def
/subsectorbox {% xmin ymin xmax ymax
gsave
.9 setgray
5 setlinewidth
/ymin exch def
/xmin exch def
/ymax exch def
/xmax exch def
newpath
xmin ymin mapCoords
getCoords moveto
xmin ymax mapCoords
getCoords lineto
xmax ymax mapCoords
getCoords lineto
xmax ymin mapCoords
getCoords lineto
xmin ymin mapCoords
getCoords lineto
closepath
stroke
grestore
} def
%-----Main-----
% Other system specs (start with zones)
(Test Sector) SectorTitle
1 1 1 2 xboat
1 2 1 3 xboat
1 3 1 4 xboat
1 3 3 4 xboat
3 4 5 3 xboat
9 6 20 14 xboat
20 14 29 26 xboat
hexGrid
1 1 mapCoords
desPlnt
(0101) hexNumber
(Zeycude) name
(C) starPort
gasGiant
1 2 mapCoords
desPlnt
(0102) hexNumber
(Reno) name
(C) starPort
gasGiant
1 3 mapCoords
liqPlnt
(0103) hexNumber
(ERRERE) name
(B) starPort
navalBase
1 4 mapCoords
liqPlnt
(0104) hexNumber
(Cantrel) name
(C) starPort
1 8 mapCoords
liqPlnt
(0108) hexNumber
(Gyomar) name
(D) starPort
gasGiant
2 2 mapCoords
liqPlnt
(0202) hexNumber
(Thengo) name
(C) starPort
gasGiant
3 1 mapCoords
liqPlnt
(0301) hexNumber
(Rio) name
(C) starPort
gasGiant
3 4 mapCoords
liqPlnt
(0304) hexNumber
(Cantrel) name
(C) starPort
5 2 mapCoords
desPlnt
(0502) hexNumber
(Reno) name
(C) starPort
gasGiant
5 3 mapCoords
liqPlnt
(0503) hexNumber
(Errere) name
(B) starPort
navalBase
6 1 mapCoords
desPlnt
(0601) hexNumber
(Zeycude) name
(C) starPort
gasGiant
8 5 mapCoords
liqPlnt
redZone
(0805) hexNumber
(Narval) name
(D) starPort
scoutBase
gasGiant
8 8 mapCoords
liqPlnt
amberZone
(0808) hexNumber
() name
(B) starPort
navalBase
gasGiant
8 10 mapCoords
asteroids
(0810) hexNumber
(Frond) name
(E) starPort
showpage
%---- cut here ----- cut here ----- cut here ----- cut here -----