Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java @ 7105:ab57b6eee71c generator-refactoring
Add refactored LongitudinalSectionGenerator2 that inherits DiagramGenerator
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 23 Sep 2013 16:41:12 +0200 |
parents | |
children | 564033adf9c6 |
comparison
equal
deleted
inserted
replaced
7104:eb3a2bc5d591 | 7105:ab57b6eee71c |
---|---|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.exports; | |
10 | |
11 import org.apache.log4j.Logger; | |
12 import org.jfree.chart.axis.NumberAxis; | |
13 | |
14 | |
15 public class LongitudinalSectionGenerator2 extends DiagramGenerator | |
16 { | |
17 public static final String I18N_CHART_SHORT_SUBTITLE = | |
18 "chart.longitudinal.section.shortsubtitle"; | |
19 | |
20 public static final String I18N_CHART_LOCATION_SUBTITLE = | |
21 "chart.longitudinal.section.locsubtitle"; | |
22 | |
23 private static Logger logger = | |
24 Logger.getLogger(LongitudinalSectionGenerator.class); | |
25 | |
26 @Override | |
27 public String getDefaultChartSubtitle() { | |
28 double[] dist = getRange(); | |
29 | |
30 Object[] args = null; | |
31 if (dist == null || dist.length != 2 || | |
32 Double.isNaN(dist[0]) || Double.isNaN(dist[1])) { | |
33 args = new Object[] {getRiverName()}; | |
34 return msg(I18N_CHART_SHORT_SUBTITLE, "", args); | |
35 } else if (Math.abs(dist[0] - dist[1]) < 1E-5) { | |
36 args = new Object[] {getRiverName(), dist[1]}; | |
37 return msg(I18N_CHART_LOCATION_SUBTITLE, "", args); | |
38 } | |
39 return super.getDefaultChartSubtitle(); | |
40 } | |
41 | |
42 /** | |
43 * Create Axis for given index. | |
44 * @return axis with according internationalized label. | |
45 */ | |
46 @Override | |
47 protected NumberAxis createYAxis(int index) { | |
48 // TODO decide what to do with this. | |
49 return super.createYAxis(index); | |
50 /* | |
51 NumberAxis axis = super.createYAxis(index); | |
52 | |
53 // "Q" Axis shall include 0. | |
54 if (index == YAXIS.Q.idx) { | |
55 axis.setAutoRangeIncludesZero(true); | |
56 } | |
57 else { | |
58 axis.setAutoRangeIncludesZero(false); | |
59 } | |
60 | |
61 return axis;*/ | |
62 } | |
63 } | |
64 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |