changeset 2612:c7ce8b011bcb

SR import: Negate negative Z values and issue a warning if a negative Z value is found.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 13 Mar 2019 12:13:22 +0100
parents e8c97481438f
children 2ee6c32f1ba6
files pkg/imports/sr.go
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/sr.go	Wed Mar 13 11:28:46 2019 +0100
+++ b/pkg/imports/sr.go	Wed Mar 13 12:13:22 2019 +0100
@@ -426,6 +426,8 @@
 	mpz := make(octree.MultiPointZ, 0, 250000)
 	s := bufio.NewScanner(r)
 
+	var hasNegZ bool
+
 	for line := 1; s.Scan(); line++ {
 		text := s.Text()
 		var p octree.Vertex
@@ -454,6 +456,13 @@
 			feedback.Warn("format error in line %d: %v", line, err)
 			continue
 		}
+		if p.Z < 0 {
+			p.Z = -p.Z
+			if !hasNegZ {
+				hasNegZ = true
+				feedback.Warn("Negative Z value found: Using -Z")
+			}
+		}
 		mpz = append(mpz, p)
 	}