chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-test.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
routesearch: parse output in query_routesearch
[ypp-sc-tools.db-test.git]
/
yarrg
/
yppedia-chart-parser
diff --git
a/yarrg/yppedia-chart-parser
b/yarrg/yppedia-chart-parser
index 4ce6bcecd36195da8061b9ff2cf93d0e7f983f3d..41ef985e6b590801041dfbdcc2635f6d8d15e631 100755
(executable)
--- a/
yarrg/yppedia-chart-parser
+++ b/
yarrg/yppedia-chart-parser
@@
-55,7
+55,11
@@
my @msgkinds= qw(change warning error);
my %msgs;
my %msgprinted;
my %msgkindprinted;
my %msgs;
my %msgprinted;
my %msgkindprinted;
-sub pmsg ($$) { push @{ $msgs{$_[0]} }, "$_[0]: $_[1]\n"; }
+sub pmsg ($$) {
+ my $m= "$_[0]: $_[1]\n";
+ print DEBUG "D $m";
+ push @{ $msgs{$_[0]} }, $m;
+}
sub warning ($) { pmsg("warning",$_[0]); }
sub error ($) { pmsg("error", $_[0]); }
sub change ($) { pmsg("change", $_[0]); }
sub warning ($) { pmsg("warning",$_[0]); }
sub error ($) { pmsg("error", $_[0]); }
sub change ($) { pmsg("change", $_[0]); }
@@
-114,7
+118,7
@@
sub yppedia_chart_parse () {
s/\<--.*--\>//g;
s/^\s*//; chomp; s/\s+$//; s/\s+/ /g;
s/\<\/?(?:b|em)\>//g;
s/\<--.*--\>//g;
s/^\s*//; chomp; s/\s+$//; s/\s+/ /g;
s/\<\/?(?:b|em)\>//g;
- s/\{\{
Chart\ style\|[^{}]*\}\}//g
;
+ s/\{\{
chart\ style\|[^{}]*\}\}//gi
;
next unless m/\{\{/; # only interested in chart template stuff
my ($x,$y, $arch,$island,$solid,$dirn);
next unless m/\{\{/; # only interested in chart template stuff
my ($x,$y, $arch,$island,$solid,$dirn);
@@
-122,9
+126,15
@@
sub yppedia_chart_parse () {
if (($x,$y,$arch) =
m/^\{\{ chart\ label \|(\d+)\|(\d+)\| .*
if (($x,$y,$arch) =
m/^\{\{ chart\ label \|(\d+)\|(\d+)\| .*
- \'\[\[ [^][\']* \| (\S+)\ archipelago \]\]\'*\}\}$/xi) {
+ (?: \<(?: big|center )\>)* \'+
+ (?: \[\[ | \{\{ )
+ [^][\']* \| ([^][\'|]+)\ archipelago
+ (?: \]\] | \}\} )
+ \'+ (?: \<\/(?: big|center )\>)* \}\}$/xi) {
printf DEBUG "%2d,%-2d arch %s\n", $x,$y,$arch;
push @wiarchlabels, [ $x,$y,$arch ];
printf DEBUG "%2d,%-2d arch %s\n", $x,$y,$arch;
push @wiarchlabels, [ $x,$y,$arch ];
+ } elsif (m/^\{\{ chart\ label \|\d+\|\d+\|
+ \<big\> \'+ \[\[ .* \b ocean \]\]/xi) {
} elsif (($x,$y,$island) =
m/^\{\{ chart\ island\ icon \|(\d+)\|(\d+)\|
([^| ][^|]*[^| ]) \| .*\}\}$/xi) {
} elsif (($x,$y,$island) =
m/^\{\{ chart\ island\ icon \|(\d+)\|(\d+)\|
([^| ][^|]*[^| ]) \| .*\}\}$/xi) {
@@
-234,8
+244,7
@@
sub yppedia_archs_chart_labels () {
#
foreach my $label (@wiarchlabels) {
my ($ax,$ay,$arch) = @$label;
#
foreach my $label (@wiarchlabels) {
my ($ax,$ay,$arch) = @$label;
- my $best_ccmulti= -1;
- my $best_d2= 0;
+ my $best_d2= 9999999;
my $best_n;
# print DEBUG "$ax,$ay arch-island-search $arch\n";
$ay += 1; $ax += 2; # coords are rather to the top left of label
my $best_n;
# print DEBUG "$ax,$ay arch-island-search $arch\n";
$ay += 1; $ax += 2; # coords are rather to the top left of label
@@
-243,19
+252,16
@@
sub yppedia_archs_chart_labels () {
next unless exists $winode2island{$vertex};
my $ccix= $wiarchs->connected_component_by_vertex($vertex);
my @cc= $wiarchs->connected_component_by_index($ccix);
next unless exists $winode2island{$vertex};
my $ccix= $wiarchs->connected_component_by_vertex($vertex);
my @cc= $wiarchs->connected_component_by_index($ccix);
- my $ccmulti= @cc > 1;
my ($vx,$vy) = split /,/, $vertex;
my $d2= ($vx-$ax)*($vx-$ax) + ($vy-$ay)*($vy-$ay);
my ($vx,$vy) = split /,/, $vertex;
my $d2= ($vx-$ax)*($vx-$ax) + ($vy-$ay)*($vy-$ay);
- my $cmp= $ccmulti <=> $best_ccmulti
- || $best_d2 <=> $d2;
+ my $cmp= $best_d2 <=> $d2;
printf DEBUG "%2d,%-2d arch-island-search %5s d2=%4d cc%-2d".
printf DEBUG "%2d,%-2d arch-island-search %5s d2=%4d cc%-2d".
- " #cc=%2d c
cmulti=%d c
mp=%2d %s\n",
- $ax,$ay, $vertex, $d2, $ccix, scalar(@cc), $c
cmulti, $c
mp,
+ " #cc=%2d cmp=%2d %s\n",
+ $ax,$ay, $vertex, $d2, $ccix, scalar(@cc), $cmp,
$winode2island{$vertex};
next unless $cmp > 0;
$best_n= $vertex;
$best_d2= $d2;
$winode2island{$vertex};
next unless $cmp > 0;
$best_n= $vertex;
$best_d2= $d2;
- $best_ccmulti= $ccmulti;
}
die 'no island vertices?!' unless defined $best_n;
my $ccix= $wiarchs->connected_component_by_vertex($best_n);
}
die 'no island vertices?!' unless defined $best_n;
my $ccix= $wiarchs->connected_component_by_vertex($best_n);