[Dive4elements-commits] [PATCH] Prophylactic fix for DeltaWt's before 1900

Wald Commits scm-commit at wald.intevation.org
Mon Jun 3 10:20:48 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1370247612 -7200
# Node ID 41cc83e5c2a2f373f6c6c3b718166aa6d28baf6a
# Parent  ebfc161cc5c41d6896d42ad737b0864661a81590
Prophylactic fix for DeltaWt's before 1900

    Use FixedMillectond for RegularTimePeriods to avoid
    a limitation in Jfreechart

diff -r ebfc161cc5c4 -r 41cc83e5c2a2 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java
--- 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);


More information about the Dive4elements-commits mailing list