App-traveller
view release on metacpan or search on metacpan
lib/Traveller/Mapper.pm view on Meta::CPAN
Rience 0205 C687267-8 G Ga Lo
Rearreso 0208 C655432-5 C G Ga Lt Ni
Laisbe 0210 E354663-3 Ag Lt Ni
Biveer 0302 C646576-9 C G Ag Ga Ni
Labeveri 0303 A796100-9 CT N G Ga Lo A
Sotexe 0408 E544778-3 G Ag Ga Lt A
Zamala 0409 A544658-13 T N G Ag Ga Ht Ni
Sogeeran 0502 A200443-14 CT N G Ht Ni Va
Aanbi 0503 E697102-7 G Ga Lo A
Bemaat 0504 C643384-9 C R G Lo Po
Diare 0505 A254430-11 TRN G Ni A
Esgeed 0507 A8B1579-11 RN G Fl Ni A
Leonbi 0510 B365789-9 T SG Ag Ri A
Reisbeon 0604 C561526-8 R G Ni
Atcevein 0605 A231313-11 CT G Lo Po
Usmabe 0607 A540A84-15 T G De Hi Ht In Po
Onbebior 0608 B220530-10 G De Ni Po A
Raraxema 0609 B421768-8 T NSG Na Po
Xeerri 0610 C210862-9 G Na
Onreon 0702 D8838A9-2 S Lt Ri A
Ismave 0703 E272654-4 Lt Ni
Lara 0704 C0008D9-5 SG As Lt Na Va A
Lalala 0705 C140473-9 R G De Ni Po
Maxereis 0707 A55A747-12 CT NSG Ht Wa
Requbire 0802 C9B4200-10 G Fl Lo A
Azaxe 0804 B6746B9-8 C G Ag Ga Ni A
Rieddige 0805 B355578-7 G Ag Ni A
Usorce 0806 E736110-3 G Lo Lt A
Solacexe 0810 D342635-4 P S Lt Ni Po R
!;
sub example {
return $example;
}
# The empty hex is centered around 0,0 and has a side length of 1,
# a maximum diameter of 2, and a minimum diameter of â3.
my @hex = ( -1, 0,
-0.5, sqrt(3)/2,
0.5, sqrt(3)/2,
1, 0,
0.5, -sqrt(3)/2,
-0.5, -sqrt(3)/2);
sub header {
my ($self, $width, $height) = @_;
# TO DO: support an option for North American âAâ paper dimensions (width 215.9 mm, length 279.4 mm)
$width //= 210;
$height //= 297;
my $template = <<EOT;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="${width}mm"
height="${height}mm"
viewBox="%s %s %s %s">
<desc>Traveller Subsector</desc>
<defs>
<style type="text/css"><![CDATA[
text {
font-size: 16pt;
font-family: Optima, "Optima Regular", Optima-Regular, Helvetica, sans-serif;
text-anchor: middle;
}
text a {
fill: blue;
text-decoration: underline;
}
.coordinates {
fill-opacity: 0.5;
}
.starport, .base {
font-size: 20pt;
}
.direction {
font-size: 24pt;
}
.legend {
text-anchor: start;
font-size: 14pt;
}
tspan.comm {
fill: #ff6347; /* tomato */
}
line.comm {
stroke-width: 10pt;
stroke: #ff6347; /* tomato */
}
tspan.trade {
fill: #afeeee; /* pale turquoise */
}
line.trade {
stroke-width: 6pt;
stroke: #afeeee; /* pale turquoise */
fill: none;
}
.travelzone {
opacity: 0.3;
}
.amber {
fill: none;
stroke-width: 1pt;
stroke: black;
}
.red {
fill: red;
}
#hex {
stroke-width: 3pt;
fill: none;
stroke: black;
}
#background {
fill: inherit;
}
#bg {
fill: inherit;
}
]]></style>
<polygon id="hex" points="%s,%s %s,%s %s,%s %s,%s %s,%s %s,%s" />
<polygon id="bg" points="%s,%s %s,%s %s,%s %s,%s %s,%s %s,%s" />
</defs>
<rect fill="white" stroke="black" stroke-width="10" id="frame"
x="%s" y="%s" width="%s" height="%s" />
EOT
my $scale = 100;
return sprintf($template,
map { sprintf("%.3f", $_ * $scale) }
# viewport
-0.5, -0.5, 3 + ($self->width - 1) * 1.5, ($self->height + 1.5) * sqrt(3),
# empty hex, once for the backgrounds and once for the stroke
@hex,
@hex,
# framing rectangle
-0.5, -0.5, 3 + ($self->width - 1) * 1.5, ($self->height + 1.5) * sqrt(3));
}
sub colour {
my $self = shift;
( run in 1.260 second using v1.01-cache-2.11-cpan-5735350b133 )