changeset 3063:33c167d6fff6

Move marker generation to XYChartGenerator flys-artifacts/trunk@4643 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Tue, 12 Jun 2012 13:20:48 +0000
parents 7660cfe5e8f6
children 478e8d9d88ba
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java
diffstat 4 files changed, 34 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jun 12 12:40:44 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jun 12 13:20:48 2012 +0000
@@ -1,3 +1,12 @@
+2012-06-12	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java:
+	  Use KMIndex.search() (with epsilon) instead of KMIndex.binarySearch().
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java,
+	  src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
+	  Move marker generation to XYChartGenerator.
+
 2012-06-12	Christian Lins	<christian.lins@intevation.de>
 
 	* doc/conf/conf.xml:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java	Tue Jun 12 12:40:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java	Tue Jun 12 13:20:48 2012 +0000
@@ -72,7 +72,7 @@
 
             KMIndex<AnalysisPeriod []> kmPeriods = result.getAnalysisPeriods();
             KMIndex.Entry<AnalysisPeriod []> kmPeriodsEntry =
-                kmPeriods.binarySearch(km);
+                kmPeriods.search(km);
 
             if (kmPeriodsEntry == null) {
                 return null;
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Jun 12 12:40:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Jun 12 13:20:48 2012 +0000
@@ -81,6 +81,8 @@
         protected int axisSymbol;
         /** List of assigned datasets (in order). */
         protected List<XYDataset> datasets;
+        /** List of assigned vertical markers */
+        protected List<Marker> domainMarkers = new ArrayList<Marker>();
         /** Range to use to include all given datasets. */
         protected Range range;
         /** Index of axis in plot. */
@@ -235,6 +237,8 @@
 
         //debugDatasets(plot);
 
+        addMarkers(plot);
+
         recoverEmptyPlot(plot);
         preparePointRanges(plot);
 
@@ -356,6 +360,25 @@
         }
     }
 
+ 
+    /**
+     * Add the given vertical marker to the chart.
+     */
+    public void addDomainMarker(Marker marker) {
+        if (marker == null) {
+            return null;
+        }
+
+        this.domainMarkers.add(marker);
+    }
+
+
+    protected void addMarkers(XYPlot plot) {
+        for(Marker marker : domainMarkers) {
+            plot.addDomainMarker(plot);
+        }
+    }
+
 
     /**
      * Effect: extend range of x axis to include given limits.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Tue Jun 12 12:40:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Tue Jun 12 13:20:48 2012 +0000
@@ -17,7 +17,6 @@
 
 import org.apache.log4j.Logger;
 
-import org.jfree.chart.JFreeChart;
 import org.jfree.chart.plot.ValueMarker;
 import org.jfree.data.general.DatasetUtilities;
 import org.jfree.data.xy.XYSeries;
@@ -97,9 +96,8 @@
        
         if(qwds != null) {
             // Draw vertical markers
-            JFreeChart chart = generateChart();
             for(QWD qwd : qwds) {
-                chart.getXYPlot().addDomainMarker(new ValueMarker(qwd.getQ()));
+                addDomainMarker(new ValueMarker(qwd.getQ()));
             }
         }
     }

http://dive4elements.wald.intevation.org