changeset 9036:c265c9fc915c

work on u-info/s-info states
author gernotbelger
date Mon, 30 Apr 2018 18:03:02 +0200
parents 8aa7d9eaaa21
children 1574ce45c98d
files artifacts/doc/conf/artifacts/sinfo.xml artifacts/doc/conf/artifacts/uinfo.xml artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/WsplChoice.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/CalculationSelectUinfo.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/UINFOArtifact.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/ScenarioTypeState.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/UseScenarioChoice.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
diffstat 10 files changed, 235 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/sinfo.xml	Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/doc/conf/artifacts/sinfo.xml	Mon Apr 30 18:03:02 2018 +0200
@@ -213,6 +213,32 @@
       </outputmodes>
     </state>
 
+
+
+
+    <!-- Calculation Mode: Grundberührungen -->
+    
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.sinfo.calculation_mode"/>
+      <to state="state.sinfo.distance_only"/>
+      <condition data="calculation_mode" value="sinfo_calc_grounding" operator="equal"/>
+    </transition>
+     
+
+
+   <!-- Calculation Mode: Überflutungsdauern Infrastrukturen BWaStr -->
+    
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.sinfo.calculation_mode"/>
+      <to state="state.sinfo.distance_only"/>
+      <condition data="calculation_mode" value="sinfo_calc_infrastructures_inundation_duration" operator="equal"/>
+    </transition>
+    
+  <state id="state.sinfo.wspl" description="state.sinfo.wspl" state="org.dive4elements.river.artifacts.sinfo.inundation.WsplChoice" helpText="help.state.sinfo.wspl">
+      <data name="wspl" type="Boolean"/>
+    </state>
+
+
     <!-- Calculation Mode: Transportkörperhöhen -->
     <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
       <from state="state.sinfo.calculation_mode"/>
--- a/artifacts/doc/conf/artifacts/uinfo.xml	Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/doc/conf/artifacts/uinfo.xml	Mon Apr 30 18:03:02 2018 +0200
@@ -21,20 +21,54 @@
 			<data name="calculation_mode" type="String" />
 		</state>
 
-
-
+	<state id="state.uinfo.distance_only" description="state.uinfo.distance_only" state="org.dive4elements.river.artifacts.states.DistanceOnlySelect" helpText="help.state.uinfo.distance_only">
+      <data name="ld_from" type="Double"/>
+      <data name="ld_to" type="Double"/>
+    </state>
+    
 
 
-		<!-- Calculation Mode: Salix Linie -->
-		<transition
-			transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
-			<from state="state.uinfo.calculation_mode" />
-			<to state="state.uinfo.salix_line" />
-			<condition data="calculation_mode" value="uinfo_salix_line"
-				operator="equal" />
-			<to state="state.sinfo.distance_only" />    <!-- TODO: KLONEN und U-Info daraus machen -->
-		</transition>
+		<!-- Calculation Mode: Salix Linie  -->
+		
 
+	<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.calculation_mode"/>
+      <to state="state.uinfo.distance_only"/>
+      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/>
+    </transition>
+ 
+
+	<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.distance_only"/>
+      <to state="state.uinfo.use_scenario"/>
+      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/>
+    </transition>
+		
+		
+ 	<state id="state.uinfo.use_scenario" description="state.uinfo.use_scenario" state="org.dive4elements.river.artifacts.uinfo.salix.UseScenarioChoice" helpText="help.state.uinfo.use_scenario">
+      <data name="use_scenario" type="Boolean"/>
+    </state>
+    
+ 	<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.use_scenario"/>
+      <to state="state.uinfo.scenario_type"/>
+      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/>
+    </transition>
+			<!-- FIXME: der State soll nur angezeigt werden, wenn zuvor bei Szenario-Betrachtung "Ja" angeklickt wurde...  -->
+ 	<state id="state.uinfo.scenario_type" description="state.uinfo.scenario_type" state="org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState" helpText="help.state.uinfo.scenario_type">
+    <!--Probleme, wenn, der DefaultState genommen wird!  <data name="scenario_type" type="Integer"/> -->
+   	<data name ="test" type ="String" />
+    </state>
+    
+  
+		 
+ 	<transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition">
+      <from state="state.uinfo.scenario_type"/>
+      <to state="state.uinfo.salix_line"/>
+      <!-- condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/> -->
+    </transition>
+    
+    
 		<state id="state.uinfo.salix_line"
 			description="state.uinfo.salix_line"
 			state="org.dive4elements.river.artifacts.uinfo.salix.SalixLineState"
@@ -73,6 +107,13 @@
 
 
 
+
+
+
+
+
+
+
 		<!-- Calculation Mode: Vegetation Zones -->
 		<transition
 			transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
@@ -80,7 +121,7 @@
 			<to state="state.uinfo.vegetation_zones" />
 			<condition data="calculation_mode"
 				value="uinfo_vegetation_zones" operator="equal" />
-			<to state="state.sinfo.distance_only" />    <!-- TODO: KLONEN und U-Info daraus machen -->
+			 
 		</transition>
 
 		<state id="state.uinfo.vegetation_zones"
@@ -126,7 +167,7 @@
 			<to state="state.uinfo.inundation_duration" />
 			<condition data="calculation_mode"
 				value="uinfo_inundation_duration" operator="equal" />
-			<to state="state.sinfo.distance_only" />    <!-- TODO: KLONEN und U-Info daraus machen -->
+			 
 		</transition>
 
 		<state id="state.uinfo.inundation_duration"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/WsplChoice.java	Mon Apr 30 18:03:02 2018 +0200
@@ -0,0 +1,23 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.sinfo.inundation;
+
+import org.dive4elements.river.artifacts.states.BooleanChoiceState;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class WsplChoice extends BooleanChoiceState {
+
+    private static final long serialVersionUID = 1L;
+
+    public WsplChoice() {
+        super("wspl.option", "wspl.active", "wspl.inactive");
+    }
+}
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/CalculationSelectUinfo.java	Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/CalculationSelectUinfo.java	Mon Apr 30 18:03:02 2018 +0200
@@ -53,9 +53,9 @@
     public boolean validate(final Artifact artifact) throws IllegalArgumentException {
         log.debug("CalculationSelect.validate");
 
-        final UINFOArtifact sinfo = (UINFOArtifact) artifact;
+        final UINFOArtifact uinfo = (UINFOArtifact) artifact;
         /* throws an exception if calculation mode is invalid */
-        sinfo.getCalculationMode();
+        uinfo.getCalculationMode();
         return true;
     }
 }
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/UINFOArtifact.java	Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/UINFOArtifact.java	Mon Apr 30 18:03:02 2018 +0200
@@ -10,78 +10,72 @@
 package org.dive4elements.river.artifacts.uinfo;
 
 import org.apache.commons.lang.StringUtils;
-import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.FacetActivity;
-import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.river.artifacts.D4EArtifact;
 
 /**
- * The default SINFO artifact.
+ * The default UINFO artifact.
  *
  * @author Gernot Belger
  */
 public class UINFOArtifact extends D4EArtifact {
 
-	private static final long serialVersionUID = 1L;
-
-	/** Error message that is thrown if no mode has been chosen. */
-	private static final String ERROR_NO_CALCULATION_MODE = "error_feed_no_calculation_mode";
-
-	/**
-	 * Error message that is thrown if an invalid calculation mode has been chosen.
-	 */
-	private static final String ERROR_INVALID_CALCULATION_MODE = "error_feed_invalid_calculation_mode";
-
-	/** The name of the artifact. */
-	private static final String ARTIFACT_NAME = "uinfo";
-
-	private static final String FIELD_RIVER = "river";
-
-	private static final String FIELD_MODE = "calculation_mode";
-
-	static {
-		// Active/deactivate facets.
-		// BEWARE: we can only define one activity for "sinfo", so we use the artifact
-		// as place for this
-		FacetActivity.Registry.getInstance().register(ARTIFACT_NAME, new FacetActivity() {
-			@Override
-			public Boolean isInitialActive(final Artifact artifact, final Facet facet, final String output) {
-				return null;
-			}
-		});
-	}
+    private static final long serialVersionUID = 1L;
 
-	/**
-	 * Default constructor, because it's serializable.
-	 */
-	public UINFOArtifact() {
-	}
-
-	/**
-	 * Returns the name of the concrete artifact.
-	 *
-	 * @return the name of the concrete artifact.
-	 */
-	@Override
-	public String getName() {
-		return ARTIFACT_NAME;
-	}
+    /** Error message that is thrown if no mode has been chosen. */
+    private static final String ERROR_NO_CALCULATION_MODE = "error_feed_no_calculation_mode";
 
-	public UinfoCalcMode getCalculationMode() {
-
-		final String calc = getDataAsString(FIELD_MODE);
-		if (calc == null) {
-			throw new IllegalArgumentException(ERROR_NO_CALCULATION_MODE);
-		}
+    /**
+     * Error message that is thrown if an invalid calculation mode has been chosen.
+     */
+    private static final String ERROR_INVALID_CALCULATION_MODE = "error_feed_invalid_calculation_mode";
 
-		try {
-			return UinfoCalcMode.valueOf(StringUtils.trimToEmpty(calc).toLowerCase());
-		} catch (final Exception e) {
-			throw new IllegalArgumentException(ERROR_INVALID_CALCULATION_MODE, e);
-		}
-	}
+    /** The name of the artifact. */
+    private static final String ARTIFACT_NAME = "uinfo";
 
-	public String getRiver() {
-		return getDataAsString(FIELD_RIVER);
-	}
+    private static final String FIELD_RIVER = "river";
+
+    private static final String FIELD_MODE = "calculation_mode";
+
+    static {
+        // Active/deactivate facets.
+        // BEWARE: we can only define one activity for "sinfo", so we use the artifact
+        // as place for this
+        FacetActivity.Registry.getInstance().register(ARTIFACT_NAME, (artifact, facet, output) -> null);
+    }
+
+    /**
+     * Default constructor, because it's serializable.
+     */
+    public UINFOArtifact() {
+    }
+
+    /**
+     * Returns the name of the concrete artifact.
+     *
+     * @return the name of the concrete artifact.
+     */
+    @Override
+    public String getName() {
+        return ARTIFACT_NAME;
+    }
+
+    public UinfoCalcMode getCalculationMode() {
+
+        final String calc = getDataAsString(FIELD_MODE);
+        if (calc == null) {
+            throw new IllegalArgumentException(ERROR_NO_CALCULATION_MODE);
+        }
+
+        try {
+            return UinfoCalcMode.valueOf(StringUtils.trimToEmpty(calc).toLowerCase());
+        }
+        catch (final Exception e) {
+            throw new IllegalArgumentException(ERROR_INVALID_CALCULATION_MODE, e);
+        }
+    }
+
+    public String getRiver() {
+        return getDataAsString(FIELD_RIVER);
+    }
 }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/ScenarioTypeState.java	Mon Apr 30 18:03:02 2018 +0200
@@ -0,0 +1,17 @@
+
+package org.dive4elements.river.artifacts.uinfo.salix;
+
+import org.dive4elements.river.artifacts.states.BooleanChoiceState;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ScenarioTypeState extends BooleanChoiceState {
+
+    private static final long serialVersionUID = 1L;
+
+    public ScenarioTypeState() {
+        super("activeMsg1", "activeMsg2", "activeMsg3"); // kriege den state irgendwie nicht selbst hin
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/UseScenarioChoice.java	Mon Apr 30 18:03:02 2018 +0200
@@ -0,0 +1,23 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.uinfo.salix;
+
+import org.dive4elements.river.artifacts.states.BooleanChoiceState;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class UseScenarioChoice extends BooleanChoiceState {
+
+    private static final long serialVersionUID = 1L;
+
+    public UseScenarioChoice() {
+        super("useScenario.option", "useScenario.active", "useScenario.inactive");
+    }
+}
\ No newline at end of file
--- a/artifacts/src/main/resources/messages.properties	Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties	Mon Apr 30 18:03:02 2018 +0200
@@ -833,6 +833,10 @@
 state.sinfo.flowdepthdevlopment_historical_select = Historisches Differenzenpaar
 help.state.sinfo.flowdepthdevlopment_historical_select = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.flowdepthdevlopment_historical_select
 
+state.sinfo.wspl = Wasserspiegellagen
+state.sinfo.wspl.option = Wasserspiegellagen zus\u00e4tzlich darstellen?
+help.state.sinfo.wspl= ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.wspl
+
 sinfo.export.flow_depth.csv.meta.header.result = ## {0} - {1} - {2}
 sinfo.export.flow_depth.csv.meta.header.result.label = Calculation Output
 sinfo.export.flow_depth.csv.meta.version = # {0}: {1}
@@ -985,6 +989,22 @@
 flowdepthdevelopmentcalculation.yearDifferenceCurrent = aktuelles Differenzenpaar
 flowdepthdevelopmentcalculation.yearDifferenceHistorical =  = historisches Differenzenpaar
 
+state.uinfo.use_scenario=Szenariobetrachtung
+useScenario.option = Zus\u00e4tzlich Szenariobetrachtung miteinbeziehen?
+useScenario.active = Activ
+useScenario.inactive = Inactiv
+help.state.uinfo.use_scenario=${help.url}/OnlineHilfe/UINFO#help.state.uinfo.use_scenario
+
+
+state.uinfo.scenario_type=Auswahl des Szenariotyps
+scenarioType.option1 = Regional wirkende Eingriffe
+scenarioType.option2 = \u00dcberregional wirkende Eingriffe
+scenarioType.option1 = Historische Betrachtung 
+help.state.uinfo.scenario_type=${help.url}/OnlineHilfe/UINFO#help.state.uinfo.scenario_type
+
+state.uinfo.distance_only = Range selection
+help.state.uinfo.distance_only = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.distance_only
+
 uinfo_salix_line = Salix-Linie
 uinfo_inundation_duration = \u00dcberflutungsdauern Aue
 uinfo_vegetation_zones = Vegetationszonen
--- a/artifacts/src/main/resources/messages_de.properties	Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Mon Apr 30 18:03:02 2018 +0200
@@ -833,6 +833,10 @@
 state.sinfo.flowdepthdevlopment_historical_select = Historisches Differenzenpaar
 help.state.sinfo.flowdepthdevlopment_historical_select = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.flowdepthdevlopment_historical_select
 
+state.sinfo.wspl = Wasserspiegellagen
+state.sinfo.wspl.option = Wasserspiegellagen zus\u00e4tzlich darstellen?
+help.state.sinfo.wspl= ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.wspl
+
 sinfo.export.flow_depth.csv.meta.header.result = ##{0} - {1} - {2}
 sinfo.export.flow_depth.csv.meta.header.result.label = Ergebnisausgabe
 sinfo.export.flow_depth.csv.meta.version = # {0}: {1}
@@ -985,6 +989,16 @@
 flowdepthdevelopmentcalculation.yearDifferenceCurrent = aktuelles Differenzenpaar
 flowdepthdevelopmentcalculation.yearDifferenceHistorical =  = historisches Differenzenpaar
 
+state.uinfo.use_scenario=Szenariobetrachtung
+useScenario.option = Zus\u00e4tzlich Szenariobetrachtung miteinbeziehen?
+useScenario.active = Ja
+useScenario.inactive = Nein
+help.state.uinfo.use_scenario=${help.url}/OnlineHilfe/UINFO#help.state.uinfo.use_scenario
+
+state.uinfo.distance_only = Wahl der Berechnungsstrecke
+help.state.uinfo.distance_only = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.distance_only
+ 
+
 uinfo_salix_line = Salix-Linie
 uinfo_inundation_duration = \u00dcberflutungsdauern Aue
 uinfo_vegetation_zones = Vegetationszonen
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Mon Apr 30 10:13:15 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Mon Apr 30 18:03:02 2018 +0200
@@ -14,7 +14,7 @@
 projectlist_creationTime = Anlegezeitpunkt
 projectlist_title = Titel
 projectlist_favorite = Dauerhaft
-projectlist_close = Schlie\u1e9een
+projectlist_close = Schlie\u00dfen
 really_delete = Wollen Sie dieses Projekt wirklich l\u00f6schen?
 project_name_too_long = Der eingegebene Projektname ist zu lang. Die maximale L\u00e4nge betr\u00e4gt $LEN Zeichen.
 switch_language = Englisch

http://dive4elements.wald.intevation.org