diff flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.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 0cb1a70b8b92
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Fri Jul 01 11:16:11 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Fri Jul 01 14:46:13 2011 +0000
@@ -1,14 +1,11 @@
 package de.intevation.flys.exports;
 
-import java.awt.Color;
-
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.JFreeChart;
 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;
@@ -104,37 +101,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);
 
@@ -196,10 +162,10 @@
         }
 
         if (name.equals(LONGITUDINAL_W)) {
-            doWOut((WQKms) f.getData(artifact, context));
+            doWOut((WQKms) f.getData(artifact, context), attr);
         }
         else if (name.equals(LONGITUDINAL_Q)) {
-            doQOut((WQKms) f.getData(artifact, context));
+            doQOut((WQKms) f.getData(artifact, context), attr);
         }
         else {
             logger.warn("Unknown facet name: " + name);
@@ -212,11 +178,12 @@
      * Process the output for W facets in a longitudinal section curve.
      *
      * @param wqkms An array of WQKms values.
+     * @param theme The theme that contains styling information.
      */
-    protected void doWOut(WQKms wqkms) {
+    protected void doWOut(WQKms wqkms, Document theme) {
         logger.debug("LongitudinalSectionGenerator.doWOut");
 
-        XYSeries series = new XYSeries(getSeriesName(wqkms, "W"));
+        XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "W"), theme);
 
         int size = wqkms.size();
 
@@ -245,11 +212,12 @@
      * Process the output for Q facets in a longitudinal section curve.
      *
      * @param wqkms An array of WQKms values.
+     * @param theme The theme that contains styling information.
      */
-    protected void doQOut(WQKms wqkms) {
+    protected void doQOut(WQKms wqkms, Document theme) {
         logger.debug("LongitudinalSectionGenerator.doQOut");
 
-        XYSeries series = new XYSeries(getSeriesName(wqkms, "Q"));
+        XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "Q"), theme);
 
         int size = wqkms.size();
 

http://dive4elements.wald.intevation.org