diff flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 3278:c27c4e06dd87

Re-add HYK rendering code to CrossSectionGenerator flys-artifacts/trunk@4924 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Wed, 11 Jul 2012 09:24:07 +0000
parents 4ac581062c40
children d9af29a4bb85
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Tue Jul 10 19:28:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Wed Jul 11 09:24:07 2012 +0000
@@ -1,21 +1,15 @@
 package de.intevation.flys.exports;
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.artifactdatabase.state.Settings;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactNamespaceContext;
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
 import de.intevation.artifacts.PreferredLocale;
-
 import de.intevation.artifacts.common.utils.XMLUtils;
-
 import de.intevation.flys.artifacts.FLYSArtifact;
-
 import de.intevation.flys.artifacts.resources.Resources;
-
 import de.intevation.flys.jfree.Bounds;
 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation;
 import de.intevation.flys.jfree.DoubleBounds;
@@ -26,11 +20,8 @@
 import de.intevation.flys.jfree.Style;
 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
 import de.intevation.flys.jfree.StyledSeries;
-
 import de.intevation.flys.model.River;
-
 import de.intevation.flys.themes.ThemeAccess;
-
 import de.intevation.flys.utils.FLYSUtils;
 import de.intevation.flys.utils.ThemeUtil;
 
@@ -40,14 +31,10 @@
 import java.awt.Paint;
 import java.awt.Stroke;
 import java.awt.TexturePaint;
-
 import java.awt.geom.Rectangle2D;
-
 import java.awt.image.BufferedImage;
-
 import java.io.IOException;
 import java.io.OutputStream;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -58,29 +45,19 @@
 import javax.xml.xpath.XPathConstants;
 
 import org.apache.log4j.Logger;
-
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.LegendItem;
 import org.jfree.chart.LegendItemCollection;
-
 import org.jfree.chart.annotations.XYLineAnnotation;
 import org.jfree.chart.annotations.XYTextAnnotation;
-
 import org.jfree.chart.axis.NumberAxis;
-
 import org.jfree.chart.plot.XYPlot;
-
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-
 import org.jfree.data.Range;
-
 import org.jfree.data.general.Series;
-
 import org.jfree.data.xy.XYDataset;
-
 import org.jfree.ui.RectangleInsets;
 import org.jfree.ui.TextAnchor;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -137,7 +114,7 @@
     protected SortedMap<Integer, AxisDataset> datasets;
 
     /** List of annotations to insert in plot. */
-    protected List<FLYSAnnotation> annotations;
+    protected List<FLYSAnnotation> annotations = new ArrayList<FLYSAnnotation>();
 
     /**
      * A mini interface that allows to walk over the YAXIS enums defined in
@@ -186,10 +163,6 @@
      * Adds annotations to list. The given annotation will be visible.
      */
     public void addAnnotations(FLYSAnnotation annotation) {
-        if (annotations == null) {
-            annotations = new ArrayList<FLYSAnnotation>();
-        }
-
         annotations.add(annotation);
     }
 
@@ -229,7 +202,7 @@
             // There is one nasty case (duration curves, where annotations
             // might stick to the second y-axis).
             // FIXME: Remove dependency to XYChartGenerator here
-            AxisDataset dataset = (XYChartGenerator.XYAxisDataset) getAxisDataset(
+            AxisDataset dataset = getAxisDataset(
                 new Integer(annotation.getAxisSymbol()));
             if (dataset == null) {
                 logger.warn("Annotation should stick to unfindable y-axis: "
@@ -449,13 +422,6 @@
             return;
         }
 
-        // Paints for the boxes/lines.
-        Stroke basicStroke = new BasicStroke(1.0f);
-
-        Paint linePaint = new Color(255,  0,0,60);
-        Paint fillPaint = new Color(0,  255,0,60);
-        Paint tranPaint = new Color(0,    0,0, 0);
-
         // OPTMIMIZE: Pre-calculate positions
         ChartArea area = new ChartArea(
             plot.getDomainAxis(0).getRange(),
@@ -517,6 +483,7 @@
     public abstract JFreeChart generateChart();
 
 
+    @Override
     public abstract void doOut(
         ArtifactAndFacet bundle,
         Document         attr,
@@ -627,13 +594,11 @@
         Document theme,
         boolean visible
     ){
-        // Running into trouble here.
         logger.debug("doAnnotations");
 
         // Add all annotations to our annotation pool.
         annotations.setTheme(theme);
         if (aandf != null) {
-            Facet facet = aandf.getFacet();
             annotations.setLabel(aandf.getFacetDescription());
         }
         else {

http://dive4elements.wald.intevation.org