diff pkg/octree/classbreaks.go @ 4685:7a9388943840

morphology: Clip class breaks again Z min and max of the the height model.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 16 Oct 2019 11:07:59 +0200
parents 49564382ffff
children f73868037365
line wrap: on
line diff
--- a/pkg/octree/classbreaks.go	Wed Oct 16 10:52:43 2019 +0200
+++ b/pkg/octree/classbreaks.go	Wed Oct 16 11:07:59 2019 +0200
@@ -115,6 +115,22 @@
 	copy(n, cbs)
 	sort.Float64s(n)
 
+	for len(n) > 0 && n[0] < min {
+		n = n[1:]
+	}
+
+	if len(n) == 0 {
+		return n
+	}
+
+	for len(n) > 0 && n[len(n)-1] > max {
+		n = n[:len(n)-1]
+	}
+
+	if len(n) == 0 {
+		return n
+	}
+
 	for min < n[0] {
 		diff := n[1] - n[0]
 		if diff == 0 {