Mercurial > dive4elements > river
changeset 3144:05a7298c4f20
Fix: add method to find discharge sector border for given river and km.
flys-artifacts/trunk@4752 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 21 Jun 2012 17:01:17 +0000 |
parents | 29022c93027d |
children | be612065993e |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeRange.java |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Jun 21 16:46:05 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Jun 21 17:01:17 2012 +0000 @@ -1,3 +1,25 @@ +2012-06-21 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/model/GaugeRange.java: + added method getSectorBorder(int). With this method you can figure + the three discharge sector borders. Returns NaN if border is + not there. Usage: + + GaugeFinderFactory ggf = GaugeFinderFactory.getInstance(); + GaugeFinder gf = ggf.getGaugeFinder("Elbe"); + if (gf == null) { /* FAIL */ } + GaugeRange gr = gf.find(km); // km is the km where you are. + if (gr == null) { /* FAIL */ } + + double m0 = gr.getSectorBorder(0); // Draw as marker if not NaN + double m1 = gr.getSectorBorder(1); // Draw as marker if not NaN + double m2 = gr.getSectorBorder(2); // Draw as marker if not NaN + + Labels should be: + '(MNQ+MQ)/2' for m0 + '(MQ+MHQ)/2' for m1 + 'HQ5' for m2 + 2012-06-21 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/GaugeFinderFactory.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeRange.java Thu Jun 21 16:46:05 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeRange.java Thu Jun 21 17:01:17 2012 +0000 @@ -77,6 +77,15 @@ } } + public double getSectorBorder(int sector) { + for (Sector s: sectors) { + if (s.sector == sector) { + return s.value; + } + } + return Double.NaN; + } + public int classify(double value) { for (Sector sector: sectors) { if (value < sector.value) {