• R/O
  • SSH
  • HTTPS

osmtools: Commit


Commit MetaInfo

Revision13 (tree)
Time2010-05-01 01:05:52
Authorargrath

Log Message

出力フォーマットを修正

Change Summary

Incremental Difference

--- ksj2/convert_administrative.pl (revision 12)
+++ ksj2/convert_administrative.pl (revision 13)
@@ -15,35 +15,72 @@
1515 use strict;
1616 use warnings;
1717
18-my $f = 'top';
1918 my %x;
2019
21-while(<>){
22- if(/<ksj:EC01/){
23- $f = 'name';
20+{
21+ my $f = 'top';
22+
23+ while(<>){
24+ if(/<ksj:EC01 /){
25+ $f = 'name';
26+ }
27+ elsif (/<jps:GM_Surface /){
28+ $f = 'surface';
29+ }
30+ elsif (/<jps:GM_OrientableCurve /){
31+ $f = 'oc';
32+ }
33+ elsif (/<jps:GM_Curve /){
34+ $f = 'curve';
35+ }
36+ elsif (/<jps:GM_Point /){
37+ $f = 'point';
38+ }
39+ elsif (m@</ksj:OBJ>@){
40+ $f = 'bottom';
41+ }
42+
43+ $x{$f} .= $_;
2444 }
25- elsif (/<jps:GM_Surface/){
26- $f = 'surface';
45+}
46+
47+my %oc;
48+
49+{
50+ my $id;
51+ my $s;
52+
53+ for (split /\n/, $x{oc}){
54+ if(/<jps:GM_OrientableCurve id="_([^\"]*)">/){
55+ $id = $1;
56+ $s = '';
57+ }
58+ $s .= $_ . "\n";
59+ if (m@</jps:GM_OrientableCurve>@){
60+ $oc{$id} = $s;
61+ }
2762 }
28- elsif (/<jps:GM_OrientableCurve/){
29- $f = 'oc';
30- }
31- elsif (/<jps:GM_Curve/){
32- $f = 'curve';
33- }
34- elsif (/<jps:GM_Point/){
35- $f = 'point';
36- }
37- elsif (m@</ksj:OBJ>@){
38- $f = 'bottom';
39- }
63+}
4064
41- $x{$f} .= $_;
42-}
4365 print $x{top};
4466 print $x{name};
4567 print $x{surface};
46-print $x{oc};
47-print $x{curve};
68+
69+{
70+ my $id;
71+
72+ for (split /\n/, $x{curve}){
73+ if(/<jps:GM_Curve id="([^\"]*)">/){
74+ $id = $1;
75+ }
76+ print $_ . "\n";
77+ if (m@</jps:GM_Curve>@){
78+ print $oc{$id} . "\n";
79+ }
80+ }
81+}
82+
83+#print $x{oc};
84+#print $x{curve};
4885 print $x{point};
4986 print $x{bottom};
Show on old repository browser