# HG changeset patch # User Bettina Gruenbauer # Date 1363879794 -3600 # Node ID 6d80318e8858d1c4bc8b7c38f3373857434cc81a # Parent 836643cc101de73a7acb568814b4b9f6b68d8f8c# Parent 02f6741f80d44cbb82a874f01925ae785d34dc2b merge diff -r 836643cc101d -r 6d80318e8858 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 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 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); + } } }