changeset 3406:3732e1bab0aa

Add kilometer to chart titles flys-artifacts/trunk@5058 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 19 Jul 2012 11:40:59 +0000
parents b0ba96bbf01d
children 70e9d56e21fc
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.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 flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties
diffstat 10 files changed, 124 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jul 19 11:40:59 2012 +0000
@@ -1,3 +1,16 @@
+2012-07-19	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixChartGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java,
+	  src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties:
+	  Add kilometer info to chart titles.
+
 2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixChartGenerator.java	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixChartGenerator.java	Thu Jul 19 11:40:59 2012 +0000
@@ -1,24 +1,22 @@
 package de.intevation.flys.exports.fixings;
 
-import org.w3c.dom.Document;
-
-import org.apache.log4j.Logger;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.flys.exports.XYChartGenerator;
 
 import java.io.OutputStream;
 
-import de.intevation.artifacts.ArtifactNamespaceContext;
-import de.intevation.artifacts.common.utils.XMLUtils;
-import de.intevation.artifacts.CallContext;
-
-import de.intevation.flys.exports.XYChartGenerator;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
 
 public abstract class FixChartGenerator
 extends XYChartGenerator
 {
     private static Logger logger = Logger.getLogger(FixChartGenerator.class);
 
-    public static final Double INVALID_KM = Double.valueOf(-1d);
-
+    public static final double INVALID_KM = Double.valueOf(-1d);
+    public static final String CURRENT_KM = "currentKm";
     public static final String XPATH_CHART_CURRENTKM =
         "/art:action/art:attributes/art:currentKm/@art:km";
 
@@ -26,16 +24,16 @@
     public void init(Document request, OutputStream out, CallContext context) {
         super.init(request, out, context);
 
-        Double currentKm = getCurrentKmFromRequest(request);
+        double currentKm = getCurrentKmFromRequest(request);
 
         if (logger.isDebugEnabled()) {
             logger.debug("currentKm = " + currentKm);
         }
 
-        context.putContextValue("currentKm", currentKm);
+        context.putContextValue(CURRENT_KM, currentKm);
     }
 
-    public static Double getCurrentKmFromRequest(Document request) {
+    public static double getCurrentKmFromRequest(Document request) {
 
         String km = XMLUtils.xpathString(
             request,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Thu Jul 19 11:40:59 2012 +0000
@@ -106,6 +106,16 @@
 
 
     @Override
+    protected String getChartTitle() {
+        return Resources.format(
+                context.getMeta(),
+                I18N_CHART_TITLE,
+                "",
+                getCurrentKmFromRequest());
+    }
+
+
+    @Override
     protected String getDefaultChartSubtitle() {
         FixationArtifactAccess access = new FixationArtifactAccess(artifact);
         DateRange range = access.getDateRange();
@@ -458,7 +468,7 @@
         valueMarker.add(marker);
     }
 
-    public Double getCurrentKmFromRequest() {
+    protected double getCurrentKmFromRequest() {
         Element km = (Element)XMLUtils.xpath(
             request,
             XPATH_CHART_CURRENTKM,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java	Thu Jul 19 11:40:59 2012 +0000
@@ -1,19 +1,15 @@
 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.FixDerivateFacet;
 import de.intevation.flys.artifacts.model.fixings.FixFunction;
-
+import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.exports.ChartGenerator;
-
 import de.intevation.flys.jfree.JFreeUtil;
 import de.intevation.flys.jfree.StyledXYSeries;
 
 import org.apache.log4j.Logger;
-
 import org.w3c.dom.Document;
 
 /**
@@ -29,16 +25,16 @@
         Logger.getLogger(FixDerivedCurveGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.fixings.derived.title";
+        "chart.fixings.derivedcurve.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.fixings.derived.subtitle";
+        "chart.fixings.derivedcurve.subtitle";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.fixings.derived.xaxis.label";
+        "chart.fixings.derivedcurve.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.fixings.derived.yaxis.label";
+        "chart.fixings.derivedcurve.yaxis.label";
 
     public static final String I18N_CHART_TITLE_DEFAULT =
         "Ableitungskurve";
@@ -94,6 +90,16 @@
 
 
     @Override
+    protected String getChartTitle() {
+        return Resources.format(
+                context.getMeta(),
+                I18N_CHART_TITLE,
+                I18N_CHART_TITLE_DEFAULT,
+                context.getContextValue(CURRENT_KM));
+    }
+
+
+    @Override
     protected String getDefaultXAxisLabel() {
         return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Thu Jul 19 11:40:59 2012 +0000
@@ -5,7 +5,6 @@
 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.exports.XYChartGenerator;
 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
 import de.intevation.flys.jfree.StyledXYSeries;
 import de.intevation.flys.utils.KMIndex;
@@ -23,7 +22,7 @@
 import org.w3c.dom.Document;
 
 public class FixLongitudinalSectionGenerator
-extends XYChartGenerator
+extends FixChartGenerator
 implements FacetTypes
 {
     private static Logger logger =
@@ -45,7 +44,7 @@
         "Fixierungsanalyse";
 
     public static final String I18N_XAXIS_LABEL_DEFAULT  =
-        "[m]";
+        "[km]";
 
     public static final String I18N_YAXIS_LABEL_DEFAULT  =
         "delta W [cm]";
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Thu Jul 19 11:40:59 2012 +0000
@@ -1,11 +1,15 @@
 package de.intevation.flys.exports.fixings;
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.FixationArtifactAccess;
+import de.intevation.flys.artifacts.model.DateRange;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.fixings.FixFunction;
 import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet;
 import de.intevation.flys.artifacts.model.fixings.QW;
 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.jfree.CollisionFreeXYTextAnnotation;
 import de.intevation.flys.jfree.FLYSAnnotation;
@@ -63,11 +67,17 @@
         }
     }
 
+
+    private FLYSArtifact artifact;
+
+
     @Override
     public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
         String name = aaf.getFacetName();
         logger.debug("doOut: " + name);
 
+        this.artifact = (FLYSArtifact)aaf.getArtifact();
+
         if(name.startsWith(FIX_SECTOR_AVERAGE_WQ)) {
             doSectorAverageOut(aaf, doc, visible);
         }
@@ -188,11 +198,35 @@
     }
 
     @Override
+    protected String getChartTitle() {
+        return Resources.format(
+                context.getMeta(),
+                I18N_CHART_TITLE,
+                I18N_CHART_TITLE_DEFAULT,
+                context.getContextValue(CURRENT_KM));
+    }
+
+    @Override
     protected String getDefaultChartTitle() {
         return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
     }
 
     @Override
+    protected String getDefaultChartSubtitle() {
+        FixationArtifactAccess access = new FixationArtifactAccess(artifact);
+        DateRange range = access.getDateRange();
+        String subtitle = Resources.format(
+                context.getMeta(),
+                I18N_CHART_SUBTITLE,
+                null,
+                access.getRiver(),
+                range.getFrom(),
+                range.getTo());
+        logger.debug("getDefaultChartSubtitle: " + subtitle);
+        return subtitle;
+    }
+
+    @Override
     protected String getDefaultXAxisLabel() {
         return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
     }
--- a/flys-artifacts/src/main/resources/messages.properties	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Thu Jul 19 11:40:59 2012 +0000
@@ -139,6 +139,11 @@
 
 chart.normalized.reference.curve.title = Reduced Reference Curve
 
+chart.fixings.derivedcurve.title = Ableitungskurve an Kilometer {0}
+chart.fixings.deltawt.title = Abweichungen von der Ausgleichskurve an Kilometer {0}
+chart.fixings.analysis.title = Längsschnitt an Kilometer {0}
+chart.fixings.wq.title = Fixierungsanalyse an Kilometer {0}
+
 chart.sq_relation.xaxis.label = Discharge [m\u00b3/s]
 chart.sq_relation.yaxis.label = Transport [kg/s]
 chart.sq_relation_a.title = Feinkornanteil
@@ -337,11 +342,15 @@
 fix.deviation=Standard deviation
 fix.reference.deviation=Reference deviation
 
-chart.fix.deltawt.title=Difference from compensating curve
+chart.fix.deltawt.title=Difference from compensating curve at kilometer {0}
 chart.fix.deltawt.subtitle=Water: {0}; Period:  {1,date,short} to {2,date,short}
 chart.fix.deltawt.xaxis.label=Date
 chart.fix.deltawt.yaxis.label=\u0394 W(t) [cm]
 
+chart.fixings.wq.subtitle=Water: {0}; Period:  {1,date,short} to {2,date,short}
+
+chart.fixings.longitudinalsection.title=Longitudinal section
+
 export.fixings.deltawt.csv.header.km=km
 export.fixings.deltawt.csv.header.deltaw=\u0394 W [cm]
 export.fixings.deltawt.csv.header.q=Discharge [m\u00b3/s]
--- a/flys-artifacts/src/main/resources/messages_de.properties	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Thu Jul 19 11:40:59 2012 +0000
@@ -126,6 +126,11 @@
 chart.reference.curve.title = Bezugslinie
 chart.reference.curve.subtitle = {0}
 
+chart.fixings.derivedcurve.title = Ableitungskurve an Kilometer {0}
+chart.fixings.deltawt.title = Abweichungen von der Ausgleichskurve an Kilometer {0}
+chart.fixings.analysis.title = Längsschnitt an Kilometer {0}
+chart.fixings.wq.title = Fixierungsanalyse an Kilometer {0}
+
 chart.reference.curve.x.axis.in.cm = Bezugspegel [cm]
 chart.reference.curve.x.axis.in.m = Bezugsort(e) [NN + m]
 chart.reference.curve.y.axis.in.cm = Zielpegel [cm]
@@ -338,11 +343,15 @@
 fix.deviation=Standardabweichung
 fix.reference.deviation=Abweichung im Bezugszeitraum
 
-chart.fix.deltawt.title=Abweichungen von der Ausgleichskurve
+chart.fix.deltawt.title=Abweichungen von der Ausgleichskurve an Kilometer {0}
 chart.fix.deltawt.subtitle=Gewässer: {0}; Darstellungszeitraum: {1,date,short} bis {2,date,short}
 chart.fix.deltawt.xaxis.label=Datum
 chart.fix.deltawt.yaxis.label=\u0394 W(t) [cm]
 
+chart.fixings.wq.subtitle=Gewässer: {0}; Darstellungszeitraum: {1,date,short} bis {2,date,short}
+
+chart.fixings.longitudinalsection.title=Längsschnitt
+
 export.fixings.deltawt.csv.header.km=km
 export.fixings.deltawt.csv.header.deltaw=\u0394 W [cm]
 export.fixings.deltawt.csv.header.q=Abfluss [m\u00b3/s]
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Thu Jul 19 11:40:59 2012 +0000
@@ -131,6 +131,10 @@
 chart.reference.curve.y.axis.in.cm = Zielpegel [cm]
 chart.reference.curve.y.axis.in.m = Zielort(e) [NN + m] 
 
+chart.fixings.derivedcurve.title = Ableitungskurve an Kilometer {0}
+chart.fixings.analysis.title = Längsschnitt an Kilometer {0}
+chart.fixings.wq.title = Fixierungsanalyse an Kilometer {0}
+
 chart.normalized.reference.curve.title = Reduzierte Bezugslinie
 
 chart.w_differences.title = Differenzen
@@ -337,11 +341,15 @@
 fix.deviation=Standardabweichung
 fix.reference.deviation=Abweichung im Bezugszeitraum
 
-chart.fix.deltawt.title=Abweichungen von der Ausgleichskurve
+chart.fix.deltawt.title=Abweichungen von der Ausgleichskurve an Kilometer {0}
 chart.fix.deltawt.subtitle=Gewässer: {0}; Darstellungszeitraum: {1,date,short} bis {2,date,short}
 chart.fix.deltawt.xaxis.label=Datum
 chart.fix.deltawt.yaxis.label=\u0394 W(t) [cm]
 
+chart.fixings.wq.subtitle=Gewässer: {0}; Darstellungszeitraum: {1,date,short} bis {2,date,short}
+
+chart.fixings.longitudinalsection.title=Längsschnitt
+
 export.fixings.deltawt.csv.header.km=km
 export.fixings.deltawt.csv.header.deltaw=\u0394 W [cm]
 export.fixings.deltawt.csv.header.q=Abfluss [m\u00b3/s]
--- a/flys-artifacts/src/main/resources/messages_en.properties	Thu Jul 19 09:37:52 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Thu Jul 19 11:40:59 2012 +0000
@@ -126,6 +126,10 @@
 chart.reference.curve.title = Reference Curve
 chart.reference.curve.subtitle = {0}
 
+chart.fixings.derivedcurve.title = Ableitungskurve an Kilometer {0}
+chart.fixings.analysis.title = Längsschnitt an Kilometer {0}
+chart.fixings.wq.title = Fixierungsanalyse an Kilometer {0}
+
 chart.reference.curve.x.axis.in.cm = Reference Gauge(s) [cm]
 chart.reference.curve.x.axis.in.m = Reference Station(s) [NN + m]
 chart.reference.curve.y.axis.in.cm = Target Gauge(s) [cm]
@@ -337,11 +341,15 @@
 fix.deviation=Standard deviation
 fix.reference.deviation=Reference deviation
 
-chart.fix.deltawt.title=Difference from compensating curve
+chart.fix.deltawt.title=Difference from compensating curve at kilometer {0}
 chart.fix.deltawt.subtitle=Water: {0}; Period:  {1,date,short} to {2,date,short}
 chart.fix.deltawt.xaxis.label=Date
 chart.fix.deltawt.yaxis.label=\u0394 W(t) [cm]
 
+chart.fix.wq.subtitle=Water: {0}; Period:  {1,date,short} to {2,date,short}
+
+chart.fixings.longitudinalsection.title=Longitudinal section
+
 export.fixings.deltawt.csv.header.km=km
 export.fixings.deltawt.csv.header.deltaw=\u0394 W [cm]
 export.fixings.deltawt.csv.header.q=Discharge [m\u00b3/s]

http://dive4elements.wald.intevation.org