Imported Upstream version 1.5.1
[routino] / src / relationsx.c
index 7b69049..1822f9d 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************
- $Header: /home/amb/routino/src/RCS/relationsx.c,v 1.8 2010/10/09 18:20:18 amb Exp $
+ $Header: /home/amb/routino/src/RCS/relationsx.c,v 1.10 2010/11/13 14:57:30 amb Exp $
 
  Extended Relation data type functions.
 
@@ -32,6 +32,7 @@
 #include "relationsx.h"
 
 #include "files.h"
+#include "logging.h"
 #include "functions.h"
 
 
@@ -182,7 +183,6 @@ void ProcessRouteRelations(RelationsX *relationsx,WaysX *waysx)
 {
  RouteRelX *unmatched=NULL,*lastunmatched=NULL;
  int nunmatched=0,lastnunmatched=0,iteration=0;
- int i,j;
 
  if(waysx->number==0)
     return;
@@ -206,12 +206,14 @@ void ProcessRouteRelations(RelationsX *relationsx,WaysX *waysx)
 
  do
    {
+    int ways=0,relations=0;
+    int i;
+
     SeekFile(relationsx->rfd,0);
 
     /* Print the start message */
 
-    printf("Processing Route Relations: Iteration=%d Relations=0",iteration);
-    fflush(stdout);
+    printf_first("Processing Route Relations: Iteration=%d Relations=0 Modified Ways=0",iteration);
 
     for(i=0;i<relationsx->rxnumber;i++)
       {
@@ -229,18 +231,25 @@ void ProcessRouteRelations(RelationsX *relationsx,WaysX *waysx)
        /* Decide what type of route it is */
 
        if(iteration==0)
+         {
+          relations++;
           routes=relationx.routes;
+         }
        else
          {
-          if((lastunmatched[j].routes|relationx.routes)==relationx.routes)
-             routes=0; /* Nothing new to add */
-          else
-             for(j=0;j<lastnunmatched;j++)
-                if(lastunmatched[j].id==relationx.id)
-                  {
+          int j;
+
+          for(j=0;j<lastnunmatched;j++)
+             if(lastunmatched[j].id==relationx.id)
+               {
+                relations++;
+
+                if((lastunmatched[j].routes|relationx.routes)==relationx.routes)
+                   routes=0; /* Nothing new to add */
+                else
                    routes=lastunmatched[j].routes;
-                   break;
-                  }
+                break;
+               }
          }
 
        /* Loop through the ways */
@@ -268,6 +277,8 @@ void ProcessRouteRelations(RelationsX *relationsx,WaysX *waysx)
 #if SLIM
                 PutBackWayX(waysx,way,1);
 #endif
+
+                ways++;
                }
             }
          }
@@ -295,10 +306,7 @@ void ProcessRouteRelations(RelationsX *relationsx,WaysX *waysx)
        while(relationid);
 
        if(!((i+1)%10000))
-         {
-          printf("\rProcessing Route Relations: Iteration=%d Relations=%d",iteration,i+1);
-          fflush(stdout);
-         }
+          printf_middle("Processing Route Relations: Iteration=%d Relations=%d Modified Ways=%d",iteration,relations,ways);
       }
 
     if(lastunmatched)
@@ -312,8 +320,7 @@ void ProcessRouteRelations(RelationsX *relationsx,WaysX *waysx)
 
     /* Print the final message */
 
-    printf("\rProcessed Route Relations: Iteration=%d Relations=%d  \n",iteration,relationsx->rxnumber);
-    fflush(stdout);
+    printf_last("Processed Route Relations: Iteration=%d Relations=%d Modified Ways=%d",iteration,relations,ways);
    }
  while(lastnunmatched && ++iteration<5);