# HG changeset patch # User Christian Lins # Date 1340520665 0 # Node ID 74c974b10c75ea45888b1a081ea5955ec58a7ef1 # Parent a08538e21b555bc03072869539e95ba393708f03 Output code to trackdown the linecolor problem flys-artifacts/trunk@4767 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a08538e21b55 -r 74c974b10c75 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Sat Jun 23 18:15:17 2012 +0000 +++ b/flys-artifacts/ChangeLog Sun Jun 24 06:51:05 2012 +0000 @@ -1,3 +1,15 @@ +2012-06-24 Christian Lins + + * src/main/java/de/intevation/flys/utils/ThemeUtil.java, + src/main/java/de/intevation/flys/exports/ChartGenerator.java, + src/main/java/de/intevation/flys/themes/ThemeFactory.java, + src/main/java/de/intevation/flys/jfree/XYStyle.java: + Add debug logs. + + * src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java, + src/main/java/de/intevation/flys/jfree/StyledXYSeries.java: + Draw the W/Q function as StyledXYSeries. + 2012-06-23 Felix Wolfsteller * src/main/java/de/intevation/flys/exports/XYChartGenerator.java: diff -r a08538e21b55 -r 74c974b10c75 flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Sat Jun 23 18:15:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Sun Jun 24 06:51:05 2012 +0000 @@ -1098,6 +1098,8 @@ * @param plot plot to add datasets to. */ protected void addDatasets(XYPlot plot) { + logger.debug("addDatasets()"); + // AxisDatasets are sorted, but some might be empty. // Thus, generate numbering on the fly. int axisIndex = 0; @@ -1107,7 +1109,7 @@ if (!entry.getValue().isEmpty()) { // Add axis and range information. AxisDataset axisDataset = entry.getValue(); - NumberAxis axis = createYAxis(entry.getKey()); + NumberAxis axis = createYAxis(entry.getKey()); plot.setRangeAxis(axisIndex, axis); diff -r a08538e21b55 -r 74c974b10c75 flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java Sat Jun 23 18:15:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java Sun Jun 24 06:51:05 2012 +0000 @@ -108,8 +108,8 @@ QWD[] qwds = (QWD[])aaf.getData(context); if(qwds != null) { XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); - for(QW qw : qwds) { - series.add(qw.getQ(), qw.getW()); + for(QWD qwd : qwds) { + series.add(qwd.getQ(), qwd.getW()); } addAxisSeries(series, 0, visible); @@ -148,7 +148,10 @@ func.getMaxQ(), // end 500, // number of samples aaf.getFacetDescription()); - addAxisSeries(series, 0, visible); + + // Wrap to StyledXYSeries + XYSeries styledSeries = new StyledXYSeries(aaf.getFacetDescription(), doc, series); + addAxisSeries(styledSeries, 0, visible); } else { logger.warn("doWQCurveOut: maxQ <= 0"); diff -r a08538e21b55 -r 74c974b10c75 flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledXYSeries.java --- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledXYSeries.java Sat Jun 23 18:15:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledXYSeries.java Sun Jun 24 06:51:05 2012 +0000 @@ -1,10 +1,12 @@ package de.intevation.flys.jfree; +import java.util.List; import org.apache.log4j.Logger; import org.w3c.dom.Document; +import org.jfree.data.xy.XYDataItem; import org.jfree.data.xy.XYSeries; import de.intevation.flys.jfree.HasLabel; @@ -27,6 +29,12 @@ this(key, true, theme); this.label = key.toString(); } + + + public StyledXYSeries(String key, Document theme, XYSeries unstyledSeries) { + this(key, theme); + add(unstyledSeries); + } /** @@ -62,5 +70,16 @@ public void setLabel(String label) { this.label = label; } + + protected void add(XYSeries series) { + List items = series.getItems(); + add(items); + } + + protected void add(List items) { + for(XYDataItem item : items) { + add(item.getXValue(), item.getYValue()); + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a08538e21b55 -r 74c974b10c75 flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java --- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java Sat Jun 23 18:15:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java Sun Jun 24 06:51:05 2012 +0000 @@ -4,6 +4,7 @@ import java.awt.Color; import java.awt.geom.Ellipse2D; +import org.apache.log4j.Logger; import org.w3c.dom.Document; @@ -18,10 +19,13 @@ */ public class XYStyle implements Style { + private static Logger logger = Logger.getLogger(XYStyle.class); + protected Document theme; protected XYLineAndShapeRenderer renderer; + public XYStyle(Document theme) { this.theme = theme; this.renderer = null; @@ -56,7 +60,13 @@ /** Set line color to renderer. */ protected void applyLineColor(XYLineAndShapeRenderer r, int idx) { Color c = ThemeUtil.parseLineColorField(theme); - r.setSeriesPaint(idx, c); + if(c != null) { + logger.debug("applyLineColor " + c.toString()); + r.setSeriesPaint(idx, c); + } + else { + logger.warn("applyLineColor: color is null - malformed linecolor field?"); + } } diff -r a08538e21b55 -r 74c974b10c75 flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java --- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java Sat Jun 23 18:15:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java Sun Jun 24 06:51:05 2012 +0000 @@ -253,7 +253,7 @@ protected static void addField(Theme theme, Node field) { String name = ((Element)field).getAttribute("name"); - logger.debug("Add field: " + name); + logger.debug("Add field " + name + " to theme " + theme.getName()); NamedNodeMap attrs = field.getAttributes(); diff -r a08538e21b55 -r 74c974b10c75 flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Sat Jun 23 18:15:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Sun Jun 24 06:51:05 2012 +0000 @@ -193,7 +193,7 @@ public static Color parsePointColor(Document theme) { String color = XMLUtils.xpathString(theme, XPATH_POINT_COLOR, null); - + logger.debug("parsePointColor(): color = " + color); return parseColor(color); } @@ -596,7 +596,10 @@ * @return color. */ public static Color parseLineColorField(Document theme) { - return parseRGB(getLineColorString(theme)); + String lineColorStr = getLineColorString(theme); + logger.debug("parseLineColorField: lineColorStr = " + + (lineColorStr == null ? "null" : lineColorStr)); + return parseRGB(lineColorStr); }