changeset 6159:41cc83e5c2a2

Prophylactic fix for DeltaWt's before 1900 Use FixedMillectond for RegularTimePeriods to avoid a limitation in Jfreechart
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 03 Jun 2013 10:20:12 +0200
parents ebfc161cc5c4
children 938d0ce85b33
files artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java	Mon Jun 03 10:01:28 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java	Mon Jun 03 10:20:12 2013 +0200
@@ -37,6 +37,7 @@
 import org.jfree.chart.annotations.XYTextAnnotation;
 import org.jfree.data.time.Day;
 import org.jfree.data.time.RegularTimePeriod;
+import org.jfree.data.time.FixedMillisecond;
 import org.jfree.data.time.TimeSeries;
 import org.jfree.data.time.TimeSeriesCollection;
 import org.w3c.dom.Document;
@@ -237,8 +238,8 @@
             FixAnalysisAccess access = new FixAnalysisAccess(artifact);
             DateRange refRange  = access.getReferencePeriod();
 
-            RegularTimePeriod start = new Day(refRange.getFrom());
-            RegularTimePeriod end = new Day(refRange.getTo());
+            RegularTimePeriod start = new FixedMillisecond(refRange.getFrom());
+            RegularTimePeriod end = new FixedMillisecond(refRange.getTo());
             StyledDomainMarker marker = new StyledDomainMarker(
                     start.getMiddleMillisecond(),
                     end.getMiddleMillisecond(),
@@ -264,7 +265,7 @@
         if (qwd == null || qwd.qwd == null || qwd.dateRange == null) {
             return;
         }
-        RegularTimePeriod rtp = new Day(qwd.qwd.getDate());
+        RegularTimePeriod rtp = new FixedMillisecond(qwd.qwd.getDate());
         double value = qwd.qwd.getDeltaW();
 
         // Draw a line spanning the analysis time.
@@ -323,7 +324,7 @@
 
         int idxInterpol = 0;
         int idxRegular = 0;
-        RegularTimePeriod rtp = new Day(qwd.getDate());
+        RegularTimePeriod rtp = new FixedMillisecond(qwd.getDate());
         double value =  qwd.getDeltaW();
         boolean interpolate = qwd.getInterpolated();
         if (interpolate) {
@@ -437,8 +438,8 @@
         }
         for (int i = 0; i < ranges.length; i++) {
             logger.debug("creating domain marker");
-            RegularTimePeriod start = new Day(ranges[i].getFrom());
-            RegularTimePeriod end = new Day(ranges[i].getTo());
+            RegularTimePeriod start = new FixedMillisecond(ranges[i].getFrom());
+            RegularTimePeriod end = new FixedMillisecond(ranges[i].getTo());
             StyledDomainMarker marker =
                     new StyledDomainMarker(start.getMiddleMillisecond(),
                             end.getMiddleMillisecond(), theme);

http://dive4elements.wald.intevation.org