[sosi2osm] 05/30: Add simple multipolygon support
Ruben Undheim
rubund-guest at moszumanska.debian.org
Sat Oct 4 13:07:54 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 66559ddf7a8dbecf6a71a3469990d5c1f0459c16
Author: Knut Karevoll <gnonthgol at gmail.com>
Date: Mon Oct 7 15:00:50 2013 +0200
Add simple multipolygon support
---
sosi.cpp | 14 ++++++++++++++
sosi2osm.cpp | 20 +++++++++++++++++++-
sosi2osm.h | 2 ++
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/sosi.cpp b/sosi.cpp
index 2d327c3..5d44018 100644
--- a/sosi.cpp
+++ b/sosi.cpp
@@ -136,3 +136,17 @@ long getSOSILinesLength() {
return lines;
}
+long* getSOSIRefs() {
+ long size = LC_InqAntRef();
+ long* ret = (long*)malloc(sizeof(long) * size);
+ short line = 1, pos = 1;
+
+ LC_GetRef(ret, size, &line, &pos);
+
+ return ret;
+}
+
+long getSOSIRefsSize() {
+ return LC_InqAntRef();
+}
+
diff --git a/sosi2osm.cpp b/sosi2osm.cpp
index 49bf7e0..1982ed9 100644
--- a/sosi2osm.cpp
+++ b/sosi2osm.cpp
@@ -132,7 +132,25 @@ void outputWay() {
}
void outputRelation() {
-
+ printf("<relation id=\"%d\" visible=\"true\">", -getSOSIId());
+ printf("<tag k=\"type\" v=\"multipolygon\"/>");
+ outputTags();
+
+ char* role = "outer";
+ long refsLen = getSOSIRefsSize();
+ long* refs = getSOSIRefs();
+ for (int i = 0; i < refsLen; i++) {
+ if (refs[i] == START_OY)
+ role = "inner";
+ else if (refs[i] == SLUTT_OY)
+ role = "outer";
+ else
+ printf("<member ref=\"%d\" role=\"%s\" type=\"way\"/>", -abs(refs[i]), role);
+ }
+
+ free(refs);
+
+ printf("</relation>\n");
}
int main(int argc, char** args) {
diff --git a/sosi2osm.h b/sosi2osm.h
index 5bd5017..baaa45a 100644
--- a/sosi2osm.h
+++ b/sosi2osm.h
@@ -12,4 +12,6 @@ void getSOSICoord(long i, double* x, double* y);
long getSOSICoordsSize();
char* getSOSILine(long i);
long getSOSILinesLength();
+long* getSOSIRefs();
+long getSOSIRefsSize();
--
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