comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java @ 8421:0fa963038c61

Only draw discharge curve if on same station as navigation.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 17 Oct 2014 13:17:12 +0200
parents 839032ac1523
children 1cff4c98df76
comparison
equal deleted inserted replaced
8420:8a14605fb64a 8421:0fa963038c61
160 public double[] getFirstLastKM() { 160 public double[] getFirstLastKM() {
161 /* Behold the first km might be larger then the last! */ 161 /* Behold the first km might be larger then the last! */
162 return new double[] {getKm(0), getKm(size()-1)}; 162 return new double[] {getKm(0), getKm(size()-1)};
163 } 163 }
164 164
165 private static final double EPS = 1e-5;
166
167 public Double sameKm() {
168 int s = size();
169 if (s < 1) return null;
170 if (s == 1) return getKm(0);
171 double a = getKm(0);
172 double b = getKm(s-1);
173 double c = getKm(s/2);
174
175 return Math.abs(a-b) > EPS || Math.abs(a-c) > EPS || Math.abs(b-c) > EPS
176 ? null
177 : a;
178 }
179
165 @Override 180 @Override
166 public boolean guessRTLData() { 181 public boolean guessRTLData() {
167 return DataUtil.guessSameDirectionData(ws, allKms()); 182 return DataUtil.guessSameDirectionData(ws, allKms());
168 } 183 }
169 } 184 }

http://dive4elements.wald.intevation.org