# HG changeset patch # User Felix Wolfsteller # Date 1377596137 -7200 # Node ID bf191baa37e7c5c933bf58815186044311783e9e # Parent 972ec1f6cf582d91463d5f81b52c26bb04fe53fd issue1455: Prepare MiddleBedHeightDiagram to show Q values. diff -r 972ec1f6cf58 -r bf191baa37e7 artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Mon Aug 26 15:35:39 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Tue Aug 27 11:35:37 2013 +0200 @@ -10,9 +10,12 @@ import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; + import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.MiddleBedHeightData; +import org.dive4elements.river.artifacts.model.WQKms; + import org.dive4elements.river.exports.process.BedheightProcessor; import org.dive4elements.river.exports.process.Processor; import org.dive4elements.river.exports.process.WOutProcessor; @@ -35,7 +38,7 @@ implements FacetTypes { public enum YAXIS { - H(0), W(1), P(2); + H(0), W(1), P(2), Q(3); protected int idx; private YAXIS(int c) { idx = c; @@ -73,6 +76,9 @@ public static final String I18N_P_YAXIS_LABEL_DEFAULT = "Gepeilte Breite [m]"; public static final String I18N_P_YAXIS_LABEL = "chart.bedheight_middle.sounding.yaxis.label"; + public static final String I18N_Q_YAXIS_LABEL_DEFAULT = "Q [m\u00b3/s]"; + public static final String I18N_Q_YAXIS_LABEL = + "chart.longitudinal.section.yaxis.second.label"; @Override protected YAxisWalker getYAxisWalker() { @@ -139,6 +145,9 @@ else if (index == YAXIS.P.idx) { label = msg(I18N_P_YAXIS_LABEL, I18N_P_YAXIS_LABEL_DEFAULT); } + else if (index = YAXIS.Q.idx) { + label = msg(I18N_Q_YAXIS_LABEL, I18N_Q_YAXIS_LABEL_DEFAULT); + } return label; } @@ -226,6 +235,13 @@ attr, visible); } + else if (name.equals(STATIC_WQKMS_Q)) { + doQOut( + (WQKms) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); + } else if (bedp.canHandle(name)) { bedp.doOut(this, artifactAndFacet, attr, visible, YAXIS.P.idx); } @@ -291,5 +307,39 @@ logger.debug("FlowVelocityGenerator.doArea"); logger.warn("TODO: Implement FlowVelocityGenerator.doArea"); } + + + // TODO method borrowed from LongitudinalSectionGenerator. + // Extract in an Processor + /** + * Process the output for Q facets in a longitudinal section curve. + * + * @param wqkms An array of WQKms values. + * @param aandf The facet and artifact. This facet does NOT support any data objects. Use + * D4EArtifact.getNativeFacet() instead to retrieve a Facet which supports + * data. + * @param theme The theme that contains styling information. + * @param visible The visibility of the curve. + */ + protected void doQOut( + WQKms wqkms, + ArtifactAndFacet aandf, + ThemeDocument theme, + boolean visible + ) { + logger.debug("MiddleBedHeightGenerator.doQOut"); + + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + + StyledSeriesBuilder.addStepPointsKmQ(series, wqkms); + + addAxisSeries(series, YAXIS.Q.idx, visible); + + /* + if (needInvertAxis(wqkms)) { + setInverted(true); + } + */ + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :