|
|
@ -24,7 +24,6 @@ my $region_template_name = "MapRegion"; |
|
|
|
my $subregion_template_name = "MapSubregion"; |
|
|
|
my $subregion_template_name = "MapSubregion"; |
|
|
|
my $location_template_name = "MapLocation"; |
|
|
|
my $location_template_name = "MapLocation"; |
|
|
|
my $site_template_name = "MapSite"; |
|
|
|
my $site_template_name = "MapSite"; |
|
|
|
my $path_template_name = "MapPath"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $border_width = 1; |
|
|
|
my $border_width = 1; |
|
|
|
my $border_colour = 'black'; |
|
|
|
my $border_colour = 'black'; |
|
|
@ -300,67 +299,6 @@ foreach my $site_page_ref (values %{$site_query_results->{query}{pages}}) |
|
|
|
$grid->get_tile_at($nw, $sw)->pin($pin); |
|
|
|
$grid->get_tile_at($nw, $sw)->pin($pin); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my (%path_specs); |
|
|
|
|
|
|
|
say STDERR "Getting Path pages"; |
|
|
|
|
|
|
|
my $path_query_results = $mw->api |
|
|
|
|
|
|
|
( { |
|
|
|
|
|
|
|
action => 'query', |
|
|
|
|
|
|
|
generator => 'categorymembers', |
|
|
|
|
|
|
|
prop => 'info|revisions', |
|
|
|
|
|
|
|
gcmtitle => 'Category:Paths', |
|
|
|
|
|
|
|
gcmlimit => 'max', |
|
|
|
|
|
|
|
rvprop => 'content', |
|
|
|
|
|
|
|
inprop => 'url', |
|
|
|
|
|
|
|
} ) || croak $mw->{error}->{code} . ': ' . $mw->{error}->{details}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $path_page_ref (values %{$path_query_results->{query}{pages}}) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
next if $path_page_ref->{title} =~ /^Category:/; |
|
|
|
|
|
|
|
my $path_name = $path_page_ref->{title}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
say STDERR "Processing Path $path_name"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $path_url = $path_page_ref->{canonicalurl}; |
|
|
|
|
|
|
|
my $path_content = $path_page_ref->{revisions}[0]{'*'}; |
|
|
|
|
|
|
|
my $parsed_template = MWTemplate::Parse($path_content, $path_template_name); |
|
|
|
|
|
|
|
next unless $parsed_template; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$path_specs{$path_name} = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id => "$path_name-path", |
|
|
|
|
|
|
|
tile_page => "$path_name/Tiles", |
|
|
|
|
|
|
|
colour => $parsed_template->{named_params}{colour}, |
|
|
|
|
|
|
|
stroke_width => $parsed_template->{named_params}{stroke_width} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
say STDERR "Getting Path Tile pages"; |
|
|
|
|
|
|
|
my $path_tile_query_results = $mw->api |
|
|
|
|
|
|
|
( { |
|
|
|
|
|
|
|
action => 'query', |
|
|
|
|
|
|
|
titles => join('|', map { $_->{tile_page} } values %path_specs), |
|
|
|
|
|
|
|
prop => 'revisions', |
|
|
|
|
|
|
|
rvprop => 'content', |
|
|
|
|
|
|
|
} ) || croak $mw->{error}->{code} . ': ' . $mw->{error}->{details}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $page (values %{$path_tile_query_results->{query}{pages}}) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
my $content = $page->{revisions}[0]{'*'}; |
|
|
|
|
|
|
|
my ($path_name) = $page->{title} =~ /(.*)\/Tiles/; |
|
|
|
|
|
|
|
say STDERR "Processing tiles for: $path_name"; |
|
|
|
|
|
|
|
my %path_spec = %{$path_specs{$path_name}}; |
|
|
|
|
|
|
|
my @path_coords; |
|
|
|
|
|
|
|
foreach my $coords (split /;/, $content) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
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} }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
open (my $fh, "> $outfile") or croak "Couldn't open $outfile for writing: $!"; |
|
|
|
open (my $fh, "> $outfile") or croak "Couldn't open $outfile for writing: $!"; |
|
|
|