changeset 3251:aeeb9192e395

W(t) chart point label rotation working flys-artifacts/trunk@4884 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Fri, 06 Jul 2012 11:12:55 +0000
parents 7613cfb037f5
children 62c9bcef0680
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
diffstat 3 files changed, 26 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jul 06 10:02:01 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jul 06 11:12:55 2012 +0000
@@ -1,3 +1,9 @@
+2012-07-07	Christian Lins <christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/utils/ThemeUtil.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java:
+	  W(t) chart label rotation now working (see #684)
+
 2012-07-07	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/ChartGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Fri Jul 06 10:02:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Fri Jul 06 11:12:55 2012 +0000
@@ -1,33 +1,23 @@
 package de.intevation.flys.exports.fixings;
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-
 import de.intevation.artifacts.ArtifactNamespaceContext;
 import de.intevation.artifacts.CallContext;
-
 import de.intevation.artifacts.common.utils.XMLUtils;
-
 import de.intevation.flys.artifacts.FLYSArtifact;
-
 import de.intevation.flys.artifacts.model.DateRange;
 import de.intevation.flys.artifacts.model.FacetTypes;
-
 import de.intevation.flys.artifacts.model.fixings.QWD;
-
 import de.intevation.flys.exports.TimeseriesChartGenerator;
-
 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation;
 import de.intevation.flys.jfree.FLYSAnnotation;
 import de.intevation.flys.jfree.StyledTimeSeries;
-
 import de.intevation.flys.utils.FLYSUtils;
 import de.intevation.flys.utils.ThemeUtil;
 
 import java.awt.BasicStroke;
 import java.awt.Color;
-
 import java.io.OutputStream;
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -37,28 +27,22 @@
 import javax.xml.xpath.XPathConstants;
 
 import org.apache.log4j.Logger;
-
 import org.jfree.chart.JFreeChart;
-
 import org.jfree.chart.annotations.XYTextAnnotation;
-
 import org.jfree.chart.plot.IntervalMarker;
 import org.jfree.chart.plot.ValueMarker;
-
 import org.jfree.chart.title.TextTitle;
-
 import org.jfree.data.time.Day;
 import org.jfree.data.time.Month;
 import org.jfree.data.time.RegularTimePeriod;
 import org.jfree.data.time.TimeSeries;
 import org.jfree.data.time.TimeSeriesCollection;
-
-//import org.jfree.ui.TextAnchor;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+
 /**
+ * Generator for Delta W(t) charts.
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
  */
 public class FixDeltaWtGenerator
@@ -161,6 +145,7 @@
     }
 
 
+    @Override
     public void doOut(
         ArtifactAndFacet artifactFacet,
         Document         theme,
@@ -338,9 +323,11 @@
             logger.debug("annotation: " + x + "/" + qwd.getDeltaW());
         }
 
-        FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme);
-        flysAnno.setTextAnnotations(textAnnos);
-        addAnnotations(flysAnno);
+        if(visible) {
+            FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme);
+            flysAnno.setTextAnnotations(textAnnos);
+            addAnnotations(flysAnno);
+        }
     }
 
 
@@ -375,16 +362,20 @@
             double value =  qwds[i].getDeltaW();
             boolean interpolate = qwds[i].getInterpolated();
             if (interpolate) {
-                interpol.addOrUpdate(rtp, value);
-                annoIdxMap.put(
-                    i,
-                    new int[]{1, idxInterpol++});
+                if(interpol.addOrUpdate(rtp, value) == null) {
+                    annoIdxMap.put(
+                            i,
+                            new int[]{1, idxInterpol});
+                    idxInterpol++;
+                }
             }
             else {
-                annoIdxMap.put(
-                    i,
-                    new int[]{0, idxRegular++});
-                series.addOrUpdate(rtp, value);
+                if(series.addOrUpdate(rtp, value) == null) {
+                    annoIdxMap.put(
+                            i,
+                            new int[]{0, idxRegular});
+                    idxRegular++;
+                }
             }
         }
         tsc.addSeries(series);
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Fri Jul 06 10:02:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Fri Jul 06 11:12:55 2012 +0000
@@ -422,7 +422,6 @@
      */
     public static String parseTextOrientation(Document theme) {
         String o = XMLUtils.xpathString(theme, XPATH_TEXT_ORIENTATION, null);
-        //logger.debug("parseTextOrientation: " + o + " xml: " + XMLUtils.toString(theme));
         if ("true".equals(o)) {
             return "horizontal";
         }

http://dive4elements.wald.intevation.org