annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java @ 804:9058c08eac3a

Added more Javadoc in some classes of state.profile. gnv-artifacts/trunk@886 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 08 Apr 2010 10:10:04 +0000
parents feae2f9d6c6f
children 3f447e92024a
rev   line source
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.chart;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
3 import de.intevation.gnv.jfreechart.PolygonDataset;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
4 import de.intevation.gnv.jfreechart.PolygonPlot;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
5 import de.intevation.gnv.jfreechart.PolygonRenderer;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
6 import de.intevation.gnv.jfreechart.PolygonSeries;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
8 import de.intevation.gnv.math.AttributedXYColumns;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
9
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
10 import de.intevation.gnv.raster.Palette;
450
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
11
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 import java.awt.Color;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 import java.awt.Paint;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
15 import java.text.NumberFormat;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
17 import java.util.HashSet;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
18 import java.util.Locale;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
19 import java.util.Map;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 import org.jfree.chart.JFreeChart;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
23 import org.jfree.chart.axis.NumberAxis;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
24 import org.jfree.chart.axis.SymbolAxis;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
25 import org.jfree.chart.axis.ValueAxis;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
26
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 import org.jfree.chart.plot.PlotOrientation;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
29 import org.jfree.chart.renderer.LookupPaintScale;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 import org.jfree.chart.title.PaintScaleLegend;
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
32 import org.jfree.chart.title.TextTitle;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 import org.jfree.ui.RectangleEdge;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 import org.jfree.ui.RectangleInsets;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 /**
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
38 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
39 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 */
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 public class VerticalCrossSectionChart
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 implements Chart
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 {
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
44 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
45 * Lookup class for retrieving a color which corresponds to a specific
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
46 * integer value.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
47 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 public static final class PalettePaintLookup
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 implements PolygonRenderer.PaintLookup
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 {
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
51 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
52 * Object storing information about value ranges and its coresponding
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
53 * colors and descriptions.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
54 */
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
55 private Palette palette;
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
56
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
57 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
58 * Map containing some special <code>Paint</code> like ground fillcolor.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
59 */
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
60 private Map<Integer, Paint> special;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
62 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
63 * Constructor
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
64 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
65 * @param palette See {@link #palette}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
66 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 public PalettePaintLookup(Palette palette) {
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
68 this(palette, null);
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
69 }
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
70
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
71 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
72 * Constructor
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
73 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
74 * @param palette See {@link #palette}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
75 * @param special See {@link #special}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
76 */
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
77 public PalettePaintLookup(
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 767
diff changeset
78 Palette palette,
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
79 Map<Integer, Paint> special
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
80 ) {
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 this.palette = palette;
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
82 this.special = special;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
85 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
86 * @param index Index of a <code>Paint</code>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
87 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
88 * @return <code>Paint</code> object for a given index.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
89 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 public Paint getPaint(int index) {
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
91 if (special != null) {
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
92 Paint paint = special.get(index);
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
93 if (paint != null) {
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
94 return paint;
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
95 }
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
96 }
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 return index < 0
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 ? Color.black
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 : palette.getColor(index);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 } // class PalettePaintLookup
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
103 /**
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 767
diff changeset
104 * This class is used to turn labels which represent a number into a
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
105 * specific format.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
106 */
450
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
107 public static class LocalizedLabelGenerator
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
108 extends PolygonRenderer.DefaultLabelGenerator
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
109 {
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
110 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
111 * <code>NumberFormat</code> which is used to turn a number into a
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
112 * specific format.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
113 */
450
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
114 protected NumberFormat format;
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
115
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
116 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
117 * Constructor
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
118 */
450
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
119 public LocalizedLabelGenerator() {
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
120 }
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
121
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
122 /**
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 767
diff changeset
123 * Constructor
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
124 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
125 * @param format See {@link #format}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
126 */
450
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
127 public LocalizedLabelGenerator(NumberFormat format) {
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
128 this.format = format;
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
129 }
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
130
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
131 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
132 * If label is a <code>Number</code>, it is turned into a format
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
133 * specified by {@link #format}.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
134 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
135 * @param label Label to format.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
136 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
137 * @return String representation of label.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
138 */
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
139 @Override
450
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
140 protected String toString(Object label) {
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
141 return label instanceof Number
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
142 ? format.format(((Number)label).doubleValue())
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
143 : super.toString(label);
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
144 }
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
145 } // class LocalizedLabelGenerator
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
146
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
147 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
148 * JFreeChart object stored at this place after chart creation.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
149 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
150 protected JFreeChart chart;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
151
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
152 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
153 * Stores {@link de.intevation.gnv.jfreechart.PolygonDataset} which is used
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
154 * to create a vertical cross chart.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
155 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
156 protected AttributedXYColumns columns;
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
157
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
158 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
159 * Map which contains colors to fill polygons draw by this chart.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
160 */
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
161 protected Map<Integer, Paint> special;
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
162
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
163 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
164 * Object used to map value intervals to specific colors and descriptions.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
165 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
166 protected Palette palette;
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
167
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
168 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
169 * Locale object used for i18n support.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
170 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
171 protected Locale locale;
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
172
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
173 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
174 * Labels for decorating the chart.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
175 */
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
176 protected ChartLabels labels;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
177
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
178 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
179 * Default Constructor
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
180 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181 public VerticalCrossSectionChart() {
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
182 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
183
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
184 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
185 * Constructor for VerticalCrossSectionChart creation.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
186 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
187 * @param columns See {@link #columns}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
188 * @param palette See {@link #palette}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
189 * @param locale See {@link #locale}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
190 * @param labels See {@link #labels}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
191 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
192 public VerticalCrossSectionChart(
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 AttributedXYColumns columns,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
194 Palette palette,
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
195 Locale locale,
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
196 ChartLabels labels
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
197 ) {
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
198 this(columns, palette, null, locale, labels);
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
199 }
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
200
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
201 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
202 * Constructor for VerticalCrossSectionChart creation.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
203 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
204 * @param columns See {@link #columns}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
205 * @param palette See {@link #palette}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
206 * @param special See {@link #special}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
207 * @param locale See {@link #locale}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
208 * @param labels See {@link #labels}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
209 */
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
210 public VerticalCrossSectionChart(
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
211 AttributedXYColumns columns,
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
212 Palette palette,
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
213 Map<Integer, Paint> special,
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
214 Locale locale,
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
215 ChartLabels labels
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
216 ) {
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
217 this.columns = columns;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
218 this.palette = palette;
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
219 this.special = special;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
220 this.locale = locale;
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
221 this.labels = labels;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
222 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
223
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
224 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
225 * This method is used to create a JFreeChart from this object. A 2D plot is
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
226 * drawn and a legend panel is created containing each value range.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
227 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
228 * @return JFreeChart object
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
229 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
230 protected JFreeChart createChart() {
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
231
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
232 boolean legendB = false;
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
233 boolean tooltips = false;
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
234 boolean urls = false;
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
235
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
236 PlotOrientation po = PlotOrientation.HORIZONTAL;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
237 PolygonDataset data = columns.getPolygonDataset();
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
238
449
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
239 HashSet<Integer> usedColors = new HashSet<Integer>();
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
240
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
241 for (int i = data.getSeriesCount()-1; i >= 0; --i) {
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
242 PolygonSeries ps = data.getSeries(i);
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
243 Integer fill = (Integer)ps.getAttribute("fill");
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
244 if (fill != null
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
245 && (special != null && !special.containsKey(fill))) {
449
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
246 usedColors.add(fill);
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
247 }
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
248 }
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
249
450
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
250 NumberFormat format = NumberFormat.getInstance(locale);
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
251 format.setMinimumFractionDigits(0);
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
252 format.setMaximumFractionDigits(2);
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
253
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
254 PolygonRenderer renderer = new PolygonRenderer(
521
1bf058f1a2d1 Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 492
diff changeset
255 new PalettePaintLookup(palette, special),
450
20a480753ff9 Render labels in vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 449
diff changeset
256 new LocalizedLabelGenerator(format));
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
257
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
258 ValueAxis domainAxis = new NumberAxis(this.labels.getDomainAxisLabel());
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
259 ValueAxis rangeAxis = new NumberAxis(this.labels.getRangeAxisLabel());
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
260
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
261 PolygonPlot plot = new PolygonPlot(
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
262 data,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 renderer,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
264 domainAxis,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 rangeAxis,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
266 null);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
267
534
92d7a8cd1ef1 Set white border for 'Profilschnitte' as default.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
268 plot.setOutlinePaint(Color.WHITE);
92d7a8cd1ef1 Set white border for 'Profilschnitte' as default.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
269
449
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
270 String [] labels = new String[usedColors.size()];
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
271
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
272 int colors = palette.getSize();
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
273 LookupPaintScale lookupPaint =
449
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
274 new LookupPaintScale(-0.5d, labels.length-0.5d, Color.white);
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
275
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
276 Color color = null;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
277
449
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
278 for (int i = 0, j = labels.length-1; i < colors && j >= 0; i++) {
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
279 if (usedColors.contains(i)) {
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
280 Palette.Entry entry = palette.getEntryByIndex(i);
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
281 color = entry.getColor();
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
282 labels[j] = entry.getDescription();
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
283 lookupPaint.add(j-0.5d, color);
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
284 --j;
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
285 }
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
286 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
288 JFreeChart chart = new JFreeChart(
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
289 this.labels.getTitle(),
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
290 JFreeChart.DEFAULT_TITLE_FONT,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
291 plot,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 legendB);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
293
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
294 chart.removeLegend();
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
295 chart.addSubtitle(new TextTitle(this.labels.getSubtitle()));
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
296
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 450
diff changeset
297 SymbolAxis scale = new SymbolAxis(this.labels.getParameterName(), labels);
449
c7ca2fce041f Add only color to scale of vertical cross section which are in the chart.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
298 scale.setRange(-1.5d, labels.length+0.5d);
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
299 scale.setGridBandsVisible(false);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
300 scale.setPlot(plot);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
301
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
302 PaintScaleLegend legend = new PaintScaleLegend(
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
303 lookupPaint, scale);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
304 legend.setMargin(new RectangleInsets(3d, 10d, 3d, 10d));
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
305 legend.setPosition(RectangleEdge.LEFT);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
306 legend.setAxisOffset(5d);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
307
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
308 chart.addSubtitle(legend);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
309
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
310 return chart;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
311 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
312
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
313 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
314 * @see de.intevation.gnv.chart.Chart#generateChart()
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
315 */
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
316 public JFreeChart generateChart() {
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
317 if (chart == null) {
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
318 chart = createChart();
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
319 }
527
f598702b2a10 Fixed issue157: Verticalcrosssection charts have a white background as all other chart types have.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 521
diff changeset
320
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
321 return chart;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
322 }
527
f598702b2a10 Fixed issue157: Verticalcrosssection charts have a white background as all other chart types have.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 521
diff changeset
323
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
324 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
325 * Set the background paint of {@link #chart}.
803
feae2f9d6c6f Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 788
diff changeset
326 * @param paint
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 534
diff changeset
327 */
527
f598702b2a10 Fixed issue157: Verticalcrosssection charts have a white background as all other chart types have.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 521
diff changeset
328 public void setBackgroundPaint(Paint paint) {
f598702b2a10 Fixed issue157: Verticalcrosssection charts have a white background as all other chart types have.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 521
diff changeset
329 chart.setBackgroundPaint(paint);
f598702b2a10 Fixed issue157: Verticalcrosssection charts have a white background as all other chart types have.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 521
diff changeset
330 }
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
331 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
332 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org