Compare commits

..

2 Commits

  1. 2
      HexGrid/Tile.pm
  2. 11
      wiki-map.pl

@ -20,6 +20,7 @@ has colour => (is => 'rw', alias => 'color');
has opacity => (is => 'rw');
has images => (is => 'rw', alias => [qw(image background backgrounds)]);
has show_coords => (is => 'rw');
has coords_colour => (is => 'rw', default => 'white');
has css_class => (is => 'rw');
has id_suffix => (is => 'rw', default => '_tile');
@ -128,6 +129,7 @@ sub render($this, $container, $width, $height, $laters = undef)
{
my $text = $g->text(x => "@{[0.1 * $width]}", y => "@{[0.6 * $height]}", class => 'coords');
$text->{'font-size'} = '3em';
$text->{fill} = $this->{coords_colour};
$text->cdata("$this->{nw},$this->{sw}");
}
if(defined $this->{css_class}) { $g->{class} = $this->{css_class} }

@ -28,6 +28,7 @@ my $path_template_name = "MapPath";
my $border_width = 1;
my $border_colour = 'black';
my $default_path_stroke_width = 5;
my $show_coords = 0;
my $embed_images = 1;
@ -89,6 +90,8 @@ foreach my $page (values %{$region_query_results->{query}{pages}})
next unless $parsed_template;
say STDERR "Processing region: $page->{title}";
$region->{defaults}{colour} = $parsed_template->{named_params}{colour};
$region->{defaults}{coords_colour} = $parsed_template->{named_params}{coordinates_colour}
if $parsed_template->{named_params}{coordinates_colour};
if($regiondir)
{
$regions_by_subregion{$region->{name}} = $region->{name};
@ -120,6 +123,8 @@ foreach my $page (values %{$subregion_query_results->{query}{pages}})
say STDERR "Processing subregion: $page->{title}";
my $subregion = $grid->make_region($page->{title});
$subregion->{defaults}{colour} = $parsed_template->{named_params}{colour};
$subregion->{defaults}{coords_colour} = $parsed_template->{named_params}{coordinates_colour}
if $parsed_template->{named_params}{coordinates_colour};
if($regiondir)
{
my $region_name = $parsed_template->{positional_params}[0];
@ -155,6 +160,8 @@ foreach my $page (values %{$location_query_results->{query}{pages}})
my $location = $grid->make_region($page->{title});
$location->{defaults}{colour} = $parsed_template->{named_params}{colour};
$location->{defaults}{coords_colour} = $parsed_template->{named_params}{coordinates_colour}
if $parsed_template->{named_params}{coordinates_colour};
push @{$background_pages{"File:$parsed_template->{named_params}{background}"}}, $location;
my $region_name = $parsed_template->{positional_params}[1];
$regions_by_subregion{$location->{name}} = $region_name;
@ -358,8 +365,8 @@ foreach my $page (values %{$path_tile_query_results->{query}{pages}})
do { carp "Skipping bad spec: $coords"; next; } unless $coords =~ $coords_regex;
push @path_coords, [$1,$2];
}
$grid->make_path_from($path_spec{id}, \@path_coords, css_class => 'path',
colour => $path_spec{colour}, style => { 'stroke-width' => $path_spec{stroke_width} });
$grid->make_path_from($path_spec{id}, \@path_coords, css_class => 'path', colour => $path_spec{colour},
style => { 'stroke-width' => $path_spec{stroke_width} // $default_path_stroke_width });
}

Loading…
Cancel
Save