changeset 8364:abef2584c9a7

Fetch current km from context (and remove obsolete or superfluous comments and logging).
author Tom Gottfried <tom@intevation.de>
date Thu, 02 Oct 2014 09:55:31 +0200 (2014-10-02)
parents 3508d625092f
children ebf74d92be38
files artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java
diffstat 2 files changed, 8 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java	Thu Oct 02 09:42:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java	Thu Oct 02 09:55:31 2014 +0200
@@ -1235,7 +1235,6 @@
      */
     public List<Output> getOutputs(Object context) {
         if (log.isDebugEnabled()) {
-            log.debug("##### Get Outputs for: " + identifier() + " #####");
             dumpArtifact();
         }
 
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Thu Oct 02 09:42:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Thu Oct 02 09:55:31 2014 +0200
@@ -22,7 +22,6 @@
 import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.exports.DiagramGenerator;
 import org.dive4elements.river.exports.StyledSeriesBuilder;
-import org.dive4elements.river.exports.fixings.FixChartGenerator;
 import org.dive4elements.river.exports.fixings.FixWQCurveGenerator;
 import org.dive4elements.river.java2d.ShapeUtils;
 import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation;
@@ -39,6 +38,7 @@
 import org.jfree.ui.RectangleInsets;
 import org.jfree.ui.TextAnchor;
 
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
 
 public class FixWQProcessor
 extends DefaultProcessor
@@ -59,7 +59,7 @@
         ThemeDocument theme,
         boolean visible
     ) {
-        // TODO: Simplyfy this processor and move general facets/data to 
+        // TODO: Simplify this processor and move general facets/data to
         // MiscDischargeProcessor or something...
         String facetType = bundle.getFacetName();
         logger.debug("facet: " + facetType + " name: " + bundle.getFacetDescription());
@@ -111,7 +111,6 @@
             DateFormat dateFormat = DateFormat.getDateInstance(
                 DateFormat.SHORT);
 
-            //TODO: W in cm at Gauge!!!
             series.add(qwd.getQ(), qwd.getW(), false);
 
             XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
@@ -150,13 +149,6 @@
             logger.debug("doAnalysisEventsOut: qwd == null");
             return;
         }
-// TODO: W in cm at Gauge!!!
-        //double gaugeDatum = getCurrentGaugeDatum();
-        //boolean atGauge = gaugeDatum != 0d;
-
-        //double factor = atGauge ? 100d : 1d;
-
-        //double w = factor*(qwd.getW()-gaugeDatum);
 
         // Force empty symbol.
         if (qwd.getInterpolated()) {
@@ -220,13 +212,6 @@
                 ? ShapeUtils.INTERPOLATED_SHAPE
                 : ShapeUtils.MEASURED_SHAPE);
 
-// TODO: W in cm at gauge!!!
-        //double gaugeDatum = getCurrentGaugeDatum();
-        //boolean atGauge = gaugeDatum != 0d;
-
-        //double factor = atGauge ? 100d : 1d;
-        //double w = factor*(qwd.getW()-gaugeDatum);
-
         series.add(qwd.getQ(), qwd.getW(), false);
 
         if (visible && theme.parseShowPointLabel()) {
@@ -275,29 +260,6 @@
                     500,   // number of samples
                     0.0 ,  // start
                     maxQ); // end
-
-            //TODO: W in cm at gauge!!!
-//            double gaugeDatum = getCurrentGaugeDatum();
-
-//            if (gaugeDatum == 0d) {
-                generator.addAxisSeries(series, axisName, visible);
-//            }
-/*            else {
-                StyledXYSeries series2 = JFreeUtil.sampleFunction2D(
-                        func.getFunction(),
-                        doc,
-                        aaf.getFacetDescription(),
-                        500,   // number of samples
-                        0.0 ,  // start
-                        maxQ); // end
-                addAxisSeries(series2, YAXIS.W.idx, false);
-                // Use second axis at cm if at gauge.
-                for (int i = 0, N = series.getItemCount(); i < N; i++) {
-                    series.updateByIndex(
-                        i, new Double(100d*(series.getY(i).doubleValue()-gaugeDatum)));
-                }
-                addAxisSeries(series, YAXIS.WCm.idx, visible);
-            }*/
         }
         else {
             logger.warn("doWQCurveOut: maxQ <= 0");
@@ -322,7 +284,7 @@
                 DateFormat.SHORT);
 
             List<XYTextAnnotation> annos = new ArrayList<XYTextAnnotation>();
-            //TODO: W in cm at Gauge!!!
+
             for (QWI qw: qws) {
                 series.add(qw.getQ(), qw.getW(), false);
 
@@ -469,24 +431,21 @@
         ThemeDocument    theme,
         boolean          visible
     ) {
-        logger.debug("FixWQCurveGenerator: doWQOut");
         Object data = bundle.getData(generator.getCallContext());
         if (data instanceof WQKms) {
             WQKms wqkms = (WQKms)data;
             // TODO As in doEventsOut, the value-searching should
-            // be delivered by the facet already (instead of in the Generator).
-            logger.debug("FixWQCurveGenerator: doWQOut: WQKms");
+            // be delivered by the facet already
             XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
-            // TODO: Remove dependency to FixChartGenerator. 
-            Double ckm = (Double) generator.getCallContext().getContextValue(FixChartGenerator.CURRENT_KM);
+            Double ckm = (Double) generator.getCallContext()
+                .getContextValue(CURRENT_KM);
+
             if (wqkms == null || wqkms.getKms().length == 0 || ckm == null) {
                 logger.info("addPointFromWQKms: No event data to show.");
                 return;
             }
+
             double[] kms = wqkms.getKms();
-            // TODO W in cm at gauge!!!
-            //double gaugeDatum = getCurrentGaugeDatum();
-            //double factor = (gaugeDatum == 0d) ? 1d : 100d;
             for (int i = 0 ; i< kms.length; i++) {
                 // TODO: Remove dependency to FixWQCurveGenerator.
                 if (Math.abs(kms[i] - ckm) <= FixWQCurveGenerator.EPSILON) {

http://dive4elements.wald.intevation.org