changeset 4468:2e8638567c49

FlowVelocityGenerator: Handle new discharge curves at new third axis.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 09 Nov 2012 12:09:23 +0100
parents 10e7bd292c47
children c40a85397117
files flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java
diffstat 1 files changed, 46 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java	Fri Nov 09 12:08:52 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java	Fri Nov 09 12:09:23 2012 +0100
@@ -32,7 +32,8 @@
 {
     public enum YAXIS {
         V(0),
-        T(1);
+        T(1),
+        Q(2);
         /* TODO Q and Density will come as 4th and 3rd axis. */
         protected int idx;
         private YAXIS(int c) {
@@ -77,10 +78,14 @@
     public static final String I18N_2YAXIS_LABEL =
         "chart.flow_velocity.section.yaxis.second.label";
 
+    public static final String I18N_3YAXIS_LABEL =
+        "chart.flow_velocity.section.yaxis.third.label";
+
     public static final String I18N_CHART_TITLE_DEFAULT  = "Geschwindigkeit- und Schubspannung";
     public static final String I18N_XAXIS_LABEL_DEFAULT  = "km";
     public static final String I18N_YAXIS_LABEL_DEFAULT  = "Geschwindigkeit v [m/s]";
     public static final String I18N_2YAXIS_LABEL_DEFAULT = "Schubspannung Tau [N]";
+    public static final String I18N_3YAXIS_LABEL_DEFAULT = "Q [m³/s]";
 
 
     @Override
@@ -139,6 +144,9 @@
         else if (index == YAXIS.T.idx) {
             label = getTAxisLabel();
         }
+        else if (index == YAXIS.Q.idx) {
+            label = getQAxisLabel();
+        }
 
         return label;
     }
@@ -155,6 +163,13 @@
     /**
      * Get internationalized label for the y axis.
      */
+    protected String getQAxisLabel() {
+        return msg(I18N_3YAXIS_LABEL, I18N_3YAXIS_LABEL_DEFAULT);
+    }
+
+    /**
+     * Get internationalized label for the y axis.
+     */
     protected String getTAxisLabel() {
         return msg(I18N_2YAXIS_LABEL, I18N_2YAXIS_LABEL_DEFAULT);
     }
@@ -200,6 +215,13 @@
                 attr,
                 visible);
         }
+        else if (name.equals(FLOW_VELOCITY_DISCHARGE)) {
+            doQOut(
+                (FlowVelocityData) artifactAndFacet.getData(context),
+                artifactAndFacet,
+                attr,
+                visible);
+        }
         else if (name.equals(FLOW_VELOCITY_TAU)) {
             doTauOut(
                 (FlowVelocityData) artifactAndFacet.getData(context),
@@ -330,6 +352,29 @@
      * @param theme The theme that contains styling information.
      * @param visible The visibility of the curve.
      */
+    protected void doQOut(
+        FlowVelocityData data,
+        ArtifactAndFacet aandf,
+        Document         theme,
+        boolean          visible
+    ) {
+        logger.debug("FlowVelocityGenerator.doTauOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPoints(series, data.getQPoints(), true);
+
+        addAxisSeries(series, YAXIS.Q.idx, visible);
+    }
+
+    /**
+     * @param data A FlowVelocityData object
+     * @param aandf The facet. This facet does NOT support any data objects. Use
+     * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports
+     * data.
+     * @param theme The theme that contains styling information.
+     * @param visible The visibility of the curve.
+     */
     protected void doTauOut(
         FlowVelocityData data,
         ArtifactAndFacet aandf,

http://dive4elements.wald.intevation.org