changeset 3467:b9c2becbcc9e

Towards issue745 (lines for averages in deltawt). flys-artifacts/trunk@5139 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 26 Jul 2012 14:12:38 +0000
parents 8160e62bbb3a
children f37e7e8907cb 38fb6b410601
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QWDDateRange.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java
diffstat 4 files changed, 47 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jul 26 11:47:04 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jul 26 14:12:38 2012 +0000
@@ -1,3 +1,12 @@
+2012-07-26	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/QWDDateRange.java:
+	  New class. QWD and a DateRange.
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java:
+	  Produce QWDDateRanges in state, consume in generator.
+
 2012-07-26  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/fixanalysis.xml: Registered new Output
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QWDDateRange.java	Thu Jul 26 14:12:38 2012 +0000
@@ -0,0 +1,20 @@
+package de.intevation.flys.artifacts.model;
+
+
+import java.io.Serializable;
+
+import de.intevation.flys.artifacts.model.fixings.QWD;
+
+public class QWDDateRange
+implements   Serializable
+{
+
+    public QWD qwd;
+    public DateRange dateRange;
+
+    public QWDDateRange(QWD qwd, DateRange dr) {
+        this.qwd = qwd;
+        this.dateRange = dr;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java	Thu Jul 26 11:47:04 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java	Thu Jul 26 14:12:38 2012 +0000
@@ -11,6 +11,8 @@
 import de.intevation.flys.artifacts.model.DataFacet;
 import de.intevation.flys.artifacts.model.FacetTypes;
 
+import de.intevation.flys.artifacts.model.QWDDateRange;
+
 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
 
 import de.intevation.flys.utils.KMIndex;
@@ -103,7 +105,7 @@
             if (qwdData == null) {
                 return null;
             }
-            return qwdData[sectorNdx];
+            return new QWDDateRange(qwdData[sectorNdx], periods[periodNdx].getDateRange());
         }
         else {
             logger.warn("Artifact is no instance of FLYSArtifact.");
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Thu Jul 26 11:47:04 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Thu Jul 26 14:12:38 2012 +0000
@@ -8,6 +8,7 @@
 import de.intevation.flys.artifacts.access.FixAnalysisAccess;
 import de.intevation.flys.artifacts.model.DateRange;
 import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.QWDDateRange;
 import de.intevation.flys.artifacts.model.fixings.QWD;
 import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.exports.TimeseriesChartGenerator;
@@ -46,6 +47,7 @@
 extends      TimeseriesChartGenerator
 implements   FacetTypes
 {
+    /** Private logger. */
     private static Logger logger =
         Logger.getLogger(FixDeltaWtGenerator.class);
 
@@ -217,23 +219,31 @@
     {
         logger.debug("doSectorAverageOut(): description = " + desc);
 
-        QWD qwd = (QWD) data;
+        QWDDateRange qwd = (QWDDateRange) data;
         TimeSeriesCollection tsc = new TimeSeriesCollection();
         TimeSeries        series = new StyledTimeSeries(desc, theme);
 
-        if (qwd == null) {
+        if (qwd == null || qwd.qwd == null || qwd.dateRange == null) {
             return;
         }
-        RegularTimePeriod rtp = new Day(qwd.getDate());
-        double value = qwd.getDeltaW();
+        RegularTimePeriod rtp = new Day(qwd.qwd.getDate());
+        double value = qwd.qwd.getDeltaW();
+        /*
+        // Draw a line spanning the analysis time.
         series.add(rtp, value);
+        rtp = new Day(qwd.dateRange.getFrom());
+        series.add(rtp, value);
+        rtp = new Day(qwd.dateRange.getTo());
+        series.add(rtp, value);
+        */
+
         tsc.addSeries(series);
 
         addAxisDataset(tsc, 0, visible);
         addAttribute(desc, "outline");
         Map<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>();
         annoIdxMap.put (0, new int[]{0,0});
-        doQWDTextAnnotations(annoIdxMap, tsc, new QWD[]{qwd}, theme, visible);
+        doQWDTextAnnotations(annoIdxMap, tsc, new QWD[]{qwd.qwd}, theme, visible);
     }
 
 

http://dive4elements.wald.intevation.org