# HG changeset patch # User Felix Wolfsteller # Date 1352459363 -3600 # Node ID 2e8638567c4906dbe601e890e86b90af1f43817c # Parent 10e7bd292c475c26e21c19eacbc223e34193c47d FlowVelocityGenerator: Handle new discharge curves at new third axis. diff -r 10e7bd292c47 -r 2e8638567c49 flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Fri Nov 09 12:08:52 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Fri Nov 09 12:09:23 2012 +0100 @@ -32,7 +32,8 @@ { public enum YAXIS { V(0), - T(1); + T(1), + Q(2); /* TODO Q and Density will come as 4th and 3rd axis. */ protected int idx; private YAXIS(int c) { @@ -77,10 +78,14 @@ public static final String I18N_2YAXIS_LABEL = "chart.flow_velocity.section.yaxis.second.label"; + public static final String I18N_3YAXIS_LABEL = + "chart.flow_velocity.section.yaxis.third.label"; + public static final String I18N_CHART_TITLE_DEFAULT = "Geschwindigkeit- und Schubspannung"; public static final String I18N_XAXIS_LABEL_DEFAULT = "km"; public static final String I18N_YAXIS_LABEL_DEFAULT = "Geschwindigkeit v [m/s]"; public static final String I18N_2YAXIS_LABEL_DEFAULT = "Schubspannung Tau [N]"; + public static final String I18N_3YAXIS_LABEL_DEFAULT = "Q [m³/s]"; @Override @@ -139,6 +144,9 @@ else if (index == YAXIS.T.idx) { label = getTAxisLabel(); } + else if (index == YAXIS.Q.idx) { + label = getQAxisLabel(); + } return label; } @@ -155,6 +163,13 @@ /** * Get internationalized label for the y axis. */ + protected String getQAxisLabel() { + return msg(I18N_3YAXIS_LABEL, I18N_3YAXIS_LABEL_DEFAULT); + } + + /** + * Get internationalized label for the y axis. + */ protected String getTAxisLabel() { return msg(I18N_2YAXIS_LABEL, I18N_2YAXIS_LABEL_DEFAULT); } @@ -200,6 +215,13 @@ attr, visible); } + else if (name.equals(FLOW_VELOCITY_DISCHARGE)) { + doQOut( + (FlowVelocityData) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); + } else if (name.equals(FLOW_VELOCITY_TAU)) { doTauOut( (FlowVelocityData) artifactAndFacet.getData(context), @@ -330,6 +352,29 @@ * @param theme The theme that contains styling information. * @param visible The visibility of the curve. */ + protected void doQOut( + FlowVelocityData data, + ArtifactAndFacet aandf, + Document theme, + boolean visible + ) { + logger.debug("FlowVelocityGenerator.doTauOut"); + + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + + StyledSeriesBuilder.addPoints(series, data.getQPoints(), true); + + addAxisSeries(series, YAXIS.Q.idx, visible); + } + + /** + * @param data A FlowVelocityData object + * @param aandf The facet. This facet does NOT support any data objects. Use + * FLYSArtifact.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 doTauOut( FlowVelocityData data, ArtifactAndFacet aandf,