[Osmtools-cvs:00006] [8] ソース整理

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 4月 25日 (日) 04:09:12 JST


Revision: 8
          http://sourceforge.jp/projects/osmtools/svn/view?view=rev&revision=8
Author:   argrath
Date:     2010-04-25 04:09:12 +0900 (Sun, 25 Apr 2010)

Log Message:
-----------
ソース整理

Modified Paths:
--------------
    ksj2/Geo/KSJ.pm
    ksj2/extract_forest.pl

Modified: ksj2/Geo/KSJ.pm
===================================================================
--- ksj2/Geo/KSJ.pm	2010-04-24 15:41:53 UTC (rev 7)
+++ ksj2/Geo/KSJ.pm	2010-04-24 19:09:12 UTC (rev 8)
@@ -319,6 +319,31 @@
 
 }
 
+sub put_curves {
+    my ($self, $id, $newid, $tag) = @_;
+
+    my @ids;
+
+    my @c = @{$self->{curve}{$id}};
+
+    $$tag{'KSJ2:curve_id'} = $id;
+    
+    while($#c >= 1950){
+	my @nc = ();
+	for(my $i = 0; $i < 1900; $i++){
+	    my $x = shift @c;
+	    push @nc, $x;
+	}
+	push @nc, $c[0];
+	push @ids, $newid;
+	$self->put_curve_1($id, $newid--, \@nc, $tag);
+    }
+    push @ids, $newid;
+    $self->put_curve_1($id, $newid--, \@c, $tag);
+
+    return ($newid, \@ids);
+}
+
 sub put_relation {
     my ($self, $newid, $outer, $inner, $tagref) = @_;
     my $fw = $self->{fh};

Modified: ksj2/extract_forest.pl
===================================================================
--- ksj2/extract_forest.pl	2010-04-24 15:41:53 UTC (rev 7)
+++ ksj2/extract_forest.pl	2010-04-24 19:09:12 UTC (rev 8)
@@ -111,47 +111,24 @@
 	my $id;
 
 
-	  for (@{$s->{outer}}){
+	for (@{$s->{outer}}){
 	    $id = $_;
-
-	    my @c = @{$curve{$id}};
 	    my %tag = %tagbase;
 	    $tag{'KSJ2:curve_id'} = $id;
-	    
-	    while($#c >= 1950){
-		my @nc = ();
-		for(my $i = 0; $i < 1900; $i++){
-		    my $x = shift @c;
-		    push @nc, $x;
-		}
-		push @nc, $c[0];
-		push @omem, $newid;
-		$ksj->put_curve_1($id, $newid--, \@nc, \%tag);
-	    }
-	    push @omem, $newid;
-	    $ksj->put_curve_1($id, $newid--, \@c, \%tag);
+
+	    my ($newnewid, $ids) = $ksj->put_curves($id, $newid, \%tag);
+	    $newid = $newnewid;
+	    push @omem, @$ids;
 	}
 
-
 	  for (@{$s->{inner}}){
 	    $id = $_;
-
-	    my @c = @{$curve{$id}};
 	    my %tag = %tagbase;
 	    $tag{'KSJ2:curve_id'} = $id;
-	    
-	    while($#c >= 1950){
-		my @nc = ();
-		for(my $i = 0; $i < 1900; $i++){
-		    my $x = shift @c;
-		    push @nc, $x;
-		}
-		push @nc, $c[0];
-		push @imem, $newid;
-		$ksj->put_curve_1($id, $newid--, \@nc, \%tag);
-	    }
-	    push @imem, $newid;
-	    $ksj->put_curve_1($id, $newid--, \@c, \%tag);
+
+	    my ($newnewid, $ids) = $ksj->put_curves($id, $newid, \%tag);
+	    $newid = $newnewid;
+	    push @imem, @$ids;
 	}
 
 	{




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