Mercurial > dive4elements > river
changeset 9313:6ffcbb4f35d5
bundu.bezugswst first result stump
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/bundu.xml Thu Jul 26 15:54:20 2018 +0200 +++ b/artifacts/doc/conf/artifacts/bundu.xml Thu Jul 26 15:58:08 2018 +0200 @@ -129,7 +129,7 @@ <facets> <facet name="fix_parameters" description="facet.fix_parameters.csv" /> </facets> - </outputmode> + </outputmode> <outputmode name="fix_wq_curve_at_export" description="output.fix_wq_curve_at_export" mime-type="text/plain" type="export"> <facets> <facet name="at" description="facet.fix_wq_curve_export.at" /> @@ -479,82 +479,20 @@ <to state="state.bundu.wst" /> <condition data="calculation_mode" value="bundu_bezugswst" operator="equal" /> </transition> - - - - + <state id="state.bundu.wst" helpText="state.bundu.wst" description="state.bundu.wst" state="org.dive4elements.river.artifacts.bundu.bezugswst.BezugswstState"> <outputmodes> - <outputmode name="longitudinal_section" description="output.longitudinal_section" mime-type="image/png" type="chart"> - <facets> - <facet name="longitudinal_section.w" description="facet.longitudinal_section.w" /> - <facet name="longitudinal_section.q" description="facet.longitudinal_section.q" /> - <facet name="w_differences" description="facet.w_differences" /> - <facet name="other.wkms" description="facet.other.wkms" /> - <facet name="other.wq" description="WQ-Type of data" /> - <facet name="other.wqkms" description="facet.other.wqkms" /> - <facet name="other.wqkms.q" description="W-Type of data" /> - <facet name="other.wqkms.w" description="W-Type of data" /> - <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points" /> - <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations" /> - <facet name="longitudinal_section.area" description="facet.longitudinal_section.area" /> - <facet name="longitudinal_section.manualpoints" description="Manuelle Punkte" /> - </facets> - </outputmode> - <outputmode name="fix_wq_curve" description="output.fix_wq_curve" mine-type="image/png" type="chart"> + + <outputmode name="bundu_wst_export" description="output.fix_waterlevel_export" mine-type="text/plain" type="export"> <facets> - <facet name="fix_sector_average_wq_0" description="Average values for Ws in Q sectors." /> - <facet name="fix_sector_average_wq_1" description="Average values for Ws in Q sectors." /> - <facet name="fix_sector_average_wq_2" description="Average values for Ws in Q sectors." /> - <facet name="fix_sector_average_wq_3" description="Average values for Ws in Q sectors." /> - <facet name="fix_analysis_events_wq" description="Raw event values used in the calculation" /> - <facet name="fix_wq_curve" description="WQ curve" /> - <facet name="fix_wq_ls" description="WQ LS curve" /> - <facet name="fix_outlier" description="The outliers" /> - <facet name="qsectors" description="qsectors." /> - <facet name="fix_events_wqkms" description="WQKMS-Type of data" /> - <facet name="other.wqkms.q" description="W-Type of data" /> - <facet name="other.wqkms.w" description="W-Type of data" /> - <facet name="other.wkms" description="facet.other.wqkms" /> - <facet name="other.wqkms" description="facet.other.wqkms" /> - <!--issue1383: facet name="longitudinal_section.w" description="facet.longitudinal_section.w"/ --> - <facet name="other.wq" description="Point-like data like fixations" /> - <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points" /> - <facet name="discharge_curve.curve" description="facet.discharge_curve.curve" /> - <facet name="mainvalues.w" description="facet.fix_wq.mainvalues.w" /> - <facet name="mainvalues.q" description="facet.fix_wq.mainvalues.q" /> - </facets> - </outputmode> - <outputmode name="cross_section" description="output.cross_section" mime-type="image/png" type="chart"> - <facets> - <facet name="cross_section_water_line" description="facet.cross_section_water_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" /> - <facet name="hyk" description="hyks" /> - </facets> - </outputmode> - <outputmode name="fix_wq_curve_at_export" description="output.fix_wq_curve_at_export" mime-type="text/plain" type="export"> - <facets> - <facet name="at" description="facet.fix_wq_curve_export.at" /> - </facets> - </outputmode> - <outputmode name="fix_waterlevel_export" description="output.fix_waterlevel_export" mine-type="text/plain" type="export"> - <facets> - <facet name="csv" description="facet.waterlevel_export.csv" /> - <facet name="wst" description="facet.waterlevel_export.wst" /> + <facet name="csv" description="facet.waterlevel_export.csv" /> <facet name="pdf" description="facet.waterlevel_export.pdf" /> </facets> </outputmode> - <outputmode name="fix_report" description="output.fix_report.report" mime-type="text/plain" type="report"> - <facets> - <facet name="report" description="facet.fix.report" /> - </facets> - </outputmode> + + </outputmodes> </state>
--- a/artifacts/doc/conf/generators/discharge-diagram-defaults.xml Thu Jul 26 15:54:20 2018 +0200 +++ b/artifacts/doc/conf/generators/discharge-diagram-defaults.xml Thu Jul 26 15:58:08 2018 +0200 @@ -2,7 +2,7 @@ <discharge-defaults> <axis name="W"/> <axis name="Transport" logarithmic="true"/> - <domain-axis key="chart.discharge.curve.xaxis.label" default="Q [kuhbikmeter]" + <domain-axis key="common.export.csv.header.q" default="Q [kuhbikmeter]" include-zero="true"/> <processor class="org.dive4elements.river.exports.process.DischargeProcessor" axis="W"/> <processor class="org.dive4elements.river.exports.process.MiscDischargeProcessor" axis="W"/>
--- a/artifacts/doc/conf/generators/generators.xml Thu Jul 26 15:54:20 2018 +0200 +++ b/artifacts/doc/conf/generators/generators.xml Thu Jul 26 15:58:08 2018 +0200 @@ -40,6 +40,7 @@ <output-generator names="fix_deltawt_curve" class="org.dive4elements.river.exports.fixings.FixDeltaWtGenerator" /> <output-generator names="fix_deltawt_curve_chartinfo" class="org.dive4elements.river.exports.fixings.FixDeltaWtInfoGenerator" /> <output-generator names="fix_waterlevel_export" class="org.dive4elements.river.exports.WaterlevelExporter" /> + <output-generator names="bundu_wst_export" class="org.dive4elements.river.artifacts.bundu.bezugswst.BunduWstExporter" /> <output-generator names="sedimentload_ls_export" class="org.dive4elements.river.exports.minfo.SedimentLoadExporter" /> <!-- Error report generators. --> <output-generator names="discharge_longitudinal_section_report" class="org.dive4elements.river.exports.ReportGenerator" />
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/doc/conf/jasper/templates/bundu.bezugswst.jrxml Thu Jul 26 15:58:08 2018 +0200 @@ -0,0 +1,255 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 4.5.0 --> +<!-- 2018-07-25T18:01:47 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="flysreport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="545" leftMargin="30" rightMargin="20" topMargin="20" bottomMargin="20"> + <property name="ireport.zoom" value="1.0"/> + <property name="ireport.x" value="0"/> + <property name="ireport.y" value="0"/> + <style name="htmlStyle" isDefault="true" mode="Transparent" markup="html" fontName="Roboto"> + <paragraph lineSpacing="Single"/> + </style> + <field name="meta:header" class="java.lang.String"/> + <field name="meta:calcMode" class="java.lang.String"/> + <field name="meta:version_label" class="java.lang.String"/> + <field name="meta:version" class="java.lang.String"/> + <field name="meta:user_label" class="java.lang.String"/> + <field name="meta:user" class="java.lang.String"/> + <field name="meta:date_label" class="java.lang.String"/> + <field name="meta:date" class="java.lang.String"/> + <field name="meta:river_label" class="java.lang.String"/> + <field name="meta:river" class="java.lang.String"/> + <field name="meta:range_label" class="java.lang.String"/> + <field name="meta:range" class="java.lang.String"/> + <field name="meta:calculation_label" class="java.lang.String"/> + <field name="meta:calculation_name" class="java.lang.String"/> + <field name="meta:station_header" class="java.lang.String"/> + <field name="meta:flowdepthdevelopment_header" class="java.lang.String"/> + <field name="meta:flowdepthdevelopmentperyear_header" class="java.lang.String"/> + <field name="meta:waterleveldifference_header" class="java.lang.String"/> + <field name="meta:waterleveldifference_header2" class="java.lang.String"/> + <field name="meta:waterleveldifference_header_label" class="java.lang.String"/> + <field name="meta:bedheightdifference_header" class="java.lang.String"/> + <field name="meta:bedheightdifference_header2" class="java.lang.String"/> + <field name="meta:bedheightdifference_header_label" class="java.lang.String"/> + <field name="meta:flowdepthcurrent_header" class="java.lang.String"/> + <field name="meta:flowdepthcurrent_header2" class="java.lang.String"/> + <field name="meta:flowdepthhistorical_header" class="java.lang.String"/> + <field name="meta:flowdepthhistorical_header2" class="java.lang.String"/> + <field name="meta:flowdepthcurrent_header_label" class="java.lang.String"/> + <field name="meta:flowdepthhistorical_header_label" class="java.lang.String"/> + <field name="meta:flowdepth_header" class="java.lang.String"/> + <field name="meta:flowdepthdevelopment" class="java.lang.String"/> + <field name="meta:flowdepthmin_header" class="java.lang.String"/> + <field name="meta:flowdepthmax_header" class="java.lang.String"/> + <field name="meta:flowdepthdevelopment_header_label" class="java.lang.String"/> + <field name="meta:flowdepth_tkh_header" class="java.lang.String"/> + <field name="meta:tkh_header" class="java.lang.String"/> + <field name="meta:tkhkind_header" class="java.lang.String"/> + <field name="meta:waterlevel_header" class="java.lang.String"/> + <field name="meta:discharge_header" class="java.lang.String"/> + <field name="meta:waterlevel_name_header" class="java.lang.String"/> + <field name="meta:gauge_header" class="java.lang.String"/> + <field name="meta:bedheight_header" class="java.lang.String"/> + <field name="meta:sounding_name_header" class="java.lang.String"/> + <field name="meta:location_header" class="java.lang.String"/> + <field name="meta:fix_date" class="java.lang.String"/> + <field name="meta:fix_q" class="java.lang.String"/> + <field name="meta:fix_w" class="java.lang.String"/> + <field name="meta:fix_state" class="java.lang.String"/> + <field name="meta:fix_delta_w" class="java.lang.String"/> + <field name="data:0" class="java.lang.String"/> + <field name="data:1" class="java.lang.String"/> + <field name="data:2" class="java.lang.String"/> + <field name="data:3" class="java.lang.String"/> + <field name="data:4" class="java.lang.String"/> + <field name="data:5" class="java.lang.String"/> + <background> + <band splitType="Stretch"/> + </background> + <title> + <band height="169" splitType="Stretch"> + <textField> + <reportElement style="htmlStyle" x="0" y="0" width="515" height="30"/> + <textElement> + <font size="18"/> + </textElement> + <textFieldExpression><![CDATA[$F{meta:header} + " " + $F{meta:river}]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="0" y="39" width="165" height="20"/> + <textFieldExpression><![CDATA[$F{meta:calcMode}]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="0" y="69" width="123" height="20"/> + <textFieldExpression><![CDATA[$F{meta:version_label} + ":"]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="123" y="69" width="392" height="20"/> + <textFieldExpression><![CDATA[$F{meta:version}]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="0" y="89" width="123" height="20"/> + <textFieldExpression><![CDATA[$F{meta:user_label} + ":"]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="123" y="89" width="392" height="20"/> + <textFieldExpression><![CDATA[$F{meta:user}]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="0" y="109" width="123" height="20"/> + <textFieldExpression><![CDATA[$F{meta:date_label} + ":"]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="123" y="109" width="392" height="20"/> + <textFieldExpression><![CDATA[$F{meta:date}]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="0" y="129" width="123" height="20"/> + <textFieldExpression><![CDATA[$F{meta:river_label} + ":"]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="123" y="129" width="392" height="20"/> + <textFieldExpression><![CDATA[$F{meta:river}]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="0" y="149" width="123" height="20"/> + <textFieldExpression><![CDATA[$F{meta:range_label} + ":"]]></textFieldExpression> + </textField> + <textField> + <reportElement style="htmlStyle" x="123" y="149" width="392" height="20"/> + <textFieldExpression><![CDATA[$F{meta:range}]]></textFieldExpression> + </textField> + </band> + </title> + <columnHeader> + <band height="25" splitType="Stretch"> + <line> + <reportElement style="htmlStyle" positionType="FixRelativeToBottom" x="0" y="24" width="550" height="1"/> + </line> + <textField isStretchWithOverflow="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="85" height="24"/> + <box padding="5"/> + <textElement textAlignment="Right" verticalAlignment="Bottom"/> + <textFieldExpression><![CDATA[$F{meta:station_header}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="85" y="0" width="85" height="24"/> + <box padding="5"/> + <textElement textAlignment="Left" verticalAlignment="Bottom"/> + <textFieldExpression><![CDATA[$F{meta:fix_date}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="170" y="0" width="85" height="24"/> + <box padding="5"/> + <textElement textAlignment="Right" verticalAlignment="Bottom"/> + <textFieldExpression><![CDATA[$F{meta:fix_q}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="255" y="0" width="85" height="24"/> + <box padding="5"/> + <textElement textAlignment="Right" verticalAlignment="Bottom"/> + <textFieldExpression><![CDATA[$F{meta:fix_w}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="340" y="0" width="60" height="24"/> + <box padding="5"/> + <textElement textAlignment="Left" verticalAlignment="Bottom"/> + <textFieldExpression><![CDATA[$F{meta:fix_state}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="400" y="0" width="85" height="24"/> + <box padding="5"/> + <textElement textAlignment="Right" verticalAlignment="Bottom"/> + <textFieldExpression><![CDATA[$F{meta:fix_delta_w}]]></textFieldExpression> + </textField> + </band> + </columnHeader> + <detail> + <band height="15" splitType="Prevent"> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="85" height="15"/> + <box topPadding="2" leftPadding="5" bottomPadding="0" rightPadding="5"> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Top"/> + <textFieldExpression><![CDATA[$F{data:0}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="85" y="0" width="85" height="15"/> + <box topPadding="2" leftPadding="5" bottomPadding="0" rightPadding="5"> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Top"/> + <textFieldExpression><![CDATA[$F{data:1}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="170" y="0" width="85" height="15"/> + <box topPadding="2" leftPadding="5" bottomPadding="0" rightPadding="5"> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Top"/> + <textFieldExpression><![CDATA[$F{data:2}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="255" y="0" width="85" height="15"/> + <box topPadding="2" leftPadding="5" bottomPadding="0" rightPadding="5"> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Top"/> + <textFieldExpression><![CDATA[$F{data:3}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="340" y="0" width="60" height="15"/> + <box topPadding="2" leftPadding="5" bottomPadding="0" rightPadding="5"> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Top"/> + <textFieldExpression><![CDATA[$F{data:4}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="400" y="0" width="85" height="15"/> + <box topPadding="2" leftPadding="5" bottomPadding="0" rightPadding="5"> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Top"/> + <textFieldExpression><![CDATA[$F{data:5}]]></textFieldExpression> + </textField> + </band> + </detail> + <pageFooter> + <band height="15" splitType="Stretch"> + <textField isStretchWithOverflow="true"> + <reportElement style="htmlStyle" x="437" y="0" width="55" height="15"/> + <box topPadding="2" rightPadding="3"/> + <textElement textAlignment="Right"/> + <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" evaluationTime="Report"> + <reportElement style="htmlStyle" x="493" y="0" width="57" height="15"/> + <box topPadding="2" leftPadding="0" bottomPadding="0" rightPadding="0"/> + <textFieldExpression><![CDATA["/ " + $V{PAGE_NUMBER}]]></textFieldExpression> + </textField> + </band> + </pageFooter> + <summary> + <band height="30" splitType="Stretch"/> + </summary> +</jasperReport>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Thu Jul 26 15:58:08 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.artifacts.bundu.bezugswst; + +import java.util.ArrayList; +import java.util.List; + +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.bundu.BUNDUArtifact; +import org.dive4elements.river.artifacts.common.GeneralResultType; +import org.dive4elements.river.artifacts.common.ResultRow; +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.model.River; + +class BezugswstCalculation { + + // private static Logger log = Logger.getLogger(FloodDurationCalculation.class); + + private final CallContext context; + + public BezugswstCalculation(final CallContext context) { + this.context = context; + } + + public CalculationResult calculate(final BUNDUArtifact bunduartifact) { + + final String user = CalculationUtils.findArtifactUser(this.context, bunduartifact); + + /* access input data */ + final BunduAccess access = new BunduAccess(bunduartifact); + + final River river = access.getRiver(); + final RiverInfo riverInfo = new RiverInfo(river); + final String calcModeLabel = Resources.getMsg(this.context.getMeta(), "bundu_bezugswst"); + final BezugswstCalculationResults results = new BezugswstCalculationResults(calcModeLabel, user, riverInfo, access.getRange()); + + final List<ResultRow> list = new ArrayList<>(); + final ResultRow row = ResultRow.create(); + row.putValue(GeneralResultType.station, 666.666); + row.putValue(GeneralResultType.dischargeQwithUnit, 77.666); + row.putValue(GeneralResultType.location, "Tescht"); + list.add(row); + + final BezugswstCalculationResult result = new BezugswstCalculationResult("label? was fürn label?", list); + results.addResult(result, null); + return new CalculationResult(results, null);// problems); + } + + /** + * Calculates one W-MSH differences pair. + * + * @param infoProvider + */ + +} \ 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/bundu/bezugswst/BezugswstCalculationResult.java Thu Jul 26 15:58:08 2018 +0200 @@ -0,0 +1,115 @@ +/* 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.bundu.bezugswst; + +import java.util.ArrayList; +import java.util.Collection; + +import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; +import org.dive4elements.river.artifacts.common.ExportContextCSV; +import org.dive4elements.river.artifacts.common.ExportContextPDF; +import org.dive4elements.river.artifacts.common.GeneralResultType; +import org.dive4elements.river.artifacts.common.IExportContext; +import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; +import org.dive4elements.river.artifacts.common.ResultRow; +import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; +import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; +import org.dive4elements.river.artifacts.sinfo.util.WstInfo; + +/** + * Contains the results of a //TODO LINK{@link BezugswstCalculation}. + * + * @author Gernot Belger + */ +final class BezugswstCalculationResult extends AbstractCalculationExportableResult { + + private static final long serialVersionUID = 1L; + + private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.jrxml"; + + private final WstInfo wst = null; + private final BedHeightInfo sounding = null; + + public BezugswstCalculationResult(final String label, final Collection<ResultRow> rows // , final BedHeightInfo sounding // ,final WstInfo wst + ) { + super(label, rows); + // this.wst = this.wst; //TODO get Peilung and Wasserstand + // this.sounding = sounding; + } + + @Override + protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { + + // exportContextCSV.writeCSVSoundingMetadata(this.sounding, " "); + // exportContextCSV.writeBlankLine(); + // exportContextCSV.writeCSVWaterlevelMetadata(wst); + // exportContextCSV.writeBlankLine(); + } + + @Override + protected String getJasperFile() { + return JASPER_FILE; + } + + protected String[] formatRow(final IExportContext exportContext, final ResultRow row) { + + final Collection<String> lines = new ArrayList<>(10); + + lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); + lines.add(exportContext.formatRowValue(row, GeneralResultType.dischargeQwithUnit)); + // lines.add(exportContext.formatRowValue(row, SInfoResultType.flowdepthDevelopment)); + + lines.add(exportContext.formatRowValue(row, GeneralResultType.location)); + + return lines.toArray(new String[lines.size()]); + } + + @Override + public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { + + final Collection<String> header = new ArrayList<>(11); + + header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); + header.add(exportContextCSV.formatCsvHeader(GeneralResultType.dischargeQwithUnit)); + // header.add(exportContextCSV.msgUnitCSV(SInfoResultType.flowdepthDevelopment, + // SInfoResultType.flowdepthDevelopment.getUnit())); + // header.add(exportContextCSV.msgUnitCSV(SInfoResultType.flowdepthDevelopmentPerYear, + // SInfoResultType.flowdepthDevelopmentPerYear.getUnit())); + header.add(exportContextCSV.formatCsvHeader(GeneralResultType.location)); + + exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); + + } + + @Override + protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { + + return this.formatRow(exportContextCSV, row); + } + + @Override + protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { + + return this.formatRow(exportContextPDF, row); + } + + @Override + protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { + /* column headings */ + exportContextPDF.addJRMetadata(source, "station_header", GeneralResultType.station); + exportContextPDF.addJRMetadata(source, "TODO_MAKE_JASPER_REPORT...", GeneralResultType.dischargeQwithUnit); + // exportContextPDF.addJRMetadata(source, "flowdepthdevelopment_header", SInfoResultType.flowdepthDevelopment); + // exportContextPDF.addJRMetadata(source, "flowdepthdevelopmentperyear_header", + // SInfoResultType.flowdepthDevelopmentPerYear); + + exportContextPDF.addJRMetadata(source, "location_header", GeneralResultType.location); + + } +} \ 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/bundu/bezugswst/BezugswstCalculationResults.java Thu Jul 26 15:58:08 2018 +0200 @@ -0,0 +1,29 @@ +/** 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.bundu.bezugswst; + +import org.apache.commons.lang.math.DoubleRange; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; +import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; + +/** + * @author Gernot Belger + */ + +final class BezugswstCalculationResults extends AbstractCalculationResults<BezugswstCalculationResult> { + + private static final long serialVersionUID = 1L; + + public BezugswstCalculationResults(final String calcModeLabel, final String user, final RiverInfo river, final DoubleRange calcRange) { + super(calcModeLabel, user, river, calcRange); + + } + +} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Thu Jul 26 15:54:20 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Thu Jul 26 15:58:08 2018 +0200 @@ -8,34 +8,17 @@ package org.dive4elements.river.artifacts.bundu.bezugswst; -import java.text.DateFormat; -import java.util.Collection; -import java.util.Date; import java.util.List; import org.apache.log4j.Logger; import org.dive4elements.artifactdatabase.state.Facet; import org.dive4elements.artifacts.CallContext; -import org.dive4elements.artifacts.CallMeta; import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.access.FixRealizingAccess; +import org.dive4elements.river.artifacts.bundu.BUNDUArtifact; import org.dive4elements.river.artifacts.model.CalculationResult; -import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet; import org.dive4elements.river.artifacts.model.DataFacet; import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.model.ReportFacet; -import org.dive4elements.river.artifacts.model.WQCKms; -import org.dive4elements.river.artifacts.model.WQKms; -import org.dive4elements.river.artifacts.model.fixings.FixOutlierFacet; -import org.dive4elements.river.artifacts.model.fixings.FixRealizingCalculation; -import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult; -import org.dive4elements.river.artifacts.model.fixings.FixReferenceEventsFacet; -import org.dive4elements.river.artifacts.model.fixings.FixWQCurveFacet; -import org.dive4elements.river.artifacts.model.fixings.FixWaterlevelFacet; -import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.states.DefaultState; -import org.dive4elements.river.utils.Formatter; -import org.dive4elements.river.utils.UniqueDateFormatter; /** * State to compute the fixation realizing (vollmer) results. @@ -77,93 +60,120 @@ public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { log.debug("BezugswstState.computeAdvance"); - CalculationResult res; - - final FixRealizingAccess access = new FixRealizingAccess(artifact); - - if (old instanceof CalculationResult) { - res = (CalculationResult) old; - } else { - final FixRealizingCalculation calc = new FixRealizingCalculation(access); - res = calc.calculate(); - } - - if (facets == null) { - return res; - } - - if (res.getReport().hasProblems()) { - facets.add(new ReportFacet()); - } - - final String id = getID(); - final CallMeta meta = context.getMeta(); - - final FixRealizingResult fixRes = (FixRealizingResult) res.getData(); - final WQKms[] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0]; - - for (int i = 0; i < wqkms.length; i++) { - String nameW = null; - String nameQ = null; - - if (access.isQ()) { - nameQ = wqkms[i].getName(); - nameW = "W(" + nameQ + ")"; - } else { - nameW = wqkms[i].getName(); - nameQ = "Q(" + nameW + ")"; - } - - final Facet wq = new FixWaterlevelFacet(i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id); - - final Facet w = new FixWaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id); + // final CalculationResult res; + // + // final FixRealizingAccess access = new FixRealizingAccess(artifact); + // + // if (old instanceof CalculationResult) { + // res = (CalculationResult) old; + // } else { + // + // final FixRealizingCalculation calc = new FixRealizingCalculation(access); + // res = calc.calculate(); + // } + // + // if (facets == null) { + // return res; + // } + // + // if (res.getReport().hasProblems()) { + // facets.add(new ReportFacet()); + // } + // + // final String id = getID(); + // final CallMeta meta = context.getMeta(); + // + // final FixRealizingResult fixRes = (FixRealizingResult) res.getData(); + // final WQKms[] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0]; + // + // for (int i = 0; i < wqkms.length; i++) { + // String nameW = null; + // String nameQ = null; + // + // if (access.isQ()) { + // nameQ = wqkms[i].getName(); + // nameW = "W(" + nameQ + ")"; + // } else { + // nameW = wqkms[i].getName(); + // nameQ = "Q(" + nameW + ")"; + // } + // + // final Facet wq = new FixWaterlevelFacet(i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id); + // + // final Facet w = new FixWaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id); + // + // final Facet q = new FixWaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id); + // final Facet csFacet = new CrossSectionWaterLineFacet(i, nameW); + // + // facets.add(wq); + // facets.add(w); + // facets.add(q); + // facets.add(csFacet); + // + // // XXX: THIS CAN NOT HAPPEN! REMOVE IT! + // if (wqkms[i] instanceof WQCKms) { + // final String nameC = nameW.replace("benutzerdefiniert", "benutzerdefiniert [korrigiert]"); + // + // final Facet c = new FixWaterlevelFacet(i, DISCHARGE_LONGITUDINAL_C, nameC); + // + // facets.add(c); + // } + // } + // + // if (wqkms.length > 0) { + // final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); + // final DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm"); + // + // final Collection<Date> reds = fixRes.getReferenceEventsDates(); + // final UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); + // + // int i = 0; + // for (final Date d : reds) { + // facets.add(new FixReferenceEventsFacet((1 << 9) | i, FIX_EVENTS, cf.format(d))); + // i++; + // } + // + // facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); + // + // facets.add(new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id)); + // + // facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id)); + // } + // + // facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id)); + // + // facets.add(new FixWQCurveFacet(0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " (" + access.getFunction() + // + ")")); + // + // if (access.getPreprocessing()) { + // facets.add(new FixOutlierFacet(0, FIX_OUTLIER, Resources.getMsg(meta, I18N_WQ_OUTLIER, I18N_WQ_OUTLIER))); + // } + return compute((BUNDUArtifact) artifact, context, hash, facets, old); + } - final Facet q = new FixWaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id); - final Facet csFacet = new CrossSectionWaterLineFacet(i, nameW); - - facets.add(wq); - facets.add(w); - facets.add(q); - facets.add(csFacet); - - // XXX: THIS CAN NOT HAPPEN! REMOVE IT! - if (wqkms[i] instanceof WQCKms) { - final String nameC = nameW.replace("benutzerdefiniert", "benutzerdefiniert [korrigiert]"); - - final Facet c = new FixWaterlevelFacet(i, DISCHARGE_LONGITUDINAL_C, nameC); - - facets.add(c); - } - } - - if (wqkms.length > 0) { - final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); - final DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm"); + @Override + public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { - final Collection<Date> reds = fixRes.getReferenceEventsDates(); - final UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); - - int i = 0; - for (final Date d : reds) { - facets.add(new FixReferenceEventsFacet((1 << 9) | i, FIX_EVENTS, cf.format(d))); - i++; - } - - facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); + return compute((BUNDUArtifact) artifact, context, hash, facets, old); + } - facets.add(new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id)); - - facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id)); - } + private Object compute(final BUNDUArtifact artifact, final CallContext context, final String hash, final List<Facet> facets, final Object old) { - facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id)); + final BezugswstCalculation s = new BezugswstCalculation(context); + final CalculationResult res = s.calculate(artifact); - facets.add(new FixWQCurveFacet(0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " (" + access.getFunction() + ")")); + if (facets == null) + return res; - if (access.getPreprocessing()) { - facets.add(new FixOutlierFacet(0, FIX_OUTLIER, Resources.getMsg(meta, I18N_WQ_OUTLIER, I18N_WQ_OUTLIER))); - } + // if (!((List<Facet>) res).isEmpty()) { + final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); + final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); + + facets.add(csv); + facets.add(pdf); + // } return res; } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduWstExporter.java Thu Jul 26 15:58:08 2018 +0200 @@ -0,0 +1,43 @@ +/* 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.bundu.bezugswst; + +import org.apache.log4j.Logger; +import org.dive4elements.river.artifacts.common.AbstractCommonExporter; +import org.dive4elements.river.artifacts.common.ExportContextCSV; +import org.dive4elements.river.artifacts.common.ExportContextPDF; +import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; + +/** + * Generates different output formats (wst, csv, pdf) of data that resulted from + * a waterlevel computation. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class BunduWstExporter extends AbstractCommonExporter<BezugswstCalculationResult, BezugswstCalculationResults> { + + /** The log used in this exporter. */ + private static Logger log = Logger.getLogger(BunduWstExporter.class); + + @Override + protected void writeCSVGlobalMetadata(final ExportContextCSV exportContext, final BezugswstCalculationResults results) { + exportContext.writeCSVGlobalMetadataDefaults(); + + } + + @Override + protected void writePDFGlobalMetadata(final ExportContextPDF exportContext, final MetaAndTableJRDataSource source) { + exportContext.addJRMetaDataUSINFO(source); + // source.addMetaData("flowdepthdevelopment_header_label", + // SInfoResultType.flowdepthDevelopment.getCsvHeader(this.context.getMeta()));// (this.context.getMeta())); + + } + +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :