diff flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java @ 924:f7761914f745

An initial implementation to render chart series based on the XML configuration in themes.xml. flys-artifacts/trunk@2276 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 01 Jul 2011 14:46:13 +0000
parents 7ca4a287cd0e
children bdb05dc9b763
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java	Fri Jul 01 11:16:11 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java	Fri Jul 01 14:46:13 2011 +0000
@@ -1,7 +1,5 @@
 package de.intevation.flys.exports;
 
-import java.awt.Color;
-
 import org.w3c.dom.Document;
 
 import org.apache.log4j.Logger;
@@ -10,7 +8,6 @@
 import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.axis.ValueAxis;
 import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.Range;
 import org.jfree.data.xy.XYSeries;
@@ -112,37 +109,6 @@
     }
 
 
-    protected void adjustPlot(XYPlot plot) {
-        super.adjustPlot(plot);
-
-        // TODO REMOVE THIS CODE, IF WE HAVE INTRODUCED THEMES!
-        //XYLineAndShapeRenderer rw = (XYLineAndShapeRenderer)
-        //    plot.getRendererForDataset(w);
-
-        //XYLineAndShapeRenderer rq = null;
-        //try {
-        //    rq = (XYLineAndShapeRenderer) rw.clone();
-        //}
-        //catch (Exception e) {
-        //    logger.error(e, e);
-        //}
-
-        //int wNum = w.getSeriesCount();
-        //int qNum = q.getSeriesCount();
-
-        //for (int i = 0; i < wNum; i++) {
-        //    rw.setSeriesPaint(i, Color.BLUE);
-        //}
-
-        //for (int i = 0; i < qNum; i++) {
-        //    rq.setSeriesPaint(i, Color.GREEN);
-        //}
-
-        //plot.setRenderer(0, rw);
-        //plot.setRenderer(1, rq);
-    }
-
-
     protected void adjustAxes(XYPlot plot) {
         super.adjustAxes(plot);
 
@@ -167,10 +133,10 @@
         Facet        f    = flys.getNativeFacet(facet);
 
         if (name.equals(DURATION_W)) {
-            doWOut((WQDay) f.getData(artifact, context));
+            doWOut((WQDay) f.getData(artifact, context), attr);
         }
         else if (name.equals(DURATION_Q)) {
-            doQOut((WQDay) f.getData(artifact, context));
+            doQOut((WQDay) f.getData(artifact, context), attr);
         }
         else {
             logger.warn("Unknown facet name: " + name);
@@ -183,14 +149,14 @@
      * Creates the series for a duration curve's W facet.
      *
      * @param wqdays The WQDay store that contains the Ws.
-     * @param river The name of the river.
+     * @param theme
      */
-    protected void doWOut(WQDay wqdays) {
+    protected void doWOut(WQDay wqdays, Document theme) {
         logger.debug("DurationCurveGenerator.doWOut");
 
         // TODO find the correct series name
-        XYSeries series = new XYSeries(
-            getSeriesName(getRiverName(), DURATION_W));
+        XYSeries series = new StyledXYSeries(
+            getSeriesName(getRiverName(), DURATION_W), theme);
 
         int size = wqdays.size();
         for (int i = 0; i < size; i++) {
@@ -208,14 +174,14 @@
      * Creates the series for a duration curve's Q facet.
      *
      * @param wqdays The WQDay store that contains the Qs.
-     * @param river The name of the river.
+     * @param theme
      */
-    protected void doQOut(WQDay wqdays) {
+    protected void doQOut(WQDay wqdays, Document theme) {
         logger.debug("DurationCurveGenerator.doQOut");
 
         // TODO find the correct series name
-        XYSeries series = new XYSeries(
-            getSeriesName(getRiverName(), DURATION_Q));
+        XYSeries series = new StyledXYSeries(
+            getSeriesName(getRiverName(), DURATION_Q), theme);
 
         int size = wqdays.size();
         for (int i = 0; i < size; i++) {

http://dive4elements.wald.intevation.org