Mercurial > gemma
comparison pkg/imports/isr.go @ 5428:b8d5f1cd15fb marking-single-beam
Simplified classification. Needs testing.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 11 Jul 2021 13:08:49 +0200 |
parents | c9da747d4109 |
children | fc79622783a7 |
comparison
equal
deleted
inserted
replaced
5427:235cfce555b5 | 5428:b8d5f1cd15fb |
---|---|
146 | 146 |
147 heights, err := mesh.ParseClassBreaks(isr.ClassBreaks) | 147 heights, err := mesh.ParseClassBreaks(isr.ClassBreaks) |
148 if err != nil { | 148 if err != nil { |
149 return nil, err | 149 return nil, err |
150 } | 150 } |
151 heights = heights.Dedup() | |
151 | 152 |
152 bns, err := fetchBottleneckResults(ctx, conn) | 153 bns, err := fetchBottleneckResults(ctx, conn) |
153 if err != nil { | 154 if err != nil { |
154 return nil, err | 155 return nil, err |
155 } | 156 } |
244 if _, err := deleteMarkingPointsStmt.ExecContext(ctx, sr.id); err != nil { | 245 if _, err := deleteMarkingPointsStmt.ExecContext(ctx, sr.id); err != nil { |
245 return err | 246 return err |
246 } | 247 } |
247 | 248 |
248 // Re-classify points. | 249 // Re-classify points. |
249 classes := heights.Classify(points.All()) | 250 classes := heights.Classify(points) |
250 | |
251 // Should not happen ... Z values over the top. | |
252 if n := len(classes) - 1; n > 1 && len(classes[n]) > 0 { | |
253 // Place the over the top values to the class below. | |
254 classes[n-1] = append(classes[n-1], classes[n]...) | |
255 classes[n] = nil | |
256 classes = classes[:n] | |
257 } | |
258 | 251 |
259 // Re-insert points | 252 // Re-insert points |
260 for i, class := range classes { | 253 for i, class := range classes { |
261 // Ignore empty classes | 254 // Ignore empty classes |
262 if len(class) == 0 { | 255 if len(class) == 0 { |