Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java @ 4520:0b330ed218f6
Added new y axis label for m3/a unit and fixed sand fraction output.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 14 Nov 2012 17:15:38 +0100 |
parents | 60c728e557f4 |
children | bb8b1c182913 |
comparison
equal
deleted
inserted
replaced
4519:3e1810e72199 | 4520:0b330ed218f6 |
---|---|
4 import org.jfree.data.xy.XYSeries; | 4 import org.jfree.data.xy.XYSeries; |
5 import org.w3c.dom.Document; | 5 import org.w3c.dom.Document; |
6 | 6 |
7 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | 7 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
8 import de.intevation.artifactdatabase.state.Facet; | 8 import de.intevation.artifactdatabase.state.Facet; |
9 import de.intevation.flys.artifacts.FLYSArtifact; | |
10 import de.intevation.flys.artifacts.access.SedimentLoadAccess; | |
9 import de.intevation.flys.artifacts.model.FacetTypes; | 11 import de.intevation.flys.artifacts.model.FacetTypes; |
10 import de.intevation.flys.artifacts.model.minfo.SedimentLoadResult; | 12 import de.intevation.flys.artifacts.model.minfo.SedimentLoadResult; |
11 import de.intevation.flys.exports.StyledSeriesBuilder; | 13 import de.intevation.flys.exports.StyledSeriesBuilder; |
12 import de.intevation.flys.exports.XYChartGenerator; | 14 import de.intevation.flys.exports.XYChartGenerator; |
13 import de.intevation.flys.jfree.FLYSAnnotation; | 15 import de.intevation.flys.jfree.FLYSAnnotation; |
30 /** The logger that is used in this generator. */ | 32 /** The logger that is used in this generator. */ |
31 private static Logger logger = Logger.getLogger(BedQualityGenerator.class); | 33 private static Logger logger = Logger.getLogger(BedQualityGenerator.class); |
32 | 34 |
33 public static final String I18N_CHART_TITLE = "chart.sedimentload.ls.title"; | 35 public static final String I18N_CHART_TITLE = "chart.sedimentload.ls.title"; |
34 public static final String I18N_XAXIS_LABEL = "chart.sedimentload.ls.xaxis.label"; | 36 public static final String I18N_XAXIS_LABEL = "chart.sedimentload.ls.xaxis.label"; |
35 public static final String I18N_YAXIS_LABEL = "chart.sedimentload.ls.yaxis.label.diff"; | 37 public static final String I18N_YAXIS_LABEL_1 = "chart.sedimentload.ls.yaxis.label.tpera"; |
38 public static final String I18N_YAXIS_LABEL_2 = "chart.sedimentload.ls.yaxis.label.m3pera"; | |
36 | 39 |
37 public static final String I18N_CHART_TITLE_DEFAULT = "Sedimentfracht"; | 40 public static final String I18N_CHART_TITLE_DEFAULT = "Sedimentfracht"; |
38 public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km"; | 41 public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km"; |
39 public static final String I18N_YAXIS_LABEL_DEFAULT = "[t/a]"; | 42 public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]"; |
43 public static final String I18N_YAXIS_LABEL_DEFAULT_2 = "[m\u00b3/a]"; | |
44 | |
45 private FLYSArtifact artifact; | |
40 | 46 |
41 @Override | 47 @Override |
42 protected YAxisWalker getYAxisWalker() { | 48 protected YAxisWalker getYAxisWalker() { |
43 return new YAxisWalker() { | 49 return new YAxisWalker() { |
44 | 50 |
65 logger.error("No facet name for doOut(). No output generated!"); | 71 logger.error("No facet name for doOut(). No output generated!"); |
66 return; | 72 return; |
67 } | 73 } |
68 | 74 |
69 Facet facet = bundle.getFacet(); | 75 Facet facet = bundle.getFacet(); |
76 artifact = (FLYSArtifact)bundle.getArtifact(); | |
70 | 77 |
71 if (facet == null) { | 78 if (facet == null) { |
72 return; | 79 return; |
73 } | 80 } |
74 | 81 |
92 bundle, | 99 bundle, |
93 attr, | 100 attr, |
94 visible); | 101 visible); |
95 } | 102 } |
96 else if (name.equals(SEDIMENT_LOAD_SUSP_SAND)) { | 103 else if (name.equals(SEDIMENT_LOAD_SUSP_SAND)) { |
97 doSedimentLoadSandOut( | 104 doSedimentLoadSuspSandOut( |
98 (SedimentLoadResult) bundle.getData(context), | 105 (SedimentLoadResult) bundle.getData(context), |
99 bundle, | 106 bundle, |
100 attr, | 107 attr, |
101 visible); | 108 visible); |
102 } | 109 } |
142 | 149 |
143 @Override | 150 @Override |
144 protected String getDefaultYAxisLabel(int pos) { | 151 protected String getDefaultYAxisLabel(int pos) { |
145 String label = "default"; | 152 String label = "default"; |
146 if (pos == YAXIS.L.idx) { | 153 if (pos == YAXIS.L.idx) { |
147 label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); | 154 SedimentLoadAccess access = new SedimentLoadAccess(artifact); |
155 if (access.getUnit().equals("m3_per_a")) { | |
156 label = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2); | |
157 } | |
158 else { | |
159 label = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1); | |
160 } | |
148 } | 161 } |
149 return label; | 162 return label; |
150 } | 163 } |
151 | 164 |
152 protected void doSedimentLoadCoarseOut(SedimentLoadResult data, | 165 protected void doSedimentLoadCoarseOut(SedimentLoadResult data, |