[PATCH 2 of 2] Merged

Wald Commits scm-commit at wald.intevation.org
Mon Aug 19 10:19:50 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1376900451 -7200
# Node ID 9e81ed5650950c3e7a8abb59619f6d5186376d9e
# Parent  d02ad36115c675f13fb00dea97eb2f83ad424962
# Parent  4937dab5ff7a1b3d4e8c709b21a855c0c2dc74b3
Merged.

diff -r d02ad36115c6 -r 9e81ed565095 artifacts/doc/conf/artifacts/winfo.xml
--- 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"/>
diff -r d02ad36115c6 -r 9e81ed565095 artifacts/doc/conf/jasper/sqrelation.jasper
Binary file artifacts/doc/conf/jasper/sqrelation.jasper has changed
diff -r d02ad36115c6 -r 9e81ed565095 artifacts/doc/conf/meta-data.xml
--- 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 <> 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>
diff -r d02ad36115c6 -r 9e81ed565095 artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java
--- 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(
diff -r d02ad36115c6 -r 9e81ed565095 artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java
--- 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),


More information about the Dive4elements-commits mailing list