[Osmtools-cvs:00010] [13] 出力フォーマットを修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 5月 1日 (土) 01:05:52 JST


Revision: 13
          http://sourceforge.jp/projects/osmtools/svn/view?view=rev&revision=13
Author:   argrath
Date:     2010-05-01 01:05:52 +0900 (Sat, 01 May 2010)

Log Message:
-----------
出力フォーマットを修正

Modified Paths:
--------------
    ksj2/convert_administrative.pl

Modified: ksj2/convert_administrative.pl
===================================================================
--- ksj2/convert_administrative.pl	2010-04-30 08:31:28 UTC (rev 12)
+++ ksj2/convert_administrative.pl	2010-04-30 16:05:52 UTC (rev 13)
@@ -15,35 +15,72 @@
 use strict;
 use warnings;
 
-my $f = 'top';
 my %x;
 
-while(<>){
-    if(/<ksj:EC01/){
-	$f = 'name';
+{
+    my $f = 'top';
+
+    while(<>){
+	if(/<ksj:EC01 /){
+	    $f = 'name';
+	}
+	elsif (/<jps:GM_Surface /){
+	    $f = 'surface';
+	}
+	elsif (/<jps:GM_OrientableCurve /){
+	    $f = 'oc';
+	}
+	elsif (/<jps:GM_Curve /){
+	    $f = 'curve';
+	}
+	elsif (/<jps:GM_Point /){
+	    $f = 'point';
+	}
+	elsif (m@</ksj:OBJ>@){
+	    $f = 'bottom';
+	}
+	
+	$x{$f} .= $_;
     }
-    elsif (/<jps:GM_Surface/){
-	$f = 'surface';
+}
+
+my %oc;
+
+{
+    my $id;
+    my $s;
+
+    for (split /\n/, $x{oc}){
+	if(/<jps:GM_OrientableCurve id="_([^\"]*)">/){
+	    $id = $1;
+	    $s = '';
+	}
+	$s .= $_ . "\n";
+	if (m@</jps:GM_OrientableCurve>@){
+	    $oc{$id} = $s;
+	}
     }
-    elsif (/<jps:GM_OrientableCurve/){
-	$f = 'oc';
-    }
-    elsif (/<jps:GM_Curve/){
-	$f = 'curve';
-    }
-    elsif (/<jps:GM_Point/){
-	$f = 'point';
-    }
-    elsif (m@</ksj:OBJ>@){
-	$f = 'bottom';
-    }
+}
 
-    $x{$f} .= $_;
-}
 print $x{top};
 print $x{name};
 print $x{surface};
-print $x{oc};
-print $x{curve};
+
+{
+    my $id;
+
+    for (split /\n/, $x{curve}){
+	if(/<jps:GM_Curve id="([^\"]*)">/){
+	    $id = $1;
+	}
+	print $_ . "\n";
+	if (m@</jps:GM_Curve>@){
+	    print $oc{$id} . "\n";
+	}
+    }
+}
+
+#print $x{oc};
+#print $x{curve};
 print $x{point};
 print $x{bottom};




Osmtools-cvs メーリングリストの案内
Back to archive index