changeset 6853:9e81ed565095

Merged.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 19 Aug 2013 10:20:51 +0200
parents d02ad36115c6 (current diff) 4937dab5ff7a (diff)
children 8d98e1825846
files
diffstat 5 files changed, 34 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/winfo.xml	Mon Aug 19 10:19:06 2013 +0200
+++ b/artifacts/doc/conf/artifacts/winfo.xml	Mon Aug 19 10:20:51 2013 +0200
@@ -642,6 +642,7 @@
                 </outputmode>
                 <outputmode name="historical_discharge_wq" description="output.historical_discharge_wq.description" mime-type="image/png" type="chart">
                     <facets>
+                        <facet name="discharge_curve.curve"/>
                         <facet name="historical_discharge.wq.q"/>
                         <facet name="historical_discharge.wq.w"/>
                         <facet name="historical_discharge.wq.curve"/>
Binary file artifacts/doc/conf/jasper/sqrelation.jasper has changed
--- a/artifacts/doc/conf/meta-data.xml	Mon Aug 19 10:19:06 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Mon Aug 19 10:20:51 2013 +0200
@@ -487,22 +487,23 @@
 
 
     <dc:macro name="historical_discharge_curve">
+      <dc:variable name="refgauge" type="number" expr="$reference_gauge"/>
       <dc:context>
         <dc:statement>
           SELECT g.id   AS gauge_id,
-                 g.name AS gauge_name,
-                 dt.id AS dt_id,
-                 t.start_time AS start_time,
-                 t.stop_time AS stop_time,
-                 dt.description AS desc,
-                 dt.bfg_id AS bfg_id
+          g.name AS gauge_name,
+          dt.id AS dt_id,
+          t.start_time AS start_time,
+          t.stop_time AS stop_time,
+          dt.description AS desc,
+          dt.bfg_id AS bfg_id
           FROM gauges g
           JOIN discharge_tables dt ON g.id = dt.gauge_id
           LEFT JOIN time_intervals t ON dt.time_interval_id = t.id
           WHERE g.river_id = ${river_id}
           AND dt.kind &lt;&gt; 0
-          AND g.station = ${fromkm}
-          AND g.station = ${tokm}
+          AND ((g.station = ${fromkm} AND g.station = ${tokm})
+          OR g.official_number = ${refgauge})
           ORDER BY start_time
         </dc:statement>
         <dc:if test="dc:has-result()">
@@ -1336,17 +1337,14 @@
           LEFT JOIN time_intervals t ON dt.time_interval_id = t.id
           WHERE g.river_id = ${river_id}
           AND dt.kind = 0
-          AND g.station = ${fromkm}
-          AND g.station = ${tokm}
+          AND ((g.station = ${fromkm} AND g.station = ${tokm})
+          OR g.official_number = ${refgauge})
         </dc:statement>
         <dc:if test="dc:has-result()">
-          <current_gauge>
-            <dc:for-each>
-              <gauge name="{$gauge_name} ({dc:date-format('dd.MM.yyyy', $start_time)})"
-                factory="gaugedischarge" target_out="{$out}"
-                ids="{$gauge_name}"/>
-            </dc:for-each>
-          </current_gauge>
+          <dc:for-each>
+            <current_gauge factory="gaugedischarge" target_out="{$out}"
+              ids="{$gauge_name}"/>
+          </dc:for-each>
         </dc:if>
       </dc:context>
     </dc:macro>
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java	Mon Aug 19 10:19:06 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java	Mon Aug 19 10:20:51 2013 +0200
@@ -10,6 +10,8 @@
 
 import java.util.List;
 
+import java.text.DateFormat;
+
 import org.apache.log4j.Logger;
 
 import org.dive4elements.artifacts.CallMeta;
@@ -31,7 +33,10 @@
 import org.dive4elements.river.artifacts.resources.Resources;
 
 import org.dive4elements.river.model.Gauge;
+import org.dive4elements.river.model.DischargeTable;
+import org.dive4elements.river.model.TimeInterval;
 
+import org.dive4elements.river.utils.Formatter;
 
 /**
  * The only state for an GaugeDischargeState (River and km known).
@@ -64,9 +69,18 @@
         }
 
         Gauge gauge = artifact.getGauge();
+        DischargeTable mdt = gauge.fetchMasterDischargeTable();
+        TimeInterval validity = mdt.getTimeInterval();
+        DateFormat df = Formatter.getDateFormatter(meta, "dd.MM.yyyy");
+        String start = validity.getStartTime() != null ?
+                         df.format(validity.getStartTime()) : "Unknown";
+        String stop = validity.getStopTime() != null ?
+                          df.format(validity.getStopTime()) : "";
+
         Object[] args = new Object[] {
             gauge.getName(),
-            gauge.getStation()
+            start,
+            stop
         };
 
         String name = Resources.getMsg(
--- a/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java	Mon Aug 19 10:19:06 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java	Mon Aug 19 10:20:51 2013 +0200
@@ -124,7 +124,9 @@
                 artifactFacet.getData(context),
                 artifactFacet.getFacetDescription(), theme, visible);
         }
-        else if (name.equals(HISTORICAL_DISCHARGE_WQ_CURVE)) {
+        else if (name.equals(HISTORICAL_DISCHARGE_WQ_CURVE) ||
+                 name.equals(DISCHARGE_CURVE) ||
+                 name.equals(GAUGE_DISCHARGE_CURVE)) {
             doHistoricalDischargeCurveOut(
                 (D4EArtifact) artifactFacet.getArtifact(),
                 artifactFacet.getData(context),

http://dive4elements.wald.intevation.org