diff artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java @ 8860:28df64078f27

Merge with 0862ea5d66baf60e7eee496d130a35157cc9ec12
author gernotbelger
date Fri, 19 Jan 2018 11:23:42 +0100
parents a805211690f7
children 1cc7653ca84f 0a5239a1e46e
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Thu Jan 18 18:34:41 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Fri Jan 19 11:23:42 2018 +0100
@@ -1,3 +1,11 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
 package org.dive4elements.river.exports.process;
 
 import java.awt.BasicStroke;
@@ -62,7 +70,8 @@
         // TODO: Simplify this processor and move general facets/data to
         // MiscDischargeProcessor or something...
         String facetType = bundle.getFacetName();
-        log.debug("facet: " + facetType + " name: " + bundle.getFacetDescription());
+        log.debug("facet: " + facetType
+            + " name: " + bundle.getFacetDescription());
         if(facetType.startsWith(FIX_SECTOR_AVERAGE_WQ)) {
             doSectorAverageOut(generator, bundle, theme, visible);
         }
@@ -101,7 +110,8 @@
         boolean visible
     ) {
         log.debug("doSectorAverageOut");
-        QWDDateRange qwdd = (QWDDateRange)bundle.getData(generator.getCallContext());
+        QWDDateRange qwdd = (QWDDateRange)bundle.getData(
+            generator.getCallContext());
         QWD qwd = qwdd != null ? qwdd.getQWD() : null;
 
         if(qwd != null) {
@@ -153,7 +163,7 @@
 
         // Force empty symbol.
         if (qwd.getInterpolated()) {
-            theme = new ThemeDocument(theme); // prevent potential side effects.
+            theme = new ThemeDocument(theme); // prevent potential side effects
             theme.setValue(ThemeDocument.USE_FILL_PAINT, "true");
         }
 
@@ -170,7 +180,8 @@
 
         if (visible && theme.parseShowPointLabel()) {
 
-            List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+            List<XYTextAnnotation> textAnnos =
+                new ArrayList<XYTextAnnotation>();
 
             DateFormat dateFormat = DateFormat.getDateInstance(
                 DateFormat.SHORT);
@@ -180,7 +191,8 @@
                 qwd.getW());
             textAnnos.add(anno);
 
-            RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme);
+            RiverAnnotation flysAnno =
+                new RiverAnnotation(null, null, null, theme);
             flysAnno.setTextAnnotations(textAnnos);
             generator.addAnnotations(flysAnno);
         }
@@ -196,13 +208,14 @@
 
         QWI qwd = (QWI)bundle.getData(generator.getCallContext());
         if (qwd == null) {
-            log.debug("doReferenceEventsOut: qwds == null in " + bundle.getFacetDescription());
+            log.debug("doReferenceEventsOut: qwds == null in "
+                + bundle.getFacetDescription());
             return;
         }
 
         // Force empty symbol.
         if (qwd.getInterpolated()) {
-            theme = new ThemeDocument(theme); // prevent potential side effects.
+            theme = new ThemeDocument(theme); // prevent potential side effects
             theme.setValue(ThemeDocument.USE_FILL_PAINT, "true");
         }
 
@@ -224,9 +237,11 @@
                 qwd.getQ(),
                 qwd.getW());
 
-            List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+            List<XYTextAnnotation> textAnnos =
+                new ArrayList<XYTextAnnotation>();
             textAnnos.add(anno);
-            RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme);
+            RiverAnnotation flysAnno =
+                new RiverAnnotation(null, null, null, theme);
             flysAnno.setTextAnnotations(textAnnos);
             generator.addAnnotations(flysAnno);
         }
@@ -330,7 +345,9 @@
         }
 
         List<?> qsectorsList = (List<?>) qsectorsObj;
-        if (qsectorsList.size() == 0 || !(qsectorsList.get(0) instanceof NamedDouble)) {
+        if (qsectorsList.size() == 0
+            || !(qsectorsList.get(0) instanceof NamedDouble)
+        ) {
             log.warn("No QSectors coming from data.");
             return;
         }
@@ -394,8 +411,10 @@
             log.debug("Got double[][]");
             double [][] values = (double [][]) data;
             for (int i = 0; i< values[0].length; i++) {
-                xy.add(new StickyAxisAnnotation(bundle.getFacetDescription(),
-                        (float) values[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+                xy.add(new StickyAxisAnnotation(
+                        bundle.getFacetDescription(),
+                        (float) values[1][i],
+                        StickyAxisAnnotation.SimpleAxis.Y_AXIS));
             }
 
             if (visible) {
@@ -411,7 +430,8 @@
             WKms wkms = (WKms) data;
 
             Double ckm =
-                (Double) generator.getCallContext().getContextValue(FixChartGenerator.CURRENT_KM);
+                (Double)generator.getCallContext().getContextValue(
+                    FixChartGenerator.CURRENT_KM);
             double location = (ckm != null)
                     ? ckm.doubleValue()
                     : getRange()[0];
@@ -439,7 +459,8 @@
             WQKms wqkms = (WQKms)data;
             // TODO As in doEventsOut, the value-searching should
             // be delivered by the facet already
-            XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+            XYSeries series = new StyledXYSeries(
+                bundle.getFacetDescription(), theme);
             Double ckm = (Double) generator.getCallContext()
                 .getContextValue(CURRENT_KM);
 
@@ -456,13 +477,16 @@
                     series.add(wqkms.getQ(i), wqkms.getW(i), false);
                     generator.addAxisSeries(series, axisName, visible);
                     if(visible && theme.parseShowPointLabel()) {
-                        List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
-                        XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
-                            bundle.getFacetDescription(),
-                            wqkms.getQ(i),
-                            wqkms.getW(i));
+                        List<XYTextAnnotation> textAnnos =
+                            new ArrayList<XYTextAnnotation>();
+                        XYTextAnnotation anno =
+                            new CollisionFreeXYTextAnnotation(
+                                bundle.getFacetDescription(),
+                                wqkms.getQ(i),
+                                wqkms.getW(i));
                         textAnnos.add(anno);
-                        RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme);
+                        RiverAnnotation flysAnno =
+                            new RiverAnnotation(null, null, null, theme);
                         flysAnno.setTextAnnotations(textAnnos);
                         generator.addAnnotations(flysAnno);
                     }
@@ -474,7 +498,8 @@
             log.debug("FixWQCurveGenerator: doWQOut: double[][]");
             double [][] values = (double [][]) data;
 
-            XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), false, true, theme);
+            XYSeries series = new StyledXYSeries(
+                bundle.getFacetDescription(), false, true, theme);
             StyledSeriesBuilder.addPoints(series, values, true);
 
             generator.addAxisSeries(series, axisName, visible);
@@ -502,7 +527,8 @@
     public String getAxisLabel(DiagramGenerator generator) {
         CallMeta meta = generator.getCallContext().getMeta();
 
-        RiverAccess access = new RiverAccess((D4EArtifact)generator.getMaster());
+        RiverAccess access = new RiverAccess((D4EArtifact)generator
+            .getMaster());
         String unit = access.getRiver().getWstUnit().getName();
         return Resources.getMsg(
                 meta,

http://dive4elements.wald.intevation.org