changeset 3169:b6da650b0718

FixA: Added longitudinal section chart. flys-artifacts/trunk@4782 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 25 Jun 2012 15:53:34 +0000
parents e10323bf3cbc
children 79e7bba0f593
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/doc/conf/conf.xml flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.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 16 files changed, 887 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jun 25 15:53:34 2012 +0000
@@ -1,3 +1,37 @@
+2012-06-25  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java:
+	  New. Generator for longitudinal sections in fix analysis.
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java:
+	  New. Facets for longitudinal sections chart in fix analysis.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java:
+	  Added new facet types.
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java:
+	  Add facets for new chart.
+
+	* src/main/java/de/intevation/flys/exports/ChartGenerator.java:
+	  Fixed NPE.
+
+	* doc/conf/artifacts/fixanalysis.xml:
+	  Added facets to config.
+
+	* doc/conf/themes.xml:
+	  Added new themes.
+
+	* doc/conf/conf.xml:
+	  Added new chart generator.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties:
+	  Added i18n strings.
+
 2012-06-25  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java:
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Mon Jun 25 15:53:34 2012 +0000
@@ -155,8 +155,18 @@
                 </outputmode>
                 <outputmode name="fix_longitudinal_section_curve" description="output.fix_longitudinal_section_curve" mine-type="image/png" type="chart">
                     <facets>
-                        <facet name="fix_sector_average_ls" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_sector_average_ls_0" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_sector_average_ls_1" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_sector_average_ls_2" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_sector_average_ls_3" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_sector_average_ls_deviation_0" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_sector_average_ls_deviation_1" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_sector_average_ls_deviation_2" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_sector_average_ls_deviation_3" description="Average values for Ws in Q sectors."/>
                         <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
+                        <facet name="fix_deviation_ls" description="The standard variance"/>
+                        <facet name="fix_analysis_events_ls" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_reference_events_ls" description="Average values for Ws in Q sectors."/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_derivate_curve" description="output.fix_derivate_curve" mine-type="image/png" type="chart">
--- a/flys-artifacts/doc/conf/conf.xml	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/doc/conf/conf.xml	Mon Jun 25 15:53:34 2012 +0000
@@ -266,6 +266,7 @@
         <output-generator name="sq_relation_export">de.intevation.flys.exports.SQRelationExporter</output-generator>
         <output-generator name="fix_deltawt_export">de.intevation.flys.exports.DeltaWtExporter</output-generator>
         <output-generator name="fix_deltawt_curve">de.intevation.flys.exports.fixings.FixDeltaWtGenerator</output-generator>
+        <output-generator name="fix_longitudinal_section_curve">de.intevation.flys.exports.fixings.FixLongitudinalGenerator</output-generator>
         <!-- Error report generators. -->
         <output-generator name="discharge_longitudinal_section_report">de.intevation.flys.exports.ReportGenerator</output-generator>
         <output-generator name="waterlevel_report">de.intevation.flys.exports.ReportGenerator</output-generator>
--- a/flys-artifacts/doc/conf/themes.xml	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/doc/conf/themes.xml	Mon Jun 25 15:53:34 2012 +0000
@@ -1088,6 +1088,107 @@
             </fields>
         </theme>
 
+        <theme name="FixingLSAverage0">
+            <inherits>
+                <inherit from="HiddenColorLines"/>
+            </inherits>
+            <fields>
+                <field name="linecolor" type="Color" default="0, 128, 0"/>
+                <field name="showlinelabel" type="boolean" display="Beschriftung anzeigen"       default="false" hints="h"/>
+            </fields>
+        </theme>
+        <theme name="FixingLSAverage1">
+            <inherits>
+                <inherit from="HiddenColorLines"/>
+            </inherits>
+            <fields>
+                <field name="linecolor" type="Color" default="0, 0, 255"/>
+                <field name="showlinelabel" type="boolean" display="Beschriftung anzeigen"       default="false" hints="h"/>
+            </fields>
+        </theme>
+        <theme name="FixingLSAverage2">
+            <inherits>
+                <inherit from="HiddenColorLines"/>
+            </inherits>
+            <fields>
+                <field name="linecolor" type="Color" default="255, 0, 255"/>
+                <field name="showlinelabel" type="boolean" display="Beschriftung anzeigen"       default="false" hints="h"/>
+            </fields>
+        </theme>
+        <theme name="FixingLSAverage3">
+            <inherits>
+                <inherit from="HiddenColorLines"/>
+            </inherits>
+            <fields>
+                <field name="linecolor" type="Color" default="255, 0, 0"/>
+                <field name="showlinelabel" type="boolean" display="Beschriftung anzeigen"       default="false" hints="h"/>
+            </fields>
+        </theme>
+
+        <theme name="FixingSectorDeviationLS0">
+            <inherits>
+                <inherit from="Areas"/>
+            </inherits>
+            <fields>
+                <field name="fillcolor" type="Color" display="Fuellfarbe" default="0, 128, 0"/>
+                <field name="transparent" type="boolean" display="Transparenz" default="true"/>
+            </fields>
+        </theme>
+        <theme name="FixingSectorDeviationLS1">
+            <inherits>
+                <inherit from="Areas"/>
+            </inherits>
+            <fields>
+                <field name="fillcolor" type="Color" display="Fuellfarbe" default="0, 0, 255"/>
+                <field name="transparent" type="boolean" display="Transparenz" default="true"/>
+            </fields>
+        </theme>
+        <theme name="FixingSectorDeviationLS2">
+            <inherits>
+                <inherit from="Areas"/>
+            </inherits>
+            <fields>
+                <field name="fillcolor" type="Color" display="Fuellfarbe" default="255, 0, 255"/>
+                <field name="transparent" type="boolean" display="Transparenz" default="true"/>
+            </fields>
+        </theme>
+        <theme name="FixingSectorDeviationLS3">
+            <inherits>
+                <inherit from="Areas"/>
+            </inherits>
+            <fields>
+                <field name="fillcolor" type="Color" display="Fuellfarbe" default="255, 0, 0"/>
+                <field name="transparent" type="boolean" display="Transparenz" default="true"/>
+            </fields>
+        </theme>
+        <theme name="FixLSDeviation">
+            <inherits>
+                <inherit from="Areas"/>
+            </inherits>
+            <fields>
+                <field name="fillcolor" type="Color" display="Fuellfarbe" default="100, 100, 100"/>
+                <field name="transparent" type="boolean" display="Transparenz" default="true"/>
+            </fields>
+        </theme>
+        <theme name="FixLSAnalysis">
+            <inherits>
+                <inherit from="HiddenColorLines"/>
+            </inherits>
+            <fields>
+                <field name="linecolor" type="Color" default="0, 255, 0"/>
+                <field name="showlinelabel" type="boolean" display="Beschriftung anzeigen"       default="false" hints="h"/>
+            </fields>
+        </theme>
+        <theme name="FixLSReference">
+            <inherits>
+                <inherit from="HiddenColorLines"/>
+            </inherits>
+            <fields>
+                <field name="linecolor" type="Color" default="0, 80, 160"/>
+                <field name="showlinelabel" type="boolean" display="Beschriftung anzeigen"       default="false" hints="h"/>
+            </fields>
+        </theme>
+
 </themegroup>
 
     <themegroup name="default-2">
@@ -2104,6 +2205,12 @@
             </fields>
         </theme>
 
+        <theme name="FixingSectorDeviationLS">
+            <inherits>
+                <inherit from="Areas"/>
+            </inherits>
+        </theme>
+
         <theme name="FixingOutliers">
             <inherits>
                 <inherit from="ColorPoints"/>
@@ -2675,5 +2782,16 @@
         <mapping from="fix_sector_average_dwt_3" to="FixingDeltaWtAverage3"/>
         <mapping from="fix_analysis_events_dwt" to="FixingDeltaWtAnalysis"/>
         <mapping from="fix_reference_events_dwt" to="FixingDeltaWtReference"/>
+        <mapping from="fix_sector_average_ls_deviation_0" to="FixingSectorDeviationLS0"/>
+        <mapping from="fix_sector_average_ls_deviation_1" to="FixingSectorDeviationLS1"/>
+        <mapping from="fix_sector_average_ls_deviation_2" to="FixingSectorDeviationLS2"/>
+        <mapping from="fix_sector_average_ls_deviation_3" to="FixingSectorDeviationLS3"/>
+        <mapping from="fix_sector_average_ls_0" to="FixingLSAverage0"/>
+        <mapping from="fix_sector_average_ls_1" to="FixingLSAverage1"/>
+        <mapping from="fix_sector_average_ls_2" to="FixingLSAverage2"/>
+        <mapping from="fix_sector_average_ls_3" to="FixingLSAverage3"/>
+        <mapping from="fix_deviation_ls" to="FixLSDeviation"/>
+        <mapping from="fix_analysis_events_ls" to="FixLSAnalysis"/>
+        <mapping from="fix_reference_events_ls" to="FixLSReference"/>
     </mappings>
 </themes>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Mon Jun 25 15:53:34 2012 +0000
@@ -232,6 +232,7 @@
     String FIX_SECTOR_AVERAGE_DWT = "fix_sector_average_dwt";
     String FIX_SECTOR_AVERAGE_LS = "fix_sector_average_ls";
     String FIX_SECTOR_AVERAGE_WQ = "fix_sector_average_wq";
+    String FIX_SECTOR_AVERAGE_LS_DEVIATION = "fix_sector_average_ls_deviation";
 
     String FIX_WQ_CURVE = "fix_wq_curve";
     String FIX_OUTLIER = "fix_outlier";
@@ -243,5 +244,7 @@
     String FIX_DERIVATE = "fix_derivate";
 
     String FIX_DEVIATION_DWT = "fix_deviation_dwt";
+    String FIX_DEVIATION_LS = "fix_deviation_ls";
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java	Mon Jun 25 15:53:34 2012 +0000
@@ -0,0 +1,104 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import java.util.Iterator;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.FixationArtifactAccess;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.CalculationResult;
+
+import de.intevation.flys.utils.KMIndex;
+
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet to show average W values for Q sectors.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class FixLongitudinalAnalysisFacet
+extends      DataFacet
+implements   FacetTypes {
+
+    /** House logger. */
+    private static Logger logger = Logger.getLogger(FixLongitudinalAnalysisFacet.class);
+
+    /** Trivial Constructor. */
+    public FixLongitudinalAnalysisFacet() {
+    }
+
+
+    public FixLongitudinalAnalysisFacet(
+        int ndx,
+        String name,
+        String description)
+    {
+        super(
+            ndx,
+            name,
+            description,
+            ComputeType.ADVANCE,
+            null,
+            null);
+    }
+
+
+    /**
+     * Returns the data this facet requires.
+     *
+     * @param artifact the owner artifact.
+     * @param context  the CallContext.
+     *
+     * @return the data as KMIndex.
+     */
+    @Override
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("FixLongitudinalAnalysisFacet.getData");
+
+        if (artifact instanceof FLYSArtifact) {
+            FLYSArtifact flys = (FLYSArtifact)artifact;
+            FixationArtifactAccess access = new FixationArtifactAccess(flys);
+
+            CalculationResult res =
+                (CalculationResult) flys.compute(context,
+                                                 ComputeType.ADVANCE,
+                                                 false);
+
+            FixResult result = (FixResult) res.getData();
+
+            KMIndex<AnalysisPeriod []> kmPeriods = result.getAnalysisPeriods();
+
+            if (kmPeriods == null) {
+                logger.warn("No analysis periods found.");
+                return null;
+            }
+
+            return kmPeriods;
+        }
+        else {
+            logger.warn("Artifact is no instance of FLYSArtifact.");
+            return null;
+        }
+    }
+
+
+    /**
+     * Create a deep copy of this Facet.
+     * @return a deep copy.
+     */
+    @Override
+    public FixLongitudinalAnalysisFacet deepCopy() {
+        FixLongitudinalAnalysisFacet copy = new FixLongitudinalAnalysisFacet();
+        copy.set(this);
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java	Mon Jun 25 15:53:34 2012 +0000
@@ -0,0 +1,120 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import java.util.Iterator;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.FixationArtifactAccess;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.Parameters;
+
+import de.intevation.flys.utils.KMIndex;
+
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet to show average W values for Q sectors.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class FixLongitudinalDeviationFacet
+extends      DataFacet
+implements   FacetTypes {
+
+    /** House logger. */
+    private static Logger logger = Logger.getLogger(FixLongitudinalDeviationFacet.class);
+
+    /** Trivial Constructor. */
+    public FixLongitudinalDeviationFacet() {
+    }
+
+
+    public FixLongitudinalDeviationFacet(
+        int ndx,
+        String name,
+        String description)
+    {
+        super(
+            ndx,
+            name,
+            description,
+            ComputeType.ADVANCE,
+            null,
+            null);
+    }
+
+
+    /**
+     * Returns the data this facet requires.
+     *
+     * @param artifact the owner artifact.
+     * @param context  the CallContext.
+     *
+     * @return the data as KMIndex.
+     */
+    @Override
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("FixLongitudinalDeviationFacet.getData");
+
+        if (artifact instanceof FLYSArtifact) {
+            FLYSArtifact flys = (FLYSArtifact)artifact;
+            FixationArtifactAccess access = new FixationArtifactAccess(flys);
+
+            CalculationResult res =
+                (CalculationResult) flys.compute(context,
+                                                 ComputeType.ADVANCE,
+                                                 false);
+
+            FixResult result = (FixResult) res.getData();
+
+            KMIndex<AnalysisPeriod []> kmPeriods = result.getAnalysisPeriods();
+
+            if (kmPeriods == null) {
+                logger.warn("No analysis periods found.");
+                return null;
+            }
+
+            Parameters params = result.getParameters();
+
+            KMIndex<double[]> kmIndex = new KMIndex<double[]>();
+            for (KMIndex.Entry<AnalysisPeriod[]> entry: kmPeriods) {
+                double km = entry.getKm();
+                double[] stdDev =
+                    params.interpolate("km", km, new String[] {"std-dev"});
+
+                if(stdDev == null) {
+                    logger.warn("getData: stdDev == null");
+                    continue;
+                }
+                kmIndex.add(km, stdDev);
+            }
+
+            return kmIndex;
+        }
+        else {
+            logger.warn("Artifact is no instance of FLYSArtifact.");
+            return null;
+        }
+    }
+
+
+    /**
+     * Create a deep copy of this Facet.
+     * @return a deep copy.
+     */
+    @Override
+    public FixLongitudinalDeviationFacet deepCopy() {
+        FixLongitudinalDeviationFacet copy = new FixLongitudinalDeviationFacet();
+        copy.set(this);
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java	Mon Jun 25 15:53:34 2012 +0000
@@ -0,0 +1,104 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.FixationArtifactAccess;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.Parameters;
+
+import de.intevation.flys.utils.KMIndex;
+
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet to show average W values for Q sectors.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class FixLongitudinalReferenceFacet
+extends      DataFacet
+implements   FacetTypes {
+
+    /** House logger. */
+    private static Logger logger = Logger.getLogger(FixLongitudinalReferenceFacet.class);
+
+    /** Trivial Constructor. */
+    public FixLongitudinalReferenceFacet() {
+    }
+
+
+    public FixLongitudinalReferenceFacet(
+        int ndx,
+        String name,
+        String description) 
+    {
+        super(
+            ndx,
+            name,
+            description,
+            ComputeType.ADVANCE,
+            null,
+            null);
+    }
+
+
+    /**
+     * Returns the data this facet requires.
+     *
+     * @param artifact the owner artifact.
+     * @param context  the CallContext.
+     *
+     * @return the data as KMIndex.
+     */
+    @Override
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("FixLongitudinalReferenceFacet.getData");
+
+        if (artifact instanceof FLYSArtifact) {
+            FLYSArtifact flys = (FLYSArtifact)artifact;
+            FixationArtifactAccess access = new FixationArtifactAccess(flys);
+
+            CalculationResult res =
+                (CalculationResult) flys.compute(context,
+                                                 ComputeType.ADVANCE,
+                                                 false);
+
+            FixResult result = (FixResult) res.getData();
+
+            KMIndex<QWD []> kmReference = result.getReferenced();
+
+            if (kmReference == null) {
+                logger.warn("No references found.");
+                return null;
+            }
+
+            return kmReference;
+        }
+        else {
+            logger.warn("Artifact is no instance of FLYSArtifact.");
+            return null;
+        }
+    }
+
+
+    /**
+     * Create a deep copy of this Facet.
+     * @return a deep copy.
+     */
+    @Override
+    public FixLongitudinalReferenceFacet deepCopy() {
+        FixLongitudinalReferenceFacet copy =
+            new FixLongitudinalReferenceFacet();
+        copy.set(this);
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java	Mon Jun 25 15:53:34 2012 +0000
@@ -24,6 +24,9 @@
 import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet;
 import de.intevation.flys.artifacts.model.fixings.FixDerivateFacet;
 import de.intevation.flys.artifacts.model.fixings.FixDeviationFacet;
+import de.intevation.flys.artifacts.model.fixings.FixLongitudinalAnalysisFacet;
+import de.intevation.flys.artifacts.model.fixings.FixLongitudinalDeviationFacet;
+import de.intevation.flys.artifacts.model.fixings.FixLongitudinalReferenceFacet;
 
 import de.intevation.flys.artifacts.model.fixings.DateRange;
 
@@ -58,6 +61,8 @@
 
     private static final String I18N_DEVIATION = "fix.deviation";
 
+    private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation";
+
     /**
      * The default constructor that initializes an empty State object.
      */
@@ -130,9 +135,14 @@
                                          FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx,
                                          description));
                 facets.add(
-                    new FixAvSectorFacet(facetNdx,
-                                         FIX_SECTOR_AVERAGE_LS,
+                    new FixLongitudinalAnalysisFacet(facetNdx,
+                                         FIX_SECTOR_AVERAGE_LS + "_" + sectorNdx,
                                          description));
+                String dev = "Abweichung: " + description;
+                facets.add(
+                    new FixLongitudinalAnalysisFacet(facetNdx,
+                                         FIX_SECTOR_AVERAGE_LS_DEVIATION + "_" + sectorNdx,
+                                         dev));
                 facets.add(
                     new FixAvSectorFacet(facetNdx,
                                          FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx,
@@ -147,7 +157,7 @@
             facets.add(new FixAnalysisEventsFacet(i,
                 FIX_ANALYSIS_EVENTS_DWT,
                 eventDesc));
-            facets.add(new FixAnalysisEventsFacet(i,
+            facets.add(new FixLongitudinalAnalysisFacet(i,
                 FIX_ANALYSIS_EVENTS_LS,
                 eventDesc));
             facets.add(new FixAnalysisEventsFacet(i,
@@ -158,17 +168,25 @@
         String i18n_ref = Resources.getMsg(context.getMeta(),
                 I18N_REFERENCEPERIOD,
                 I18N_REFERENCEPERIOD);
+        String i18n_dev = Resources.getMsg(context.getMeta(),
+                I18N_REFERENCEDEVIATION,
+                I18N_REFERENCEDEVIATION);
+
 
         facets.add(new FixReferenceEventsFacet(0,
             FIX_REFERENCE_EVENTS_DWT,
             i18n_ref));
-        facets.add(new FixReferenceEventsFacet(1,
+        facets.add(new FixLongitudinalReferenceFacet(1,
             FIX_REFERENCE_EVENTS_LS,
             i18n_ref));
         facets.add(new FixReferenceEventsFacet(2,
             FIX_REFERENCE_EVENTS_WQ,
             i18n_ref));
 
+        facets.add(new FixLongitudinalDeviationFacet(0,
+            FIX_DEVIATION_LS,
+            i18n_dev));
+
         String i18n_ana = Resources.getMsg(context.getMeta(),
                 I18N_ANALYSISPERIODS,
                 I18N_ANALYSISPERIODS);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Mon Jun 25 15:53:34 2012 +0000
@@ -1196,10 +1196,8 @@
             }
 
             LegendItem legendItem = renderer.getLegendItem(idx, s);
-            if (legendItem.getLabel().endsWith(" ")) {
-                legendItem = null;
-            }
-            if (legendItem.getLabel().endsWith("interpol")) {
+            if (legendItem.getLabel().endsWith(" ") ||
+                legendItem.getLabel().endsWith("interpol")) {
                 legendItem = null;
             }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Mon Jun 25 15:53:34 2012 +0000
@@ -195,6 +195,8 @@
 
     protected List<Marker> domainMarkers = new ArrayList<Marker>();
 
+    protected List<Marker> valueMarkers = new ArrayList<Marker>();
+
     /** The max X range to include all X values of all series for each axis. */
     protected Map<Integer, Bounds> xBounds;
 
@@ -381,10 +383,25 @@
     }
 
 
+    /**
+     * Add the given vertical marker to the chart.
+     */
+    public void addValueMarker(Marker marker) {
+        if (marker == null) {
+            return;
+        }
+
+        valueMarkers.add(marker);
+    }
+
+
     protected void addMarkers(XYPlot plot) {
         for(Marker marker : domainMarkers) {
             plot.addDomainMarker(marker);
         }
+        for(Marker marker : valueMarkers) {
+            plot.addRangeMarker(marker);
+        }
     }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Mon Jun 25 15:53:34 2012 +0000
@@ -0,0 +1,344 @@
+package de.intevation.flys.exports.fixings;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+
+import de.intevation.flys.artifacts.model.fixings.DateRange;
+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.model.fixings.AnalysisPeriod;
+
+import de.intevation.flys.exports.ChartGenerator;
+import de.intevation.flys.exports.XYChartGenerator;
+
+import de.intevation.flys.jfree.Function2DAdapter;
+import de.intevation.flys.jfree.StyledXYSeries;
+import de.intevation.flys.jfree.StyledAreaSeriesCollection;
+
+import de.intevation.flys.utils.KMIndex;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.data.general.DatasetUtilities;
+
+import org.jfree.data.xy.XYSeries;
+import org.jfree.chart.plot.Marker;
+import org.jfree.chart.plot.ValueMarker;
+import org.jfree.data.xy.XYSeriesCollection;
+
+import org.w3c.dom.Document;
+
+public class FixLongitudinalSectionGenerator
+extends XYChartGenerator
+implements FacetTypes
+{
+    private static Logger logger =
+        Logger.getLogger(FixLongitudinalSectionGenerator.class);
+
+    public static final String I18N_CHART_TITLE =
+        "chart.fixings.longitudinalsection.title";
+
+    public static final String I18N_CHART_SUBTITLE =
+        "chart.fixings.longitudinalsection.subtitle";
+
+    public static final String I18N_XAXIS_LABEL =
+        "chart.fixings.longitudinalsection.xaxis.label";
+
+    public static final String I18N_YAXIS_LABEL =
+        "chart.fixings.longitudinalsection.yaxis.label";
+
+    public static final String I18N_CHART_TITLE_DEFAULT  =
+        "Fixierungsanalyse";
+
+    public static final String I18N_XAXIS_LABEL_DEFAULT  =
+        "[m]";
+
+    public static final String I18N_YAXIS_LABEL_DEFAULT  =
+        "delta W [cm]";
+
+    public static enum YAXIS {
+        dW(0);
+        public int idx;
+        private YAXIS(int c) {
+            idx = c;
+        }
+    }
+
+    @Override
+    public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
+        String name = aaf.getFacetName();
+        logger.debug("doOut: " + name);
+
+        if (name.contains(FIX_SECTOR_AVERAGE_LS_DEVIATION)) {
+            doSectorAverageDeviationOut(aaf, doc, visible);
+        }
+        else if (name.contains(FIX_SECTOR_AVERAGE_LS)) {
+            doSectorAverageOut(aaf, doc, visible);
+        }
+        else if (name.equals(FIX_REFERENCE_EVENTS_LS)) {
+            doReferenceEventsOut(aaf, doc, visible);
+        }
+        else if (name.equals(FIX_ANALYSIS_EVENTS_LS)) {
+            doAnalysisEventsOut(aaf, doc, visible);
+        }
+        else if (name.equals(FIX_DEVIATION_LS)) {
+            doReferenceDeviationOut(aaf, doc, visible);
+        }
+        else {
+            logger.warn("Unknown facet name " + name);
+            return;
+        }
+    }
+
+    protected void doSectorAverageOut(
+        ArtifactAndFacet aaf,
+        Document doc,
+        boolean visible)
+    {
+        logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex());
+
+        int index = aaf.getFacet().getIndex();
+        int sectorNdx = index & 3;
+        int periodNdx = index >> 2;
+
+        KMIndex<AnalysisPeriod[]> kms =
+            (KMIndex<AnalysisPeriod[]>)aaf.getData(context);
+
+        if(kms == null) {
+            return;
+        }
+
+        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc);
+
+        for (KMIndex.Entry<AnalysisPeriod[]> entry: kms) {
+            double km = entry.getKm();
+            AnalysisPeriod[] ap = entry.getValue();
+            QWD qwd = ap[periodNdx].getQSectorAverages()[sectorNdx];
+            if (qwd == null) {
+                continue;
+            }
+            double deltaW = qwd.getDeltaW();
+            series.add(km, deltaW);
+        }
+
+        addAxisSeries(series, 0, visible);
+
+    }
+
+
+    protected void doSectorAverageDeviationOut(
+        ArtifactAndFacet aaf,
+        Document doc,
+        boolean visible)
+    {
+        logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex());
+
+        int index = aaf.getFacet().getIndex();
+        int sectorNdx = index & 3;
+        int periodNdx = index >> 2;
+
+        KMIndex<AnalysisPeriod[]> kms =
+            (KMIndex<AnalysisPeriod[]>)aaf.getData(context);
+
+        if(kms == null) {
+            return;
+        }
+
+        StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(doc);
+        XYSeries upper =
+            new StyledXYSeries(aaf.getFacetDescription(), false, doc);
+        XYSeries lower =
+            new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
+
+
+        for (KMIndex.Entry<AnalysisPeriod[]> entry: kms) {
+            double km = entry.getKm();
+            AnalysisPeriod[] ap = entry.getValue();
+            QWD qwd = ap[periodNdx].getQSectorAverages()[sectorNdx];
+            double dev = ap[periodNdx].getQSectorStdDev(sectorNdx);
+            logger.debug("std-dev: " + dev);
+            if (qwd == null) {
+                continue;
+            }
+            double deltaW = qwd.getDeltaW();
+            double up = deltaW + dev;
+            double lo = deltaW - dev;
+            upper.add(km, up);
+            lower.add(km, lo);
+        }
+        area.addSeries(upper);
+        area.addSeries(lower);
+
+        addAreaSeries(area, 0, visible);
+    }
+
+
+    protected void doReferenceDeviationOut(
+        ArtifactAndFacet aaf,
+        Document doc,
+        boolean visible)
+    {
+        logger.debug("doReferenceOut");
+
+        KMIndex<double[]> kms =
+            (KMIndex<double[]>)aaf.getData(context);
+
+        if(kms == null) {
+            return;
+        }
+
+        StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(doc);
+        XYSeries upper =
+            new StyledXYSeries(aaf.getFacetDescription(), false, doc);
+        XYSeries lower =
+            new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
+
+
+        for (KMIndex.Entry<double[]> entry: kms) {
+            double km = entry.getKm();
+            double[] devArray = entry.getValue();
+            if (devArray == null) {
+                continue;
+            }
+            double dev = devArray[0];
+            double up = dev;
+            double lo = -dev;
+            upper.add(km, up);
+            lower.add(km, lo);
+        }
+        area.addSeries(upper);
+        area.addSeries(lower);
+
+        Marker marker = new ValueMarker(0);
+        marker.setStroke(new BasicStroke(2));
+        marker.setPaint(Color.BLACK);
+        addValueMarker(marker);
+        addAreaSeries(area, 0, visible);
+    }
+
+    protected void doAnalysisEventsOut(
+        ArtifactAndFacet aaf,
+        Document doc,
+        boolean visible)
+    {
+        logger.debug("doAnalysisEventsOut");
+        int index = aaf.getFacet().getIndex();
+        int sectorNdx = index & 3;
+        int periodNdx = index >> 2;
+
+        KMIndex<AnalysisPeriod[]> kms =
+            (KMIndex<AnalysisPeriod[]>)aaf.getData(context);
+
+        if(kms == null) {
+            return;
+        }
+
+        XYSeriesCollection col = new XYSeriesCollection();
+
+        List<StyledXYSeries> series = new ArrayList<StyledXYSeries>();
+
+        for (KMIndex.Entry<AnalysisPeriod[]> entry: kms) {
+            double km = entry.getKm();
+            AnalysisPeriod[] ap = entry.getValue();
+            QWD[] qwds = ap[periodNdx].getQWDs();
+
+            String space = "";
+            for (int i = 0; i < qwds.length; i++) {
+                if (series.size() <= i && qwds.length > i) {
+                    StyledXYSeries s = new StyledXYSeries(aaf.getFacetDescription() + space, false, doc);
+                    series.add (s);
+                }
+                StyledXYSeries s = series.get(i);
+                s.add(km, qwds[i].getDeltaW());
+                space+= " ";
+            }
+        }
+        for (StyledXYSeries s: series) {
+            col.addSeries(s);
+        }
+
+        addAxisDataset(col, 0, visible);
+    }
+
+    protected void doReferenceEventsOut(
+        ArtifactAndFacet aaf,
+        Document doc,
+        boolean visible)
+    {
+        logger.debug("doReferenceEventOut");
+
+        KMIndex<QWD[]> kms =
+            (KMIndex<QWD[]>)aaf.getData(context);
+
+        if(kms == null) {
+            return;
+        }
+
+        XYSeriesCollection col = new XYSeriesCollection();
+
+        List<StyledXYSeries> series = new ArrayList<StyledXYSeries>();
+
+        for (KMIndex.Entry<QWD[]> entry: kms) {
+            double km = entry.getKm();
+            QWD[] qwds = entry.getValue();
+
+            String space = "";
+            for (int i = 0; i < qwds.length; i++) {
+                if (series.size() <= i && qwds.length > i) {
+                    StyledXYSeries s = new StyledXYSeries(aaf.getFacetDescription() + space, false, doc);
+                    series.add (s);
+                }
+                StyledXYSeries s = series.get(i);
+                s.add(km, qwds[i].getDeltaW());
+                space += " ";
+            }
+        }
+        for (StyledXYSeries s: series) {
+            col.addSeries(s);
+        }
+
+        addAxisDataset(col, 0, visible);
+    }
+
+
+    @Override
+    protected String getDefaultChartTitle() {
+        return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultXAxisLabel() {
+        return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultYAxisLabel(int pos) {
+        return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
+    }
+
+    @Override
+    protected ChartGenerator.YAxisWalker getYAxisWalker() {
+        return new YAxisWalker() {
+            @Override
+            public int length() {
+                return YAXIS.values().length;
+            }
+
+            @Override
+             public String getId(int idx) {
+                YAXIS[] yaxes = YAXIS.values();
+                return yaxes[idx].toString();
+            }
+        };
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/resources/messages.properties	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Mon Jun 25 15:53:34 2012 +0000
@@ -335,6 +335,7 @@
 fix.outlier=Outlier
 fix.analysis=Analysis
 fix.deviation=Standard deviation
+fix.reference.deviation=Reference deviation
 
 chart.fix.deltawt.title=\u0394 W(t) (Please change...)
 chart.fix.deltawt.subtitle=add subtitle
--- a/flys-artifacts/src/main/resources/messages_de.properties	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Mon Jun 25 15:53:34 2012 +0000
@@ -336,6 +336,7 @@
 fix.outlier=Ausrei\u00dfer
 fix.analysis=Analyse
 fix.deviation=Standardabweichung
+fix.reference.deviation=Abweichung im Bezugszeitraum
 
 chart.fix.deltawt.title=\u0394W(t) (Bitte aendern...)
 chart.fix.deltawt.subtitle=add subtitle
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Mon Jun 25 15:53:34 2012 +0000
@@ -335,6 +335,7 @@
 fix.outlier=Ausrei\u00dfer
 fix.analysis=Analyse
 fix.deviation=Standardabweichung
+fix.reference.deviation=Abweichung im Bezugszeitraum
 
 chart.fix.deltawt.title=\u0394 W(t) (Bitte aendern...)
 chart.fix.deltawt.subtitle=add subtitle
--- a/flys-artifacts/src/main/resources/messages_en.properties	Mon Jun 25 15:38:38 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Mon Jun 25 15:53:34 2012 +0000
@@ -328,13 +328,14 @@
 help.winfo.historical.discharge.timerange=https://flys-intern.intevation.de/Flys-3.0/OnlineHilfe/WINFO#Auswahl_des_Auswertezeitraumes
 help.winfo.historical.discharge.mode=https://flys-intern.intevation.de/Flys-3.0/OnlineHilfe/WINFO#Auswahl_der_Analyseart
 
-fix.reference.period=Referenceperiod
-fix.reference.period.events=Referenceperiodevents
-fix.analysis.periods=Analysisperiods
+fix.reference.period=Reference period
+fix.reference.period.events=Reference period events
+fix.analysis.periods=Analysis periods
 fix.derivative=Derivative
 fix.outlier=Outlier
 fix.analysis=Analysis
 fix.deviation=Standard deviation
+fix.reference.deviation=Reference deviation
 
 chart.fix.deltawt.title=Delta W(t) (Please change...)
 chart.fix.deltawt.subtitle=add subtitle

http://dive4elements.wald.intevation.org