comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java @ 7483:f206f6049b2b

Dont assume that wqdays are always of none zero length.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 31 Oct 2013 18:26:49 +0100
parents 5d071e1cb17c
children 3e9961dcbf9a
comparison
equal deleted inserted replaced
7482:f8e1af4e2f69 7483:f206f6049b2b
56 * Set the hit-point in Q where a line drawn from the axis would hit the 56 * Set the hit-point in Q where a line drawn from the axis would hit the
57 * curve in WQDay (if hit). 57 * curve in WQDay (if hit).
58 * Employ linear interpolation. 58 * Employ linear interpolation.
59 */ 59 */
60 protected static void setHitPoint(WQDay wqday, StickyAxisAnnotation annotation) { 60 protected static void setHitPoint(WQDay wqday, StickyAxisAnnotation annotation) {
61
62 if (wqday.size() == 0) {
63 return;
64 }
65
61 int idx = 0; 66 int idx = 0;
62 float q = annotation.getPos(); 67 float q = annotation.getPos();
63 boolean qIncreases = wqday.getQ(0) < wqday.getQ(wqday.size()-1); 68 boolean qIncreases = wqday.getQ(0) < wqday.getQ(wqday.size()-1);
64 if (qIncreases) { 69 if (qIncreases) {
65 while (idx < wqday.size() && wqday.getQ(idx) < q) { 70 while (idx < wqday.size() && wqday.getQ(idx) < q) {

http://dive4elements.wald.intevation.org