changeset 5418:e89ff1894bb4 marking-single-beam

Don't clip the points against the border polygon. The implemented way was wrong.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 07 Jul 2021 18:27:40 +0200
parents 2d294ad81241
children 202715173935
files pkg/imports/sr.go pkg/mesh/vertex.go
diffstat 2 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/sr.go	Wed Jul 07 18:14:04 2021 +0200
+++ b/pkg/imports/sr.go	Wed Jul 07 18:27:40 2021 +0200
@@ -702,7 +702,7 @@
 	} else { // SurveyTypeMarking
 		if err := generateMarkingPoints(
 			ctx, tx, feedback,
-			xyz, removed, epsg,
+			xyz, epsg,
 			id,
 		); err != nil {
 			return nil, err
@@ -953,21 +953,18 @@
 	tx *sql.Tx,
 	feedback Feedback,
 	xyz mesh.MultiPointZ,
-	removed map[int32]struct{},
 	epsg uint32,
 	id int64,
 ) error {
 	log.Printf("debug: generateMarkingPoints")
 
-	min, max := mesh.MinMaxVertex(xyz.FilterRemoved(removed))
+	min, max := mesh.MinMaxVertex(xyz.All())
 
 	log.Printf("debug: min/max %.2f/%.2f\n", min.Z, max.Z)
 
 	heights := loadClassBreaks(ctx, tx, feedback, min.Z, max.Z)
 
-	classes := heights.Classify(xyz.FilterRemoved(removed))
-
-	log.Printf("debug: removed %d\n", len(removed))
+	classes := heights.Classify(xyz.All())
 
 	// Should not happen ... Z values over the top.
 	if n := len(classes) - 1; n > 1 && len(classes[n]) > 0 {
--- a/pkg/mesh/vertex.go	Wed Jul 07 18:14:04 2021 +0200
+++ b/pkg/mesh/vertex.go	Wed Jul 07 18:27:40 2021 +0200
@@ -1134,6 +1134,20 @@
 	return out
 }
 
+// All returns all points as an iterator.
+func (mpz MultiPointZ) All() func() (Vertex, bool) {
+	var idx int
+	return func() (v Vertex, ok bool) {
+		if idx >= len(mpz) {
+			ok = false
+			return
+		}
+		v, ok = mpz[idx], true
+		idx++
+		return
+	}
+}
+
 // FilterRemoved returns an iterator that only delivers the vertices
 // which indices are not marked as removed.
 func (mpz MultiPointZ) FilterRemoved(removed map[int32]struct{}) func() (Vertex, bool) {