Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 2104:bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
flys-artifacts/trunk@3661 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 12 Jan 2012 12:29:56 +0000 |
parents | a026d005accd |
children | 51b9899f819d |
comparison
equal
deleted
inserted
replaced
2103:b9f7ec9bda18 | 2104:bb0dede9294f |
---|---|
23 | 23 |
24 /** | 24 /** |
25 * An OutGenerator that generates cross section graphs. | 25 * An OutGenerator that generates cross section graphs. |
26 */ | 26 */ |
27 public class CrossSectionGenerator | 27 public class CrossSectionGenerator |
28 extends XYChartGenerator | 28 extends LongitudinalSectionGenerator//XYChartGenerator |
29 implements FacetTypes | 29 implements FacetTypes |
30 { | 30 { |
31 /** The logger that is used in this generator. */ | 31 /** The logger that is used in this generator. */ |
32 private static Logger logger = | 32 private static Logger logger = |
33 Logger.getLogger(CrossSectionGenerator.class); | 33 Logger.getLogger(CrossSectionGenerator.class); |
74 | 74 |
75 /** | 75 /** |
76 * Get localized chart title. | 76 * Get localized chart title. |
77 */ | 77 */ |
78 @Override | 78 @Override |
79 protected String getDefaultChartTitle() { | 79 public String getDefaultChartTitle() { |
80 Object[] i18n_msg_args = new Object[] { | 80 Object[] i18n_msg_args = new Object[] { |
81 getRiverName() | 81 getRiverName() |
82 }; | 82 }; |
83 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT, i18n_msg_args); | 83 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT, i18n_msg_args); |
84 } | 84 } |
173 return; | 173 return; |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 /** | 178 /** Look up the axis identifier for a given facet type. */ |
179 * Do Area out. | 179 public int axisIdxForFacet(String facetName) { |
180 */ | 180 // TODO Where to add thid axis too. |
181 protected void doArea( | 181 return 0; |
182 Object o, | |
183 String seriesName, | |
184 Document theme, | |
185 boolean visible | |
186 ) { | |
187 logger.debug("CrossSectionGenerator.doArea"); | |
188 StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); | |
189 | |
190 // TODO make this more stable. | |
191 Object[] doubles = (Object[]) o; | |
192 XYSeries up = null; | |
193 XYSeries down = null; | |
194 | |
195 if (doubles[1] != null) { | |
196 up = new StyledXYSeries(seriesName, false, theme); | |
197 StyledSeriesBuilder.addPoints(up, (double [][]) doubles[1]); | |
198 } | |
199 | |
200 if (doubles[0] != null) { | |
201 // TODO: Sort this out: when the two series have the same name, | |
202 // the renderer (or anything in between) will not work correctly. | |
203 down = new StyledXYSeries(seriesName + " ", false, theme); | |
204 StyledSeriesBuilder.addPoints(down, (double [][]) doubles[0]); | |
205 } | |
206 | |
207 if (up == null && down != null) { | |
208 area.setMode(StyledAreaSeriesCollection.FILL_MODE.ABOVE); | |
209 down.setKey(seriesName); | |
210 area.addSeries(down); | |
211 } | |
212 else if (up != null && down == null) { | |
213 area.setMode(StyledAreaSeriesCollection.FILL_MODE.UNDER); | |
214 area.addSeries(up); | |
215 } | |
216 else if (up != null && down != null) { | |
217 if (doubles[2] != null && ((Boolean)doubles[2]).booleanValue()) { | |
218 area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN); | |
219 } | |
220 else { | |
221 area.setMode(StyledAreaSeriesCollection.FILL_MODE.ABOVE); | |
222 } | |
223 area.addSeries(up); | |
224 area.addSeries(down); | |
225 } | |
226 addAreaSeries(area, 0, visible); | |
227 } | 182 } |
228 | 183 |
229 | 184 |
230 /** | 185 /** |
231 * Do cross sections waterline out. | 186 * Do cross sections waterline out. |