# HG changeset patch # User gernotbelger # Date 1525349878 -7200 # Node ID f4b66f6692e36a5fc3e75172706ea5ca81a08624 # Parent 0ddeeb413faea676d3acb9fc066f3793b1fa644c sinfo.xml definition states+transitions diff -r 0ddeeb413fae -r f4b66f6692e3 artifacts/doc/conf/artifacts/sinfo.xml --- a/artifacts/doc/conf/artifacts/sinfo.xml Thu May 03 10:16:36 2018 +0200 +++ b/artifacts/doc/conf/artifacts/sinfo.xml Thu May 03 14:17:58 2018 +0200 @@ -223,21 +223,146 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0ddeeb413fae -r f4b66f6692e3 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/grounding/GroundingState.java --- /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:17:58 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 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 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 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 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 diff -r 0ddeeb413fae -r f4b66f6692e3 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/grounding/YearChoice.java --- /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:17:58 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 Ingo Weinzierl + */ +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 diff -r 0ddeeb413fae -r f4b66f6692e3 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/InundationState.java --- /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:17:58 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 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 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 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 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 diff -r 0ddeeb413fae -r f4b66f6692e3 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/RiversideChoice.java --- /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:17:58 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 Ingo Weinzierl + */ +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 diff -r 0ddeeb413fae -r f4b66f6692e3 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/WqinputChoice.java --- /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:17:58 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 Ingo Weinzierl + */ +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 diff -r 0ddeeb413fae -r f4b66f6692e3 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/WsplChoice.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/WsplChoice.java Thu May 03 10:16:36 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/inundation/WsplChoice.java Thu May 03 14:17:58 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 diff -r 0ddeeb413fae -r f4b66f6692e3 artifacts/src/main/resources/messages.properties --- a/artifacts/src/main/resources/messages.properties Thu May 03 10:16:36 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Thu May 03 14:17:58 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