changeset 3906:fc6c6f6039df

Fix for area clipping problem in longitudinal section char flys-artifacts/trunk@5572 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Sat, 22 Sep 2012 17:04:44 +0000
parents 8bbb9e173297
children 9a2c38fb5f29
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties
diffstat 7 files changed, 64 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Sat Sep 22 09:59:21 2012 +0000
+++ b/flys-artifacts/ChangeLog	Sat Sep 22 17:04:44 2012 +0000
@@ -1,3 +1,16 @@
+2012-09-22	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java,
+	  src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
+	  Longitudinal section chart does now respect the bounds of the drawn
+	  areas, so that no clipping occurs (#878).
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties:
+	  i18n corrections.
+
 2012-09-22	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Sat Sep 22 09:59:21 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Sat Sep 22 17:04:44 2012 +0000
@@ -1,7 +1,37 @@
 package de.intevation.flys.exports;
 
+import java.awt.Color;
+import java.awt.Font;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.ImageIcon;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.LegendItem;
+import org.jfree.chart.annotations.XYAnnotation;
+import org.jfree.chart.annotations.XYImageAnnotation;
+import org.jfree.chart.annotations.XYTextAnnotation;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.Marker;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.XYPlot;
+import org.jfree.data.Range;
+import org.jfree.data.general.Series;
+import org.jfree.data.xy.XYDataset;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.w3c.dom.Document;
+
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-
 import de.intevation.flys.jfree.Bounds;
 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation;
 import de.intevation.flys.jfree.DoubleBounds;
@@ -9,47 +39,6 @@
 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
 import de.intevation.flys.jfree.StyledXYSeries;
 
-import java.awt.Color;
-import java.awt.Font;
-import javax.swing.ImageIcon;
-
-import java.text.NumberFormat;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.LegendItem;
-
-import org.jfree.chart.annotations.XYAnnotation;
-import org.jfree.chart.annotations.XYImageAnnotation;
-import org.jfree.chart.annotations.XYTextAnnotation;
-
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-
-import org.jfree.chart.plot.Marker;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.plot.XYPlot;
-
-import org.jfree.data.Range;
-
-import org.jfree.data.general.Series;
-
-import org.jfree.data.xy.XYDataset;
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-
-import org.w3c.dom.Document;
-
 
 /**
  * An abstract base class for creating XY charts.
@@ -71,10 +60,13 @@
     public class XYAxisDataset implements AxisDataset {
         /** Symbolic integer, but also coding the priority (0 goes first). */
         protected int axisSymbol;
+
         /** List of assigned datasets (in order). */
         protected List<XYDataset> datasets;
+
         /** Range to use to include all given datasets. */
         protected Range range;
+
         /** Index of axis in plot. */
         protected int plotAxisIndex;
 
@@ -130,17 +122,19 @@
         /** Get Array of Datasets. */
         @Override
         public XYDataset[] getDatasets() {
-            return (XYDataset[])
-                datasets.toArray(new XYDataset[datasets.size()]);
+            return datasets.toArray(new XYDataset[datasets.size()]);
         }
 
 
         /** Add a Dataset that describes an area. */
         public void addArea(StyledAreaSeriesCollection series) {
             this.datasets.add(series);
+            List<?> allSeries = series.getSeries();
+            for (int n = 0; n < allSeries.size(); n++) {
+                includeYRange((XYSeries)allSeries.get(n));
+            }
         }
 
-        // TODO obsolete?
         /** True if to be rendered as area. */
         @Override
         public boolean isArea(XYDataset series) {
@@ -172,6 +166,7 @@
     } // class AxisDataset
 
     /** Enumerator over existing axes. */
+    @Override
     protected abstract YAxisWalker getYAxisWalker();
 
     public static final int AXIS_SPACE = 5;
@@ -200,6 +195,7 @@
     /**
      * Generate the chart anew (including localized axis and all).
      */
+    @Override
     public JFreeChart generateChart() {
         logger.debug("XYChartGenerator.generateChart");
 
@@ -479,7 +475,7 @@
     /**
      * Add given series if visible, if not visible adjust ranges (such that
      * all points in data would be plotted once visible).
-     * @param series the dataseries to include in plot.
+     * @param series the data series to include in plot.
      * @param index  ('symbolic') index of the series and of its axis.
      * @param visible whether or not the data should be plotted.
      */
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Sat Sep 22 09:59:21 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Sat Sep 22 17:04:44 2012 +0000
@@ -154,7 +154,6 @@
         XYSeries lower =
                 new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
 
-
         for (KMIndex.Entry<AnalysisPeriod> entry: kms) {
             double km = entry.getKm();
             AnalysisPeriod ap = entry.getValue();
--- a/flys-artifacts/src/main/resources/messages.properties	Sat Sep 22 09:59:21 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Sat Sep 22 17:04:44 2012 +0000
@@ -30,10 +30,10 @@
 state.fix.analysis.referenceperiod = Reference period
 state.fix.analysis.analysisperiods = Analysis period
 state.fix.analysis.function = Function
-state.fix.analysis.preprocessing = Preprocessing
+state.fix.analysis.preprocessing = Outliers
 state.fix.preprocess=preprocess
 state.fix.vollmer.function=Function
-state.fix.vollmer.preprocessing = Aufbereiten
+state.fix.vollmer.preprocessing = Outliers
 state.fix.vollmer.qa = Input for W/Q data
 
 state.minfo.river = River
--- a/flys-artifacts/src/main/resources/messages_de.properties	Sat Sep 22 09:59:21 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Sat Sep 22 17:04:44 2012 +0000
@@ -30,10 +30,10 @@
 state.fix.analysis.referenceperiod = Bezugszeitraum
 state.fix.analysis.analysisperiods = Analysezeitr\u00e4ume
 state.fix.analysis.function = Funktion
-state.fix.analysis.preprocessing = Aufbereiten
+state.fix.analysis.preprocessing = Ausrei\u00DFer
 state.fix.preprocess=aufbereiten
 state.fix.vollmer.function=Funktion
-state.fix.vollmer.preprocessing = Aufbereiten
+state.fix.vollmer.preprocessing = Ausrei\u00DFer
 state.fix.vollmer.qa = Eingabe f\u00e4r W/Q Daten
 
 state.minfo.river = Gew\u00e4sser
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Sat Sep 22 09:59:21 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Sat Sep 22 17:04:44 2012 +0000
@@ -30,10 +30,10 @@
 state.fix.analysis.referenceperiod = Bezugszeitraum
 state.fix.analysis.analysisperiods = Analysezeitr\u00e4ume
 state.fix.analysis.function = Funktion
-state.fix.analysis.preprocessing = Aufbereitung
+state.fix.analysis.preprocessing = Ausrei\u00DFer
 state.fix.preprocess=aufbereiten
 state.fix.vollmer.function=Funktion
-state.fix.vollmer.preprocessing = Aufbereiten
+state.fix.vollmer.preprocessing = Ausrei\u00DFer
 state.fix.vollmer.qa = Eingabe f\u00e4r W/Q Daten
 
 state.minfo.river = Gew\u00e4sser
--- a/flys-artifacts/src/main/resources/messages_en.properties	Sat Sep 22 09:59:21 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Sat Sep 22 17:04:44 2012 +0000
@@ -30,11 +30,11 @@
 state.fix.analysis.referenceperiod = Reference period
 state.fix.analysis.analysisperiods = Analysis period
 state.fix.analysis.function = Function
-state.fix.analysis.preprocessing = Preprocessing
+state.fix.analysis.preprocessing = Outliers
 state.fix.preprocess=preprocess
 state.fix.vollmer.function=Function
-state.fix.vollmer.preprocessing = Aufbereiten
-state.fix.vollmer.qa = Eingabe for W/Q data
+state.fix.vollmer.preprocessing = Outliers
+state.fix.vollmer.qa = Input for W/Q data
 
 state.minfo.river = River
 state.minfo.calculation_mode = Calculation Mode

http://dive4elements.wald.intevation.org