Mercurial > dive4elements > river
changeset 9051:2f39cd32e6fb
Merge
author | gernotbelger |
---|---|
date | Thu, 03 May 2018 14:29:14 +0200 |
parents | 2ffb55a53e8d (current diff) f4b66f6692e3 (diff) |
children | a6c19528ac16 |
files | |
diffstat | 8 files changed, 447 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/sinfo.xml Thu May 03 11:52:40 2018 +0200 +++ b/artifacts/doc/conf/artifacts/sinfo.xml Thu May 03 14:29:14 2018 +0200 @@ -223,21 +223,146 @@ <to state="state.sinfo.distance_only"/> <condition data="calculation_mode" value="sinfo_calc_grounding" operator="equal"/> </transition> - + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.sinfo.distance_only"/> + <to state="state.sinfo.year"/> + <condition data="calculation_mode" value="sinfo_calc_grounding" operator="equal"/> + </transition> + + <state id="state.sinfo.year" description="state.sinfo.year" state="org.dive4elements.river.artifacts.sinfo.grounding.YearChoice" helpText="help.state.sinfo.year"> + <data name="year" type="Boolean"/> + </state> + + + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.sinfo.year"/> + <to state="state.sinfo.grounding"/> + <condition data="calculation_mode" value="sinfo_calc_grounding" operator="equal"/> + </transition> + + <state id="state.sinfo.grounding" description="state.sinfo.grounding" state="org.dive4elements.river.artifacts.sinfo.grounding.GroundingState" helpText="help.state.sinfo.grounding"> + <outputmodes> + <outputmode name="grounding" description="output.grounding" mime-type="image/png" type="chart"> + <facets> + <!-- REMARK: id's that ends with 'filtered' are handled differently ' --> + <facet name="sinfo_facet_flow_depth.filtered" description="flow depth, filtered by current zoom state"/> + <facet name="sinfo_facet_flow_depth" description="flow depth"/> + + <facet name="sinfo_facet_flow_depth_with_tkh.filtered" description="flow depth including tkh, filtered by current zoom state"/> + <facet name="sinfo_facet_flow_depth_with_tkh" description="flow depth including tkh"/> + + <facet name="sinfo_facet_tkh" description="Facet for tkh"/> + + <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> + </facets> + </outputmode> + + <outputmode name="sinfo_flowdepth_export" description="output.sinfo_flowdepth_export" mime-type="text/plain" type="export"> + <facets> + <facet name="csv" description="facet.sinfo_flowdepth_export.csv"/> + <facet name="pdf" description="facet.sinfo_flowdepth_export.pdf"/> + </facets> + </outputmode> + + <outputmode name="sinfo_flowdepth_report" description="output.sinfo_flowdepth_report" mime-type="text/xml" type="report"> + <facets> + <facet name="report" description="facet.sinfo_flowdepth_report"/> + </facets> + </outputmode> + </outputmodes> + </state> + + <!-- Calculation Mode: Überflutungsdauern Infrastrukturen BWaStr --> + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.sinfo.distance_only"/> + <to state="state.sinfo.riverside"/> + <condition data="calculation_mode" value="sinfo_calc_infrastructures_inundation_duration" operator="equal"/> + </transition> + + <state id="state.sinfo.riverside" description="state.sinfo.riverside" state="org.dive4elements.river.artifacts.sinfo.inundation.RiversideChoice" helpText="help.state.sinfo.riverside"> + <data name="todo_radio_btn" type="Boolean"/> + </state> + + <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"> + <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> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.sinfo.riverside"/> + <to state="state.sinfo.wspl"/> + <condition data="calculation_mode" value="sinfo_calc_infrastructures_inundation_duration" operator="equal"/> + </transition> + + <state id="state.sinfo.wqinput" description="state.sinfo.wqinput" state="org.dive4elements.river.artifacts.sinfo.inundation.WqinputChoice" helpText="help.state.sinfo.wqinput"> + <data name="wqinput" type="Boolean"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.sinfo.wspl"/> + <to state="state.sinfo.wqinput"/> + <condition data="calculation_mode" value="sinfo_calc_infrastructures_inundation_duration" operator="equal"/> + </transition> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.sinfo.wqinput"/> + <to state="state.sinfo.infrastructures_inundation"/> + <condition data="calculation_mode" value="sinfo_calc_infrastructures_inundation_duration" operator="equal"/> + </transition> + + + + <state id="state.sinfo.infrastructures_inundation" description="state.sinfo.infrastructures_inundation" state="org.dive4elements.river.artifacts.sinfo.inundation.InundationState" helpText="help.state.sinfo.infrastructures_inundation"> + <outputmodes> + <outputmode name="infrastructures_inundation" description="output.infrastructures_inundation" mime-type="image/png" type="chart"> + <facets> + <!-- REMARK: id's that ends with 'filtered' are handled differently ' --> + <facet name="sinfo_facet_flow_depth.filtered" description="flow depth, filtered by current zoom state"/> + <facet name="sinfo_facet_flow_depth" description="flow depth"/> + <facet name="sinfo_facet_flow_depth_with_tkh.filtered" description="flow depth including tkh, filtered by current zoom state"/> + <facet name="sinfo_facet_flow_depth_with_tkh" description="flow depth including tkh"/> + + <facet name="sinfo_facet_tkh" description="Facet for tkh"/> + + <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> + </facets> + </outputmode> + + <outputmode name="sinfo_flowdepth_export" description="output.sinfo_flowdepth_export" mime-type="text/plain" type="export"> + <facets> + <facet name="csv" description="facet.sinfo_flowdepth_export.csv"/> + <facet name="pdf" description="facet.sinfo_flowdepth_export.pdf"/> + </facets> + </outputmode> + + <outputmode name="sinfo_flowdepth_report" description="output.sinfo_flowdepth_report" mime-type="text/xml" type="report"> + <facets> + <facet name="report" description="facet.sinfo_flowdepth_report"/> + </facets> + </outputmode> + </outputmodes> + </state> + + + + + + + + <!-- Calculation Mode: Transportkörperhöhen --> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/grounding/GroundingState.java Thu May 03 14:29:14 2018 +0200 @@ -0,0 +1,114 @@ +/* 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.grounding; + +import java.util.List; + +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.ChartArtifact; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.model.CalculationResult; +import org.dive4elements.river.artifacts.model.EmptyFacet; +import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; +import org.dive4elements.river.artifacts.states.DefaultState; + +/** State in which a waterlevel has been calculated. */ +public class GroundingState extends DefaultState { + + /// ** The log that is used in this state. */ + // private static Logger log = Logger.getLogger(FlowDepthState.class); + + private static final long serialVersionUID = 1L; + + /** + * From this state can only be continued trivially. + */ + @Override + protected String getUIProvider() { + return "continue"; + } + + @Override + public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { + if (artifact instanceof ChartArtifact) { + facets.add(new EmptyFacet()); + return null; + } + + return compute((SINFOArtifact) artifact, context, hash, facets, old); + } + + @Override + public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { + if (artifact instanceof ChartArtifact) { + facets.add(new EmptyFacet()); + return null; + } + return compute((SINFOArtifact) artifact, context, hash, facets, old); + } + + /** + * Compute result or returned object from cache, create facets. + * + * @param old + * Object that was cached. + */ + private Object compute(final SINFOArtifact sinfo, final CallContext context, final String hash, final List<Facet> facets, final Object old) { + + final CalculationResult res = doCompute(sinfo, context, old); + + if (facets == null) + return res; + // + // final FlowDepthCalculationResults results = (FlowDepthCalculationResults) res.getData(); + // + // /* add themes for chart, for each result */ + // final List<FlowDepthCalculationResult> resultList = results.getResults(); + // for (int index = 0; index < resultList.size(); index++) { + // + // final FlowDepthCalculationResult result = resultList.get(index); + // + // /* filtered (zoom dependent mean) flow depth */ + // facets.add(FlowDepthProcessor.createFlowDepthFilteredFacet(context, hash, this.id, result, index)); + // facets.add(FlowDepthProcessor.createFlowDepthRawFacet(context, hash, this.id, result, index)); + // + // if (results.isUseTkh()) { + // /* filtered (zoom dependent mean) flow depth including tkh */ + // facets.add(FlowDepthProcessor.createFlowDepthTkhFilteredFacet(context, hash, this.id, result, index)); + // facets.add(FlowDepthProcessor.createFlowDepthTkhRawFacet(context, hash, this.id, result, index)); + // + // facets.add(TkhProcessor.createTkhFacet(context, hash, this.id, result, index)); + // } + // } + + // if (!resultList.isEmpty()) { + // final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); + // final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); + // + // facets.add(csv); + // facets.add(pdf); + // } + // + // final Calculation report = res.getReport(); + // + // if (report.hasProblems()) { + // facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); + // } + + return res; + } + + private CalculationResult doCompute(final SINFOArtifact sinfo, final CallContext context, final Object old) { + if (old instanceof CalculationResult) + return (CalculationResult) old; + + return null; // new FlowDepthCalculation(context).calculate(sinfo); + } +} \ 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/sinfo/grounding/YearChoice.java Thu May 03 14:29:14 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.grounding; + +import org.dive4elements.river.artifacts.states.BooleanChoiceState; + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class YearChoice extends BooleanChoiceState { + + private static final long serialVersionUID = 1L; + + public YearChoice() { + super("option", "active", "inactive"); // TODO: RADIO-Btn-Impl + } +} \ 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/sinfo/inundation/InundationState.java Thu May 03 14:29:14 2018 +0200 @@ -0,0 +1,114 @@ +/* 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 java.util.List; + +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.ChartArtifact; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.model.CalculationResult; +import org.dive4elements.river.artifacts.model.EmptyFacet; +import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; +import org.dive4elements.river.artifacts.states.DefaultState; + +/** State in which a waterlevel has been calculated. */ +public class InundationState extends DefaultState { + + /// ** The log that is used in this state. */ + // private static Logger log = Logger.getLogger(FlowDepthState.class); + + private static final long serialVersionUID = 1L; + + /** + * From this state can only be continued trivially. + */ + @Override + protected String getUIProvider() { + return "continue"; + } + + @Override + public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { + if (artifact instanceof ChartArtifact) { + facets.add(new EmptyFacet()); + return null; + } + + return compute((SINFOArtifact) artifact, context, hash, facets, old); + } + + @Override + public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { + if (artifact instanceof ChartArtifact) { + facets.add(new EmptyFacet()); + return null; + } + return compute((SINFOArtifact) artifact, context, hash, facets, old); + } + + /** + * Compute result or returned object from cache, create facets. + * + * @param old + * Object that was cached. + */ + private Object compute(final SINFOArtifact sinfo, final CallContext context, final String hash, final List<Facet> facets, final Object old) { + + final CalculationResult res = doCompute(sinfo, context, old); + + if (facets == null) + return res; + // + // final FlowDepthCalculationResults results = (FlowDepthCalculationResults) res.getData(); + // + // /* add themes for chart, for each result */ + // final List<FlowDepthCalculationResult> resultList = results.getResults(); + // for (int index = 0; index < resultList.size(); index++) { + // + // final FlowDepthCalculationResult result = resultList.get(index); + // + // /* filtered (zoom dependent mean) flow depth */ + // facets.add(FlowDepthProcessor.createFlowDepthFilteredFacet(context, hash, this.id, result, index)); + // facets.add(FlowDepthProcessor.createFlowDepthRawFacet(context, hash, this.id, result, index)); + // + // if (results.isUseTkh()) { + // /* filtered (zoom dependent mean) flow depth including tkh */ + // facets.add(FlowDepthProcessor.createFlowDepthTkhFilteredFacet(context, hash, this.id, result, index)); + // facets.add(FlowDepthProcessor.createFlowDepthTkhRawFacet(context, hash, this.id, result, index)); + // + // facets.add(TkhProcessor.createTkhFacet(context, hash, this.id, result, index)); + // } + // } + + // if (!resultList.isEmpty()) { + // final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); + // final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); + // + // facets.add(csv); + // facets.add(pdf); + // } + // + // final Calculation report = res.getReport(); + // + // if (report.hasProblems()) { + // facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); + // } + + return res; + } + + private CalculationResult doCompute(final SINFOArtifact sinfo, final CallContext context, final Object old) { + if (old instanceof CalculationResult) + return (CalculationResult) old; + + return null; // new FlowDepthCalculation(context).calculate(sinfo); + } +} \ 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/sinfo/inundation/RiversideChoice.java Thu May 03 14:29:14 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 RiversideChoice extends BooleanChoiceState { + + private static final long serialVersionUID = 1L; + + public RiversideChoice() { + super("state.sinfo.riverside.option1", "active", "inactive"); + } +} \ 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/sinfo/inundation/WqinputChoice.java Thu May 03 14:29:14 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 WqinputChoice extends BooleanChoiceState { + + private static final long serialVersionUID = 1L; + + public WqinputChoice() { + super("state.sinfo.wqinput.option", "wspl.active", "wspl.inactive"); + } +} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/WsplChoice.java Thu May 03 11:52:40 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/WsplChoice.java Thu May 03 14:29:14 2018 +0200 @@ -18,6 +18,6 @@ private static final long serialVersionUID = 1L; public WsplChoice() { - super("wspl.option", "wspl.active", "wspl.inactive"); + super("state.sinfo.wspl.option", "wspl.active", "wspl.inactive"); } } \ No newline at end of file
--- a/artifacts/src/main/resources/messages.properties Thu May 03 11:52:40 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Thu May 03 14:29:14 2018 +0200 @@ -788,6 +788,13 @@ sinfo_calc_flow_depth_development=Flie\u00dftiefenentwicklung sinfo_calc_flow_depth_minmax=Minimale und Maximale Flie\u00dftiefe + +state.sinfo.infrastructures_inundation = \u00dcberflutungsdauern Infrastrukturen BWaStr (Ergebnis) +help.state.sinfo.infrastructures_inundation = ${help.url}/OnlineHilfe/SINFO#help.state.infrastructures_inundation + +state.sinfo.grounding =Grundber\u00fchrungen (Ergebnis) +help.state.sinfo.grounding =help.state.sinfo.flowdepthdevlopment_current_select = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.grounding + sinfo_calc_grounding=Grundber\u00fchrungen sinfo_calc_transport_bodies_heights=Transportk\u00f6rperh\u00f6hen sinfo_calc_infrastructures_inundation_duration=\u00dcberflutungsdauern Infrastrukturen BWaStr @@ -833,9 +840,24 @@ 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.riverside = Auswahl der Uferseite +state.sinfo.riverside.option1 = Linke Uferseite +state.sinfo.riverside.option1 = Rechte Uferseite +state.sinfo.riverside.option1 = Beide Uferseiten +help.state.sinfo.wspl= ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.riverside + +state.sinfo.wqinput = Eingabe f\u00fcr W/Q Daten +state.sinfo.wqinput.option = wqinput-option +help.state.sinfo.wqinput = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.wqinput + state.sinfo.wspl = Wasserspiegellagen state.sinfo.wspl.option = Wasserspiegellagen zus\u00e4tzlich darstellen? help.state.sinfo.wspl= ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.wspl + +state.sinfo.grounding.year = Jahr/Zeitraum +state.sinfo.grounding.year.option1 = Jahr +state.sinfo.grounding.year.option1 = Zeitraum +help.state.sinfo.wspl= ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.grounding.year sinfo.export.flow_depth.csv.meta.header.result = ## {0} - {1} - {2} sinfo.export.flow_depth.csv.meta.header.result.label = Calculation Output