changeset 5631:ca4b6263996c

Added old calculations to datacage 'M-INFO Sedimentfracht'. * Added facets to artifact config. * Added macros to datacage config. * Create subfolders for old calculations in datacage. * New outputs in sediment load generator.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 10 Apr 2013 15:04:56 +0200
parents 619da3fa7a8b
children 33aa0d152f54
files flys-artifacts/doc/conf/artifacts/minfo.xml flys-artifacts/doc/conf/meta-data.xml flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java
diffstat 3 files changed, 501 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Wed Apr 10 14:51:57 2013 +0200
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Wed Apr 10 15:04:56 2013 +0200
@@ -466,6 +466,17 @@
                         <facet name="sedimentload.total_load"/>
                         <facet name="sedimentload_ls.manualpoints"/>
                         <facet name="sedimentload.total"/>
+                        <facet name="flow_velocity.totalchannel" description="A facet for total channels"/>
+                        <facet name="flow_velocity.mainchannel" description="A facet for main channels"/>
+                        <facet name="flow_velocity.totalchannel.filtered" description="A facet for total channels"/>
+                        <facet name="flow_velocity.mainchannel.filtered" description="A facet for main channels"/>
+                        <facet name="bedheight_difference.height_year" description="A facet for absolute heights"/>
+                        <facet name="bedheight_difference.height_year.filtered" description="A facet for absolute heights"/>
+                        <facet name="bedheight_difference.year" description="A facet for bed height differences"/>
+                        <facet name="bedheight_difference.year.filtered" description="A facet for bed height differences"/>
+                        <facet name="bedheight_difference.epoch" description="A facet for bed height differences"/>
+                        <facet name="w_differences" description="facet.w_differences"/>
+                        <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
                     </facets>
                 </outputmode>
                 <outputmode name="sedimentload_ls_report" description="output.sedimentload_ls_report" mime-type="text/xml" type="report">
--- a/flys-artifacts/doc/conf/meta-data.xml	Wed Apr 10 14:51:57 2013 +0200
+++ b/flys-artifacts/doc/conf/meta-data.xml	Wed Apr 10 15:04:56 2013 +0200
@@ -611,6 +611,33 @@
           </soundings_width>
         </dc:macro>
 
+        <dc:macro name="morph_width">
+          <morph-width>
+            <dc:context>
+              <dc:statement>
+                SELECT id   AS width_id
+                FROM morphologic_width
+                WHERE river_id = ${river_id}
+              </dc:statement>
+              <dc:for-each>
+                <dc:context>
+                  <dc:statement>
+                    SELECT min(station) AS from,
+                           max(station) AS to
+                    FROM morphologic_width_values
+                    WHERE morphologic_width_id = ${width_id}
+                  </dc:statement>
+                  <dc:for-each>
+                    <morphologic-width name="{$from} - {$to}"
+                                       ids="{$width_id}"
+                                       factory="morph-width"/>
+                  </dc:for-each>
+                </dc:context>
+              </dc:for-each>
+            </dc:context>
+          </morph-width>
+        </dc:macro>
+
         <dc:macro name="longitudinal-section-prototype">
           <dc:call-macro name="basedata_0"/>
           <dc:call-macro name="basedata_1_additionals"/>
@@ -732,6 +759,10 @@
             <dc:if test="dc:contains($artifact-outs, 'bed_longitudinal_section')">
               <dc:call-macro name="annotations_per_type"/>
             </dc:if>
+            <dc:if test="dc:contains($artifact-outs, 'sedimentload_ls')">
+              <dc:call-macro name="annotations_per_type"/>
+              <dc:call-macro name="morph_width"/>
+            </dc:if>
             <dc:comment>
               MINFO bedheight middle
             </dc:comment>
@@ -2512,27 +2543,40 @@
                     <dc:call-macro name="range-filter">
                       <dc:context>
                         <dc:statement>
-                          SELECT a.gid         AS aid,
-                                 f.id          AS fid,
-                                 f.name        AS facet_name,
-                                 f.num         AS facet_num,
-                                 f.description AS facet_description
-                          FROM outs AS o, facets AS f, artifacts AS a
+                          SELECT id AS oid
+                          FROM outs AS o
                           WHERE
-                            (f.name = 'bed_longitudinal_section.bed_diameter_toplayer'
-                             OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND
-                             f.out_id = o.id         AND
-                             o.artifact_id = ${a_id} AND
-                             a.id = ${a_id}
+                            o.artifact_id = ${a_id} AND
+                            o.name='bed_longitudinal_section'
                         </dc:statement>
                         <dc:for-each>
-                          <dc:element name="${facet_name}">
-                            <dc:attribute name="factory" value="minfo"/>
-                            <dc:attribute name="description" value="${facet_description}"/>
-                            <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
-                            <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="out" value="bed_longitudinal_section"/>
-                          </dc:element>
+                          <quality-bed description="{$river} {$a_creation} {$collection_name}">
+                            <dc:context>
+                              <dc:statement>
+                                SELECT a.gid         AS aid,
+                                       f.id          AS fid,
+                                       f.name        AS facet_name,
+                                       f.num         AS facet_num,
+                                       f.description AS facet_description
+                                FROM outs AS o, facets AS f, artifacts AS a
+                                WHERE
+                                  (f.name = 'bed_longitudinal_section.bed_diameter_toplayer'
+                                   OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND
+                                   f.out_id = o.id         AND
+                                   o.artifact_id = ${a_id} AND
+                                   a.id = ${a_id}
+                              </dc:statement>
+                              <dc:for-each>
+                                <dc:element name="${facet_name}">
+                                  <dc:attribute name="factory" value="minfo"/>
+                                  <dc:attribute name="description" value="${facet_description}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="artifact-id" value="${aid}"/>
+                                  <dc:attribute name="out" value="bed_longitudinal_section"/>
+                                </dc:element>
+                              </dc:for-each>
+                            </dc:context>
+                          </quality-bed>
                         </dc:for-each>
                       </dc:context>
                     </dc:call-macro>
@@ -2548,26 +2592,39 @@
                     <dc:call-macro name="range-filter">
                       <dc:context>
                         <dc:statement>
-                          SELECT a.gid         AS aid,
-                                 f.id          AS fid,
-                                 f.name        AS facet_name,
-                                 f.num         AS facet_num,
-                                 f.description AS facet_description
-                          FROM outs AS o, facets AS f, artifacts AS a
+                          SELECT id AS oid
+                          FROM outs AS o
                           WHERE
-                             f.name = 'bed_longitudinal_section.bedload_diameter' AND
-                             f.out_id = o.id         AND
-                             o.artifact_id = ${a_id} AND
-                             a.id = ${a_id}
+                            o.artifact_id = ${a_id} AND
+                            o.name='bed_longitudinal_section'
                         </dc:statement>
                         <dc:for-each>
-                          <dc:element name="${facet_name}">
-                            <dc:attribute name="factory" value="minfo"/>
-                            <dc:attribute name="description" value="${facet_description}"/>
-                            <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
-                            <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="out" value="bed_longitudinal_section"/>
-                          </dc:element>
+                          <quality-load description="{$river} {$a_creation} {$collection_name}">
+                            <dc:context>
+                              <dc:statement>
+                                SELECT a.gid         AS aid,
+                                       f.id          AS fid,
+                                       f.name        AS facet_name,
+                                       f.num         AS facet_num,
+                                       f.description AS facet_description
+                                FROM outs AS o, facets AS f, artifacts AS a
+                                WHERE
+                                   f.name = 'bed_longitudinal_section.bedload_diameter' AND
+                                   f.out_id = o.id         AND
+                                   o.artifact_id = ${a_id} AND
+                                   a.id = ${a_id}
+                              </dc:statement>
+                              <dc:for-each>
+                                <dc:element name="${facet_name}">
+                                  <dc:attribute name="factory" value="minfo"/>
+                                  <dc:attribute name="description" value="${facet_description}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="artifact-id" value="${aid}"/>
+                                  <dc:attribute name="out" value="bed_longitudinal_section"/>
+                                </dc:element>
+                              </dc:for-each>
+                            </dc:context>
+                          </quality-load>
                         </dc:for-each>
                       </dc:context>
                     </dc:call-macro>
@@ -2581,29 +2638,42 @@
                 <dc:for-each>
                   <dc:context>
                     <dc:call-macro name="range-filter">
-                      <dc:context>
-                        <dc:statement>
-                          SELECT a.gid         AS aid,
-                                 f.id          AS fid,
-                                 f.name        AS facet_name,
-                                 f.num         AS facet_num,
-                                 f.description AS facet_description
-                          FROM outs AS o, facets AS f, artifacts AS a
-                          WHERE
-                             (f.name = 'bed_longitudinal_section.sediment_density_toplayer' OR
-                              f.name = 'bed_longitudinal_section.sediment_density_sublayer') AND
-                             f.out_id = o.id         AND
-                             o.artifact_id = ${a_id} AND
-                             a.id = ${a_id}
-                        </dc:statement>
-                        <dc:for-each>
-                          <dc:element name="${facet_name}">
-                            <dc:attribute name="factory" value="minfo"/>
-                            <dc:attribute name="description" value="${facet_description}"/>
-                            <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
-                            <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="out" value="bed_longitudinal_section"/>
-                          </dc:element>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT id AS oid
+                        FROM outs AS o
+                        WHERE
+                          o.artifact_id = ${a_id} AND
+                          o.name='bed_longitudinal_section'
+                      </dc:statement>
+                      <dc:for-each>
+                        <density description="{$river} {$a_creation} {$collection_name}">
+                            <dc:context>
+                              <dc:statement>
+                                SELECT a.gid         AS aid,
+                                       f.id          AS fid,
+                                       f.name        AS facet_name,
+                                       f.num         AS facet_num,
+                                       f.description AS facet_description
+                                FROM outs AS o, facets AS f, artifacts AS a
+                                WHERE
+                                   (f.name = 'bed_longitudinal_section.sediment_density_toplayer' OR
+                                    f.name = 'bed_longitudinal_section.sediment_density_sublayer') AND
+                                   f.out_id = o.id         AND
+                                   o.artifact_id = ${a_id} AND
+                                   a.id = ${a_id}
+                              </dc:statement>
+                              <dc:for-each>
+                                <dc:element name="${facet_name}">
+                                  <dc:attribute name="factory" value="minfo"/>
+                                  <dc:attribute name="description" value="${facet_description}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="artifact-id" value="${aid}"/>
+                                  <dc:attribute name="out" value="bed_longitudinal_section"/>
+                                </dc:element>
+                              </dc:for-each>
+                            </dc:context>
+                          </density>
                         </dc:for-each>
                       </dc:context>
                     </dc:call-macro>
@@ -2619,27 +2689,40 @@
                     <dc:call-macro name="range-filter">
                       <dc:context>
                         <dc:statement>
-                          SELECT a.gid         AS aid,
-                                 f.id          AS fid,
-                                 f.name        AS facet_name,
-                                 f.num         AS facet_num,
-                                 f.description AS facet_description
-                          FROM outs AS o, facets AS f, artifacts AS a
+                          SELECT id AS oid
+                          FROM outs AS o
                           WHERE
-                             (f.name = 'bed_longitudinal_section.porosity_toplayer' OR
-                              f.name = 'bed_longitudinal_section.porosity_sublayer') AND
-                             f.out_id = o.id         AND
-                             o.artifact_id = ${a_id} AND
-                             a.id = ${a_id}
+                            o.artifact_id = ${a_id} AND
+                            o.name='bed_longitudinal_section'
                         </dc:statement>
                         <dc:for-each>
-                          <dc:element name="${facet_name}">
-                            <dc:attribute name="factory" value="minfo"/>
-                            <dc:attribute name="description" value="${facet_description}"/>
-                            <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
-                            <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="out" value="bed_longitudinal_section"/>
-                          </dc:element>
+                          <porosity description="{$river} {$a_creation} {$collection_name}">
+                            <dc:context>
+                              <dc:statement>
+                                SELECT a.gid         AS aid,
+                                       f.id          AS fid,
+                                       f.name        AS facet_name,
+                                       f.num         AS facet_num,
+                                       f.description AS facet_description
+                                FROM outs AS o, facets AS f, artifacts AS a
+                                WHERE
+                                   (f.name = 'bed_longitudinal_section.porosity_toplayer' OR
+                                    f.name = 'bed_longitudinal_section.porosity_sublayer') AND
+                                   f.out_id = o.id         AND
+                                   o.artifact_id = ${a_id} AND
+                                   a.id = ${a_id}
+                              </dc:statement>
+                              <dc:for-each>
+                                <dc:element name="${facet_name}">
+                                  <dc:attribute name="factory" value="minfo"/>
+                                  <dc:attribute name="description" value="${facet_description}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="artifact-id" value="${aid}"/>
+                                  <dc:attribute name="out" value="bed_longitudinal_section"/>
+                                </dc:element>
+                              </dc:for-each>
+                            </dc:context>
+                          </porosity>
                         </dc:for-each>
                       </dc:context>
                     </dc:call-macro>
@@ -2655,29 +2738,41 @@
                     <dc:call-macro name="range-filter">
                       <dc:context>
                         <dc:statement>
-                          SELECT a.gid         AS aid,
-                                 f.id          AS fid,
-                                 f.name        AS facet_name,
-                                 f.num         AS facet_num,
-                                 f.description AS facet_description
-                          FROM outs AS o, facets AS f, artifacts AS a
+                          SELECT id AS oid
+                          FROM outs AS o
                           WHERE
-                            (f.name = 'flow_velocity.totalchannel' OR
-                             f.name = 'flow_velocity.mainchannel' OR
-                             f.name = 'flow_velocity.totalchannel.filtered' OR
-                             f.name = 'flow_velocity.mainchannel.filtered') AND
-                             f.out_id = o.id         AND
-                             o.artifact_id = ${a_id} AND
-                             a.id = ${a_id}
+                            o.artifact_id = ${a_id} and o.name='flow_velocity'
                         </dc:statement>
                         <dc:for-each>
-                          <dc:element name="${facet_name}">
-                            <dc:attribute name="factory" value="minfo"/>
-                            <dc:attribute name="description" value="${facet_description}"/>
-                            <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
-                            <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="out" value="bed_longitudinal_section"/>
-                          </dc:element>
+                          <flow description="{$river} {$a_creation} {$collection_name}">
+                          <dc:context>
+                            <dc:statement>
+                              SELECT a.gid         AS aid,
+                                     f.id          AS fid,
+                                     f.name        AS facet_name,
+                                     f.num         AS facet_num,
+                                     f.description AS facet_description
+                              FROM outs AS o, facets AS f, artifacts AS a
+                              WHERE
+                                (f.name = 'flow_velocity.totalchannel' OR
+                                 f.name = 'flow_velocity.mainchannel' OR
+                                 f.name = 'flow_velocity.totalchannel.filtered' OR
+                                 f.name = 'flow_velocity.mainchannel.filtered') AND
+                                 f.out_id = o.id         AND
+                                 o.artifact_id = ${a_id} AND
+                                 a.id = ${a_id}
+                            </dc:statement>
+                            <dc:for-each>
+                              <dc:element name="${facet_name}">
+                                <dc:attribute name="factory" value="minfo"/>
+                                <dc:attribute name="description" value="${facet_description}"/>
+                                <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                <dc:attribute name="artifact-id" value="${aid}"/>
+                                <dc:attribute name="out" value="flow_velocity"/>
+                              </dc:element>
+                            </dc:for-each>
+                          </dc:context>
+                        </flow>
                         </dc:for-each>
                       </dc:context>
                     </dc:call-macro>
@@ -2686,6 +2781,109 @@
               </flow-velocity>
             </dc:macro>
 
+            <dc:macro name="sediment-load">
+              <sediment-load>
+                <dc:for-each>
+                  <dc:context>
+                    <dc:call-macro name="range-filter">
+                      <dc:context>
+                        <dc:statement>
+                          SELECT id AS oid
+                          FROM outs AS o
+                          WHERE
+                            o.artifact_id = ${a_id} and o.name='sedimentload_ls'
+                        </dc:statement>
+                        <dc:for-each>
+                          <load description="{$river} {$a_creation} {$collection_name}">
+                            <dc:context>
+                              <dc:statement>
+                                SELECT a.gid         AS aid,
+                                       f.id          AS fid,
+                                       f.name        AS facet_name,
+                                       f.num         AS facet_num,
+                                       f.description AS facet_description
+                                FROM outs AS o, facets AS f, artifacts AS a
+                                WHERE f.name LIKE 'sedimentload%' AND
+                                      f.out_id = o.id         AND
+                                      o.artifact_id = ${a_id} AND
+                                      a.id = ${a_id}
+                              </dc:statement>
+                              <dc:for-each>
+                                <dc:element name="${facet_name}">
+                                  <dc:attribute name="factory" value="minfo"/>
+                                  <dc:attribute name="description" value="${facet_description}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="artifact-id" value="${aid}"/>
+                                  <dc:attribute name="out" value="sedimentload_ls"/>
+                                </dc:element>
+                              </dc:for-each>
+                            </dc:context>
+                          </load>
+                        </dc:for-each>
+                      </dc:context>
+                    </dc:call-macro>
+                  </dc:context>
+                </dc:for-each>
+              </sediment-load>
+            </dc:macro>
+
+            <dc:macro name="bedheight-differences">
+              <bedheight-differences>
+                <dc:for-each>
+                  <dc:context>
+                    <dc:call-macro name="range-filter">
+                      <dc:context>
+                        <dc:statement>
+                          SELECT id AS oid,
+                                 name AS o_name
+                          FROM outs AS o
+                          WHERE
+                            o.artifact_id = ${a_id} AND
+                            (o.name = 'bed_difference_year' OR
+                             o.name = 'bed_differnece_epoch')
+                        </dc:statement>
+                        <dc:for-each>
+                          <difference description="{$river} {$a_creation} {$collection_name}">
+                            <dc:context>
+                              <dc:statement>
+                                SELECT a.gid         AS aid,
+                                       f.id          AS fid,
+                                       f.name        AS facet_name,
+                                       f.num         AS facet_num,
+                                       f.description AS facet_description
+                                FROM outs AS o, facets AS f, artifacts AS a
+                                WHERE (f.name LIKE 'bedheight_difference.year%' OR
+                                       f.name LIKE 'bedheight_difference.epoch%') AND
+                                      f.out_id = o.id         AND
+                                      o.artifact_id = ${a_id} AND
+                                      a.id = ${a_id}
+                              </dc:statement>
+                              <dc:for-each>
+                                <dc:element name="${facet_name}">
+                                  <dc:attribute name="factory" value="minfo"/>
+                                  <dc:attribute name="description" value="${facet_description}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="artifact-id" value="${aid}"/>
+                                  <dc:choose>
+                                    <dc:when test="dc:contains($o_name, 'bed_difference_year')">
+                                      <dc:attribute name="out" value="bed_difference_year"/>
+                                    </dc:when>
+                                    <dc:otherwise>
+                                      <dc:attribute name="out" value="bed_difference_epoch"/>
+                                    </dc:otherwise>
+                                  </dc:choose>
+                                </dc:element>
+                              </dc:for-each>
+                            </dc:context>
+                          </difference>
+                        </dc:for-each>
+                      </dc:context>
+                    </dc:call-macro>
+                  </dc:context>
+                </dc:for-each>
+              </bedheight-differences>
+            </dc:macro>
+
 
             <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
               <dc:call-macro name="longitudinal"/>
@@ -2742,6 +2940,12 @@
               <dc:call-macro name="bedquality-density"/>
               <dc:call-macro name="bedquality-porosity"/>
             </dc:if>
+            <dc:if test="dc:contains($artifact-outs, 'sedimentload_ls')">
+              <dc:call-macro name="differences"/>
+              <dc:call-macro name="bedheight-differences"/>
+              <dc:call-macro name="flow-velocity"/>
+              <dc:call-macro name="sediment-load"/>
+            </dc:if>
           </dc:context>
         </dc:call-macro>
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java	Wed Apr 10 14:51:57 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java	Wed Apr 10 15:04:56 2013 +0200
@@ -1,5 +1,7 @@
 package de.intevation.flys.exports.minfo;
 
+import java.util.Arrays;
+
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
 import org.w3c.dom.Document;
@@ -7,13 +9,22 @@
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.RangeAccess;
+import de.intevation.flys.artifacts.access.RiverAccess;
 import de.intevation.flys.artifacts.access.SedimentLoadAccess;
 import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.FlowVelocityData;
+import de.intevation.flys.artifacts.model.WKms;
+import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult;
+import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult;
 import de.intevation.flys.artifacts.model.minfo.SedimentLoadResult;
 import de.intevation.flys.exports.StyledSeriesBuilder;
 import de.intevation.flys.exports.XYChartGenerator;
+import de.intevation.flys.jfree.Bounds;
+import de.intevation.flys.jfree.DoubleBounds;
 import de.intevation.flys.jfree.FLYSAnnotation;
 import de.intevation.flys.jfree.StyledXYSeries;
+import de.intevation.flys.utils.DataUtil;
 
 
 public class SedimentLoadLSGenerator
@@ -21,7 +32,10 @@
 implements FacetTypes
 {
     public enum YAXIS {
-        L(0);
+        L(0),
+        D(1),
+        DW(2),
+        V(3);
 
         protected int idx;
 
@@ -30,17 +44,25 @@
         }
     }
     /** The logger that is used in this generator. */
-    private static Logger logger = Logger.getLogger(BedQualityGenerator.class);
+    private static Logger logger = Logger.getLogger(SedimentLoadLSGenerator.class);
 
     public static final String I18N_CHART_TITLE = "chart.sedimentload.ls.title";
     public static final String I18N_XAXIS_LABEL = "chart.sedimentload.ls.xaxis.label";
     public static final String I18N_YAXIS_LABEL_1 = "chart.sedimentload.ls.yaxis.label.tpera";
     public static final String I18N_YAXIS_LABEL_2 = "chart.sedimentload.ls.yaxis.label.m3pera";
+    public static final String I18N_YAXIS_D_LABEL = "chart.beddifference.yaxis.label.diff";
+    public static final String I18N_YAXIS_V_LABEL =
+        "chart.flow_velocity.section.yaxis.label";
+    public final static String I18N_WDIFF_YAXIS_LABEL =
+        "chart.w_differences.yaxis.label";
 
+    public final static String I18N_WDIFF_YAXIS_LABEL_DEFAULT = "m";
     public static final String I18N_CHART_TITLE_DEFAULT = "Sedimentfracht";
     public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km";
     public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]";
     public static final String I18N_YAXIS_LABEL_DEFAULT_2 = "[m\u00b3/a]";
+    public static final String I18N_YAXIS_D_LABEL_DEFAULT = "delta S [m]";
+    public static final String I18N_YAXIS_V_LABEL_DEFAULT = "Geschwindigkeit v [m/s]";
 
     private FLYSArtifact artifact;
 
@@ -78,7 +100,32 @@
         if (facet == null) {
             return;
         }
-
+        if (getXBounds(0) != null && getDomainAxisRange() != null) {
+            logger.debug(Arrays.toString(getDomainAxisRangeFromRequest()));
+            Bounds bounds =
+                calculateZoom(getXBounds(0), getDomainAxisRange());
+            context.putContextValue("startkm", bounds.getLower());
+            context.putContextValue("endkm", bounds.getUpper());
+        }
+        else if (getXBounds(0) != null && getDomainAxisRange() == null) {
+            context.putContextValue("startkm", getXBounds(0).getLower());
+            context.putContextValue("endkm", getXBounds(0).getUpper());
+        }
+        else if (getXBounds(0) == null && getDomainAxisRange() == null) {
+            FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact();
+            RangeAccess access = new RangeAccess(artifact, context);
+            context.putContextValue("startkm", access.getFrom());
+            context.putContextValue("endkm", access.getTo());
+        }
+        else if (getXBounds(0) == null && getDomainAxisRange() != null){
+            FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact();
+            RangeAccess access = new RangeAccess(artifact, context);
+            Bounds b = new DoubleBounds(access.getFrom(), access.getTo());
+            Bounds bounds =
+                calculateZoom(b, getDomainAxisRange());
+            context.putContextValue("startkm", bounds.getLower());
+            context.putContextValue("endkm", bounds.getUpper());
+        }
         if (name.equals(SEDIMENT_LOAD_COARSE)) {
             doSedimentLoadCoarseOut(
                 (SedimentLoadResult) bundle.getData(context),
@@ -135,6 +182,62 @@
                 attr,
                 visible);
         }
+        else if (name.equals(FLOW_VELOCITY_TOTALCHANNEL)) {
+            doFlowVelocityTotalOut(
+                (FlowVelocityData) bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
+        else if (name.equals(FLOW_VELOCITY_TOTALCHANNEL_FILTERED)) {
+            doFlowVelocityTotalOut(
+                (FlowVelocityData) bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
+        else if (name.equals(FLOW_VELOCITY_MAINCHANNEL)) {
+            doFlowVelocityMainOut(
+                (FlowVelocityData) bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
+        else if (name.equals(FLOW_VELOCITY_MAINCHANNEL_FILTERED)) {
+            doFlowVelocityMainOut(
+                (FlowVelocityData) bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
+        else if (name.equals(BED_DIFFERENCE_YEAR)) {
+            doBedDifferenceYearOut(
+                (BedDiffYearResult) bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
+        else if (name.equals(BED_DIFFERENCE_YEAR_FILTERED)) {
+            doBedDifferenceYearOut(
+                (BedDiffYearResult) bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
+        else if (name.equals(BED_DIFFERENCE_EPOCH)) {
+            doBedDifferenceEpochOut(
+                (BedDiffEpochResult) bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
+        else if (name.equals(W_DIFFERENCES)) {
+            doWDifferencesOut(
+                (WKms) bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
         else if (name.equals(LONGITUDINAL_ANNOTATION)) {
             doAnnotations(
                 (FLYSAnnotation) bundle.getData(context),
@@ -174,6 +277,16 @@
                 label = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1);
             }
         }
+        else if (pos == YAXIS.V.idx) {
+            label = msg(I18N_YAXIS_V_LABEL, I18N_YAXIS_V_LABEL_DEFAULT);
+        }
+        else if (pos == YAXIS.D.idx) {
+            label = msg(I18N_YAXIS_D_LABEL, I18N_YAXIS_D_LABEL_DEFAULT);
+        }
+        else if (pos == YAXIS.DW.idx) {
+            label = msg(I18N_WDIFF_YAXIS_LABEL, I18N_WDIFF_YAXIS_LABEL_DEFAULT);
+        }
+
         return label;
     }
 
@@ -249,4 +362,78 @@
         addAxisSeries(series, YAXIS.L.idx, visible);
     }
 
+    protected void doFlowVelocityMainOut(
+        FlowVelocityData data,
+        ArtifactAndFacet aandf,
+        Document         theme,
+        boolean          visible
+    ) {
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getMainChannelPoints(), true);
+
+        addAxisSeries(series, YAXIS.V.idx, visible);
+    }
+
+    protected void doFlowVelocityTotalOut(
+        FlowVelocityData data,
+        ArtifactAndFacet aandf,
+        Document         theme,
+        boolean          visible
+    ) {
+        if (data == null) {
+            logger.warn("No data to add to FlowVelocity chart.");
+            return;
+         }
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getTotalChannelPoints(), true);
+
+        addAxisSeries(series, YAXIS.V.idx, visible);
+    }
+
+    protected void doBedDifferenceYearOut(
+        BedDiffYearResult data,
+        ArtifactAndFacet aandf,
+        Document theme,
+        boolean visible
+    ) {
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getDifferencesData(), true);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+    }
+
+    protected void doBedDifferenceEpochOut(
+        BedDiffEpochResult data,
+        ArtifactAndFacet aandf,
+        Document theme,
+        boolean visible
+    ) {
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getDifferencesData(), true);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+    }
+
+    protected void doWDifferencesOut(
+        WKms       wkms,
+        ArtifactAndFacet aandf,
+        Document   theme,
+        boolean    visible
+    ) {
+        if (wkms == null) {
+            logger.warn("No data to add to WDifferencesChart.");
+            return;
+        }
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPoints(series, wkms);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+        if (DataUtil.guessWaterIncreasing(wkms.allWs())) {
+            setInverted(true);
+        }
+    }
+
 }

http://dive4elements.wald.intevation.org