Mercurial > dive4elements > river
changeset 9444:ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/bundu.xml Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/doc/conf/artifacts/bundu.xml Tue Aug 21 13:41:18 2018 +0200 @@ -508,8 +508,18 @@ <outputmode name="bundu_wspl_longitudinal_section" description="output.bundu_wspl_longitudinal_section" mime-type="image/png" type="chart"> <facets> <facet name="longitudinal_section.w" description="longitudinal_section.w"/> + <facet name="bundu_facet_bedheight" description="bundu_facet_bedheight"/> <facet name="bundu_facet_channelmin" description="bundu_facet_channelmin"/> - <facet name="bundu_facet_bedheight" description="bundu_facet_bedheight"/> + <facet name="bundu_facet_bedheight_01" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_02" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_03" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_04" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_05" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_06" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_07" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_08" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_09" description="bundu_facet_bedheight_01"/> + <facet name="bundu_facet_bedheight_10" description="bundu_facet_bedheight_01"/> <facet name="longitudinal_section.q" description="longitudinal_section.q"/> <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> <facet name="longitudinal_section.area" description="facet.longitudinal_section.area"/> @@ -520,6 +530,16 @@ <facets> <facet name="bundu_facet_flowdepth.filtered" description="bundu_facet_flowdepth.filtered"/> <facet name="bundu_facet_channeldepth" description="bundu_facet_channeldepth"/> + <facet name="bundu_facet_depth_01.filtered" description="bundu_facet_depth_01.filtered"/> + <facet name="bundu_facet_depth_02.filtered" description="bundu_facet_depth_02.filtered"/> + <facet name="bundu_facet_depth_03.filtered" description="bundu_facet_depth_03.filtered"/> + <facet name="bundu_facet_depth_04.filtered" description="bundu_facet_depth_04.filtered"/> + <facet name="bundu_facet_depth_05.filtered" description="bundu_facet_depth_05.filtered"/> + <facet name="bundu_facet_depth_06.filtered" description="bundu_facet_depth_06.filtered"/> + <facet name="bundu_facet_depth_07.filtered" description="bundu_facet_depth_07.filtered"/> + <facet name="bundu_facet_depth_08.filtered" description="bundu_facet_depth_08.filtered"/> + <facet name="bundu_facet_depth_09.filtered" description="bundu_facet_depth_09.filtered"/> + <facet name="bundu_facet_depth_10.filtered" description="bundu_facet_depth_10.filtered"/> <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"/>
--- a/artifacts/doc/conf/themes.xml Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/doc/conf/themes.xml Tue Aug 21 13:41:18 2018 +0200 @@ -496,7 +496,27 @@ <mapping from="bundu_facet_channelmin" to="BunduChannel"/> <mapping from="bundu_facet_bedheight" to="BunduBed"/> + <mapping from="bundu_facet_bedheight_01" to="BunduBed01"/> + <mapping from="bundu_facet_bedheight_02" to="BunduBed02"/> + <mapping from="bundu_facet_bedheight_03" to="BunduBed03"/> + <mapping from="bundu_facet_bedheight_04" to="BunduBed04"/> + <mapping from="bundu_facet_bedheight_05" to="BunduBed05"/> + <mapping from="bundu_facet_bedheight_06" to="BunduBed06"/> + <mapping from="bundu_facet_bedheight_07" to="BunduBed07"/> + <mapping from="bundu_facet_bedheight_08" to="BunduBed08"/> + <mapping from="bundu_facet_bedheight_09" to="BunduBed09"/> + <mapping from="bundu_facet_bedheight_10" to="BunduBed10"/> <mapping from="bundu_facet_flowdepth.filtered" to="BunduBed"/> + <mapping from="bundu_facet_depth_01.filtered" to="BunduBed01"/> + <mapping from="bundu_facet_depth_02.filtered" to="BunduBed02"/> + <mapping from="bundu_facet_depth_03.filtered" to="BunduBed03"/> + <mapping from="bundu_facet_depth_04.filtered" to="BunduBed04"/> + <mapping from="bundu_facet_depth_05.filtered" to="BunduBed05"/> + <mapping from="bundu_facet_depth_06.filtered" to="BunduBed06"/> + <mapping from="bundu_facet_depth_07.filtered" to="BunduBed07"/> + <mapping from="bundu_facet_depth_08.filtered" to="BunduBed08"/> + <mapping from="bundu_facet_depth_09.filtered" to="BunduBed09"/> + <mapping from="bundu_facet_depth_10.filtered" to="BunduBed10"/> <mapping from="bundu_facet_channeldepth" to="BunduChannel"/> </mappings> </themes> \ No newline at end of file
--- a/artifacts/doc/conf/themes/default.xml Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/doc/conf/themes/default.xml Tue Aug 21 13:41:18 2018 +0200 @@ -3046,4 +3046,84 @@ <field name="linecolor" type="Color" display="Linienfarbe" default="224, 0, 0"/> </fields> </theme> + <theme name="BunduBed01"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed02"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed03"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed04"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed05"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed06"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed07"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed08"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed09"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed10"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> </themegroup> \ No newline at end of file
--- a/artifacts/doc/conf/themes/second.xml Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/doc/conf/themes/second.xml Tue Aug 21 13:41:18 2018 +0200 @@ -3034,4 +3034,84 @@ <field name="linecolor" type="Color" display="Linienfarbe" default="224, 0, 0"/> </fields> </theme> + <theme name="BunduBed01"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed02"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed03"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed04"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed05"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed06"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed07"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed08"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed09"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> + <theme name="BunduBed10"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="128, 0, 0"/> + </fields> + </theme> </themegroup> \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java Tue Aug 21 13:41:18 2018 +0200 @@ -14,6 +14,8 @@ import org.dive4elements.artifactdatabase.state.FacetActivity; import org.dive4elements.artifacts.Artifact; import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.bundu.bezugswst.BezugswstDepthProcessor; +import org.dive4elements.river.artifacts.bundu.bezugswst.BezugswstHeightProcessor; import org.dive4elements.river.artifacts.model.FacetTypes; /** @@ -52,6 +54,10 @@ if (FacetTypes.LONGITUDINAL_Q.equals(name)) return Boolean.FALSE; + if (name.startsWith(BezugswstHeightProcessor.FACET_FIELD_BEDHEIGHT_PREFIX)) + return Boolean.FALSE; + if (name.startsWith(BezugswstDepthProcessor.FACET_FIELD_DEPTH_PREFIX)) + return Boolean.FALSE; return null; }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduResultType.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduResultType.java Tue Aug 21 13:41:18 2018 +0200 @@ -239,7 +239,47 @@ } }; - // RESULT TYPE FIELDS + /** + * List of bed height values of the 10 fields of a cross section + */ + public static final BunduResultType bedHeightFields = new BunduResultType(null, null) { + + private static final long serialVersionUID = 1L; + + @Override + public String exportValue(final CallContext context, final Object value) { + final double doubleValue = asDouble(value); + return exportDoubleValue(context, doubleValue); + } + + @Override + protected NumberFormat createFormatter(final CallContext context) { + throw new UnsupportedOperationException(); + } + }; + + /** + * List of depth values of the 10 fields of a cross section + */ + public static final BunduResultType depthFields = new BunduResultType(I18NStrings.UNIT_NONE, null) { + + private static final long serialVersionUID = 1L; + + @Override + public String exportValue(final CallContext context, final Object value) { + final double doubleValue = asDouble(value); + return exportDoubleValue(context, doubleValue); + } + + @Override + protected NumberFormat createFormatter(final CallContext context) { + throw new UnsupportedOperationException(); + } + }; + + /** + * List of volume values of the 10 fields of a cross section + */ public static final BunduResultType missVolumeFields = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.volume.field") { private static final long serialVersionUID = 1L; @@ -256,7 +296,10 @@ } }; - public static final BunduResultType missMassfields = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.mass.field") { + /** + * List of mass values of the 10 fields of a cross section + */ + public static final BunduResultType missMassFields = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.mass.field") { private static final long serialVersionUID = 1L; @@ -272,16 +315,35 @@ } }; - public static final BunduResultType missStationRange = new BunduResultType(I18NStrings.UNIT_KM, I18NStrings.CSV_KM_HEADER) { + public static final BunduResultType missStationRangeFrom = new BunduResultType(I18NStrings.UNIT_KM, "bundu.export.bezugswst.csv.meta.miss.mass.km_from") { + + private static final long serialVersionUID = 1L; + @Override public String exportValue(final CallContext context, final Object value) { - return exportStringValue(value); + final double doubleValue = asDouble(value); + return exportDoubleValue(context, doubleValue); } @Override protected NumberFormat createFormatter(final CallContext context) { - throw new UnsupportedOperationException(); + return Formatter.getWaterlevelKM(context); } }; + public static final BunduResultType missStationRangeTo = new BunduResultType(I18NStrings.UNIT_KM, "bundu.export.bezugswst.csv.meta.miss.mass.km_to") { + + private static final long serialVersionUID = 1L; + + @Override + public String exportValue(final CallContext context, final Object value) { + final double doubleValue = asDouble(value); + return exportDoubleValue(context, doubleValue); + } + + @Override + protected NumberFormat createFormatter(final CallContext context) { + return Formatter.getWaterlevelKM(context); + } + }; } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Tue Aug 21 13:41:18 2018 +0200 @@ -34,6 +34,7 @@ import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; import org.dive4elements.river.artifacts.sinfo.util.WstInfo; import org.dive4elements.river.exports.WaterlevelDescriptionBuilder; +import org.dive4elements.river.model.BedHeightValueType; import org.dive4elements.river.model.River; import org.dive4elements.river.utils.Formatter; @@ -224,6 +225,15 @@ row.putValue(BunduResultType.channelLowerEdge, Formatter.roundFlowDepth(w).subtract(Formatter.roundFlowDepth(channelDepth)).doubleValue()); else row.putValue(BunduResultType.channelLowerEdge, Double.NaN); + final List<Double> fieldHeights = new ArrayList<>(); + final List<Double> fieldDepths = new ArrayList<>(); + for (int i = BedHeightValueType.FIELD_FIRST_INDEX; i <= BedHeightValueType.FIELD_LAST_INDEX; i++) { + final double h = bedHeightsFinder.getFieldHeight(station, i); + fieldHeights.add(Double.valueOf(h)); + fieldDepths.add(w - h); + } + row.putValue(BunduResultType.bedHeightFields, fieldHeights); + row.putValue(BunduResultType.depthFields, fieldDepths); return row; } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstDepthProcessor.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstDepthProcessor.java Tue Aug 21 13:41:18 2018 +0200 @@ -22,6 +22,7 @@ import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.model.BedHeightValueType; import org.dive4elements.river.themes.ThemeDocument; /** @@ -40,6 +41,12 @@ private static final String FACET_CHANNELDEPTH_DESCRIPTION = "bundu_facet_channeldepth.description"; + public static final String FACET_FIELD_DEPTH_PREFIX = "bundu_facet_depth_"; + + private static final String FACET_FIELD_DEPTH_FORMAT = FACET_FIELD_DEPTH_PREFIX + "%02d.filtered"; + + private static final String FACET_FIELD_DEPTH_DESCRIPTION = "bundu_facet_field_depth.description"; + private static final String AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label"; private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); @@ -47,6 +54,8 @@ static { HANDLED_FACET_TYPES.add(FACET_FLOWDEPTH_FILTERED); HANDLED_FACET_TYPES.add(FACET_CHANNELDEPTH); + for (int i = BedHeightValueType.FIELD_FIRST_INDEX; i <= BedHeightValueType.FIELD_LAST_INDEX; i++) + HANDLED_FACET_TYPES.add(String.format(FACET_FIELD_DEPTH_FORMAT, i)); } public BezugswstDepthProcessor() { @@ -67,10 +76,23 @@ return new BezugswstResultFacet(facetIndex, resultIndex, FACET_CHANNELDEPTH, description, AXIS_LABEL, id, hash); } + public static Facet createFieldDepthFacet(final CallContext context, final String hash, final String id, final int facetIndex, + final int resultIndex, final int fieldIndex) { + + final String description = Resources.getMsg(context.getMeta(), FACET_FIELD_DEPTH_DESCRIPTION, FACET_FIELD_DEPTH_DESCRIPTION, fieldIndex); + final String facetName = String.format(FACET_FIELD_DEPTH_FORMAT, fieldIndex); + return new BezugswstResultFacet(facetIndex, resultIndex, facetName, description, AXIS_LABEL, id, hash); + } + @Override protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { - return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE); + if (bundle.getFacetName().startsWith(FACET_FIELD_DEPTH_PREFIX)) { + final int fieldIndex = Integer.parseInt(bundle.getFacetName().substring(FACET_FIELD_DEPTH_PREFIX.length(), FACET_FIELD_DEPTH_PREFIX.length() + 2)); + return generateFieldDepthSeries(generator, bundle, theme, visible, fieldIndex); + } + + return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), null); } protected AbstractResultType doGetType(final String facetName) { @@ -83,4 +105,13 @@ final String error = String.format("Unknown facet name: %s", facetName); throw new UnsupportedOperationException(error); } + + private final String generateFieldDepthSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, + final boolean visible, final int fieldIndex) { + + final BezugswstMainCalculationResult data = (BezugswstMainCalculationResult) getResult(generator, bundle); + final double[][] points = data.getFieldValuePoints(fieldIndex, BunduResultType.depthFields); + + return buildSeriesForPoints(points, generator, bundle, theme, visible, null); + } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstHeightProcessor.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstHeightProcessor.java Tue Aug 21 13:41:18 2018 +0200 @@ -23,6 +23,7 @@ import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.exports.DiagramGenerator; import org.dive4elements.river.exports.LongitudinalSectionGenerator; +import org.dive4elements.river.model.BedHeightValueType; import org.dive4elements.river.themes.ThemeDocument; /** @@ -42,6 +43,12 @@ private static final String FACET_BEDHEIGHT_DESCRIPTION = "bundu_facet_bedheight.description"; + public static final String FACET_FIELD_BEDHEIGHT_PREFIX = "bundu_facet_bedheight_"; + + private static final String FACET_FIELD_BEDHEIGHT_FORMAT = FACET_FIELD_BEDHEIGHT_PREFIX + "%02d"; + + private static final String FACET_FIELD_BEDHEIGHT_DESCRIPTION = "bundu_facet_field_bedheight.description"; + private static final String AXIS_LABEL = LongitudinalSectionGenerator.I18N_YAXIS_LABEL; private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); @@ -49,6 +56,8 @@ static { HANDLED_FACET_TYPES.add(FACET_CHANNELMIN); HANDLED_FACET_TYPES.add(FACET_BEDHEIGHT); + for (int i = BedHeightValueType.FIELD_FIRST_INDEX; i <= BedHeightValueType.FIELD_LAST_INDEX; i++) + HANDLED_FACET_TYPES.add(String.format(FACET_FIELD_BEDHEIGHT_FORMAT, i)); } public BezugswstHeightProcessor() { @@ -69,10 +78,23 @@ return new BezugswstResultFacet(facetIndex, resultIndex, FACET_BEDHEIGHT, description, AXIS_LABEL, id, hash); } + public static Facet createFieldBedheightFacet(final CallContext context, final String hash, final String id, final int facetIndex, + final int resultIndex, final int fieldIndex) { + + final String description = Resources.getMsg(context.getMeta(), FACET_FIELD_BEDHEIGHT_DESCRIPTION, FACET_FIELD_BEDHEIGHT_DESCRIPTION, fieldIndex); + final String facetName = String.format(FACET_FIELD_BEDHEIGHT_FORMAT, fieldIndex); + return new BezugswstResultFacet(facetIndex, resultIndex, facetName, description, AXIS_LABEL, id, hash); + } + @Override protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { - return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE); + if (bundle.getFacetName().startsWith(FACET_FIELD_BEDHEIGHT_PREFIX)) { + final int fieldIndex = Integer.parseInt(bundle.getFacetName().substring(FACET_FIELD_BEDHEIGHT_PREFIX.length())); + return generateFieldHeightSeries(generator, bundle, theme, visible, fieldIndex); + } + + return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), null); } protected AbstractResultType doGetType(final String facetName) { @@ -85,4 +107,13 @@ final String error = String.format("Unknown facet name: %s", facetName); throw new UnsupportedOperationException(error); } + + private final String generateFieldHeightSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, + final boolean visible, final int fieldIndex) { + + final BezugswstMainCalculationResult data = (BezugswstMainCalculationResult) getResult(generator, bundle); + final double[][] points = data.getFieldValuePoints(fieldIndex, BunduResultType.bedHeightFields); + + return buildSeriesForPoints(points, generator, bundle, theme, visible, null); + } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMainCalculationResult.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMainCalculationResult.java Tue Aug 21 13:41:18 2018 +0200 @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.dive4elements.river.artifacts.bundu.BunduResultType; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; @@ -25,6 +26,8 @@ import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; import org.dive4elements.river.artifacts.sinfo.util.WstInfo; +import gnu.trove.TDoubleArrayList; + /** * Contains the results of a //TODO LINK{@link BezugswstCalculation}. * @@ -169,4 +172,27 @@ exportContextPDF.addJRMetadata(source, "location_header", GeneralResultType.location); } + + /** + * Gets a longitudinal section of a result type value of a cross section field + * + * @param fieldIndex + * 1-based field index + * @param type + * result type like bedHeightField + */ + public final double[][] getFieldValuePoints(final int fieldIndex, final BunduResultType type) { + + final TDoubleArrayList x = new TDoubleArrayList(this.getRows().size()); + final TDoubleArrayList y = new TDoubleArrayList(this.getRows().size()); + + for (final ResultRow row : this.getRows()) { + x.add(row.getDoubleValue(GeneralResultType.station)); + @SuppressWarnings("unchecked") + final List<Double> fieldHeights = (List<Double>) row.getValue(type); + y.add(fieldHeights.get(fieldIndex - 1)); + } + + return new double[][] { x.toNativeArray(), y.toNativeArray() }; + } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult1.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult1.java Tue Aug 21 13:41:18 2018 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde +/** 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 @@ -87,8 +87,8 @@ header.add(exportContextCSV.formatCsvHeader(BunduResultType.sounding)); header.add(exportContextCSV.formatCsvHeader(BunduResultType.channelLowerEdge) + " [" + river.getWstUnit() + "]"); // Args wäre hier auch gegangen...; - // beim pdf ist es ohne args deutlich - // einfacher, deshalb... + // beim pdf ist es ohne args deutlich + // einfacher, deshalb... header.add(exportContextCSV.formatCsvHeader(BunduResultType.channelDepth)); header.add(exportContextCSV.formatCsvHeader(BunduResultType.hasMissingDepth)); header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeTotal));
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java Tue Aug 21 13:41:18 2018 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde +/** 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 @@ -33,7 +33,8 @@ private static final long serialVersionUID = 1L; private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result2.jrxml"; - private static final String fieldMsgStr = "bundu.export.bezugswst.csv.meta.miss.field"; + private static final String fieldVolumeMsgKey = "bundu.export.bezugswst.csv.meta.miss.volume.field"; + private static final String fieldMassMsgKey = "bundu.export.bezugswst.csv.meta.miss.mass.field"; private static final int fieldSize = 10; public BezugswstMissVolCalculationResult2(final String label, final Collection<ResultRow> rows) { @@ -56,10 +57,12 @@ final Collection<String> lines = new ArrayList<>(20); lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); - final List<String> fields = (List<String>) row.getValue(BunduResultType.missVolumeFields); - assert (fields.size() == fieldSize); // immer abgleichen mit der Calculation! - for (final String field : fields) { - lines.add(field); + final List<String> vFields = (List<String>) row.getValue(BunduResultType.missVolumeFields); + assert (vFields.size() == fieldSize); // immer abgleichen mit der Calculation! + final List<String> mFields = (List<String>) row.getValue(BunduResultType.missMassFields); + for (int i = 0; i <= vFields.size() - 1; i++) { + lines.add(vFields.get(i)); + lines.add(mFields.get(i)); } lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeMeanBed)); lines.add(exportContext.formatRowValue(row, BunduResultType.missMassMeanBed)); @@ -70,14 +73,15 @@ @Override public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { - final int colSize = fieldSize + 2; + final int colSize = 2 * fieldSize + 2; exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result2", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern final Collection<String> header = new ArrayList<>(colSize); header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); for (int i = 1; i <= fieldSize; i++) { - header.add(exportContextCSV.msg(fieldMsgStr, i)); + header.add(exportContextCSV.msg(fieldVolumeMsgKey, i)); + header.add(exportContextCSV.msg(fieldMassMsgKey, i)); } header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeMeanBed)); header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassMeanBed)); @@ -104,7 +108,8 @@ exportContextPDF.addJRMetadata(source, "station_header", GeneralResultType.station); for (int i = 1; i <= fieldSize; i++) { - exportContextPDF.addJRMetadata(source, "field_header" + String.valueOf(i), exportContextPDF.msg(fieldMsgStr, i)); + exportContextPDF.addJRMetadata(source, "field_header" + String.valueOf(i), exportContextPDF.msg(fieldVolumeMsgKey, i)); + exportContextPDF.addJRMetadata(source, "field_header" + String.valueOf(i), exportContextPDF.msg(fieldMassMsgKey, i)); } exportContextPDF.addJRMetadata(source, "mean_bedheight_header", BunduResultType.missVolumeMeanBed); exportContextPDF.addJRMetadata(source, "mean_bedheight_header", BunduResultType.missMassMeanBed);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult3.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult3.java Tue Aug 21 13:41:18 2018 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde +/** 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 @@ -51,7 +51,8 @@ final Collection<String> lines = new ArrayList<>(20); - lines.add(exportContext.formatRowValue(row, BunduResultType.missStationRange)); + lines.add(exportContext.formatRowValue(row, BunduResultType.missStationRangeFrom)); + lines.add(exportContext.formatRowValue(row, BunduResultType.missStationRangeTo)); lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeTotal)); lines.add(exportContext.formatRowValue(row, BunduResultType.missMassTotal)); return lines.toArray(new String[lines.size()]); @@ -60,11 +61,12 @@ @Override public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { - final int colSize = 3; + final int colSize = 4; exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result3", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern final Collection<String> header = new ArrayList<>(colSize); - header.add(exportContextCSV.formatCsvHeader(BunduResultType.missStationRange)); + header.add(exportContextCSV.formatCsvHeader(BunduResultType.missStationRangeFrom)); + header.add(exportContextCSV.formatCsvHeader(BunduResultType.missStationRangeTo)); header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeTotal)); header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassTotal)); @@ -88,7 +90,8 @@ protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { /* column headings */ - exportContextPDF.addJRMetadata(source, "station_header", BunduResultType.missStationRange); + exportContextPDF.addJRMetadata(source, "station_header", BunduResultType.missStationRangeFrom); + exportContextPDF.addJRMetadata(source, "station_header", BunduResultType.missStationRangeTo); exportContextPDF.addJRMetadata(source, "channel_miss_volume_header", BunduResultType.missVolumeTotal); exportContextPDF.addJRMetadata(source, "channel_miss_mass_header", BunduResultType.missMassTotal);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Tue Aug 21 13:41:18 2018 +0200 @@ -26,6 +26,7 @@ import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.ReportFacet; import org.dive4elements.river.artifacts.states.DefaultState; +import org.dive4elements.river.model.BedHeightValueType; /** * State to compute the bundu bezugswst results. @@ -94,9 +95,13 @@ final String nameW = "W(" + nameQ + ")"; facets.add(new BezugswstFixationFacet(0, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, this.id)); facets.add(new BezugswstFixationFacet(0, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, this.id)); + for (int i = BedHeightValueType.FIELD_FIRST_INDEX; i <= BedHeightValueType.FIELD_LAST_INDEX; i++) + facets.add(BezugswstHeightProcessor.createFieldBedheightFacet(context, hash, this.id, facetIndex++, 0, i)); facets.add(BezugswstDepthProcessor.createFlowdepthFilteredFacet(context, hash, this.id, facetIndex++, 0, result.getBedHeightLabel())); facets.add(BezugswstDepthProcessor.createChanneldepthFacet(context, hash, this.id, facetIndex++, 0)); + for (int i = BedHeightValueType.FIELD_FIRST_INDEX; i <= BedHeightValueType.FIELD_LAST_INDEX; i++) + facets.add(BezugswstDepthProcessor.createFieldDepthFacet(context, hash, this.id, facetIndex++, 0, i)); 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);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/BedHeightsFinder.java Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/BedHeightsFinder.java Tue Aug 21 13:41:18 2018 +0200 @@ -171,6 +171,10 @@ return interpolateBedHeights(km, BedHeightValueType.max); } + public double getFieldHeight(final double km, final int index) { + return interpolateBedHeights(km, BedHeightValueType.field(index)); + } + private double interpolateBedHeights(final double km, final BedHeightValueType type) { if (this.values.containsKey(km)) {
--- a/artifacts/src/main/resources/messages.properties Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Tue Aug 21 13:41:18 2018 +0200 @@ -932,6 +932,8 @@ bundu.export.bezugswst.csv.meta.miss.volume.field = Feld {0} Fehlvolumen [m\u00b3] bundu.export.bezugswst.csv.meta.miss.mass.mean_bed = Mittlere Sohlh\u00f6he Fehlmasse [t] bundu.export.bezugswst.csv.meta.miss.volume.mean_bed = Mittlere Sohlh\u00f6he Fehlvolumen [m\u00b3] +bundu.export.bezugswst.csv.meta.miss.km_from = Fluss-km von +bundu.export.bezugswst.csv.meta.miss.km_to = Fluss-km bis export.flow_depth.csv.header.km = Fluss-km sinfo.export.flow_depth.csv.header.flowdepth = Flie\u00dftiefe @@ -1311,9 +1313,11 @@ bundu.chart.wspl.section.title = BZWS-L\u00e4ngsschnitt bundu_facet_bedheight.description = Mittlere Sohlh\u00f6he ({0}) bundu_facet_channelmin.description = Sohle (Sollzustand) +bundu_facet_field_bedheight.description = Sohlh\u00f6he Feld {0} bundu.chart.depth.section.title = h-L\u00e4ngsschnitt bundu_facet_flowdepth.filtered.description = h (BZWS, {0}) bundu_facet_channeldepth.description = h (Solltiefe) +bundu_facet_field_depth.description = h Feld {0} bundu.channelfinder.empty = The database does not contain any values for the river and the reference year bundu.channelfinder.missing = no channel data available
--- a/artifacts/src/main/resources/messages_de.properties Mon Aug 20 18:50:33 2018 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Tue Aug 21 13:41:18 2018 +0200 @@ -932,6 +932,8 @@ bundu.export.bezugswst.csv.meta.miss.volume.field = Feld {0} Fehlvolumen [m\u00b3] bundu.export.bezugswst.csv.meta.miss.mass.mean_bed = Mittlere Sohlh\u00f6he Fehlmasse [t] bundu.export.bezugswst.csv.meta.miss.volume.mean_bed = Mittlere Sohlh\u00f6he Fehlvolumen [m\u00b3] +bundu.export.bezugswst.csv.meta.miss.km_from = Fluss-km von +bundu.export.bezugswst.csv.meta.miss.km_to = Fluss-km bis export.flow_depth.csv.header.km = Fluss-km sinfo.export.flow_depth.csv.header.flowdepth = Flie\u00dftiefe @@ -1311,9 +1313,11 @@ bundu.chart.wspl.section.title = BZWS-L\u00e4ngsschnitt bundu_facet_bedheight.description = Mittlere Sohlh\u00f6he ({0}) bundu_facet_channelmin.description = Sohle (Sollzustand) +bundu_facet_field_bedheight.description = Sohlh\u00f6he Feld {0} bundu.chart.depth.section.title = h-L\u00e4ngsschnitt bundu_facet_flowdepth.filtered.description = h (BZWS, {0}) bundu_facet_channeldepth.description = h (Solltiefe) +bundu_facet_field_depth.description = h Feld {0} bundu.channelfinder.empty = Die Datenbank enth\u00e4lt keine Fahrrinnedaten f\u00fcr das Gew\u00e4sser und das Bezugsjahr bundu.channelfinder.missing = keine Fahrrinnedaten vorhanden
--- a/backend/src/main/java/org/dive4elements/river/model/BedHeightValue.java Mon Aug 20 18:50:33 2018 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/BedHeightValue.java Tue Aug 21 13:41:18 2018 +0200 @@ -250,6 +250,34 @@ } @Transient + public Double getSectionHeight(final int index) { + switch (index) { + case 1: + return this.height01; + case 2: + return this.height02; + case 3: + return this.height03; + case 4: + return this.height04; + case 5: + return this.height05; + case 6: + return this.height06; + case 7: + return this.height07; + case 8: + return this.height08; + case 9: + return this.height09; + case 10: + return this.height10; + default: + throw new IllegalArgumentException(); + } + } + + @Transient public void setSectionHeight(final int index, final Double value) { switch (index) { case 1: @@ -286,6 +314,7 @@ break; } } + public static List<BedHeightValue> getBedHeightValues(final BedHeight single) { final Session session = SessionHolder.HOLDER.get(); final Query query = session.createQuery("FROM BedHeightValue WHERE bedHeight=:single");
--- a/backend/src/main/java/org/dive4elements/river/model/BedHeightValueType.java Mon Aug 20 18:50:33 2018 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/BedHeightValueType.java Tue Aug 21 13:41:18 2018 +0200 @@ -33,7 +33,80 @@ public Double getValue(final BedHeightValue bedheightValue) { return bedheightValue.getHeight(); } + }, + field01 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight01(); + } + }, + field02 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight02(); + } + }, + field03 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight03(); + } + }, + field04 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight04(); + } + }, + field05 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight05(); + } + }, + field06 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight06(); + } + }, + field07 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight07(); + } + }, + field08 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight08(); + } + }, + field09 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight09(); + } + }, + field10 { + @Override + public Double getValue(final BedHeightValue bedheightValue) { + return bedheightValue.getHeight10(); + } }; public abstract Double getValue(final BedHeightValue bedheightValue); + + /** + * Enum constant of a section height + * + * @param index + * 1-based section index + */ + public static BedHeightValueType field(final int index) { + return valueOf(String.format("field%02d", index)); + } + + public static final int FIELD_FIRST_INDEX = 1; + public static final int FIELD_LAST_INDEX = 10; } \ No newline at end of file