comparison artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java @ 9556:9b8e8fc1f408

Use facetName in all processors as themeType for legend aggregation.
author gernotbelger
date Tue, 23 Oct 2018 16:26:58 +0200
parents 740d65e4aa14
children
comparison
equal deleted inserted replaced
9555:ef5754ba5573 9556:9b8e8fc1f408
159 return msg(getChartSubtitleKey(), "", args); 159 return msg(getChartSubtitleKey(), "", args);
160 } 160 }
161 161
162 /** 162 /**
163 * Gets key to look up internationalized String for the charts subtitle. 163 * Gets key to look up internationalized String for the charts subtitle.
164 * 164 *
165 * @return key to look up translated subtitle. 165 * @return key to look up translated subtitle.
166 */ 166 */
167 protected String getChartSubtitleKey() { 167 protected String getChartSubtitleKey() {
168 return I18N_CHART_SUBTITLE; 168 return I18N_CHART_SUBTITLE;
169 } 169 }
170 170
171 /** 171 /**
172 * Gets key to look up internationalized String for the charts short 172 * Gets key to look up internationalized String for the charts short
173 * subtitle. 173 * subtitle.
174 * 174 *
175 * @return key to look up translated subtitle. 175 * @return key to look up translated subtitle.
176 */ 176 */
177 protected String getChartShortSubtitleKey() { 177 protected String getChartShortSubtitleKey() {
178 return I18N_CHART_SHORT_SUBTITLE; 178 return I18N_CHART_SHORT_SUBTITLE;
179 } 179 }
214 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit }); 214 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit });
215 } 215 }
216 216
217 /** 217 /**
218 * Create Axis for given index. 218 * Create Axis for given index.
219 * 219 *
220 * @return axis with according internationalized label. 220 * @return axis with according internationalized label.
221 */ 221 */
222 @Override 222 @Override
223 protected NumberAxis createYAxis(final int index) { 223 protected NumberAxis createYAxis(final int index) {
224 final NumberAxis axis = super.createYAxis(index); 224 final NumberAxis axis = super.createYAxis(index);
272 } 272 }
273 } 273 }
274 274
275 /** 275 /**
276 * Produce output. 276 * Produce output.
277 * 277 *
278 * @param artifactAndFacet 278 * @param artifactAndFacet
279 * current facet and artifact. 279 * current facet and artifact.
280 * @param attr 280 * @param attr
281 * theme for facet 281 * theme for facet
282 */ 282 */
336 if (wkms == null) { 336 if (wkms == null) {
337 log.warn("No data to add to WDifferencesChart."); 337 log.warn("No data to add to WDifferencesChart.");
338 return; 338 return;
339 } 339 }
340 340
341 final XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); 341 final XYSeries series = new StyledXYSeries(aandf.getFacetName(), aandf.getFacetDescription(), theme);
342 342
343 if (log.isDebugEnabled()) { 343 if (log.isDebugEnabled()) {
344 if (wkms.size() > 0) { 344 if (wkms.size() > 0) {
345 log.debug("Generate series: " + series.getKey()); 345 log.debug("Generate series: " + series.getKey());
346 log.debug("Start km: " + wkms.getKm(0)); 346 log.debug("Start km: " + wkms.getKm(0));
354 addAxisSeries(series, YAXIS.D.idx, visible); 354 addAxisSeries(series, YAXIS.D.idx, visible);
355 } 355 }
356 356
357 /** 357 /**
358 * Get name of series (displayed in legend). 358 * Get name of series (displayed in legend).
359 * 359 *
360 * @return name of the series. 360 * @return name of the series.
361 */ 361 */
362 protected String getSeriesName(final WQKms wqkms, final String mode) { 362 protected String getSeriesName(final WQKms wqkms, final String mode) {
363 final String name = wqkms.getName(); 363 final String name = wqkms.getName();
364 final String prefix = name != null && name.indexOf(mode) >= 0 ? null : mode; 364 final String prefix = name != null && name.indexOf(mode) >= 0 ? null : mode;
378 } 378 }
379 } 379 }
380 380
381 /** 381 /**
382 * Do Area out. 382 * Do Area out.
383 * 383 *
384 * @param theme 384 * @param theme
385 * styling information. 385 * styling information.
386 * @param visible 386 * @param visible
387 * whether or not visible. 387 * whether or not visible.
388 */ 388 */
389 protected void doArea(final Object o, final ArtifactAndFacet aandf, final ThemeDocument theme, final boolean visible) { 389 protected void doArea(final Object o, final ArtifactAndFacet aandf, final ThemeDocument theme, final boolean visible) {
390 log.debug("LongitudinalSectionGenerator.doArea"); 390 log.debug("LongitudinalSectionGenerator.doArea");
391 final StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); 391
392 final String facetName = aandf.getFacetName();
393
394 final StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(facetName, theme);
392 395
393 final String seriesName = aandf.getFacetDescription(); 396 final String seriesName = aandf.getFacetDescription();
394 397
395 final AreaFacet.Data data = (AreaFacet.Data) o; 398 final AreaFacet.Data data = (AreaFacet.Data) o;
396 399
397 XYSeries up = null; 400 XYSeries up = null;
398 XYSeries down = null; 401 XYSeries down = null;
399 402
400 if (data.getUpperData() != null) { 403 if (data.getUpperData() != null) {
401 up = new StyledXYSeries(seriesName, false, theme); 404 up = new StyledXYSeries(facetName, seriesName, false, theme);
402 if (data.getUpperData() instanceof WQKms) { 405 if (data.getUpperData() instanceof WQKms) {
403 if (FacetTypes.IS.Q(data.getUpperFacetName())) { 406 if (FacetTypes.IS.Q(data.getUpperFacetName())) {
404 StyledSeriesBuilder.addPointsKmQ(up, (WQKms) data.getUpperData()); 407 StyledSeriesBuilder.addPointsKmQ(up, (WQKms) data.getUpperData());
405 } else { 408 } else {
406 StyledSeriesBuilder.addPoints(up, (WKms) data.getUpperData()); 409 StyledSeriesBuilder.addPoints(up, (WKms) data.getUpperData());
420 // should be added as annotation. 423 // should be added as annotation.
421 424
422 if (data.getLowerData() != null) { 425 if (data.getLowerData() != null) {
423 // TODO: Sort this out: when the two series have the same name, 426 // TODO: Sort this out: when the two series have the same name,
424 // the renderer (or anything in between) will not work correctly. 427 // the renderer (or anything in between) will not work correctly.
425 down = new StyledXYSeries(seriesName + " ", false, theme); 428 down = new StyledXYSeries(facetName, seriesName + " ", false, theme);
426 if (data.getLowerData() instanceof WQKms) { 429 if (data.getLowerData() instanceof WQKms) {
427 if (FacetTypes.IS.Q(data.getLowerFacetName())) { 430 if (FacetTypes.IS.Q(data.getLowerFacetName())) {
428 StyledSeriesBuilder.addPointsKmQ(down, (WQKms) data.getLowerData()); 431 StyledSeriesBuilder.addPointsKmQ(down, (WQKms) data.getLowerData());
429 } else { 432 } else {
430 StyledSeriesBuilder.addPoints(down, (WQKms) data.getLowerData()); 433 StyledSeriesBuilder.addPoints(down, (WQKms) data.getLowerData());

http://dive4elements.wald.intevation.org