Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/LegendSection.java @ 7076:7f600001c807 generator-refactoring
Add LTR inversion code to diagram generator.
This code is used in serveral diagrams and as it modifies a
whole diagram it should be central. (This should also make
maintenance easier). This function can be called by processors
to make sure that their data is plotted with an LTR waterflow.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 20 Sep 2013 16:33:22 +0200 |
parents | af13ceeba52a |
children | 1cc7653ca84f |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3148
diff
changeset
|
9 package org.dive4elements.river.exports; |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 /** |
3148
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
13 * Settings regarding legend of chart. |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 */ |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
16 public class LegendSection extends TypeSection { |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
3148
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
18 public static final String VISIBILITY_ATTR = "visibility"; |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
19 public static final String FONTSIZE_ATTR = "font-size"; |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
20 public static final String AGGREGATION_ATTR = "aggregation-threshold"; |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 public LegendSection() { |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 super("legend"); |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
3148
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
28 /** Register font size attribute and value. */ |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 public void setFontSize(int fontSize) { |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 if (fontSize <= 0) { |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 return; |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
34 setIntegerValue(FONTSIZE_ATTR, fontSize); |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
2046
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
38 public Integer getFontSize() { |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
39 return getIntegerValue(FONTSIZE_ATTR); |
2046
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
40 } |
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
41 |
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
42 |
3148
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
43 public Integer getAggregationThreshold() { |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
44 return getIntegerValue(AGGREGATION_ATTR); |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
45 } |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
46 |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
47 |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
48 public void setAggregationThreshold(int aggregationThreshold) { |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
49 setIntegerValue(AGGREGATION_ATTR, Math.abs(aggregationThreshold)); |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
50 } |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
51 |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
52 |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 public void setVisibility(boolean visibility) { |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
54 setBooleanValue(VISIBILITY_ATTR, visibility); |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 } |
2046
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
56 |
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
57 |
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
58 public Boolean getVisibility() { |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
59 return getBooleanValue(VISIBILITY_ATTR); |
2046
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
60 } |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |