changeset 3585:c105b4466b4e

Basedata in FixA WQ DC and diagram. flys-artifacts/trunk@5201 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 14 Aug 2012 08:42:08 +0000
parents e60b011c6e0f
children 5cb5a9edc251
files flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/doc/conf/meta-data.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQFacet.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java
diffstat 5 files changed, 63 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Mon Aug 13 13:50:45 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Tue Aug 14 08:42:08 2012 +0000
@@ -145,6 +145,8 @@
                         <facet name="fix_wq_curve" description="WQ curve"/>
                         <facet name="qsectors" description="qsectors."/>
                         <facet name="fix_outlier" description="The outliers"/>
+                        <facet name="other.wqkms" description="facet.other.wqkms"/>
+                        <facet name="other.wq"    description="Point-like data like fixations"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_deltawt_curve" description="output.fix_deltawt_curve" mine-type="image/png" type="chart">
--- a/flys-artifacts/doc/conf/meta-data.xml	Mon Aug 13 13:50:45 2012 +0000
+++ b/flys-artifacts/doc/conf/meta-data.xml	Tue Aug 14 08:42:08 2012 +0000
@@ -654,9 +654,11 @@
                  <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
                </dc:if>
                <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
-                 <dc:call-macro name="basedata_0"/>
+                 <dc:call-macro name="basedata_0_wq"/>
                  <dc:call-macro name="basedata_1_additionals"/>
                </dc:if>
+               <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')">
+               </dc:if>
                <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
                  <dc:call-macro name="annotations"/>
                </dc:if>
@@ -771,6 +773,30 @@
             </dc:choose>
           </dc:if>
 
+          <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
+              <discharge_table_nn>
+                <discharge_table_gauge>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT id   AS gauge_id,
+                             name AS gauge_name
+                      FROM gauges WHERE river_id = ${river_id}
+                    </dc:statement>
+                    <dc:elements>
+                      <gauge>
+                        <dc:attribute name="name" value="${gauge_name}"/>
+                        <dc:attribute name="db-id" value="${gauge_id}"/>
+                        <dc:attribute name="factory" value="gaugedischarge"/>
+                        <dc:attribute name="from" value="${g_start}"/>
+                        <dc:attribute name="to" value="${g_stop}"/>
+                        <dc:attribute name="ids" value="${gauge_name}"/>
+                      </gauge>
+                    </dc:elements>
+                  </dc:context>
+                </discharge_table_gauge>
+              </discharge_table_nn>
+          </dc:if>
+
           <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
 
               <longitudinal_section>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java	Mon Aug 13 13:50:45 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java	Tue Aug 14 08:42:08 2012 +0000
@@ -122,12 +122,12 @@
                     name = STATIC_WQ;
                 }
 
-                Facet facet = new WQFacet(name,
+                Facet wQFacet = new WQFacet(name,
                     Resources.getMsg(
                         callMeta,
                         wkmsName,
                         wkmsName));
-                fs.add(facet);
+                fs.add(wQFacet);
                 facets.put(state.getID(), fs);
             }
         }
@@ -190,8 +190,10 @@
 
     /**
      * Get WQ at a given km.
+     * @param currentKm the requested km. If NULL, ld_location data
+     *        will be used.
      */
-    public double [][] getWQAtKm(double km) {
+    public double [][] getWQAtKm(Double currentKm) {
 
         WstValueTable interpolator = null;
         // Get WstValueTable
@@ -204,7 +206,10 @@
                 getDataAsInt("wst_id"));
         }
 
-        Double tmp = getDataAsDouble("ld_locations");
+        Double tmp = (currentKm != null)
+                     ? currentKm
+                     : getDataAsDouble("ld_locations");
+
         double [][] vs = interpolator.interpolateWQColumnwise(
             tmp != null ? tmp : 0);
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQFacet.java	Mon Aug 13 13:50:45 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQFacet.java	Tue Aug 14 08:42:08 2012 +0000
@@ -42,7 +42,8 @@
     public Object getData(Artifact artifact, CallContext context) {
         WQKmsInterpolArtifact interpolData =
             (WQKmsInterpolArtifact) artifact;
-        return interpolData.getWQAtKm(10);
+        Double currentKm = (Double)context.getContextValue("currentKm");
+        return interpolData.getWQAtKm(currentKm);
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Mon Aug 13 13:50:45 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Tue Aug 14 08:42:08 2012 +0000
@@ -13,6 +13,7 @@
 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.exports.StyledSeriesBuilder;
 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation;
 import de.intevation.flys.jfree.FLYSAnnotation;
 import de.intevation.flys.jfree.JFreeUtil;
@@ -112,6 +113,9 @@
         else if(QSECTOR.equals(name)) {
             doQSectorOut(aaf, doc, visible);
         }
+        else if(STATIC_WQ.equals(name)) {
+            doWQOut(aaf.getData(context), aaf, doc, visible);
+        }
         else {
             logger.warn("Unknown facet name " + name);
             return;
@@ -243,6 +247,25 @@
         }
     }
 
+    /**
+     * Add WQ Data to plot.
+     * @param wqkms data as double[][]
+     */
+    protected void doWQOut(
+        Object           wqkms,
+        ArtifactAndFacet aaf,
+        Document         theme,
+        boolean          visible
+    ) {
+        logger.debug("FixWQCurveGenerator: doWQOut");
+        double [][] data = (double [][]) wqkms;
+
+        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data, true);
+
+        addAxisSeries(series, YAXIS.W.idx, visible);
+    }
+
     protected void addQWSeries(QW[] qws, ArtifactAndFacet aaf, Document theme, boolean visible) {
          if(qws != null) {
             XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);

http://dive4elements.wald.intevation.org