Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.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 |
---|---|
52 * Set the hit-point in W where a line drawn from the axis would hit the | 52 * Set the hit-point in W where a line drawn from the axis would hit the |
53 * curve in WQDay (if hit). | 53 * curve in WQDay (if hit). |
54 * Employ linear interpolation. | 54 * Employ linear interpolation. |
55 */ | 55 */ |
56 protected static void setHitPoint(WQDay wqday, StickyAxisAnnotation annotation) { | 56 protected static void setHitPoint(WQDay wqday, StickyAxisAnnotation annotation) { |
57 | |
58 if (wqday.size() == 0) { | |
59 return; | |
60 } | |
61 | |
57 int idx = 0; | 62 int idx = 0; |
58 float w = annotation.getPos(); | 63 float w = annotation.getPos(); |
59 boolean wIncreases = wqday.getW(0) < wqday.getW(wqday.size()-1); | 64 boolean wIncreases = wqday.getW(0) < wqday.getW(wqday.size()-1); |
60 if (wIncreases) { | 65 if (wIncreases) { |
61 while (idx < wqday.size() && wqday.getW(idx) < w) { | 66 while (idx < wqday.size() && wqday.getW(idx) < w) { |