Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java @ 767:79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
gnv-artifacts/trunk@823 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 24 Mar 2010 14:48:55 +0000 |
parents | 92d7a8cd1ef1 |
children | 9a828e5a2390 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java Tue Mar 23 14:11:51 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java Wed Mar 24 14:48:55 2010 +0000 @@ -35,22 +35,45 @@ import org.jfree.ui.RectangleInsets; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class VerticalCrossSectionChart implements Chart { + /** + * Lookup class for retrieving a color which corresponds to a specific + * integer value. + */ public static final class PalettePaintLookup implements PolygonRenderer.PaintLookup { + /** + * Object storing information about value ranges and its coresponding + * colors and descriptions. + */ private Palette palette; + + /** + * Map containing some special <code>Paint</code> like ground fillcolor. + */ private Map<Integer, Paint> special; + /** + * Constructor + * + * @param palette See {@link #palette} + */ public PalettePaintLookup(Palette palette) { this(palette, null); } + /** + * Constructor + * + * @param palette See {@link #palette} + * @param special See {@link #special} + */ public PalettePaintLookup( Palette palette, Map<Integer, Paint> special @@ -59,6 +82,11 @@ this.special = special; } + /** + * @param index Index of a <code>Paint</code> + * + * @return <code>Paint</code> object for a given index. + */ public Paint getPaint(int index) { if (special != null) { Paint paint = special.get(index); @@ -72,18 +100,43 @@ } } // class PalettePaintLookup + /** + * This class is used to turn labels which represent a number into a + * specific format. + */ public static class LocalizedLabelGenerator extends PolygonRenderer.DefaultLabelGenerator { + /** + * <code>NumberFormat</code> which is used to turn a number into a + * specific format. + */ protected NumberFormat format; + /** + * Constructor + */ public LocalizedLabelGenerator() { } + /** + * Constructor + * + * @param format See {@link #format} + */ public LocalizedLabelGenerator(NumberFormat format) { this.format = format; } + /** + * If label is a <code>Number</code>, it is turned into a format + * specified by {@link #format}. + * + * @param label Label to format. + * + * @return String representation of label. + */ + @Override protected String toString(Object label) { return label instanceof Number ? format.format(((Number)label).doubleValue()) @@ -91,17 +144,51 @@ } } // class LocalizedLabelGenerator + /** + * JFreeChart object stored at this place after chart creation. + */ protected JFreeChart chart; + /** + * Stores {@link de.intevation.gnv.jfreechart.PolygonDataset} which is used + * to create a vertical cross chart. + */ protected AttributedXYColumns columns; + + /** + * Map which contains colors to fill polygons draw by this chart. + */ protected Map<Integer, Paint> special; + + /** + * Object used to map value intervals to specific colors and descriptions. + */ protected Palette palette; + + /** + * Locale object used for i18n support. + */ protected Locale locale; + + /** + * Labels for decorating the chart. + */ protected ChartLabels labels; + /** + * Default Constructor + */ public VerticalCrossSectionChart() { } + /** + * Constructor for VerticalCrossSectionChart creation. + * + * @param columns See {@link #columns} + * @param palette See {@link #palette} + * @param locale See {@link #locale} + * @param labels See {@link #labels} + */ public VerticalCrossSectionChart( AttributedXYColumns columns, Palette palette, @@ -111,6 +198,15 @@ this(columns, palette, null, locale, labels); } + /** + * Constructor for VerticalCrossSectionChart creation. + * + * @param columns See {@link #columns} + * @param palette See {@link #palette} + * @param special See {@link #special} + * @param locale See {@link #locale} + * @param labels See {@link #labels} + */ public VerticalCrossSectionChart( AttributedXYColumns columns, Palette palette, @@ -125,6 +221,12 @@ this.labels = labels; } + /** + * This method is used to create a JFreeChart from this object. A 2D plot is + * drawn and a legend panel is created containing each value range. + * + * @return JFreeChart object + */ protected JFreeChart createChart() { boolean legendB = false; @@ -208,6 +310,9 @@ return chart; } + /** + * @see de.intevation.gnv.chart.Chart#generateChart() + */ public JFreeChart generateChart() { if (chart == null) { chart = createChart(); @@ -216,6 +321,9 @@ return chart; } + /** + * Set the background paint of {@link #chart}. + */ public void setBackgroundPaint(Paint paint) { chart.setBackgroundPaint(paint); }