[sosi2osm] 29/30: Make sure anonomous nodes also gets sent to output file

Ruben Undheim rubund-guest at moszumanska.debian.org
Sat Oct 4 13:07:57 UTC 2014


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to branch upstream
in repository sosi2osm.

commit fd8752ddb19c9f3e32dd5595f2f3d71d3b040566
Author: Knut Karevoll <gnonthgol at gmail.com>
Date:   Thu Oct 2 12:18:10 2014 +0200

    Make sure anonomous nodes also gets sent to output file
---
 node.cpp     | 10 +++++-----
 sosi2osm.cpp |  2 +-
 sosi2osm.h   |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/node.cpp b/node.cpp
index 0b2df95..87aa21a 100644
--- a/node.cpp
+++ b/node.cpp
@@ -31,9 +31,9 @@ void getCoords(long int* size, double** lat, double** lon) {
 }
 
 long nodeId = -1;
-long createNode(double lat, double lon, short kp) {
+long createNode(double lat, double lon, short kp, FILE* output) {
 	if (kp == 0) {
-    	printf("<node id=\"%ld\" lat=\"%.7f\" lon=\"%.7f\" version=\"1\" visible=\"true\"/>\n", nodeId, lat, lon);
+    	fprintf(output, "<node id=\"%ld\" lat=\"%.7f\" lon=\"%.7f\" version=\"1\" visible=\"true\"/>\n", nodeId, lat, lon);
 	    return nodeId--;
     }
     
@@ -63,11 +63,11 @@ long createNode(double lat, double lon, short kp) {
     kpM[lenM] = kp;
     idM[lenM] = nodeId;
     lenM++;
-    printf("<node id=\"%ld\" lat=\"%.7f\" lon=\"%.7f\" version=\"1\" visible=\"true\"/>\n", nodeId, lat, lon);
+    fprintf(output, "<node id=\"%ld\" lat=\"%.7f\" lon=\"%.7f\" version=\"1\" visible=\"true\"/>\n", nodeId, lat, lon);
     return nodeId--;
 }
 
-long int createNodes(long int** ids) {
+long int createNodes(long int** ids, FILE* output) {
 	long int size;
     double *lat, *lon;
     getCoords(&size, &lat, &lon);
@@ -75,7 +75,7 @@ long int createNodes(long int** ids) {
     *ids = nd;
     
     for (int i = 0; i < size; i++) {
-        nd[i] = createNode(lat[i], lon[i], LC_GetKp(i+1));
+        nd[i] = createNode(lat[i], lon[i], LC_GetKp(i+1), output);
     }
     
     free(lat);
diff --git a/sosi2osm.cpp b/sosi2osm.cpp
index e6d7bda..8e7dc4a 100644
--- a/sosi2osm.cpp
+++ b/sosi2osm.cpp
@@ -23,7 +23,7 @@ void handleHead() {
 
 void outputWay(FILE* output) {
     long int* nd;
-    long int size = createNodes(&nd);
+    long int size = createNodes(&nd, output);
     
     fprintf(output, "<way id=\"%ld\" version=\"1\" visible=\"true\">", -getSOSIId());
     outputTags(output);
diff --git a/sosi2osm.h b/sosi2osm.h
index 82f6aab..1194a41 100644
--- a/sosi2osm.h
+++ b/sosi2osm.h
@@ -25,6 +25,6 @@ void outputTags(FILE* output);
 // Node
 
 void setProjection(const char* proj);
-long int createNodes(long int** ids);
+long int createNodes(long int** ids, FILE* output);
 void outputNode(FILE* output);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/sosi2osm.git



More information about the Pkg-grass-devel mailing list