Mercurial > dive4elements > river
changeset 5362:6d80318e8858
merge
author | Bettina Gruenbauer <bettina@intevation.de> |
---|---|
date | Thu, 21 Mar 2013 16:29:54 +0100 |
parents | 836643cc101d (current diff) 02f6741f80d4 (diff) |
children | 7b35f2c070c3 9b2482a3b9fe |
files | |
diffstat | 1 files changed, 21 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java Thu Mar 21 16:29:11 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java Thu Mar 21 16:29:54 2013 +0100 @@ -8,7 +8,6 @@ import java.util.Date; import java.util.List; import java.util.Locale; -import java.util.Map; import org.apache.log4j.Logger; import org.hibernate.Session; @@ -26,14 +25,13 @@ import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.GlobalContext; import de.intevation.flys.artifacts.model.DischargeTables; -import de.intevation.flys.artifacts.model.GaugeFinder; -import de.intevation.flys.artifacts.model.GaugeFinderFactory; import de.intevation.flys.artifacts.model.GaugeRange; import de.intevation.flys.artifacts.model.GaugesFactory; import de.intevation.flys.artifacts.resources.Resources; import de.intevation.flys.backend.SessionHolder; import de.intevation.flys.model.DischargeTable; import de.intevation.flys.model.Gauge; +import de.intevation.flys.model.MainValue; import de.intevation.flys.model.TimeInterval; @@ -131,8 +129,7 @@ applyMainValueMarkers( plot, - gauge.getRiver().getName(), - gauge.getStation().doubleValue(), + gauge, callMeta); return chart; @@ -161,40 +158,32 @@ } - /** Add domain markers to plot that indicate (only some Q) mainvalues. */ + /** Add domain markers to plot that indicate mainvalues. */ protected static void applyMainValueMarkers( XYPlot plot, - String river, - double km, + Gauge gauge, CallMeta meta ) { - GaugeFinderFactory ggf = GaugeFinderFactory.getInstance(); - GaugeFinder gf = ggf.getGaugeFinder(river); - - if (gf == null) { - log.warn("No gauge finder found for river '" + river + "'"); - return; - } + String river = gauge.getRiver().getName(); + double km = gauge.getStation().doubleValue(); - GaugeRange gr = gf.find(km); - if (gr == null) { - log.debug("No gauge range found for km " - + km + " on river " + river + "."); - return; - } - - if (log.isDebugEnabled()) { - log.debug(gr); - } - - for (Map.Entry<String, Double> entry: gr.getMainValues().entrySet()) { - Marker m = FixingsKMChartService.createQSectorMarker( - entry.getValue(), - entry.getKey()); - - if (m != null) { + // Get Gauge s mainvalues. + List<MainValue> mainValues = gauge.getMainValues(); + for (MainValue mainValue : mainValues) { + if (mainValue.getMainValue().getType().getName().equals("Q")) { + // Its a Q main value. + Marker m = FixingsKMChartService.createQSectorMarker( + mainValue.getValue().doubleValue(), + mainValue.getMainValue().getName()); plot.addDomainMarker(m); } + else if (mainValue.getMainValue().getType().getName().equals("W")) { + // Its a W main value. + Marker m = FixingsKMChartService.createQSectorMarker( + mainValue.getValue().doubleValue(), + mainValue.getMainValue().getName()); + plot.addRangeMarker(m); + } } }