Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java @ 6940:274948f91dd6
issue1466: Fix, sort stations before gap detection.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 29 Aug 2013 11:33:30 +0200 |
parents | 0c593745bcd6 |
children | fe32a7f9655e |
comparison
equal
deleted
inserted
replaced
6939:765cf5fe26c3 | 6940:274948f91dd6 |
---|---|
29 | 29 |
30 import java.util.ArrayList; | 30 import java.util.ArrayList; |
31 import java.util.Collections; | 31 import java.util.Collections; |
32 import java.util.List; | 32 import java.util.List; |
33 import java.util.Map; | 33 import java.util.Map; |
34 import java.util.TreeSet; | |
34 import java.util.TreeMap; | 35 import java.util.TreeMap; |
35 | 36 |
36 import org.apache.log4j.Logger; | 37 import org.apache.log4j.Logger; |
37 | 38 |
38 | 39 |
103 if (getName().equals(FacetTypes.SEDIMENT_LOAD_TOTAL)) { | 104 if (getName().equals(FacetTypes.SEDIMENT_LOAD_TOTAL)) { |
104 SedimentLoad load = result.getLoad(); | 105 SedimentLoad load = result.getLoad(); |
105 TDoubleArrayList xPos = new TDoubleArrayList(); | 106 TDoubleArrayList xPos = new TDoubleArrayList(); |
106 TDoubleArrayList yPos = new TDoubleArrayList(); | 107 TDoubleArrayList yPos = new TDoubleArrayList(); |
107 double lastX = -1d; | 108 double lastX = -1d; |
108 for (double km: load.getKms()) { | 109 for (double km: new TreeSet<Double>(load.getKms())) { |
109 SedimentLoadFraction fraction = load.getFraction(km); | 110 SedimentLoadFraction fraction = load.getFraction(km); |
110 if (fraction.getTotal() != 0) { | 111 if (fraction.getTotal() != 0) { |
111 if (Math.abs(lastX-km) >= EPSILON) { | 112 if (Math.abs(lastX-km) >= EPSILON) { |
112 xPos.add(Double.NaN); | 113 xPos.add(Double.NaN); |
113 yPos.add(Double.NaN); | 114 yPos.add(Double.NaN); |