changeset 2266:c9a40e3fdf16

Added a second Y axis for ReferenceCurveGenerator. flys-artifacts/trunk@3922 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 06 Feb 2012 13:20:00 +0000
parents 1dad713412a7
children 46918e6a831d
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java
diffstat 2 files changed, 44 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Feb 06 13:09:05 2012 +0000
+++ b/flys-artifacts/ChangeLog	Mon Feb 06 13:20:00 2012 +0000
@@ -1,3 +1,9 @@
+2012-02-06  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java:
+	  Added further i18n stubs.
+	  Also added a second Y axis (experimental, to ease axis labeling etc.).
+
 2012-02-06  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* doc/conf/artifacts/winfo.xml: Register new export output and csv
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Mon Feb 06 13:09:05 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Mon Feb 06 13:20:00 2012 +0000
@@ -30,13 +30,16 @@
 implements   FacetTypes
 {
     public static enum YAXIS {
-        W(0);
+        W_M(0),
+        W_CM(1);
+
         public int idx;
         private YAXIS(int c) {
            idx = c;
         }
     }
 
+    /** House logger. */
     private static Logger logger =
         Logger.getLogger(ReferenceCurveGenerator.class);
 
@@ -46,6 +49,18 @@
     public static final String I18N_CHART_SUBTITLE =
         "chart.reference.curve.subtitle";
 
+    public static final String W_CM_DEFAULT =
+        "chart.reference.curve.wcm";
+
+    public static final String W_NNM_DEFAULT =
+        "chart.reference.curve.wnn";
+
+    public static final String START_GAUGE =
+        "chart.reference.curve.start_at_gauge";
+
+    public static final String START_FREE =
+        "chart.reference.curve.start_free";
+
     /*
 
     public static final String I18N_XAXIS_LABEL =
@@ -54,16 +69,19 @@
     public static final String I18N_YAXIS_LABEL =
         "chart.reference.curve.yaxis.label";
 */
-    public static final String I18N_CHART_TITLE_DEFAULT  =
-        "Bezugslinie";
 /*
     public static final String I18N_XAXIS_LABEL_DEFAULT  =
-        "W [NN+m]";
+        "W [NN + m]";
 
     public static final String I18N_YAXIS_LABEL_DEFAULT  =
         "W [NN + m]";
     */
 
+
+    public static final String I18N_CHART_TITLE_DEFAULT  =
+        "Bezugslinie";
+
+
     public ReferenceCurveGenerator() {
         super();
     }
@@ -79,7 +97,8 @@
         String label   = getYAxisLabel(index);
 
         NumberAxis axis = createNumberAxis(index, label);
-        if (index == YAXIS.W.idx) {
+        // TODO aspect-ratio settings.
+        if (index == YAXIS.W_M.idx) {
             axis.setAutoRangeIncludesZero(false);
         }
         axis.setLabelFont(labelFont);
@@ -117,6 +136,7 @@
     @Override
     protected String getDefaultXAxisLabel() {
         // TODO i18nreturn msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
+        // at_gauge + w_cm
         return "W am Bezugsort- oder Pegel.";
     }
 
@@ -128,10 +148,13 @@
     @Override
     protected String getDefaultYAxisLabel(int index) {
         String label = "default";
-        if (index == YAXIS.W.idx) {
+        if (index == YAXIS.W_M.idx) {
             //label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
-            //TODO i18n
-            return "W am Zielort oder -pegel";
+            //TODO i18n 
+            return "W am Zielort";
+        }
+        else if (index == YAXIS.W_CM.idx) {
+            return "W am Zielpegel";
         }
 
         return label;
@@ -169,6 +192,7 @@
     }
 
 
+    /** Register DataSeries with (maybe transformed) points. */
     public void doReferenceOut(
         Object   data,
         Document theme,
@@ -191,7 +215,12 @@
             series.add(values[0], values[1], false);
         }
 
-        addAxisSeries(series, YAXIS.W.idx, visible);
+        if (ww.endAtGauge()) {
+            addAxisSeries(series, YAXIS.W_M.idx, visible);
+        }
+        else {
+            addAxisSeries(series, YAXIS.W_CM.idx, visible);
+        }
     }
 
 

http://dive4elements.wald.intevation.org