changeset 392:72177020db92

Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub. flys-artifacts/trunk@1817 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 04 May 2011 07:48:39 +0000
parents 5d6988836f01
children befedd7629d5
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/winfo.xml flys-artifacts/doc/conf/conf.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java
diffstat 6 files changed, 165 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 03 17:37:56 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed May 04 07:48:39 2011 +0000
@@ -1,3 +1,25 @@
+2011-05-04  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/artifacts/winfo.xml: Added new transitions and states to enable
+	  the WINFO artifact for computing discharge curves.
+
+	* doc/conf/conf.xml: Added OutGenerators that generate computed discharge
+	  curves and exports for its data.
+
+	* src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java:
+	  New. This state is reached if the user chose the computed discharge
+	  curve.
+
+	* src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java:
+	  New. This is only a stub implementation at the moment. This
+	  OutGenerator should create computed discharge curves later. It extends
+	  the DischargeCurveGenerator which should do the same stuff for discharge
+	  curves for gauges.
+
+	* src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java:
+	  New. This is only a stub implementation at the moment. This OutGenerator
+	  should create the exports of the discharge curve computation.
+
 2011-05-03  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/winfo.xml: Added a new output mode for the duration
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml	Tue May 03 17:37:56 2011 +0000
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml	Wed May 04 07:48:39 2011 +0000
@@ -24,6 +24,12 @@
         <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
             <from state="state.winfo.calculation_mode"/>
             <to state="state.winfo.location"/>
+            <condition data="calculation_mode" value="calc.discharge.curve" operator="equal"/>
+        </transition>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
+            <from state="state.winfo.calculation_mode"/>
+            <to state="state.winfo.location"/>
             <condition data="calculation_mode" value="calc.duration.curve" operator="equal"/>
         </transition>
 
@@ -62,9 +68,16 @@
             <to state="state.winfo.wq"/>
         </transition>
 
-        <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
+        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
             <from state="state.winfo.location"/>
             <to state="state.winfo.durationcurve"/>
+            <condition data="calculation_mode" value="calc.duration.curve" operator="equal"/>
+        </transition>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
+            <from state="state.winfo.location"/>
+            <to state="state.winfo.computeddischargecurve"/>
+            <condition data="calculation_mode" value="calc.discharge.curve" operator="equal"/>
         </transition>
 
         <state id="state.winfo.wq" description="state.winfo.wq" state="de.intevation.flys.artifacts.states.WQSelect">
@@ -92,6 +105,22 @@
             </outputmodes>
         </state>
 
+        <state id="state.winfo.computeddischargecurve" description="state.winfo.computeddischargecurve" state="de.intevation.flys.artifacts.states.ComputedDischargeCurveState">
+            <outputmodes>
+                <outputmode name="computed_discharge_curve" description="output.computed_discharge_curve" mime-type="image/png">
+                    <facets>
+                        <facet name="computed_discharge_curve.w" description="facet.computed_discharge_curve.w"/>
+                        <facet name="computed_discharge_curve.q" description="facet.computed_discharge_curve.q"/>
+                    </facets>
+                </outputmode>
+                <outputmode name="computed_dischargecurve_export" description="output.computed_dischargecurve_export" mime-type="text/plain">
+                    <facets>
+                        <facet name="csv" description="facet.computed_dischargecurve_export.csv" />
+                    </facets>
+                </outputmode>
+            </outputmodes>
+        </state>
+
         <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
             <from state="state.winfo.wq"/>
             <to state="state.winfo.waterlevel"/>
--- a/flys-artifacts/doc/conf/conf.xml	Tue May 03 17:37:56 2011 +0000
+++ b/flys-artifacts/doc/conf/conf.xml	Wed May 04 07:48:39 2011 +0000
@@ -50,10 +50,12 @@
 
     <output-generators>
         <output-generator name="discharge_curve">de.intevation.flys.exports.DischargeCurveGenerator</output-generator>
+        <output-generator name="computed_discharge_curve">de.intevation.flys.exports.ComputedDischargeCurveGenerator</output-generator>
         <output-generator name="longitudinal_section">de.intevation.flys.exports.LongitudinalSectionGenerator</output-generator>
         <output-generator name="duration_curve">de.intevation.flys.exports.DurationCurveGenerator</output-generator>
         <output-generator name="waterlevel_export">de.intevation.flys.exports.WaterlevelExporter</output-generator>
         <output-generator name="durationcurve_export">de.intevation.flys.exports.DurationCurveExporter</output-generator>
+        <output-generator name="computed_dischargecurve_export">de.intevation.flys.exports.ComputedDischargeCurveExporter</output-generator>
     </output-generators>
 
     <rest-server>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java	Wed May 04 07:48:39 2011 +0000
@@ -0,0 +1,36 @@
+package de.intevation.flys.artifacts.states;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Element;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+
+/**
+ * The final state that will be reached after the discharge curve calculation
+ * mode has been chosen.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ComputedDischargeCurveState extends DefaultState {
+
+    /** The logger that is used in this state.*/
+    private static Logger logger =
+        Logger.getLogger(ComputedDischargeCurveState.class);
+
+
+    protected Element[] createItems(
+        XMLUtils.ElementCreator cr,
+        Artifact    artifact,
+        String      name,
+        CallContext context)
+    {
+        logger.debug("ComputedDischargeCurveState.createItems");
+        return null;
+    }
+}
+// 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/exports/ComputedDischargeCurveExporter.java	Wed May 04 07:48:39 2011 +0000
@@ -0,0 +1,47 @@
+package de.intevation.flys.exports;
+
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.w3c.dom.Document;
+
+import org.apache.log4j.Logger;
+
+import au.com.bytecode.opencsv.CSVWriter;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.WINFOArtifact;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ComputedDischargeCurveExporter extends AbstractExporter {
+
+    /** The logger used in this exporter.*/
+    private static Logger logger =
+        Logger.getLogger(ComputedDischargeCurveExporter.class);
+
+
+    public void init(Document request, OutputStream out, CallContext context) {
+        logger.debug("ComputedDischargeCurveExporter.init");
+
+        super.init(request, out, context);
+    }
+
+
+    protected void addData(Artifact artifact) {
+        // TODO FILL ME
+    }
+
+
+    protected void writeCSVData(CSVWriter writer) {
+        logger.info("ComputedDischargeCurveExporter.writeData");
+
+        // TODO FILL ME
+    }
+}
+// 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/exports/ComputedDischargeCurveGenerator.java	Wed May 04 07:48:39 2011 +0000
@@ -0,0 +1,28 @@
+package de.intevation.flys.exports;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
+import de.intevation.artifacts.Artifact;
+
+
+/**
+ * An OutGenerator that generates discharge curves.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ComputedDischargeCurveGenerator extends DischargeCurveGenerator {
+
+    /** The logger used in this generator.*/
+    private static Logger logger =
+        Logger.getLogger(ComputedDischargeCurveGenerator.class);
+
+
+    @Override
+    public void doOut(Artifact artifact, String facet, Document attr) {
+        logger.debug("ComputedDischargeCurveGenerator.doOut");
+        // TODO FILL ME
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org