Mercurial > dive4elements > river
changeset 9481:787fc085459b
TSV introduced; uinfo.inundationWMS-Config
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/uinfo.xml Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/doc/conf/artifacts/uinfo.xml Wed Sep 12 10:55:09 2018 +0200 @@ -3,123 +3,123 @@ <states> <state id="state.uinfo.river" description="state.uinfo.river" state="org.dive4elements.river.artifacts.states.RiverSelect" helpText="help.state.uinfo.river"> - <data name="river" type="String"/> + <data name="river" type="String" /> </state> <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> - <from state="state.uinfo.river"/> - <to state="state.uinfo.calculation_mode"/> + <from state="state.uinfo.river" /> + <to state="state.uinfo.calculation_mode" /> </transition> <state id="state.uinfo.calculation_mode" description="state.uinfo.calculation_mode" state="org.dive4elements.river.artifacts.uinfo.CalculationSelectUinfo" helpText="help.state.uinfo.calculation_mode"> - <data name="calculation_mode" type="String"/> + <data name="calculation_mode" type="String" /> </state> - <state id="state.uinfo.veg.distance_only" description="state.uinfo.veg.distance_only" state="org.dive4elements.river.artifacts.states.DistanceOnlyInundationDurVegSelect" helpText="help.state.uinfo.vegetationzone.distance_only"> - <data name="ld_from" type="Double"/> - <data name="ld_to" type="Double"/> + <state id="state.uinfo.veg.distance_only" description="state.uinfo.veg.distance_only" state="org.dive4elements.river.artifacts.states.DistanceOnlyInundationDurVegSelect" helpText="help.state.uinfo.vegetationzone.distance_only"> + <data name="ld_from" type="Double" /> + <data name="ld_to" type="Double" /> </state> <state id="state.uinfo.salix.distance_only" description="state.uinfo.salix.distance_only" state="org.dive4elements.river.artifacts.states.DistanceOnlySelect" helpText="help.state.uinfo.salix.distance_only"> - <data name="ld_from" type="Double"/> - <data name="ld_to" type="Double"/> + <data name="ld_from" type="Double" /> + <data name="ld_to" type="Double" /> </state> <state id="state.uinfo.inundationduration.distance_only" description="state.uinfo.inundationduration.distance_only" state="org.dive4elements.river.artifacts.states.DistanceOnlyInundationDurVegSelect" helpText="help.state.uinfo.inundation_duration.location"> - <data name="ld_from" type="Double"/> - <data name="ld_to" type="Double"/> + <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.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.salix.distance_only"/> - <to state="state.uinfo.salix.use_scenario"/> - <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/> - </transition> - - <state id="state.uinfo.salix.use_scenario" description="state.uinfo.salix.use_scenario" state="org.dive4elements.river.artifacts.uinfo.salix.UseScenarioChoice" helpText="help.state.uinfo.salix.use_scenario"> - <data name="use_scenario" type="Boolean"/> - </state> - - <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.salix.use_scenario"/> - <to state="state.uinfo.salix.scenario_type"/> - <condition data="use_scenario" value="true" operator="equal"/> - </transition> - - <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.salix.use_scenario"/> - <to state="state.uinfo.salix_line"/> - <condition data="use_scenario" value="false" operator="equal"/> - </transition> - - <state id="state.uinfo.salix.scenario_type" description="state.uinfo.salix.scenario_type" state="org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState" helpText="help.state.uinfo.salix.scenario_type"> - <data name="scenario_selection" type="String"/> - </state> - - <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.salix.scenario_type"/> - <to state="state.uinfo.distance_only_part.from_regional"/> - <condition data="scenario_selection" value="scenarioType.option1" operator="equal"/> - </transition> - - <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.salix.scenario_type"/> - <to state="state.uinfo.salix.supraregional"/> - <condition data="scenario_selection" value="scenarioType.option2" operator="equal"/> + <from state="state.uinfo.calculation_mode" /> + <to state="state.uinfo.salix.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.salix.supraregional"/> - <to state="state.uinfo.salix_line"/> - <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/> + <from state="state.uinfo.salix.distance_only" /> + <to state="state.uinfo.salix.use_scenario" /> + <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" /> </transition> - <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.salix.scenario_type"/> - <to state="state.uinfo.salix.historical.soundings"/> - <condition data="scenario_selection" value="scenarioType.option3" operator="equal"/> - </transition> - - <state id="state.uinfo.salix.historical.soundings" description="state.uinfo.salix.historical.soundings" state="org.dive4elements.river.artifacts.states.SoundingsSelectSingle" helpText="help.state.uinfo.salix.historical.soundings"> - <data name="soundings" type="multiattribute"/> - </state> - - <state id="state.uinfo.salix.supraregional" description="state.uinfo.salix.supraregional" state="org.dive4elements.river.artifacts.uinfo.salix.SupraRegionalTableState" helpText="help.state.uinfo.salix.supraregional"> - <data name="supraregional_table" type="String"/> + <state id="state.uinfo.salix.use_scenario" description="state.uinfo.salix.use_scenario" state="org.dive4elements.river.artifacts.uinfo.salix.UseScenarioChoice" helpText="help.state.uinfo.salix.use_scenario"> + <data name="use_scenario" type="Boolean" /> </state> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.salix.historical.soundings"/> - <to state="state.uinfo.distance_only_part.historical"/> - <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/> + <from state="state.uinfo.salix.use_scenario" /> + <to state="state.uinfo.salix.scenario_type" /> + <condition data="use_scenario" value="true" operator="equal" /> </transition> - <state id="state.uinfo.distance_only_part.historical" description="state.uinfo.distance_only_part.historical" state="org.dive4elements.river.artifacts.uinfo.salix.DistanceOnlyPartHistoricalSelect" helpText="help.state.uinfo.salix.historical.distance_only_part"> - <data name="ld_from_part" type="Double"/> - <data name="ld_to_part" type="Double"/> - <data name="bedheights_for_part" type="Double"/> + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.salix.use_scenario" /> + <to state="state.uinfo.salix_line" /> + <condition data="use_scenario" value="false" operator="equal" /> + </transition> + + <state id="state.uinfo.salix.scenario_type" description="state.uinfo.salix.scenario_type" state="org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState" helpText="help.state.uinfo.salix.scenario_type"> + <data name="scenario_selection" type="String" /> </state> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.distance_only_part.historical"/> - <to state="state.uinfo.salix_line"/> - <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/> + <from state="state.uinfo.salix.scenario_type" /> + <to state="state.uinfo.distance_only_part.from_regional" /> + <condition data="scenario_selection" value="scenarioType.option1" operator="equal" /> + </transition> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.salix.scenario_type" /> + <to state="state.uinfo.salix.supraregional" /> + <condition data="scenario_selection" value="scenarioType.option2" operator="equal" /> + </transition> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.salix.supraregional" /> + <to state="state.uinfo.salix_line" /> + <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" /> + </transition> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.salix.scenario_type" /> + <to state="state.uinfo.salix.historical.soundings" /> + <condition data="scenario_selection" value="scenarioType.option3" operator="equal" /> + </transition> + + <state id="state.uinfo.salix.historical.soundings" description="state.uinfo.salix.historical.soundings" state="org.dive4elements.river.artifacts.states.SoundingsSelectSingle" helpText="help.state.uinfo.salix.historical.soundings"> + <data name="soundings" type="multiattribute" /> + </state> + + <state id="state.uinfo.salix.supraregional" description="state.uinfo.salix.supraregional" state="org.dive4elements.river.artifacts.uinfo.salix.SupraRegionalTableState" helpText="help.state.uinfo.salix.supraregional"> + <data name="supraregional_table" type="String" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.salix.historical.soundings" /> + <to state="state.uinfo.distance_only_part.historical" /> + <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" /> + </transition> + + <state id="state.uinfo.distance_only_part.historical" description="state.uinfo.distance_only_part.historical" state="org.dive4elements.river.artifacts.uinfo.salix.DistanceOnlyPartHistoricalSelect" helpText="help.state.uinfo.salix.historical.distance_only_part"> + <data name="ld_from_part" type="Double" /> + <data name="ld_to_part" type="Double" /> + <data name="bedheights_for_part" type="Double" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.distance_only_part.historical" /> + <to state="state.uinfo.salix_line" /> + <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" /> </transition> <state id="state.uinfo.salix.load.scenario.regional" description="state.uinfo.salix.load.scenario.regional" state="org.dive4elements.river.artifacts.uinfo.salix.LoadScenarioSelectLimit5" helpText="help.state.uinfo.salix.regional"> - <data name="sedimentheight" type="String" /> <!-- mittelwasserlage in cm! --> + <data name="sedimentheight" type="String" /> <!-- mittelwasserlage in cm! --> </state> <state id="state.uinfo.distance_only_part.from_regional" description="state.uinfo.distance_only_part.from_regional" state="org.dive4elements.river.artifacts.states.DistanceOnlyPartSelect" helpText="help.state.uinfo.salix.regional"> - <data name="ld_from_part" type="Double"/> - <data name="ld_to_part" type="Double"/> + <data name="ld_from_part" type="Double" /> + <data name="ld_to_part" type="Double" /> </state> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> @@ -138,48 +138,48 @@ <outputmodes> <outputmode name="uinfo_salix_line" description="output.uinfo_salix_line" mime-type="image/png" type="chart"> <facets> - <facet name="uinfo_facet_salix_line.filtered" description="salix line, filtered by current zoom state"/> - <facet name="uinfo_facet_salix_line" description="salix line"/> - <facet name="uinfo_facet_salix_mnwmw.filtered" description="nmw-mw differences, filtered by current zoom state"/> - <facet name="uinfo_facet_salix_mnwmw" description="mnw-mw differences"/> - <facet name="uinfo_facet_salix_scenario.filtered" description="scenario salix line, filtered by current zoom state"/> - <facet name="uinfo_facet_salix_scenario" description="scenario salix line"/> - <facet name="uinfo_facet_salix_rank" description="salix ranks"/> + <facet name="uinfo_facet_salix_line.filtered" description="salix line, filtered by current zoom state" /> + <facet name="uinfo_facet_salix_line" description="salix line" /> + <facet name="uinfo_facet_salix_mnwmw.filtered" description="nmw-mw differences, filtered by current zoom state" /> + <facet name="uinfo_facet_salix_mnwmw" description="mnw-mw differences" /> + <facet name="uinfo_facet_salix_scenario.filtered" description="scenario salix line, filtered by current zoom state" /> + <facet name="uinfo_facet_salix_scenario" description="scenario salix line" /> + <facet name="uinfo_facet_salix_rank" description="salix ranks" /> </facets> </outputmode> <outputmode name="cross_section" description="output.cross_section" mime-type="image/png" type="chart"> <facets> - <facet name="uinfo_facet_salix_line_cross_section_water_line" description="Saxlix Line"/> - <facet name="uinfo_facet_salix_scenario_cross_section_water_line" description="Salix Lines of scenarios"/> - <facet name="uinfo_facet_salix_waterlevel_mnw_cross_section_water_line" description="Waterlevels used during salix line calculation"/> - <facet name="uinfo_facet_salix_waterlevel_mw_cross_section_water_line" description="Waterlevels used during salix line calculation"/> - <facet name="uinfo_facet_salix_waterlevel_mhw_cross_section_water_line" description="Waterlevels used during salix line calculation"/> - <facet name="uinfo_facet_salix_waterlevel_hw5_cross_section_water_line" description="Waterlevels used during salix line calculation"/> + <facet name="uinfo_facet_salix_line_cross_section_water_line" description="Saxlix Line" /> + <facet name="uinfo_facet_salix_scenario_cross_section_water_line" description="Salix Lines of scenarios" /> + <facet name="uinfo_facet_salix_waterlevel_mnw_cross_section_water_line" description="Waterlevels used during salix line calculation" /> + <facet name="uinfo_facet_salix_waterlevel_mw_cross_section_water_line" description="Waterlevels used during salix line calculation" /> + <facet name="uinfo_facet_salix_waterlevel_mhw_cross_section_water_line" description="Waterlevels used during salix line calculation" /> + <facet name="uinfo_facet_salix_waterlevel_hw5_cross_section_water_line" description="Waterlevels used during salix line calculation" /> - <facet name="cross_section" description="facet.cross_section"/> - <facet name="area" description="an area"/> - <facet name="cross_section.area" description="an area"/> - <facet name="cross_section.manualpoints" description="points"/> - <facet name="cross_section.manualline" description="line"/> + <facet name="cross_section" description="facet.cross_section" /> + <facet name="area" description="an area" /> + <facet name="cross_section.area" description="an area" /> + <facet name="cross_section.manualpoints" description="points" /> + <facet name="cross_section.manualline" description="line" /> <!-- - This would automatically import some existing hyks, but we do not want this here + This would automatically import some existing hyks, but we do not want this here <facet name="hyk" description="hyks"/> - --> + --> </facets> </outputmode> <outputmode name="uinfo_salix_line_export" description="output.uinfo_salix_line_export" mime-type="text/plain" type="export"> <facets> - <facet name="csv" description="facet.uinfo_salix_line_export.csv"/> - <facet name="pdf" description="facet.uinfo_salix_line_export.pdf"/> + <facet name="csv" description="facet.uinfo_salix_line_export.csv" /> + <facet name="pdf" description="facet.uinfo_salix_line_export.pdf" /> </facets> </outputmode> <outputmode name="uinfo_salix_line_report" description="output.uinfo_salix_line_report" mime-type="text/xml" type="report"> <facets> - <facet name="report" description="facet.uinfo_salix_line_report"/> + <facet name="report" description="facet.uinfo_salix_line_report" /> </facets> </outputmode> </outputmodes> @@ -189,78 +189,89 @@ <!-- Calculation Mode: Inundation Duration --> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.calculation_mode"/> - <to state="state.uinfo.inundationduration.distance_only"/> - <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal"/> - </transition> - - <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.inundationduration.distance_only"/> - <to state="state.uinfo.inundation.year_totalepoch"/> - <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal"/> + <from state="state.uinfo.calculation_mode" /> + <to state="state.uinfo.inundationduration.distance_only" /> + <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" /> </transition> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.inundation.year_totalepoch"/> - <to state="state.uinfo.inundation.load.year"/> - <condition data="ye_select" value="state.uinfo.year" operator="equal"/> + <from state="state.uinfo.inundationduration.distance_only" /> + <to state="state.uinfo.inundation.year_totalepoch" /> + <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" /> </transition> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.inundation.year_totalepoch"/> - <to state="state.uinfo.inundation.use_scenario"/> - <condition data="ye_select" value="state.uinfo.totalepoch" operator="equal"/> + <from state="state.uinfo.inundation.year_totalepoch" /> + <to state="state.uinfo.inundation.load.year" /> + <condition data="ye_select" value="state.uinfo.year" operator="equal" /> + </transition> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.inundation.year_totalepoch" /> + <to state="state.uinfo.inundation.load.epoch" /> + <condition data="ye_select" value="state.uinfo.epoch" operator="equal" /> </transition> <state id="state.uinfo.inundation.year_totalepoch" description="state.uinfo.inundation.year_totalepoch" state="org.dive4elements.river.artifacts.uinfo.inundationduration.YearChoice" helpText="help.state.uinfo.inundation.year_totalepoch"> - <data name="ye_select" type="String"/> + <data name="ye_select" type="String" /> </state> - <state id="state.uinfo.inundation.load.year" description="state.uinfo.inundation.load.year" state="org.dive4elements.river.artifacts.uinfo.inundationduration.LoadSingleYearSelectState" helpText="help.state.uinfo.inundation.load.year"> - <data name="singleyear" type="String"/> + <state id="state.uinfo.inundation.load.year" description="state.uinfo.inundation.load.year" state="org.dive4elements.river.artifacts.uinfo.inundationduration.WMSYearSelectState" helpText="help.state.uinfo.inundation.load.year"> + <data name="year_epoch_select" type="String" /> </state> + <state id="state.uinfo.inundation.load.epoch" description="state.uinfo.inundation.load.epoch" state="org.dive4elements.river.artifacts.uinfo.inundationduration.WMSEpochSelectState" helpText="help.state.uinfo.inundation.load.epoch"> + <data name="year_epoch_select" type="String" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.inundation.load.year"/> - <to state="state.uinfo.inundation.use_scenario"/> - <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal"/> + <from state="state.uinfo.inundation.load.year" /> + <to state="state.uinfo.inundation.use_scenario" /> + <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" /> + </transition> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.inundation.load.epoch" /> + <to state="state.uinfo.inundation.use_scenario" /> + <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" /> </transition> <!-- Doppelter State, andere ID, damit keine Mehrfach-Condition benötigt wird --> <state id="state.uinfo.inundation.use_scenario" description="state.uinfo.inundation.use_scenario" state="org.dive4elements.river.artifacts.uinfo.salix.UseScenarioChoice" helpText="help.state.uinfo.inundation.use_scenario"> - <data name="use_scenario" type="Boolean"/> + <data name="use_scenario" type="Boolean" /> </state> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.inundation.use_scenario"/> - <to state="state.uinfo.inundation.scenario"/> - <condition data="use_scenario" value="true" operator="equal"/> + <from state="state.uinfo.inundation.use_scenario" /> + <to state="state.uinfo.inundation.load.scenario" /> + <condition data="use_scenario" value="true" operator="equal" /> </transition> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.inundation.use_scenario"/> - <to state="state.uinfo.inundation.vegetation"/> - <condition data="use_scenario" value="false" operator="equal"/> + <from state="state.uinfo.inundation.use_scenario" /> + <to state="state.uinfo.inundation.vegetation" /> + <condition data="use_scenario" value="false" operator="equal" /> </transition> - <state id="state.uinfo.inundation.scenario" description="state.uinfo.inundation.scenario" state="org.dive4elements.river.artifacts.uinfo.inundationduration.LoadScenarioSelect" helpText="help.state.uinfo.inundation.scenario"> - <data name="sedimentheight" type="String"/> <!-- mittelwasserlage in cm! --> + <state id="state.uinfo.inundation.load.scenario" description="state.uinfo.inundation.load.scenario" state="org.dive4elements.river.artifacts.uinfo.inundationduration.LoadScenarioSelect" helpText="help.state.uinfo.inundation.scenario"> + <data name="sedimentheight" type="String" /> <!-- mittelwasserlage in cm! --> </state> <state id="state.uinfo.inundation.vegetation" description="state.uinfo.inundation.vegetation" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesTableState" helpText="help.state.uinfo.inundation.vegetation"> - <data name="vegzones" type="String"/> + <data name="vegzones" type="String" /> </state> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.inundation.scenario"/> - <to state="state.uinfo.inundation.vegetation"/> - <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal"/> + <from state="state.uinfo.inundation.load.scenario" /> + <to state="state.uinfo.inundation.vegetation" /> + <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" /> </transition> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.inundation.vegetation"/> - <to state="state.uinfo.inundation_duration"/> - <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal"/> + <from state="state.uinfo.inundation.vegetation" /> + <to state="state.uinfo.inundation_duration" /> + <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" /> </transition> <state id="state.uinfo.inundation_duration" description="state.uinfo.inundation_duration" state="org.dive4elements.river.artifacts.uinfo.inundationduration.InundationDurationState" helpText="help.state.uinfo.inundation_duration"> @@ -268,43 +279,43 @@ <outputmode name="map" description="output.uesk.map.description" type="map"> <facets> - <facet name="floodmap.wsplgen"/> - <facet name="floodmap.barriers"/> - <facet name="floodmap.riveraxis"/> - <facet name="floodmap.wmsbackground"/> - <facet name="floodmap.kms"/> - <facet name="floodmap.qps"/> - <facet name="floodmap.hws_lines"/> - <facet name="floodmap.hws_points"/> - <facet name="floodmap.hydr_boundaries"/> - <facet name="floodmap.hydr_boundaries_poly"/> - <facet name="floodmap.catchment"/> - <facet name="floodmap.floodplain"/> - <facet name="floodmap.floodmarks"/> - <facet name="floodmap.lines"/> - <facet name="floodmap.buildings"/> - <facet name="floodmap.fixpoints"/> - <facet name="floodmap.floodmaps"/> - <facet name="floodmap.gauge_location"/> - <facet name="floodmap.externalwms"/> - <facet name="floodmap.externalwms_1"/> - <facet name="floodmap.externalwms_2"/> - <facet name="floodmap.externalwms_3"/> - <facet name="floodmap.externalwms_4"/> - <facet name="floodmap.jetties"/> + <facet name="floodmap.wsplgen" /> + <facet name="floodmap.barriers" /> + <facet name="floodmap.riveraxis" /> + <facet name="floodmap.wmsbackground" /> + <facet name="floodmap.kms" /> + <facet name="floodmap.qps" /> + <facet name="floodmap.hws_lines" /> + <facet name="floodmap.hws_points" /> + <facet name="floodmap.hydr_boundaries" /> + <facet name="floodmap.hydr_boundaries_poly" /> + <facet name="floodmap.catchment" /> + <facet name="floodmap.floodplain" /> + <facet name="floodmap.floodmarks" /> + <facet name="floodmap.lines" /> + <facet name="floodmap.buildings" /> + <facet name="floodmap.fixpoints" /> + <facet name="floodmap.floodmaps" /> + <facet name="floodmap.gauge_location" /> + <facet name="floodmap.externalwms" /> + <facet name="floodmap.externalwms_1" /> + <facet name="floodmap.externalwms_2" /> + <facet name="floodmap.externalwms_3" /> + <facet name="floodmap.externalwms_4" /> + <facet name="floodmap.jetties" /> </facets> </outputmode> <!-- FIXME: i01n name in FLYSConstants --> <outputmode name="uinfo_inundation_duration_export" description="output.uinfo_inundation_duration_export" mime-type="text/plain" type="export"> <facets> - <facet name="wms_url" description="XXXXXXXXXX _ no entry in generators necessary either"/> + <facet name="wms_url" description="XXXXXXXXXX _ no entry in generators necessary either" /> </facets> </outputmode> <outputmode name="uinfo_inundation_duration_report" description="output.uinfo_inundation_duration_report" mime-type="text/xml" type="report"> <facets> - <facet name="report" description="facet.uinfo_inundation_duration_report"/> + <facet name="report" description="facet.uinfo_inundation_duration_report" /> </facets> </outputmode> </outputmodes> @@ -314,25 +325,25 @@ <!-- Calculation Mode: Vegetation Zones --> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.calculation_mode"/> - <to state="state.uinfo.veg.distance_only"/> - <condition data="calculation_mode" value="uinfo_vegetation_zones" operator="equal"/> + <from state="state.uinfo.calculation_mode" /> + <to state="state.uinfo.veg.distance_only" /> + <condition data="calculation_mode" value="uinfo_vegetation_zones" operator="equal" /> </transition> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.veg.distance_only"/> - <to state="state.uinfo.vegetation_zones.table"/> - <condition data="calculation_mode" value="uinfo_vegetation_zones" operator="equal"/> + <from state="state.uinfo.veg.distance_only" /> + <to state="state.uinfo.vegetation_zones.table" /> + <condition data="calculation_mode" value="uinfo_vegetation_zones" operator="equal" /> </transition> <state id="state.uinfo.vegetation_zones.table" description="state.uinfo.vegetation_zones.table" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesTableEditState" helpText="help.state.uinfo.vegetation_zones"> - <data name="vegzones" type="String"/> + <data name="vegzones" type="String" /> </state> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.uinfo.vegetation_zones.table"/> - <to state="state.uinfo.vegetation_zones"/> - <condition data="calculation_mode" value="uinfo_vegetation_zones" operator="equal"/> + <from state="state.uinfo.vegetation_zones.table" /> + <to state="state.uinfo.vegetation_zones" /> + <condition data="calculation_mode" value="uinfo_vegetation_zones" operator="equal" /> </transition> <state id="state.uinfo.vegetation_zones" description="state.uinfo.vegetation_zones" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesState" helpText="help.state.uinfo.vegetation_zones"> @@ -341,15 +352,15 @@ <!-- FIXME: i01n name in FLYSConstants --> <outputmode name="uinfo_vegetation_zones_export" description="output.uinfo_vegetation_zones_export" mime-type="text/plain" type="export"> <facets> - <facet name="csv" description="facet.uinfo_vegetation_zones_export.csv"/> - <facet name="pdf" description="facet.uinfo_vegetation_zones_export.pdf"/> + <facet name="csv" description="facet.uinfo_vegetation_zones_export.csv" /> + <facet name="pdf" description="facet.uinfo_vegetation_zones_export.pdf" /> </facets> </outputmode> <!-- FIXME: i01n name in FLYSConstants --> <outputmode name="uinfo_vegetation_zones_report" description="output.uinfo_vegetation_zones_report" mime-type="text/xml" type="report"> <facets> - <facet name="report" description="facet.uinfo_vegetation_zones_report"/> + <facet name="report" description="facet.uinfo_vegetation_zones_report" /> </facets> </outputmode> </outputmodes>
--- a/artifacts/doc/conf/modules/d50_sohlkorndurchmesser_Rhein.properties Mon Sep 10 17:06:23 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -# Konfigurationsdatei f\u00fcr die in der Berechnungsart SINFO-Transportk\u00f6rperh\u00f6hen sowie SINFO-Flie\u00dftiefen zu ermittelnden D50-Sohlkorndurchmesser. -# Je Gew\u00e4sser ist optional eine Datei mit Namen "sinfo_tkh_d50_sohlkorndurchmesser_<Gew\u00e4ssername>.properties" anzulegen. Gro\u00df-/Kleinschriebung beim Gew\u00e4ssernamen ist zu beachten! -# Liegt f\u00fcr ein Gew\u00e4sser keine Konfiguration vor, findet keine Beschr\u00e4nkung der Abfragezeitr\u00e4ume f\u00fcr die D50-Daten statt und es werden alle verf\u00fcgbaren Daten verwendet. -# Die Datei ist im Charset 'ISO-8859-1' zu kodieren. - -# Die Datei definiert f\u00fcr beliebig viele Peil-Zeitr\u00e4ume, in der die in Flys zu w\u00e4hlenden Peilung sich befinden kann, jeweils einen Abfragezeitraum f\u00fcr die D50-Daten. -# Pro Sohlh\u00f6he ist eine Zeile folgender Form anzulegen: -#<Peilzeitraum-Start>;<Peilzeitraum-Ende>;<D50-Abfragezeitraum-Start>;<D50-Abfragezeitraum-Ende> - -# S\u00e4mtliche Werte werden im Format "JJJJ" angegeben. Es wird dabei immer in Intervallen auf Datumsbasis gerechnet. -# Der Startzeitpunkt ist der 01.01. und der Endzeitpunkt der 31.12. des jeweils spezifizierten Jahres. -# Die Intervalle k\u00f6nnen zu einer Seite offen sein. Statt einer Jahreseingabe erfolgt hierbei die Eingabe -# 'MIN' f\u00fcr ein negativ unendliches Startdatum sowie -# 'MAX' f\u00fcr ein positiv unendliches Enddatum. - -# \u00c4nderungen werden erst nach einem Neustart des Servers wirksam. - -MIN;1999;MIN;1999 -2000;MAX;2000;MAX
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/doc/conf/modules/d50_sohlkorndurchmesser_Rhein.tsv Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,19 @@ +# Konfigurationsdatei für die in der Berechnungsart SINFO-Transportkörperhöhen sowie SINFO-Fließtiefen zu ermittelnden D50-Sohlkorndurchmesser. +# Je Gewässer ist optional eine Datei mit Namen 'sinfo_tkh_d50_sohlkorndurchmesser_<Gewässername>.tsv' anzulegen. Groß-/Kleinschriebung beim Gewässernamen ist zu beachten! +# Liegt für ein Gewässer keine Konfiguration vor, findet keine Beschränkung der Abfragezeiträume für die D50-Daten statt und es werden alle verfügbaren Daten verwendet. +# Die Datei ist im Charset 'ISO-8859-1' zu kodieren. + +# Die Datei definiert für beliebig viele Peil-Zeiträume, in der die in Flys zu wählenden Peilung sich befinden kann, jeweils einen Abfragezeitraum für die D50-Daten. +# Pro Sohlhöhe ist eine Zeile folgender Form anzulegen: +#<Peilzeitraum-Start><Tab><Peilzeitraum-Ende><Tab><D50-Abfragezeitraum-Start><Tab><D50-Abfragezeitraum-Ende> + +# Sämtliche Werte werden im Format 'JJJJ' angegeben. Es wird dabei immer in Intervallen auf Datumsbasis gerechnet. +# Der Startzeitpunkt ist der 01.01. und der Endzeitpunkt der 31.12. des jeweils spezifizierten Jahres. +# Die Intervalle können zu einer Seite offen sein. Statt einer Jahreseingabe erfolgt hierbei die Eingabe +# 'MIN' für ein negativ unendliches Startdatum sowie +# 'MAX' für ein positiv unendliches Enddatum. + +# Änderungen werden erst nach einem Neustart des Servers wirksam. + +MIN 1999 MIN 1999 +2000 MAX 2000 MAX \ No newline at end of file
--- a/artifacts/doc/conf/modules/wms_uedauern_Elbe.properties Mon Sep 10 17:06:23 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -jahre=1995,1996,1997 -url=htps://geoportal.bafg.de/wms/${jahr} -scenario_url=htps://geoportal.bafg.de/wms/${jahr}_${scenario} - -mittel_url=htps://geoportal.bafg.de/wms/ -mittel_start=1998 -mittel_ende=2000 -mittel_scenario_url=htps://geoportal.bafg.de/wms/${scenario}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/doc/conf/modules/wms_uedauern_jahre_Rhein.tsv Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,13 @@ +# Konfigurationsdatei für die in der Berechnungsart UINFO-Überflutungsdauern auszugebenden URLs +# Je Gewässer ist zwingend eine Datei mit Namen 'wms_uedauern_jahre_<Gewässername>.tsv' anzulegen. Groß-/Kleinschriebung beim Gewässernamen ist zu beachten! + +# Die Datei definiert für beliebig viele Layer individuell konfigurierbare Bezeichnungen und URLs. +# Pro Layer ist eine Zeile folgender Form anzulegen: +#<Layer-Name><Tab><Label><Tab><WMS-URL> + +# Änderungen werden erst nach einem Neustart des Servers wirksam. + +1991 0 https://geoportal.bafg.de/arcgis3/services/U2_Flut3/Elbe_Flut3_1991_2001/MapServer/WMSServer +1992 1 https://geoportal.bafg.de/arcgis3/services/U2_Flut3/Elbe_Flut3_1991_2001/MapServer/WMSServer +1993 2 https://geoportal.bafg.de/arcgis3/services/U2_Flut3/Elbe_Flut3_1991_2001/MapServer/WMSServer +1994 3 https://geoportal.bafg.de/arcgis3/services/U2_Flut3/Elbe_Flut3_1991_2001/MapServer/WMSServer \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/doc/conf/modules/wms_uedauern_mittel_Rhein.tsv Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,11 @@ +# Konfigurationsdatei für die in der Berechnungsart UINFO-Überflutungsdauern auszugebenden URLs +# Je Gewässer ist zwingend eine Datei mit Namen 'wms_uedauern_mittel_<Gewässername>.tsv' anzulegen. Groß-/Kleinschriebung beim Gewässernamen ist zu beachten! + +# Die Datei definiert für beliebig viele Layer individuell konfigurierbare Bezeichnungen und URLs. +# Pro Layer ist eine Zeile folgender Form anzulegen: +#<Layer-Name><Tab><Label><Tab><WMS-URL> + +# Änderungen werden erst nach einem Neustart des Servers wirksam. + +Langjähriges Mittel (1989-2001) 0 www.das-ist-ein-test.de +Langjähriges Mittel (1888-1999) 1 www.das-ist-ein-test.de \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Wed Sep 12 10:55:09 2018 +0200 @@ -45,8 +45,8 @@ private final FlowVelocityModelKmValueFinder flowVelocitiesFinder; - public static TkhCalculator buildTkhCalculator(final boolean useTkh, final Calculation problems, final String label, - final River river, final DoubleRange calcRange, final WaterlevelValuesFinder waterlevelProvider, final DischargeValuesFinder dischargeProvider, + public static TkhCalculator buildTkhCalculator(final boolean useTkh, final Calculation problems, final String label, final River river, + final DoubleRange calcRange, final WaterlevelValuesFinder waterlevelProvider, final DischargeValuesFinder dischargeProvider, final BedHeightsFinder bedHeightsProvider) { if (!useTkh) @@ -59,8 +59,14 @@ /* access bed quality data */ final int soundingYear = bedHeightsProvider.getInfo().getYear(); - final BedQualityD50KmValueFinder bedMeasurementsFinder = BedQualityD50KmValueFinder.loadBedMeasurements(problems, river, calcRange, soundingYear, - VALID_BED_MEASUREMENT_YEARS); + BedQualityD50KmValueFinder bedMeasurementsFinder = null; + // try { + bedMeasurementsFinder = BedQualityD50KmValueFinder.loadBedMeasurements(problems, river, calcRange, soundingYear, VALID_BED_MEASUREMENT_YEARS); + // } + // catch (final BedQualityParseException | IOException | TsvReaderException e) { + // e.printStackTrace(); + // } + if (bedMeasurementsFinder == null) return new TkhCalculator(null, waterlevelProvider, dischargeProvider, bedHeightsProvider, null, null); @@ -74,8 +80,7 @@ if (flowVelocitiesFinder == null) return new TkhCalculator(null, waterlevelProvider, dischargeProvider, bedHeightsProvider, null, null); - return new TkhCalculator(bedMeasurementsFinder, waterlevelProvider, dischargeProvider, bedHeightsProvider, soilKindFinder, - flowVelocitiesFinder); + return new TkhCalculator(bedMeasurementsFinder, waterlevelProvider, dischargeProvider, bedHeightsProvider, soilKindFinder, flowVelocitiesFinder); } private TkhCalculator(final BedQualityD50KmValueFinder bedMeasurementsFinder, final WaterlevelValuesFinder waterlevelProvider,
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/BedQualityD50TimeRangeConfig.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/BedQualityD50TimeRangeConfig.java Wed Sep 12 10:55:09 2018 +0200 @@ -9,17 +9,17 @@ */ package org.dive4elements.river.artifacts.sinfo.tkhstate; -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; +import java.io.IOException; import java.util.Calendar; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; -import org.dive4elements.artifacts.common.utils.Config; import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.model.DateRange; +import org.dive4elements.river.artifacts.sinfo.tkhstate.TsvHelper.TsvReaderException; import org.dive4elements.river.model.River; /** @@ -29,75 +29,70 @@ */ public final class BedQualityD50TimeRangeConfig { - private static final String CONFIG_FILE = "d50_sohlkorndurchmesser_%s.properties"; + private static final String CONFIG_FILE = "d50_sohlkorndurchmesser_%s.tsv"; private final Map<String, DateRange> cache = new HashMap<>(); private static BedQualityD50TimeRangeConfig INSTANCE = new BedQualityD50TimeRangeConfig(); - public static synchronized DateRange getDefaults(final River river, final int soundingYear, final Calculation problems) { + public static class BedQualityParseException extends Exception { + + private static final long serialVersionUID = 1L; + + private BedQualityParseException(final String string) { + super(string); + } + } + + public static synchronized DateRange getDefaults(final River river, final int soundingYear, final Calculation problems) + throws BedQualityParseException, IOException, TsvReaderException { return INSTANCE.getBedHeightDefaultsForRiver(river, soundingYear, problems); } - private synchronized DateRange getBedHeightDefaultsForRiver(final River river, final int soundingYear, final Calculation problems) { + private synchronized DateRange getBedHeightDefaultsForRiver(final River river, final int soundingYear, final Calculation problems) + throws BedQualityParseException { final String rivername = river.getName(); final String cacheKey = new StringBuilder().append(rivername).append(";").append(soundingYear).toString(); if (!this.cache.containsKey(cacheKey)) { - final DateRange range = loadBedHeightDefaultsForRiver(river, soundingYear, problems); - this.cache.put(cacheKey, range); - return range; + final File file = TsvHelper.makeFile2(CONFIG_FILE, rivername); + final File fileCheck = TsvHelper.checkFile(file); + if (fileCheck == null) + return null; // automatically dateRange min/max wil be taken + + List<String[]> results = null; + try { + results = TsvHelper.readTsv(file, 4); + } + catch (final TsvReaderException | IOException e) { + problems.addProblem("sinfo.bedqualityd50config.configfile.loaderror", file.getPath(), e.getStackTrace()); + } + if (results != null) { + for (final String[] line : results) { + final CalRange range = new CalRange(parseInput(line[0]), parseInput(line[1]), parseInput(line[2]), parseInput(line[3])); + if (range.isSoundingYearInRange(soundingYear)) { + final DateRange dateRange = new DateRange(range.getStartTimeQuery(), range.getEndTimeQuery()); + this.cache.put(cacheKey, dateRange); + + } + } + } + problems.addProblem("sinfo.bedqualityd50config.configfile.loaderror", file.getPath(), + " Die angegebene d50-sohlkorndurchmesser-config-file enthält keinen gültigen Bereich für das konfigurierte Peiljahr."); + return null; } return this.cache.get(cacheKey); } - private static DateRange loadBedHeightDefaultsForRiver(final River river, final int soundingYear, final Calculation problems) { - final String rivername = river.getName(); - final File configDir = Config.getModulesConfigDirectory(); - - final String filename = String.format(CONFIG_FILE, rivername); - - final File file = new File(configDir, filename); - - if (!file.canRead() && !file.isFile()) { - return null; // no config-file specified or spelling mistake etc. (not necessarily an error) - } - - try (final BufferedReader reader = new BufferedReader(new FileReader(file))) { - - String line; - while ((line = reader.readLine()) != null) { - if ((line = line.trim()).length() == 0 || line.startsWith("#")) { - continue; - } - - final String[] parts = line.split(";"); - - if (parts.length != 4) { - throw new Exception("Invalid number of Tokens; should be 4!"); - } - - final CalRange range = new CalRange(parseInput(parts[0]), parseInput(parts[1]), parseInput(parts[2]), parseInput(parts[3])); - if (range.isSoundingYearInRange(soundingYear)) { - return new DateRange(range.getStartTimeQuery(), range.getEndTimeQuery()); - } - } - return null; - } - catch (final Exception e) { - e.printStackTrace(); - problems.addProblem("sinfo.bedqualityd50config.configfile.loaderror", CONFIG_FILE, e.getMessage()); - return null; - } - } - - private static Integer parseInput(final String value) throws Exception { + private static Integer parseInput(final String raw) throws BedQualityParseException { + final String value = raw.trim(); if (value.toUpperCase().equals("MIN") || value.toUpperCase().equals("MAX")) return null; try { + return Integer.valueOf(value); } catch (final NumberFormatException e) { - throw new Exception("Invalid input; should be year ('yyyy') or 'MIN' or 'MAX'"); + throw new BedQualityParseException("Invalid input; should be year ('yyyy') or 'MIN' or 'MAX'"); } } @@ -120,12 +115,12 @@ private CalRange(final Integer startYearSounding, final Integer endYearSounding, final Integer startYearQuery, final Integer endYearQuery) { - this.startTimeSounding = 1l;// (startYearSounding != null) ? getLongValForYear(startYearSounding, 0, 1) : + this.startTimeSounding = 1L;// (startYearSounding != null) ? getLongValForYear(startYearSounding, 0, 1) : // BedQualityD50KmValueFinder.MIN_DATE.getTime(); - this.startTimeQuery = 1l;// (startYearQuery != null) ? getLongValForYear(startYearQuery, 0, 1) : BedQualityD50KmValueFinder.MIN_DATE.getTime(); - this.endTimeSounding = 1l;// (endYearSounding != null) ? getLongValForYear(endYearSounding, 11, 31) : + this.startTimeQuery = 1L;// (startYearQuery != null) ? getLongValForYear(startYearQuery, 0, 1) : BedQualityD50KmValueFinder.MIN_DATE.getTime(); + this.endTimeSounding = 1L;// (endYearSounding != null) ? getLongValForYear(endYearSounding, 11, 31) : // BedQualityD50KmValueFinder.MAX_DATE.getTime(); - this.endTimeQuery = 1l; // (endYearQuery != null) ? getLongValForYear(endYearQuery, 11, 31) : BedQualityD50KmValueFinder.MAX_DATE.getTime(); + this.endTimeQuery = 1L;// (endYearQuery != null) ? getLongValForYear(endYearQuery, 11, 31) : BedQualityD50KmValueFinder.MAX_DATE.getTime(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TsvHelper.java Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,76 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * 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.tkhstate; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.dive4elements.artifacts.common.utils.Config; + +import au.com.bytecode.opencsv.CSVReader; + +/** + * @author Domenico Nardi Tironi + * + */ +public class TsvHelper { + + public static class TsvReaderException extends Exception { + private static final long serialVersionUID = 1L; + + public TsvReaderException(final String message) { + super(message); + } + } + + public static List<String[]> readTsv(final File inputFile, final int requiredLength) throws IOException, TsvReaderException { + + final List<String[]> result = new ArrayList<>(); + + final byte[] BOM = new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF }; + final String bomChar = new String(BOM, "UTF-8"); + + try (final BufferedReader bReader = new BufferedReader(new FileReader(inputFile))) { + + try (final CSVReader reader = new CSVReader(bReader, '\t')) { + String[] line; + while ((line = reader.readNext()) != null) { + if (line == null || line[0].startsWith("#") || line[0].trim().equals("") || (line[0].startsWith(bomChar) && line[0].contains("#"))) { + continue; + } + + if (line.length != requiredLength) { + reader.close(); + throw new TsvReaderException("Invalid number of Tokens; should be " + requiredLength + "!"); + } + result.add(line); + } + } + return result; + } + } + + public static final File makeFile2(final String fileNameRaw, final String rivername) { + final File configDir = Config.getModulesConfigDirectory(); + final String filename = String.format(fileNameRaw, rivername); + return new File(configDir, filename); + } + + public static final File checkFile(final File file) { + if (!file.canRead() && !file.isFile()) { + return null; // no config-file specified or spelling mistake etc. (not necessarily an error) + } + return file; + } +} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/CalculationSelectUinfo.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/CalculationSelectUinfo.java Wed Sep 12 10:55:09 2018 +0200 @@ -19,7 +19,7 @@ import org.dive4elements.artifacts.common.utils.XMLUtils; import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.states.DefaultState; -import org.dive4elements.river.artifacts.uinfo.inundationduration.UedauernPropertiesHelper; +import org.dive4elements.river.artifacts.uinfo.inundationduration.UedauernConfiguration; import org.w3c.dom.Element; /** @@ -60,11 +60,9 @@ if (calcmode.equals("uinfo_inundation_duration")) { final String river = uinfo.getRiver(); - if (!UedauernPropertiesHelper.fileExistsForRiver(river)) { + if (!UedauernConfiguration.filesExistsForRiver(river)) throw new IllegalArgumentException("error_no_data_for_river"); - } } - return true; } } \ 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/inundationduration/AbstractYearEpochUrlState.java Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,96 @@ +/* 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.inundationduration; + +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.dive4elements.artifactdatabase.data.StateData; +import org.dive4elements.artifacts.Artifact; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.common.utils.XMLUtils; +import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; +import org.dive4elements.river.artifacts.sinfo.tkhstate.TsvHelper.TsvReaderException; +import org.dive4elements.river.artifacts.states.AddTableDataHelper; +import org.dive4elements.river.artifacts.states.DefaultState; +import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; +import org.dive4elements.river.artifacts.uinfo.inundationduration.UedauernConfiguration.YearType; +import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState; +import org.w3c.dom.Element; + +/** State in which to fetch years for sedminent load calculation. */ +public abstract class AbstractYearEpochUrlState extends DefaultState { + private static final long serialVersionUID = 1L; + private final YearType type; + + /** + * The default constructor that initializes an empty State object. + * + * @param jahre + */ + public AbstractYearEpochUrlState(final YearType type) { + this.type = type; + } + + @Override + protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { + final String dataKey = "year_epoch_select"; + try { + if (dataKey.equals(name)) { + + final InundationDurationAccess access = new InundationDurationAccess((UINFOArtifact) artifact); + final UedauernConfiguration properties = UedauernConfiguration.getInstance(access.getRiverName(), this.type); + final Collection<String> items = properties.getLabels(); + + final String columnType = "STRING"; + final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "select_key", context.getMeta()); // pinKeycolum; nicht zu + + helper.addColumn(0, "pinfrom", "60", "common.client.ui.selection", "ICON", "CENTER", "from"); + helper.addColumn(1, "select_key", "240", yearOrEpoch(), columnType, "LEFT", null); + + for (final String year : items) { + final Map<String, String> row = new HashMap<>(); + row.put("select_key", year); + helper.addRow(row); + + } + helper.submitMapToXml(); + } + } + catch (final IllegalArgumentException iae) { + iae.printStackTrace(); + } + catch (final IOException e) { + e.printStackTrace(); + } + catch (final TsvReaderException e) { + e.printStackTrace(); + } + } + + private String yearOrEpoch() { + switch (this.type) { + case jahre: + return "year"; + + case mittel: + return "state.uinfo.epoch"; + + default: + throw new IllegalStateException(); + } + } + + @Override + protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { + return ScenarioTypeState.changeHeaderForCurrentState(yearOrEpoch(), data.getName(), cr, context); + } +} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationAccess.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationAccess.java Wed Sep 12 10:55:09 2018 +0200 @@ -10,10 +10,17 @@ package org.dive4elements.river.artifacts.uinfo.inundationduration; +import java.io.IOException; + +import org.dive4elements.artifacts.CallMeta; import org.dive4elements.river.artifacts.access.RangeAccess; import org.dive4elements.river.artifacts.common.EpochYearAccessHelper; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.sinfo.tkhstate.TsvHelper.TsvReaderException; import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode; +import org.dive4elements.river.artifacts.uinfo.inundationduration.InundationDurationCalculationResult.WmsLayer; +import org.dive4elements.river.artifacts.uinfo.inundationduration.UedauernConfiguration.YearType; /** * Access to the flow depth calculation type specific SInfo artifact data. @@ -36,7 +43,7 @@ // calculation_mode (String) // ld_from, ld_to // ye_select (String; state.uinfo.totalepoch oder state.uinfo.year) - // singleyear (String) + // year_epoch_select // totalepoch (String; TODO: minmax totalEpoch herausfinden und setzen (nicht hier.. aber trotzdem die Erinnerung hier)) // use_scenario boolean (danach kommt kein radioBtn, sondern sedimentheight-Eingabe) // sedimentheight String @@ -51,41 +58,63 @@ assert (calculationMode == UinfoCalcMode.uinfo_inundation_duration); } - public Integer getYear() { - final int[] years = this.helper.getYears("state.uinfo.year", "singleyear"); - if (years != null) { - return years[0]; - } - return null; + public boolean isUseYear() { + if (this.helper.getYearEpoch().equals("state.uinfo.year")) + return true; + return false; } - public String getWMSUrl() { + public WmsLayer createWMSLayer(final CallMeta meta, final String i10nKey) { - final UedauernPropertiesHelper helper = UedauernPropertiesHelper.getInstance(getRiverName()); - if (this.getYear() != null) { - return helper.urlFromYear(this.getYear()); - } else { - return helper.getMittelUrl(); // nur 2 cases... + final YearType type = isUseYear() ? YearType.jahre : YearType.mittel; + final String selectedElement = getSelectedLabel(); + + final String layerLabel = Resources.getMsg(meta, i10nKey, new Object[] { selectedElement }); + + try { + final UedauernConfiguration helper = UedauernConfiguration.getInstance(getRiverName(), type); + final String url = helper.getUrl(selectedElement); + final String layer = helper.getLayer(selectedElement); + + return new WmsLayer(layerLabel, url, layer, true); } + catch (final IOException | TsvReaderException e) { + e.printStackTrace(); + } + return null; } - public String getWMSScenarioUrl() { - if (getIsUseScenario()) { - final UedauernPropertiesHelper helper = UedauernPropertiesHelper.getInstance(getRiverName()); - if (this.getYear() != null) { - return helper.getScenarioUrlFromYear(this.getYear(), this.getDwspl()); - } else { - return helper.getMittelScenarioUrl(this.getDwspl()); // nur 2 cases... - } + public WmsLayer createScenarioWMSLayer(final CallMeta meta, final String i10nKey) { + + // FIXME: use scenario-cm as label, and scenario-type + final YearType type = YearType.jahre; + final String selectedElement = Integer.toString(getDwspl()); + + final String layerLabel = Resources.getMsg(meta, i10nKey, new Object[] { selectedElement }); + + try { + final UedauernConfiguration helper = UedauernConfiguration.getInstance(getRiverName(), type); + final String url = helper.getUrl(selectedElement); + final String layer = helper.getLayer(selectedElement); + + return new WmsLayer(layerLabel, url, layer, false); } - return ""; + catch (final IOException | TsvReaderException e) { + e.printStackTrace(); + } + return null; + } - public Integer getDwspl() { - if (getIsUseScenario()) { + private String getSelectedLabel() { + return this.getString("year_epoch_select"); + } + + private Integer getDwspl() { + if (getIsUseScenario()) return super.getInteger("sedimentheight"); - } + return null; } @@ -97,12 +126,4 @@ public boolean getIsUseScenario() { return super.getBoolean("use_scenario"); } - - public Integer[] mittelStartEndYears() { - if (getIsUseScenario()) { - final UedauernPropertiesHelper helper = UedauernPropertiesHelper.getInstance(getRiverName()); - return helper.getMittelStartEnd(); - } - return null; - } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java Wed Sep 12 10:55:09 2018 +0200 @@ -11,17 +11,12 @@ import java.util.List; -import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.access.RiverAccess; import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.model.CalculationResult; -import org.dive4elements.river.artifacts.resources.Resources; -import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; -import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; +import org.dive4elements.river.artifacts.uinfo.inundationduration.InundationDurationCalculationResult.WmsLayer; import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZoneServerClientXChange; -import org.dive4elements.river.model.River; /** * @author Domenico Nardi Tironi @@ -38,42 +33,33 @@ public CalculationResult calculate(final UINFOArtifact uinfo) { final Calculation problems = new Calculation(); - final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name()); - final String user = CalculationUtils.findArtifactUser(this.context, uinfo); - - final RiverAccess access = new RiverAccess(uinfo); + final InundationDurationAccess indurax = new InundationDurationAccess(uinfo); - final InundationDurationAccess indurax = new InundationDurationAccess(uinfo); - final River river = indurax.getRiver(); - final RiverInfo riverInfo = new RiverInfo(river); - final DoubleRange calcRange = indurax.getRange(); - final String url = indurax.getWMSUrl(); - final Integer year = indurax.getYear(); // null bei year -> Integer final String zonesRaw = indurax.getVegZones(); final List<VegetationZoneServerClientXChange> zones = VegetationZoneServerClientXChange.parse(zonesRaw); - final String scenarioUrl = indurax.getWMSScenarioUrl(); - final String scenarioStr = String.valueOf(indurax.getDwspl()); + + final boolean isUseScenario = indurax.getIsUseScenario(); + + final InundationDurationCalculationResult result = new InundationDurationCalculationResult(); + + final WmsLayer inundationDurationLayer = indurax.createWMSLayer(this.context.getMeta(), "uinfo.export.url.inundationduration.inundationduration"); + result.addLayer(inundationDurationLayer); // TODO: add vegetationzone-values as parameter to url and use this url as veg'zone'url - - final boolean isUseScenario = indurax.getIsUseScenario(); - final Integer[] mittelStartEndYears = indurax.mittelStartEndYears(); - final InundationDurationCalculationResult result = new InundationDurationCalculationResult(); - - final String rangeDuration = year != null ? String.valueOf(year) - : new StringBuilder().append(String.valueOf(mittelStartEndYears[0])).append("-").append(mittelStartEndYears[1]).toString(); + final WmsLayer vegetationLayer = indurax.createWMSLayer(this.context.getMeta(), "uinfo.export.url.inundationduration.vegetation"); + result.addLayer(vegetationLayer); - result.addLayer(Resources.getMsg(this.context.getMeta(), "uinfo.export.url.inundationduration.inundationduration", new Object[] { rangeDuration }), url, - true); - // TODO: add vegetationzone-values as parameter to url and use this url as veg'zone'url - result.addLayer(Resources.getMsg(this.context.getMeta(), "uinfo.export.url.inundationduration.vegetation", new Object[] { rangeDuration }), url, false); if (isUseScenario) { - result.addLayer( - Resources.getMsg(this.context.getMeta(), "uinfo.export.url.inundationduration.scenario", new Object[] { rangeDuration, scenarioStr }), - scenarioUrl, true); - // TODO: add vegetationzone-values as parameter to url and use this url as veg'zone'url - result.addLayer(Resources.getMsg(this.context.getMeta(), "uinfo.export.url.inundationduration.vegetation_scenario", - new Object[] { rangeDuration, scenarioStr }), scenarioUrl, false); + // TODO: wieder einkommentieren, sobald die URL-Definition für Szenarien geklärt ist (und hoffentlich analog zu "mittel" + // und "jahre" funktioniert) + // final WmsLayer scenarioInundationDurationLayer = indurax.createScenarioWMSLayer(this.context.getMeta(), + // "uinfo.export.url.inundationduration.scenario"); + // result.addLayer(scenarioInundationDurationLayer); + // + // // TODO: add vegetationzone-values as styles to layer + // final WmsLayer scenarioVegetationLayer = indurax.createScenarioWMSLayer(this.context.getMeta(), + // "uinfo.export.url.inundationduration.vegetation_scenario"); + // result.addLayer(scenarioVegetationLayer); } return new CalculationResult(result, problems);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculationResult.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculationResult.java Wed Sep 12 10:55:09 2018 +0200 @@ -18,18 +18,16 @@ */ final class InundationDurationCalculationResult implements Serializable { - private static final long serialVersionUID = 1L; - - private final List<WmsLayer> layers = new ArrayList<>(); - - public final static class WmsLayer { + public static final class WmsLayer { private final String label; private final String url; private final boolean showLayerLink; + private final String layer; - public WmsLayer(final String label, final String url, final boolean showLayerLink) { + public WmsLayer(final String label, final String url, final String layer, final boolean showLayerLink) { this.label = label; this.url = url; + this.layer = layer; this.showLayerLink = showLayerLink; } @@ -41,13 +39,21 @@ return this.url; } + public String getLayer() { + return this.layer; + } + public boolean isShowLayerLink() { return this.showLayerLink; } } - public void addLayer(final String label, final String url, final boolean showLayerLink) { - this.layers.add(new WmsLayer(label, url, showLayerLink)); + private static final long serialVersionUID = 1L; + + private final List<WmsLayer> layers = new ArrayList<>(); + + public void addLayer(final WmsLayer layer) { + this.layers.add(layer); } public List<WmsLayer> getLayers() {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationState.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationState.java Wed Sep 12 10:55:09 2018 +0200 @@ -35,7 +35,7 @@ private static final long serialVersionUID = 1L; - private static final String LABEL_URL_SEPARATOR = ";";// always sync with client (ExportPanel) + private static final String LABEL_URL_SEPARATOR = ";LABEL_URL_SEPARATOR;";// always sync with client (ExportPanel) /** * From this state can only be continued trivially. @@ -94,10 +94,10 @@ final String url = layer.getUrl(); final WMSLayerFacet wmsFacet = new WMSLayerFacet(index, FLOODMAP_EXTERNAL_WMS_INUNDATIONDUR + index, label, type, getID(), hash, url); + wmsFacet.addLayer(layer.getLayer()); + facets.add(wmsFacet); - wmsFacet.addLayer("OSM-WMS-Dienst"); - // wmsFacet.setExtent(getExtent(false)); // wmsFacet.setOriginalExtent(getExtent(true)); wmsFacet.setSrid(getSrid()); @@ -110,8 +110,6 @@ // tODO: create layer links: filter by "showLayerLink" - // tODO: create layer links: filter by "showLayerLink" - final Calculation report = res.getReport(); if (report.hasProblems()) facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); @@ -119,10 +117,10 @@ return res; } - private CalculationResult doCompute(final UINFOArtifact sinfo, final CallContext context, final Object old) { + private CalculationResult doCompute(final UINFOArtifact artifact, final CallContext context, final Object old) { if (old instanceof CalculationResult) return (CalculationResult) old; - return new InundationDurationCalculation(context).calculate(sinfo); + return new InundationDurationCalculation(context).calculate(artifact); } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java Wed Sep 12 10:55:09 2018 +0200 @@ -12,11 +12,14 @@ import java.util.Map; import org.apache.log4j.Logger; +import org.dive4elements.artifactdatabase.data.StateData; import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.common.utils.XMLUtils; import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; import org.dive4elements.river.artifacts.states.AddTableDataHelper; import org.dive4elements.river.artifacts.states.DefaultState; +import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState; import org.w3c.dom.Element; /** State in which to fetch years for sedminent load calculation. */ @@ -65,7 +68,11 @@ @Override public boolean validate(final Artifact artifact) throws IllegalArgumentException { return true; + } + @Override + protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { + return ScenarioTypeState.changeHeaderForCurrentState("state.uinfo.inundation.scenario", data.getName(), cr, context); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadSingleYearSelectState.java Mon Sep 10 17:06:23 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* 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.inundationduration; - -import java.util.HashMap; -import java.util.Map; - -import org.dive4elements.artifacts.Artifact; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; -import org.dive4elements.river.artifacts.states.AddTableDataHelper; -import org.dive4elements.river.artifacts.states.DefaultState; -import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; -import org.w3c.dom.Element; - -/** State in which to fetch years for sedminent load calculation. */ -public class LoadSingleYearSelectState extends DefaultState { - private static final long serialVersionUID = 1L; - - /** - * The default constructor that initializes an empty State object. - */ - public LoadSingleYearSelectState() { - } - - /** Year Select Widget. */ - @Override - protected String getUIProvider() { - return "common.state.load_single_year_select"; - } - - @Override - protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { - final String dataKey = "singleyear"; - try { - if (dataKey.equals(name)) { - final InundationDurationAccess access = new InundationDurationAccess((UINFOArtifact) artifact); - final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "year", context.getMeta()); // pinKeycolum; nicht zu verweschseln mit - // datakey..artifact. - - helper.addColumn(0, "pinfrom", "60", "common.client.ui.selection", "ICON", "CENTER", "from"); - helper.addColumn(1, "year", "60", "year", "INTEGER", "LEFT", null); - final UedauernPropertiesHelper properties = UedauernPropertiesHelper.getInstance(access.getRiverName()); - - for (final String year : properties.getEinzeljahre()) { - final Map<String, String> row = new HashMap<>(); - row.put("year", year); - helper.addRow(row); - - } - helper.submitMapToXml(); - } - } - catch (final IllegalArgumentException iae) { - iae.printStackTrace(); - } - } - -} \ 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/inundationduration/UedauernConfiguration.java Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,125 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * 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.inundationduration; + +import java.io.File; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.dive4elements.river.artifacts.sinfo.tkhstate.TsvHelper; +import org.dive4elements.river.artifacts.sinfo.tkhstate.TsvHelper.TsvReaderException; + +/** + * @author Domenico Nardi Tironi + * + */ +public class UedauernConfiguration { + + public final static class WmsConfig { + private final String label; + private final String url; + private final String layer; + + public WmsConfig(final String label, final String url, final String layer) { + this.label = label; + this.url = url; + this.layer = layer; + } + + public String getLabel() { + return this.label; + } + + public String getUrl() { + return this.url; + } + + public String getLayer() { + return this.layer; + } + } + + public static enum YearType { + jahre, mittel + } + + private static Map<String, UedauernConfiguration> cache = new HashMap<>(); + + private final Map<String, WmsConfig> wmsConfigs; + + public static synchronized UedauernConfiguration getInstance(final String rivername, final YearType type) throws IOException, TsvReaderException { + + final String cacheKey = type.name() + "#" + rivername; + if (!cache.containsKey(cacheKey)) { + final UedauernConfiguration instance = loadConfiguration(rivername, type); + cache.put(cacheKey, instance); + } + + return cache.get(cacheKey); + } + + private UedauernConfiguration(final String rivername, final YearType type, final Map<String, WmsConfig> wmsConfigs) { + this.wmsConfigs = wmsConfigs; + } + + private static UedauernConfiguration loadConfiguration(final String rivername, final YearType type) throws IOException, TsvReaderException { + + final String configFile = makeFileName(rivername, type); + final File file = TsvHelper.makeFile2(configFile, rivername); + final List<String[]> tsv = TsvHelper.readTsv(file, 3); + + final Map<String, WmsConfig> wmsConfigs = new LinkedHashMap<>(tsv.size()); + + for (final String[] line : tsv) { + final String label = line[0]; + wmsConfigs.put(label, new WmsConfig(label, line[2], line[1])); + } + + return new UedauernConfiguration(rivername, type, wmsConfigs); + } + + private static final String makeFileName(final String river, final YearType type) { + return "wms_uedauern_" + String.valueOf(type) + "_" + river + ".tsv"; + } + + public Collection<String> getLabels() throws UnsupportedEncodingException { + return this.wmsConfigs.keySet(); + } + + public final String getUrl(final String label) throws UnsupportedEncodingException { + final WmsConfig wmsConfig = this.wmsConfigs.get(label); + return wmsConfig.getUrl(); + } + + public String getLayer(final String label) { + final WmsConfig wmsConfig = this.wmsConfigs.get(label); + return wmsConfig.getLayer(); + } + + public static boolean filesExistsForRiver(final String river) { + + final String configFileYears = makeFileName(river, YearType.jahre); + + final File fileJahre = TsvHelper.makeFile2(configFileYears, river); + + final String configFileMittel = makeFileName(river, YearType.mittel); + final File fileMittel = TsvHelper.makeFile2(configFileMittel, river); + + if (TsvHelper.checkFile(fileJahre) == null || TsvHelper.checkFile(fileMittel) == null) + return false; + return true; + } + +} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/UedauernPropertiesHelper.java Mon Sep 10 17:06:23 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * 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.inundationduration; - -import java.io.IOException; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Properties; - -import org.apache.commons.lang.text.StrSubstitutor; -import org.dive4elements.artifacts.CallMeta; -import org.dive4elements.artifacts.common.utils.Config; -import org.dive4elements.river.artifacts.resources.Resources; - -/** - * @author Domenico Nardi Tironi - * - */ -public class UedauernPropertiesHelper { - - private static UedauernPropertiesHelper instance; - private final String CONFIG_FILE; - private final String rivername; - private Integer[] mittelStartEnde = null; - private String[] einzeljahre = null; - private String mittelUrl = null; - private Properties properties = null; - - public UedauernPropertiesHelper(final String rivername) { - this.rivername = rivername; - this.CONFIG_FILE = makeFileName(rivername); - } - - public static synchronized UedauernPropertiesHelper getInstance(final String rivername) { - if (UedauernPropertiesHelper.instance == null || !UedauernPropertiesHelper.instance.getRivername().equals(rivername)) { - - UedauernPropertiesHelper.instance = new UedauernPropertiesHelper(rivername); - } - return UedauernPropertiesHelper.instance; - } - - private String getRivername() { - return this.rivername; - } - - private static final String makeFileName(final String river) { - return "wms_uedauern_" + river + ".properties"; - } - - public LinkedHashMap<String, String> getExtraLayers(final CallMeta meta) { - final LinkedHashMap<String, String> entries = new LinkedHashMap<>(); - - final Integer[] totalEpoch = getMittelStartEnd(); - final Object[] args = new Object[] { String.valueOf(totalEpoch[0]), String.valueOf(totalEpoch[1]) }; - - entries.put("state.uinfo.totalepoch", Resources.getMsg(meta, "state.uinfo.totalepoch", args)); // - // String.valueOf: avoid formatting - // (3.333,00 - - return entries; - } - - private Properties getProperties() { - if (this.properties == null) { - try { - this.properties = Config.loadProperties(this.CONFIG_FILE, Config.getModulesConfigDirectory()); - } - catch (final IOException e) { - e.printStackTrace(); - } - } - return this.properties; - } - - final Integer[] getMittelStartEnd() { - if (this.mittelStartEnde == null) { - final Integer mittel_start = Integer.valueOf(getProperties().get("mittel_start").toString()); - final Integer mittel_ende = Integer.valueOf(getProperties().get("mittel_ende").toString()); - this.mittelStartEnde = new Integer[] { mittel_start, mittel_ende }; // lazy - - } - return this.mittelStartEnde; - } - - public String[] getEinzeljahre() { - if (this.einzeljahre == null) { // lazy - final Object years = getProperties().get("jahre"); - if (years != null) { - this.einzeljahre = years.toString().split(","); - } - } - return this.einzeljahre; - } - - public final String getMittelUrl() { - if (this.mittelUrl == null) { // lazy - this.mittelUrl = getProperties().get("mittel_url").toString(); - } - return this.mittelUrl; - } - - public final String urlFromYear(final int year) { - // besser kein lazy-loading, da der user nochmal zurück gehen und das Jahr ändern könnte... - final String templateUrl = getProperties().get("url").toString(); - final Map<String, String> tokens = new HashMap<>(); - tokens.put("jahr", String.valueOf(year)); - final StrSubstitutor subst = new StrSubstitutor(tokens); - final String yearUrl = subst.replace(templateUrl); - return yearUrl; - } - - public static boolean fileExistsForRiver(final String river) { - try { - Config.loadProperties(makeFileName(river), Config.getModulesConfigDirectory()); - return true; - } - catch (final IOException e) { - e.printStackTrace(); - return false; - } - } - - public String getScenarioUrlFromYear(final Integer year, final Integer dMwspl) { - // besser kein lazy-loading, da der user nochmal zurück gehen und das Jahr ändern könnte... - final String templateUrl = getProperties().get("scenario_url").toString(); - final Map<String, String> tokens = new HashMap<>(); - tokens.put("jahr", String.valueOf(year)); - tokens.put("scenario", String.valueOf(dMwspl)); - final StrSubstitutor subst = new StrSubstitutor(tokens); - final String yearUrl = subst.replace(templateUrl); - return yearUrl; - } - - public String getMittelScenarioUrl(final Integer dMwspl) { - final Map<String, String> tokens = new HashMap<>(); - tokens.put("scenario", String.valueOf(dMwspl)); - final String templateUrl = getProperties().get("mittel_scenario_url").toString(); - final StrSubstitutor subst = new StrSubstitutor(tokens); - final String url = subst.replace(templateUrl); - return url; - } -} \ 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/inundationduration/WMSEpochSelectState.java Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,28 @@ +/* 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.inundationduration; + +import org.dive4elements.river.artifacts.uinfo.inundationduration.UedauernConfiguration.YearType; + +/** State in which to fetch years for sedminent load calculation. */ +public class WMSEpochSelectState extends AbstractYearEpochUrlState { + private static final long serialVersionUID = 1L; + + /** + * The default constructor that initializes an empty State object. + */ + public WMSEpochSelectState() { + super(YearType.mittel); + } + + @Override + protected String getUIProvider() { + return "uinfo.inundation.wms_epoch"; + } +} \ 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/inundationduration/WMSYearSelectState.java Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,28 @@ +/* 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.inundationduration; + +import org.dive4elements.river.artifacts.uinfo.inundationduration.UedauernConfiguration.YearType; + +/** State in which to fetch years for sedminent load calculation. */ +public class WMSYearSelectState extends AbstractYearEpochUrlState { + private static final long serialVersionUID = 1L; + + /** + * The default constructor that initializes an empty State object. + */ + public WMSYearSelectState() { + super(YearType.jahre); + } + + @Override + protected String getUIProvider() { + return "uinfo.inundation.wms_year"; + } +} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/YearChoice.java Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/YearChoice.java Wed Sep 12 10:55:09 2018 +0200 @@ -28,10 +28,8 @@ if (artifact != null) {// necessary; otherwise crashes randomly when reloading old calculations final InundationDurationAccess access = new InundationDurationAccess((UINFOArtifact) artifact); - final UedauernPropertiesHelper helper = UedauernPropertiesHelper.getInstance(access.getRiverName()); - final LinkedHashMap<String, String> extras = helper.getExtraLayers(meta); entries.put("state.uinfo.year", null); - entries.putAll(extras); + entries.put("state.uinfo.epoch", null); } return entries; }
--- a/artifacts/src/main/resources/messages.properties Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Wed Sep 12 10:55:09 2018 +0200 @@ -83,10 +83,11 @@ state.uinfo.vegetation_zones.table = Classification of Vegetation Zones and Flooding Durations (FD) state.uinfo.salix.supraregional = Supraregional Effects -state.uinfo.inundation.year_totalepoch = Year/Total Epoch +state.uinfo.inundation.year_totalepoch = Year/Epoch state.uinfo.salix.year_epoch = Year/Epoch state.uinfo.load.year_with_soundings = Year state.uinfo.inundation.load.year= Year +state.uinfo.inundation.load.epoch= Epoch state.uinfo.load.epoch=Epoch state.uinfo.year=Year state.uinfo.epoch=Epoch @@ -1092,7 +1093,8 @@ state.uinfo.inundation.use_scenario=Scenario state.uinfo.salix.load.scenario.regional = Waterlevel Changes state.uinfo.inundation.scenario.regional = Waterlevel Change Input (up to 5 Input Values) -state.uinfo.inundation.scenario = Insert a value for sounding or waterlevel change +state.uinfo.inundation.scenario = Insert a Value for Sounding or Waterlevel Change +state.uinfo.inundation.load.scenario = Sounding or Waterlevel Change state.uinfo.salix.use_scenario=Scenario useScenario.option = Also include Scenario? useScenario.active = Active @@ -1122,6 +1124,8 @@ help.state.uinfo.inundation.scenario = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.inundation.scenario help.state.uinfo.inundation.vegetation = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.vegetation help.state.uinfo.inundation.load.year = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.inundation.load.year +#Erstmal dieselbe URL wie f\u00fcr year; evtl. noch \u00e4ndern! +help.state.uinfo.inundation.load.epoch = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.inundation.load.year state.bundu.wst.load.distance_only_part = Missing Depths Calculation state.uinfo.distance_only_part.historical= Sub-range
--- a/artifacts/src/main/resources/messages_de.properties Mon Sep 10 17:06:23 2018 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Wed Sep 12 10:55:09 2018 +0200 @@ -83,10 +83,11 @@ state.uinfo.vegetation_zones.table = Einteilung der Vegetationszonen und \u00dcberflutungsdauern (\u00dcFD) state.uinfo.salix.supraregional = \u00dcberregional wirkende Eingriffe -state.uinfo.inundation.year_totalepoch = Jahr/Gesamter Zeitraum +state.uinfo.inundation.year_totalepoch = Jahr/Epoche state.uinfo.salix.year_epoch = Jahr/Epoche state.uinfo.load.year_with_soundings = Jahr state.uinfo.inundation.load.year= Jahr +state.uinfo.inundation.load.epoch= Epoche state.uinfo.load.epoch=Epoche state.uinfo.year=Einzeljahr state.uinfo.epoch=Epoche @@ -1093,6 +1094,7 @@ state.uinfo.salix.load.scenario.regional = \u00c4nderungen der MW-Spiegellage state.uinfo.inundation.scenario.regional = Eingabe der \u00c4nderung der Mittelwasserspiegellage (bis zu 5 Werte m\u00f6glich) state.uinfo.inundation.scenario = Wert f\u00fcr \u00c4nderung der Sohl- bzw. Mittelwasserlage eingeben +state.uinfo.inundation.load.scenario = \u00c4nderung der Sohl- bzw. Mittelwasserlage state.uinfo.salix.use_scenario=Szenariobetrachtung useScenario.option = Zus\u00e4tzlich Szenariobetrachtung miteinbeziehen? useScenario.active = Ja @@ -1122,6 +1124,8 @@ help.state.uinfo.inundation.scenario = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.inundation.scenario help.state.uinfo.inundation.vegetation = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.vegetation help.state.uinfo.inundation.load.year = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.inundation.load.year +#Erstmal dieselbe URL wie f\u00fcr year; evtl. noch \u00e4ndern! +help.state.uinfo.inundation.load.epoch = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.inundation.load.year state.bundu.wst.load.distance_only_part= Berechnungsstrecke Fehltiefen state.uinfo.distance_only_part.historical= Teilabschnitt
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Wed Sep 12 10:55:09 2018 +0200 @@ -1614,4 +1614,6 @@ String gauge_list_grid_start(); String gauge_list_grid_end(); + + String no_data_for_input(); } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed Sep 12 10:55:09 2018 +0200 @@ -763,6 +763,7 @@ lower_time = from upper_time = to +no_data_for_input = No data available for given input $1. no_data_for_year = No data available for: $1 no_data_sediment_difference = Invalid value: $1
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed Sep 12 10:55:09 2018 +0200 @@ -763,6 +763,7 @@ lower_time = von upper_time = bis +no_data_for_input = F\u00fcr die Eingabe $1 liegen keine Daten vor. no_data_for_year = F\u00fcr das Jahr $1 liegen keine Daten vor. no_data_sediment_difference = Der Wert $1 ist ung\u00fcltig.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java Wed Sep 12 10:55:09 2018 +0200 @@ -42,11 +42,15 @@ void setErrorForItemMsg(String errorForItemMsg); - // void setMSG(FLYSConstants msg); + boolean isMultipleInputsAllowed(); + + String titleForCreateOld(); } private TextItem inputItem; + private String title = null; + protected List<String> validInputs = new ArrayList<String>(); private final IMultiSingleBehaviour behaviour; @@ -70,6 +74,7 @@ } }; + this.title = data.get(0).getDescription(); final FromToTableHelperPanel helper = new FromToTableHelperPanel(data, getDatakey(), this.MSG, fromHandler, null); final Canvas table = helper.getTable(); this.validInputs = helper.getKeycolEntries(); @@ -93,13 +98,14 @@ final Data years = getData(items, getDatakey()); final DataItem[] yearsItems = years.getItems(); - final String v1 = yearsItems[0].getStringValue().replace(" ", ", "); + final String v1 = this.behaviour.isMultipleInputsAllowed() ? yearsItems[0].getStringValue().replace(" ", ", ") : yearsItems[0].getStringValue(); final Label old = new Label(v1); final HLayout layout = new HLayout(); layout.setWidth("400px"); - final Label label = new Label(dataList.getLabel()); + final String labelStr = this.behaviour.titleForCreateOld() != null ? this.behaviour.titleForCreateOld() : dataList.getLabel(); + final Label label = new Label(labelStr); label.setWidth("200px"); final Canvas back = getBackButton(dataList.getState()); @@ -146,4 +152,5 @@ final String sValue = this.inputItem.getValueAsString(); return this.behaviour.validate(errors, sValue); } + } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ExportPanel.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ExportPanel.java Wed Sep 12 10:55:09 2018 +0200 @@ -36,7 +36,7 @@ */ public class ExportPanel extends VLayout { - private static final String LABEL_URL_SEPARATOR = ";";// always sync with server (InundationDurationState) + private static final String LABEL_URL_SEPARATOR = ";LABEL_URL_SEPARATOR;";// always sync with server (InundationDurationState) /** The message class that provides i18n strings. */ protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java Wed Sep 12 10:55:09 2018 +0200 @@ -33,6 +33,7 @@ import org.dive4elements.river.client.client.ui.sinfo.DiffPairTwinPanel; import org.dive4elements.river.client.client.ui.sinfo.FlowDepthMinMaxTwinPanel; import org.dive4elements.river.client.client.ui.sq.SQPeriodPanel; +import org.dive4elements.river.client.client.ui.uinfo.InundationWMSInputPanel; import org.dive4elements.river.client.client.ui.uinfo.Limit5SalixBehaviour; import org.dive4elements.river.client.client.ui.uinfo.LoadSedimentHeightPanel; import org.dive4elements.river.client.client.ui.uinfo.LoadSingleYearPanel; @@ -204,9 +205,7 @@ return new RadioPanel("unit"); } else if (uiProvider.equals("riverside_radio_panel")) { return new RadioPanel("riverside"); - } - - else if (uiProvider.equals("static_data")) { + } else if (uiProvider.equals("static_data")) { return new StaticDataPanel(); } else if (uiProvider.equals("minfo.sedimentload_distance_select")) { return new SedLoadDistancePanel(); @@ -220,6 +219,10 @@ return new CollisionLoadEpochPanel(); } else if (uiProvider.equals("common.state.load_single_year_select")) { return new LoadSingleYearPanel(getMSG()); + } else if (uiProvider.equals("uinfo.inundation.wms_year")) { + return new InundationWMSInputPanel(getMSG(), getMSG().year(), true); + } else if (uiProvider.equals("uinfo.inundation.wms_epoch")) { + return new InundationWMSInputPanel(getMSG(), getMSG().epoch(), false); } else if (uiProvider.equals("common.state.load_single_year_select.show_hint")) { return new LoadSingleYearPanel(getMSG(), true); } else if (uiProvider.equals("uinfo.salix.load_single_year_pseudo_epoch_select")) {
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java Wed Sep 12 10:55:09 2018 +0200 @@ -8,7 +8,6 @@ package org.dive4elements.river.client.client.ui.fixation; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -28,7 +27,7 @@ import com.smartgwt.client.widgets.layout.VLayout; public class FixFunctionSelect extends FixationPanel { - public static final Map<String, String> funcDesc = new HashMap<String, String>(); + public static final LinkedHashMap<String, String> funcDesc = new LinkedHashMap<String, String>(); static { funcDesc.put("log", "W(Q) = m*ln(Q + b)"); @@ -49,10 +48,12 @@ layout.setAlign(VerticalAlignment.TOP); layout.setHeight(25); - final LinkedHashMap initial = new LinkedHashMap(); + final LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>(); this.form = new DynamicForm(); + final int selectIndex = 0; + final int size = data.size(); for (int i = 0; i < size; i++) { @@ -80,13 +81,16 @@ } // I was here. Me 2. + int j = 0; + assert selectIndex < d.getItems().length; for (final DataItem item : d.getItems()) { - if (!defaultSet && first) { + if (!defaultSet && first && j == selectIndex) { initial.put(d.getLabel(), item.getStringValue()); first = false; } funcTypes.put(item.getStringValue(), item.getLabel()); + j++; } label.setWidth(50);
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/MultiBehaviour.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/MultiBehaviour.java Wed Sep 12 10:55:09 2018 +0200 @@ -53,4 +53,14 @@ return errors; } + @Override + public boolean isMultipleInputsAllowed() { + return true; + } + + @Override + public String titleForCreateOld() { + return null; + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/InundationWMSInputPanel.java Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,63 @@ +/* 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.client.client.ui.uinfo; + +import org.dive4elements.river.client.client.FLYSConstants; +import org.dive4elements.river.client.client.ui.AbstractSingleItemPanel; +import org.dive4elements.river.client.shared.model.DataList; + +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.TextItem; +import com.smartgwt.client.widgets.layout.VLayout; + +public class InundationWMSInputPanel extends AbstractSingleItemPanel { + + private static final long serialVersionUID = 1L; + private final boolean isEditable; + + public InundationWMSInputPanel(final FLYSConstants msg, final String titleForCreateOld, final boolean isEditable) { + super(new UinfoInundationSingleYearEpochBehaviour(msg, titleForCreateOld)); + this.isEditable = isEditable; + } + + @Override + protected String getDatakey() { + return "year_epoch_select"; + } + + @Override + protected String errorForItemMsg() { + return this.MSG.no_data_for_input(); + } + + @Override + public Canvas createWidget(final DataList data) { + final VLayout layout = new VLayout(); + + final Label title = new Label(data.get(0).getDescription()); + title.setHeight("25px"); + + final DynamicForm form = new DynamicForm(); + form.setNumCols(4); + + final TextItem inputItem = createInputItem("INPUT"); + inputItem.setWidth(250); + inputItem.setCanEdit(this.isEditable); + inputItem.setShowTitle(false); + form.setFields(inputItem); + + layout.addMember(title); + layout.addMember(form); + + return layout; + } + +} \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/Limit5SalixBehaviour.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/Limit5SalixBehaviour.java Wed Sep 12 10:55:09 2018 +0200 @@ -64,4 +64,14 @@ return errors; } + @Override + public boolean isMultipleInputsAllowed() { + return true; + } + + @Override + public String titleForCreateOld() { + return null; + } + }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SingleBehaviour.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SingleBehaviour.java Wed Sep 12 10:55:09 2018 +0200 @@ -40,4 +40,14 @@ return errors; } + @Override + public boolean isMultipleInputsAllowed() { + return false; + } + + @Override + public String titleForCreateOld() { + return null; + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/UinfoInundationSingleYearEpochBehaviour.java Wed Sep 12 10:55:09 2018 +0200 @@ -0,0 +1,65 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * 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.client.client.ui.uinfo; + +import java.util.List; + +import org.dive4elements.river.client.client.FLYSConstants; + +import com.smartgwt.client.widgets.form.fields.TextItem; + +/** + * @author Domenico Nardi Tironi + * + */ +public class UinfoInundationSingleYearEpochBehaviour extends ValidationBehaviourSingleMultiInputItem { + + private final String titleForCreateOld; + + public UinfoInundationSingleYearEpochBehaviour(final FLYSConstants msg, final String titleForCreateOld) { + super(msg); + this.titleForCreateOld = titleForCreateOld; + } + + @Override + public void appendValue(final TextItem inputItem, final String value) { + inputItem.setValue(value); + } + + @Override + public List<String> validate(final List<String> errors, final String inputValueString) { + boolean isGood = false; + for (final String validYear : this.getValidInputs()) { // no numeric check + /* No list contains for strings? */ + if (inputValueString.equals(validYear)) { + isGood = true; + break; + } + } + if (!isGood) { + String tmp = this.errorForItemMsg; + tmp = tmp.replace("$1", inputValueString); + errors.add(tmp); + } + + return errors; + + } + + @Override + public boolean isMultipleInputsAllowed() { + return false; + } + + @Override + public String titleForCreateOld() { + return this.titleForCreateOld; + } +}
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/ValidationBehaviourSingleMultiInputItem.java Mon Sep 10 17:06:23 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/ValidationBehaviourSingleMultiInputItem.java Wed Sep 12 10:55:09 2018 +0200 @@ -22,7 +22,7 @@ public abstract class ValidationBehaviourSingleMultiInputItem implements IMultiSingleBehaviour { private List<String> validInputs = null; - private String errorForItemMsg = null; + protected String errorForItemMsg = null; protected final FLYSConstants MSG; public ValidationBehaviourSingleMultiInputItem(final List<String> validInputs, final String errorForItemMsg, final FLYSConstants MSG) { @@ -41,7 +41,7 @@ // int goodValues = 0; errors.addAll(validateNumber(sValue)); boolean isGood = false; - for (final String validYear : this.validInputs) { + for (final String validYear : this.getValidInputs()) { /* No list contains for strings? */ if (sValue.equals(validYear)) { isGood = true; @@ -72,15 +72,19 @@ } @Override + public final void setErrorForItemMsg(final String errorForItemMsg) { + this.errorForItemMsg = errorForItemMsg; + + } + + @Override public final void setValidInputs(final List<String> validInputs) { this.validInputs = validInputs; } - @Override - public final void setErrorForItemMsg(final String errorForItemMsg) { - this.errorForItemMsg = errorForItemMsg; - + protected final List<String> getValidInputs() { + return this.validInputs; } }