changeset 3770:6a08f4dc790b

Manual Points for fixing charts (not working yet) flys-artifacts/trunk@5475 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Sat, 15 Sep 2012 07:07:51 +0000
parents 728ecd2afa20
children 04309ca24614
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/doc/conf/artifacts/manualpoints.xml flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java
diffstat 6 files changed, 186 insertions(+), 163 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 14 14:20:42 2012 +0000
+++ b/flys-artifacts/ChangeLog	Sat Sep 15 07:07:51 2012 +0000
@@ -1,3 +1,12 @@
+2012-09-15	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml,
+	  doc/conf/artifacts/manualpoints.xml,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java:
+	  Try to add support for ManualPoints in fixing charts (not working yet).  
+
 2012-09-14  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurementFactory.java:
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Fri Sep 14 14:20:42 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Sat Sep 15 07:07:51 2012 +0000
@@ -158,6 +158,7 @@
                         <facet name="other.wq"    description="Point-like data like fixations"/>
                         <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points"/>
                         <facet name="discharge_curve.curve" description="facet.discharge_curve.curve"/>
+                        <facet name="fix_wq_curve.manualpoints" description="Manual points"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_deltawt_curve" description="output.fix_deltawt_curve" mine-type="image/png" type="chart">
@@ -170,6 +171,7 @@
                         <facet name="fix_reference_events_dwt" description="Raw event values used in the calculation"/>
                         <facet name="fix_analysis_periods_dwt" description="Dateranges of analysis periods."/>
                         <facet name="fix_deviation_dwt" description="The standard variance"/>
+                        <facet name="fix_deltawt_curve.manualpoints" description="Manual points"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_longitudinal_section_curve" description="output.fix_longitudinal_section_curve" mine-type="image/png" type="chart">
@@ -186,12 +188,13 @@
                         <facet name="fix_deviation_ls" description="The standard variance"/>
                         <facet name="fix_analysis_events_ls" description="Average values for Ws in Q sectors."/>
                         <facet name="fix_reference_events_ls" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_longitudinal_section_curve.manualpoints" description="Manual points"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_derivate_curve" description="output.fix_derivate_curve" mine-type="image/png" type="chart">
                     <facets>
                         <facet name="fix_derivate" description="Derivate curve"/>
-                        <facet name="fix_derivate.manualpoints" description="Manual points"/>
+                        <facet name="fix_derivate_curve.manualpoints" description="Manual points"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_report" description="output.fix_report.report" mime-type="text/plain" type="report">
--- a/flys-artifacts/doc/conf/artifacts/manualpoints.xml	Fri Sep 14 14:20:42 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/manualpoints.xml	Sat Sep 15 07:07:51 2012 +0000
@@ -18,6 +18,10 @@
             <facet name="reference_curve_normalized.manualpoints" description="points"/>
             <facet name="historical_discharge.manualpoints" description="Points provided by user." />
             <facet name="cross_section.manualline" description="Lines provided by user." />
+            <facet name="fix_wq_curve.manualpoints" description="Points provided by user." />
+            <facet name="fix_deltawt_curve.manualpoints" description="Points provided by user." />
+            <facet name="fix_longitudinal_section_curve.manualpoints" description="Points provided by user." />
+            <facet name="fix_derivate_curve.manualpoints" description="Points provided by user." />
           </facets>
         </outputmode>
       </outputmodes>
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Fri Sep 14 14:20:42 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Sat Sep 15 07:07:51 2012 +0000
@@ -195,6 +195,11 @@
                     theme,
                     visible);
         }
+        else if (FacetTypes.IS.MANUALPOINTS(name)) {
+            doPoints (artifactFacet.getData(context),
+                    artifactFacet,
+                    theme, visible, YAXIS.dW.idx);
+        }
         else {
             logger.warn("doOut(): unknown facet name: " + name);
             return;
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Fri Sep 14 14:20:42 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Sat Sep 15 07:07:51 2012 +0000
@@ -1,60 +1,52 @@
 package de.intevation.flys.exports.fixings;
 
-import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-
-import de.intevation.flys.artifacts.model.FacetTypes;
-
-import de.intevation.flys.artifacts.model.fixings.AnalysisPeriod;
-import de.intevation.flys.artifacts.model.fixings.QWD;
-
-import de.intevation.flys.exports.ChartGenerator;
-
-import de.intevation.flys.jfree.FLYSAnnotation;
-import de.intevation.flys.jfree.StyledAreaSeriesCollection;
-import de.intevation.flys.jfree.StyledXYSeries;
-
-import de.intevation.flys.utils.KMIndex;
-
 import java.awt.BasicStroke;
 import java.awt.Color;
 
 import org.apache.log4j.Logger;
-
 import org.jfree.chart.plot.Marker;
 import org.jfree.chart.plot.ValueMarker;
-
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
+import org.w3c.dom.Document;
 
-import org.w3c.dom.Document;
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.fixings.AnalysisPeriod;
+import de.intevation.flys.artifacts.model.fixings.QWD;
+import de.intevation.flys.exports.ChartGenerator;
+import de.intevation.flys.jfree.FLYSAnnotation;
+import de.intevation.flys.jfree.StyledAreaSeriesCollection;
+import de.intevation.flys.jfree.StyledXYSeries;
+import de.intevation.flys.utils.KMIndex;
 
 public class FixLongitudinalSectionGenerator
 extends FixChartGenerator
 implements FacetTypes
 {
     private static Logger logger =
-        Logger.getLogger(FixLongitudinalSectionGenerator.class);
+            Logger.getLogger(FixLongitudinalSectionGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.fixings.longitudinalsection.title";
+            "chart.fixings.longitudinalsection.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.fixings.longitudinalsection.subtitle";
+            "chart.fixings.longitudinalsection.subtitle";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.fixings.longitudinalsection.xaxis.label";
+            "chart.fixings.longitudinalsection.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.fixings.longitudinalsection.yaxis.label";
+            "chart.fixings.longitudinalsection.yaxis.label";
 
     public static final String I18N_CHART_TITLE_DEFAULT  =
-        "Fixierungsanalyse";
+            "Fixierungsanalyse";
 
     public static final String I18N_XAXIS_LABEL_DEFAULT  =
-        "[km]";
+            "[km]";
 
     public static final String I18N_YAXIS_LABEL_DEFAULT  =
-        "delta W [cm]";
+            "delta W [cm]";
 
     public static enum YAXIS {
         dW(0);
@@ -86,10 +78,15 @@
         }
         else if (name.equals(LONGITUDINAL_ANNOTATION)) {
             doAnnotations(
-                 (FLYSAnnotation) aaf.getData(context),
-                 aaf,
-                 doc,
-                 visible);
+                    (FLYSAnnotation) aaf.getData(context),
+                    aaf,
+                    doc,
+                    visible);
+        }
+        else if (FacetTypes.IS.MANUALPOINTS(name)) {
+            doPoints (aaf.getData(context),
+                    aaf,
+                    doc, visible, YAXIS.dW.idx);
         }
         else {
             logger.warn("Unknown facet name " + name);
@@ -99,9 +96,9 @@
 
     @SuppressWarnings("unchecked")
     protected void doSectorAverageOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex());
 
@@ -109,7 +106,7 @@
         int sectorNdx = index & 3;
 
         KMIndex<AnalysisPeriod> kms =
-            (KMIndex<AnalysisPeriod>)aaf.getData(context);
+                (KMIndex<AnalysisPeriod>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -135,9 +132,9 @@
 
     @SuppressWarnings("unchecked")
     protected void doSectorAverageDeviationOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex());
 
@@ -145,7 +142,7 @@
         int sectorNdx = index & 3;
 
         KMIndex<AnalysisPeriod> kms =
-            (KMIndex<AnalysisPeriod>)aaf.getData(context);
+                (KMIndex<AnalysisPeriod>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -153,9 +150,9 @@
 
         StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(doc);
         XYSeries upper =
-            new StyledXYSeries(aaf.getFacetDescription(), false, doc);
+                new StyledXYSeries(aaf.getFacetDescription(), false, doc);
         XYSeries lower =
-            new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
+                new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
 
 
         for (KMIndex.Entry<AnalysisPeriod> entry: kms) {
@@ -182,14 +179,14 @@
 
     @SuppressWarnings("unchecked")
     protected void doReferenceDeviationOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doReferenceOut");
 
         KMIndex<double[]> kms =
-            (KMIndex<double[]>)aaf.getData(context);
+                (KMIndex<double[]>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -197,9 +194,9 @@
 
         StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(doc);
         XYSeries upper =
-            new StyledXYSeries(aaf.getFacetDescription(), false, doc);
+                new StyledXYSeries(aaf.getFacetDescription(), false, doc);
         XYSeries lower =
-            new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
+                new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
 
 
         for (KMIndex.Entry<double[]> entry: kms) {
@@ -226,14 +223,14 @@
 
     @SuppressWarnings("unchecked")
     protected void doAnalysisEventsOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doAnalysisEventsOut");
 
         KMIndex<QWD> kms =
-            (KMIndex<QWD>)aaf.getData(context);
+                (KMIndex<QWD>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -247,7 +244,7 @@
             double km = entry.getKm();
             QWD qwd = entry.getValue();
 
-                series.add(km, qwd.getDeltaW());
+            series.add(km, qwd.getDeltaW());
         }
         col.addSeries(series);
 
@@ -256,14 +253,14 @@
 
     @SuppressWarnings("unchecked")
     protected void doReferenceEventsOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doReferenceEventOut");
 
         KMIndex<QWD> kms =
-            (KMIndex<QWD>)aaf.getData(context);
+                (KMIndex<QWD>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -309,7 +306,7 @@
             }
 
             @Override
-             public String getId(int idx) {
+            public String getId(int idx) {
                 YAXIS[] yaxes = YAXIS.values();
                 return yaxes[idx].toString();
             }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Fri Sep 14 14:20:42 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Sat Sep 15 07:07:51 2012 +0000
@@ -1,5 +1,22 @@
 package de.intevation.flys.exports.fixings;
 
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.annotations.XYTextAnnotation;
+import org.jfree.chart.plot.Marker;
+import org.jfree.chart.plot.ValueMarker;
+import org.jfree.chart.title.TextTitle;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.ui.RectangleAnchor;
+import org.jfree.ui.TextAnchor;
+import org.w3c.dom.Document;
+
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.flys.artifacts.FLYSArtifact;
@@ -14,8 +31,8 @@
 import de.intevation.flys.artifacts.model.WQKms;
 import de.intevation.flys.artifacts.model.fixings.FixFunction;
 import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet;
+import de.intevation.flys.artifacts.model.fixings.QWD;
 import de.intevation.flys.artifacts.model.fixings.QWI;
-import de.intevation.flys.artifacts.model.fixings.QWD;
 import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.exports.ChartGenerator;
 import de.intevation.flys.exports.StyledSeriesBuilder;
@@ -24,31 +41,10 @@
 import de.intevation.flys.jfree.JFreeUtil;
 import de.intevation.flys.jfree.StickyAxisAnnotation;
 import de.intevation.flys.jfree.StyledXYSeries;
-import de.intevation.flys.utils.ThemeUtil;
-import de.intevation.flys.utils.FLYSUtils;
-
 import de.intevation.flys.model.Gauge;
 import de.intevation.flys.model.River;
-
-import org.jfree.chart.plot.Marker;
-import org.jfree.chart.plot.ValueMarker;
-import org.jfree.ui.RectangleAnchor;
-import org.jfree.ui.TextAnchor;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-
-
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.annotations.XYTextAnnotation;
-import org.jfree.chart.title.TextTitle;
-import org.jfree.data.xy.XYSeries;
-import org.w3c.dom.Document;
+import de.intevation.flys.utils.FLYSUtils;
+import de.intevation.flys.utils.ThemeUtil;
 
 /**
  * Generator for WQ fixing charts.
@@ -59,31 +55,31 @@
 implements   FacetTypes
 {
     private static Logger logger =
-        Logger.getLogger(FixWQCurveGenerator.class);
+            Logger.getLogger(FixWQCurveGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.fixings.wq.title";
+            "chart.fixings.wq.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.fixings.wq.subtitle";
+            "chart.fixings.wq.subtitle";
 
     public static final String I18N_CHART_SUBTITLE1 =
-        "chart.fixings.wq.subtitle1";
+            "chart.fixings.wq.subtitle1";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.fixings.wq.xaxis.label";
+            "chart.fixings.wq.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.fixings.wq.yaxis.label";
+            "chart.fixings.wq.yaxis.label";
 
     public static final String I18N_CHART_TITLE_DEFAULT  =
-        "Fixierungsanalyse";
+            "Fixierungsanalyse";
 
     public static final String I18N_XAXIS_LABEL_DEFAULT  =
-        "Q [m\u00B3/s]";
+            "Q [m\u00B3/s]";
 
     public static final String I18N_YAXIS_LABEL_DEFAULT  =
-        "W [NN + m]";
+            "W [NN + m]";
 
     public static enum YAXIS {
         W(0),
@@ -132,16 +128,21 @@
                     doc,
                     visible);
         }
-        if (LONGITUDINAL_W.equals(name) || STATIC_WQ.equals(name)) {
+        else if (LONGITUDINAL_W.equals(name) || STATIC_WQ.equals(name)) {
             doWQOut(aaf.getData(context), aaf, doc, visible);
         }
         else if (name.equals(DISCHARGE_CURVE)) {
             doDischargeOut(
-                (WINFOArtifact) aaf.getArtifact(),
-                aaf.getData(context),
-                aaf.getFacetDescription(),
-                doc,
-                visible);
+                    (WINFOArtifact) aaf.getArtifact(),
+                    aaf.getData(context),
+                    aaf.getFacetDescription(),
+                    doc,
+                    visible);
+        }
+        else if (FacetTypes.IS.MANUALPOINTS(aaf.getFacetName())) {
+            doPoints(aaf.getData(context),
+                    aaf,
+                    doc, visible, YAXIS.W.idx);
         }
         else {
             logger.warn("Unknown facet name " + name);
@@ -174,15 +175,15 @@
             List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
 
             DateFormat dateFormat = DateFormat.getDateInstance(
-                DateFormat.SHORT);
+                    DateFormat.SHORT);
 
-                series.add(qwd.getQ(), qwd.getW());
+            series.add(qwd.getQ(), qwd.getW());
 
-                XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
+            XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
                     dateFormat.format(qwd.getDate()),
                     qwd.getQ(),
                     qwd.getW());
-                textAnnos.add(anno);
+            textAnnos.add(anno);
 
             addAxisSeries(series, 0, visible);
             if(visible && ThemeUtil.parseShowPointLabel(doc)) {
@@ -198,22 +199,22 @@
 
     /** Add reference event points to chart */
     protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
-       logger.debug("doReferenceEventsOut");
+        logger.debug("doReferenceEventsOut");
 
-       QWI qwd = (QWI)aaf.getData(context);
-       if(qwd != null) {
+        QWI qwd = (QWI)aaf.getData(context);
+        if(qwd != null) {
             XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc);
             List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
 
             DateFormat dateFormat = DateFormat.getDateInstance(
-                DateFormat.SHORT);
+                    DateFormat.SHORT);
 
             series.add(qwd.getQ(), qwd.getW());
 
             XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
-                dateFormat.format(qwd.getDate()),
-                qwd.getQ(),
-                qwd.getW());
+                    dateFormat.format(qwd.getDate()),
+                    qwd.getQ(),
+                    qwd.getW());
             textAnnos.add(anno);
 
             addAxisSeries(series, 0, visible);
@@ -233,7 +234,7 @@
 
         FixWQCurveFacet facet = (FixWQCurveFacet)aaf.getFacet();
         FixFunction func = (FixFunction)facet.getData(
-            aaf.getArtifact(), context);
+                aaf.getArtifact(), context);
 
         if (func == null) {
             logger.warn("doWQCurveOut: Facet does not contain FixFunction");
@@ -244,12 +245,12 @@
 
         if (maxQ > 0) {
             StyledXYSeries series = JFreeUtil.sampleFunction2D(
-                func.getFunction(),
-                doc,
-                aaf.getFacetDescription(),
-                500,   // number of samples
-                0.0 ,  // start
-                maxQ); // end
+                    func.getFunction(),
+                    doc,
+                    aaf.getFacetDescription(),
+                    500,   // number of samples
+                    0.0 ,  // start
+                    maxQ); // end
 
             addAxisSeries(series, 0, visible);
         }
@@ -273,12 +274,21 @@
             return;
         }
 
-        List<NamedDouble> qsectors = (List<NamedDouble>) aaf.getData(context);
-
-        if (qsectors == null) {
+        Object qsectorsObj = aaf.getData(context);
+        if (qsectorsObj == null || !(qsectorsObj instanceof List)) {
             logger.warn("No QSectors coming from data.");
             return;
         }
+
+        List<?> qsectorsList = (List<?>) qsectorsObj;
+        if (qsectorsList.size() == 0 || !(qsectorsList.get(0) instanceof NamedDouble)) {
+            logger.warn("No QSectors coming from data.");
+            return;
+        }
+
+        @SuppressWarnings("unchecked")
+        List<NamedDouble> qsectors = (List<NamedDouble>) qsectorsList;
+
         for (NamedDouble qsector : qsectors) {
             if (Double.isNaN(qsector.getValue())) {
                 continue;
@@ -294,11 +304,11 @@
             }
             else {
                 stroke = new BasicStroke(size,
-                    BasicStroke.CAP_BUTT,
-                    BasicStroke.JOIN_ROUND,
-                    1.0f,
-                    dashes,
-                    0.0f);
+                        BasicStroke.CAP_BUTT,
+                        BasicStroke.JOIN_ROUND,
+                        1.0f,
+                        dashes,
+                        0.0f);
             }
             m.setStroke(stroke);
 
@@ -324,11 +334,11 @@
      * @param theme theme to use.
      */
     protected void doWAnnotations(
-        Object   wqkms,
-        ArtifactAndFacet aandf,
-        Document theme,
-        boolean  visible
-    ) {
+            Object   wqkms,
+            ArtifactAndFacet aandf,
+            Document theme,
+            boolean  visible
+            ) {
         Facet facet = aandf.getFacet();
 
         List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>();
@@ -337,11 +347,11 @@
             double [][] data = (double [][]) wqkms;
             for (int i = 0; i< data[0].length; i++) {
                 xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
-                    (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+                        (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
             }
 
             doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
-                aandf, theme, visible);
+                    aandf, theme, visible);
         }
         else {
             // Assume its WKms.
@@ -350,15 +360,14 @@
 
             Double ckm = (Double) context.getContextValue(CURRENT_KM);
             double location = (ckm != null)
-                              ? ckm.doubleValue()
-                              : getRange()[0];
-            double w = ((StaticWKmsArtifact) aandf.getArtifact())
-                .getWAtKmLin(data, location);
-            xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
-              (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+                    ? ckm.doubleValue()
+                            : getRange()[0];
+                    double w = StaticWKmsArtifact.getWAtKmLin(data, location);
+                    xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
+                            (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS));
 
-            doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
-                aandf, theme, visible);
+                    doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
+                            aandf, theme, visible);
         }
     }
 
@@ -367,11 +376,11 @@
      * Add series with discharge curve to diagram.
      */
     protected void doDischargeOut(
-        WINFOArtifact artifact,
-        Object        o,
-        String        description,
-        Document      theme,
-        boolean       visible)
+            WINFOArtifact artifact,
+            Object        o,
+            String        description,
+            Document      theme,
+            boolean       visible)
     {
         WQKms wqkms = (WQKms) o;
 
@@ -392,9 +401,7 @@
         }
 
         XYSeries series = new StyledXYSeries(description, theme);
-
         StyledSeriesBuilder.addPointsQW(series, wqkms);
-
         addAxisSeries(series, YAXIS.W.idx, visible);
     }
 
@@ -404,18 +411,16 @@
      * @param wqkms data as double[][]
      */
     protected void doWQOut(
-        Object           wqkms,
-        ArtifactAndFacet aaf,
-        Document         theme,
-        boolean          visible
-    ) {
+            Object           wqkms,
+            ArtifactAndFacet aaf,
+            Document         theme,
+            boolean          visible
+            ) {
         logger.debug("FixWQCurveGenerator: doWQOut");
         if (wqkms instanceof WQKms) {
             WQKms data = (WQKms) wqkms;
 
             XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
-            Double ckm = (Double) context.getContextValue(CURRENT_KM);
-
             StyledSeriesBuilder.addPointsQW(series, data);
 
             addAxisSeries(series, YAXIS.W.idx, visible);
@@ -432,36 +437,36 @@
 
 
     protected void addQWSeries(
-        QWI []           qws,
-        ArtifactAndFacet aaf,
-        Document         theme,
-        boolean          visible
-    ) {
+            QWI []           qws,
+            ArtifactAndFacet aaf,
+            Document         theme,
+            boolean          visible
+            ) {
         if (qws == null) {
             return;
         }
 
         XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
         List<XYTextAnnotation> textAnnos =
-            new ArrayList<XYTextAnnotation>(qws.length);
+                new ArrayList<XYTextAnnotation>(qws.length);
 
         DateFormat dateFormat = DateFormat.getDateInstance(
-            DateFormat.SHORT);
+                DateFormat.SHORT);
 
         for (QWI qw: qws) {
             series.add(qw.getQ(), qw.getW());
 
             XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
-                dateFormat.format(qw.getDate()),
-                qw.getQ(),
-                qw.getW());
+                    dateFormat.format(qw.getDate()),
+                    qw.getQ(),
+                    qw.getW());
             textAnnos.add(anno);
         }
 
         addAxisSeries(series, 0, visible);
         if (visible && ThemeUtil.parseShowPointLabel(theme)) {
             FLYSAnnotation flysAnno =
-                new FLYSAnnotation(null, null, null, theme);
+                    new FLYSAnnotation(null, null, null, theme);
             flysAnno.setTextAnnotations(textAnnos);
             addAnnotations(flysAnno);
         }
@@ -554,7 +559,7 @@
             }
 
             @Override
-             public String getId(int idx) {
+            public String getId(int idx) {
                 YAXIS[] yaxes = YAXIS.values();
                 return yaxes[idx].toString();
             }

http://dive4elements.wald.intevation.org