# HG changeset patch # User Felix Wolfsteller # Date 1363859378 -3600 # Node ID 02f6741f80d44cbb82a874f01925ae785d34dc2b # Parent a16852a552067bcefdddb756b01cb6dacfbede0d DischargeTablesOverview: Show main values from gauge in dischargetablesoverview. diff -r a16852a55206 -r 02f6741f80d4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java Thu Mar 21 10:11:24 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java Thu Mar 21 10:49:38 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 entry: gr.getMainValues().entrySet()) { - Marker m = FixingsKMChartService.createQSectorMarker( - entry.getValue(), - entry.getKey()); - - if (m != null) { + // Get Gauge s mainvalues. + List 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); + } } }