changeset 4220:a30647abf009

Added config and states for sediment load calculation in MINFO module. The config describes the transitions and states for parameter input in sediment load calculation.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 23 Oct 2012 09:53:02 +0200
parents 0674d89210f5
children 480de0dbca8e
files flys-artifacts/doc/conf/artifacts/minfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadDistanceSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadEpochSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadOffEpochSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadUnit.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadYearSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/YearEpochSelect.java
diffstat 8 files changed, 266 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Tue Oct 23 07:39:09 2012 +0200
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Tue Oct 23 09:53:02 2012 +0200
@@ -45,6 +45,7 @@
             <condition data="calculation_mode" value="calc.bed.quality" operator="equal"/>
         </transition>
 
+
         <state id="state.minfo.distance_only" description="state.minfo.distance_only" state="de.intevation.flys.artifacts.states.DistanceOnlySelect" helpText="help.minfo.distance">
             <data name="ld_from" type="Double" />
             <data name="ld_to"   type="Double" />
@@ -313,6 +314,92 @@
                 </outputmode>
             </outputmodes>
         </state>
+
+        <!-- sediment load config-->
+        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
+            <from state="state.minfo.calculation_mode"/>
+            <to state="state.minfo.sediment.load.year_epoch"/>
+            <condition data="calculation_mode" value="calc.sediment.load" operator="equal"/>
+        </transition>
+
+        <state id="state.minfo.sediment.load.year_epoch" description="state.minfo.sediment.load.year_epoch" state="de.intevation.flys.artifacts.states.minfo.YearEpochSelect" helpText="help.minfo.year_epoch">
+            <data name="ye_select" type="String"/>
+        </state>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
+            <from state="state.minfo.sediment.load.year_epoch"/>
+            <to state="state.minfo.sediment.load.location"/>
+        </transition>
+
+        <state id="state.minfo.sediment.load.location" description="state.minfo.distance_only" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadDistanceSelect" helpText="help.minfo.distance">
+            <data name="ld_from" type="Double" />
+            <data name="ld_to"   type="Double" />
+        </state>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
+            <from state="state.minfo.sediment.load.location"/>
+            <to state="state.minfo.sediment.load.off_epochs"/>
+            <condition data="ye_select" value="off_epoch" operator="equal"/>
+        </transition>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
+            <from state="state.minfo.sediment.load.location"/>
+            <to state="state.minfo.sediment.load.period"/>
+            <condition data="ye_select" value="year" operator="equal"/>
+        </transition>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
+            <from state="state.minfo.sediment.load.location"/>
+            <to state="state.minfo.sediment.load.epochs"/>
+            <condition data="ye_select" value="epoch" operator="equal"/>
+        </transition>
+
+        <state id="state.minfo.sediment.load.period" description="state.minfo.bed.period" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadYearSelect">
+            <data name="start" type="Long"/>
+            <data name="end" type="Long"/>
+        </state>
+
+        <state id="state.minfo.sediment.load.epochs" description="state.minfo.bed.epochs" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadEpochSelect">
+            <data name="epochs" type="String"/>
+        </state>
+
+        <state id="state.minfo.sediment.load.off_epochs" description="state.minfo.bed.off_epochs" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadOffEpochSelect">
+            <data name="off_epochs" type="String"/>
+        </state>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
+            <from state="state.minfo.sediment.load.period"/>
+            <to state="state.minfo.sediment.load.unit"/>
+        </transition>
+
+        <state id="state.minfo.sediment.load.unit" description="state.minfo.sediment.load.unit" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadUnit">
+            <data name="unit" type="String"/>
+        </state>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
+            <from state="state.minfo.sediment.load.unit"/>
+            <to state="state.minfo.sediment.load.calculate"/>
+        </transition>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
+            <from state="state.minfo.sediment.load.epochs"/>
+            <to state="state.minfo.sediment.load.calculate"/>
+        </transition>
+
+        <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
+            <from state="state.minfo.sediment.load.off_epochs"/>
+            <to state="state.minfo.sediment.load.calculate"/>
+        </transition>
+
+        <state id="state.minfo.sediment.load.calculate" description="state.minfo.sediment.load.calculate" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadCalculate">
+            <outputmodes>
+                <outputmode name="dummy" description="output.dummy" mime-type="image/png" type="chart">
+                    <facets>
+                    </facets>
+                </outputmode>
+            </outputmodes>
+        </state>
+
     </states>
 
 </artifact>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java	Tue Oct 23 09:53:02 2012 +0200
@@ -0,0 +1,12 @@
+package de.intevation.flys.artifacts.states.minfo;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.states.DefaultState;
+
+
+public class SedimentLoadCalculate
+extends DefaultState
+implements FacetTypes 
+{
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadDistanceSelect.java	Tue Oct 23 09:53:02 2012 +0200
@@ -0,0 +1,13 @@
+package de.intevation.flys.artifacts.states.minfo;
+
+import de.intevation.flys.artifacts.states.DistanceOnlySelect;
+
+
+public class SedimentLoadDistanceSelect
+extends DistanceOnlySelect 
+{
+    @Override
+    protected String getUIProvider() {
+        return "minfo.sedimentload_distance_select";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadEpochSelect.java	Tue Oct 23 09:53:02 2012 +0200
@@ -0,0 +1,25 @@
+package de.intevation.flys.artifacts.states.minfo;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.artifacts.states.DefaultState;
+
+
+public class SedimentLoadEpochSelect
+extends DefaultState
+{
+    /** The logger used in this class. */
+    private static Logger logger = Logger.getLogger(SedimentLoadEpochSelect.class);
+
+
+    /**
+     * The default constructor that initializes an empty State object.
+     */
+    public SedimentLoadEpochSelect() {
+    }
+
+    @Override
+    protected String getUIProvider() {
+        return "minfo.sedimentload_epoch_select";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadOffEpochSelect.java	Tue Oct 23 09:53:02 2012 +0200
@@ -0,0 +1,25 @@
+package de.intevation.flys.artifacts.states.minfo;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.artifacts.states.DefaultState;
+
+
+public class SedimentLoadOffEpochSelect
+extends DefaultState
+{
+   /** The logger used in this class. */
+    private static Logger logger = Logger.getLogger(SedimentLoadOffEpochSelect.class);
+
+
+    /**
+     * The default constructor that initializes an empty State object.
+     */
+    public SedimentLoadOffEpochSelect() {
+    }
+
+    @Override
+    protected String getUIProvider() {
+        return "minfo.sedimentload_offepoch_select";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadUnit.java	Tue Oct 23 09:53:02 2012 +0200
@@ -0,0 +1,60 @@
+package de.intevation.flys.artifacts.states.minfo;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.artifacts.states.DefaultState;
+
+
+public class SedimentLoadUnit
+extends DefaultState
+{
+   /** The logger used in this class. */
+    private static Logger logger = Logger.getLogger(SedimentLoadUnit.class);
+
+
+    /**
+     * The default constructor that initializes an empty State object.
+     */
+    public SedimentLoadUnit() {
+    }
+
+    @Override
+    protected String getUIProvider() {
+        return "minfo.sedimentload_unit_select";
+    }
+
+    @Override
+    protected Element[] createItems(
+        XMLUtils.ElementCreator ec,
+        Artifact                artifact,
+        String                  name,
+        CallContext             context)
+    {
+        CallMeta meta = context.getMeta();
+        Element[] elements = new Element[2];
+        elements[0] = createItem(
+                ec,
+                new String[] {
+                    Resources.getMsg(meta,
+                        "state.minfo.t_per_a",
+                        "state.minfo.t_per_a"),
+                    "t_per_a"});
+
+        elements[1] = createItem(
+            ec,
+            new String[] {
+                Resources.getMsg(meta,
+                    "state.minfo.m3_per_a",
+                    "state.minfo.m3_per_a"),
+                "m3_per_a"});
+
+       return elements;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadYearSelect.java	Tue Oct 23 09:53:02 2012 +0200
@@ -0,0 +1,26 @@
+package de.intevation.flys.artifacts.states.minfo;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.artifacts.states.DefaultState;
+
+
+public class SedimentLoadYearSelect
+extends DefaultState
+{
+    /** The logger used in this class. */
+    private static Logger logger = Logger.getLogger(SedimentLoadYearSelect.class);
+
+
+    /**
+     * The default constructor that initializes an empty State object.
+     */
+    public SedimentLoadYearSelect() {
+    }
+
+    @Override
+    protected String getUIProvider() {
+        return "minfo.sedimentload_year_select";
+    }
+
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/YearEpochSelect.java	Tue Oct 23 07:39:09 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/YearEpochSelect.java	Tue Oct 23 09:53:02 2012 +0200
@@ -6,6 +6,7 @@
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
 import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.artifacts.states.DefaultState;
 
@@ -33,7 +34,22 @@
         CallContext             context)
     {
         CallMeta meta = context.getMeta();
-        Element[] elements = new Element[2];
+        Element[] elements;
+        if (((FLYSArtifact)artifact).getCurrentStateId()
+            .equals("state.minfo.sediment.load.year_epoch")
+        ) {
+            elements = new Element[3];
+            elements[2] = createItem(
+                ec,
+                new String[] {
+                    Resources.getMsg(meta,
+                        "state.minfo.off_epoch",
+                        "state.minfo.off_epoch"),
+                    "off_epoch"});
+        }
+        else {
+            elements = new Element[2];
+        }
         elements[0] = createItem(
                 ec,
                 new String[] {
@@ -50,7 +66,7 @@
                     "state.minfo.epoch"),
                 "epoch"});
 
-        return elements;
+       return elements;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org