Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java @ 795:cdade5005cba
Added javadoc in jfreechart package.
gnv-artifacts/trunk@877 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 31 Mar 2010 13:48:07 +0000 |
parents | c4156275c1e1 |
children | feae2f9d6c6f |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java Wed Mar 31 12:18:03 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java Wed Mar 31 13:48:07 2010 +0000 @@ -32,14 +32,23 @@ import org.jfree.util.ObjectList; /** + * A class for plotting polygons into a 2D chart. This plot makes use of <code> + * PolygonRenderer</code>. + * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ // TODO implement cloneable public class PolygonPlot extends Plot { + /** + * + */ public static final String PLOT_TYPE = "PolygonPlot"; + /** + * + */ public static final PlotOrientation DEFAULT_PLOT_ORIENTATION = PlotOrientation.VERTICAL; @@ -56,11 +65,23 @@ private ObjectList rangeAxes; + /** + * Constructs a new PolygonPlot with a dataset and a renderer. + * + * @param dataset Dataset containing polygons. + * @param renderer The renderer used to draw polygons. + */ public PolygonPlot(PolygonDataset dataset, PolygonRenderer renderer) { this(dataset, renderer, null, null, PlotOrientation.HORIZONTAL); } + /** + * + * @param dataset Dataset containing polygons. + * @param renderer The renderer used to draw polygons. + * @param orientation The orientation used for this plot. + */ public PolygonPlot( PolygonDataset dataset, PolygonRenderer renderer, @@ -70,6 +91,14 @@ } + /** + * + * @param dataset Dataset containing polygons. + * @param renderer The renderer used to draw polygons. + * @param domainAxis The x axis. + * @param rangeAxis The y axis. + * @param orientation The orientation used for this plot. + */ public PolygonPlot( PolygonDataset dataset, PolygonRenderer renderer, @@ -109,6 +138,9 @@ } + /** + * + */ public void configureDomainAxis() { // we just have 1 dataset Range domainAxisRange = getDataset().getDomainBounds(); @@ -123,26 +155,47 @@ } } + /** + * + * @return + */ public ValueAxis getDomainAxis() { return getDomainAxis(0); } + /** + * + * @param index + * @return + */ public ValueAxis getDomainAxis(int index) { return index < domainAxes.size() ? (ValueAxis)domainAxes.get(index) : null; } + /** + * + * @return + */ public ValueAxis getRangeAxis() { return getRangeAxis(0); } + /** + * + * @param index + * @return + */ public ValueAxis getRangeAxis(int index) { return index < rangeAxes.size() ? (ValueAxis)rangeAxes.get(index) : null; } + /** + * + */ public void configureRangeAxis() { // we just have 1 dataset Range rangeAxisRange = getDataset().getRangeBounds(); @@ -158,21 +211,42 @@ } + /** + * + * @return + */ public PolygonDataset getDataset(){ return this.dataset; } + /** + * + * @return + */ public String getPlotType() { return PLOT_TYPE; } + /** + * + * @param dataset + */ public void setDataset(PolygonDataset dataset) { this.dataset = dataset; } + /** + * This is the major method to draw the into a given Graphic2D object. + * + * @param g2 Graphics object where the plot is drawn into. + * @param area The bounds for drawing this plot. + * @param anchor An anchor point. + * @param parentState The plot state. + * @param info + */ public void draw( Graphics2D g2, Rectangle2D area, @@ -218,6 +292,14 @@ } + /** + * Method to draw the axis for this plot. + * + * @param g2 + * @param plotArea + * @param dataArea + * @param plotState + */ private void drawAxes( Graphics2D g2, Rectangle2D plotArea, @@ -290,6 +372,14 @@ } + /** + * Put some labels at data items into the plot. Uses PolygonRenderer to do + * this job. + * + * @param g2 + * @param area + * @param info + */ private void drawLabels( Graphics2D g2, Rectangle2D area, @@ -298,6 +388,14 @@ renderer.drawLabels(g2, this, area, dataset); } + + /** + * Plot the polygons. Uses PolygonRenderer to do this job. + * + * @param g2 + * @param area + * @param info + */ private void drawPolygons( Graphics2D g2, Rectangle2D area, @@ -307,6 +405,12 @@ } + /** + * + * @param g2 + * @param plotArea + * @return + */ private AxisSpace calculateAxisSpace(Graphics2D g2, Rectangle2D plotArea) { AxisSpace space = new AxisSpace(); space = calculateRangeAxisSpace(g2, plotArea, space); @@ -317,6 +421,13 @@ } + /** + * + * @param g2 + * @param plotArea + * @param space + * @return + */ private AxisSpace calculateDomainAxisSpace( Graphics2D g2, Rectangle2D plotArea, @@ -338,6 +449,13 @@ } + /** + * + * @param g2 + * @param plotArea + * @param space + * @return + */ private AxisSpace calculateRangeAxisSpace( Graphics2D g2, Rectangle2D plotArea, @@ -358,6 +476,11 @@ return space; } + + /** + * + * @return + */ public RectangleEdge getDomainAxisEdge() { return Plot.resolveDomainAxisLocation( getDomainAxisLocation(), orientation @@ -365,6 +488,11 @@ } + /** + * + * @param idx + * @return + */ public RectangleEdge getDomainAxisEdge(int idx) { AxisLocation location = getDomainAxisLocation(idx); RectangleEdge result = Plot.resolveDomainAxisLocation( @@ -378,6 +506,10 @@ } + /** + * + * @return + */ public RectangleEdge getRangeAxisEdge() { return Plot.resolveRangeAxisLocation( getRangeAxisLocation(), orientation @@ -385,6 +517,11 @@ } + /** + * + * @param idx + * @return + */ public RectangleEdge getRangeAxisEdge(int idx) { AxisLocation location = getRangeAxisLocation(idx); RectangleEdge result = Plot.resolveRangeAxisLocation( @@ -399,11 +536,20 @@ } + /** + * + * @return + */ public AxisLocation getDomainAxisLocation() { return (AxisLocation) domainAxisLocation.get(0); } + /** + * + * @param idx + * @return + */ public AxisLocation getDomainAxisLocation(int idx) { if (idx < domainAxisLocation.size()) return (AxisLocation) domainAxisLocation.get(idx); @@ -412,11 +558,20 @@ } + /** + * + * @return + */ public AxisLocation getRangeAxisLocation() { return (AxisLocation) rangeAxisLocation.get(0); } + /** + * + * @param idx + * @return + */ public AxisLocation getRangeAxisLocation(int idx) { if (idx < rangeAxisLocation.size()) return (AxisLocation) rangeAxisLocation.get(idx); @@ -425,6 +580,12 @@ } + /** + * + * @param dataset + * @return true, if dataset is null or if it does not contain any + * PolygonSeries, otherwise false. + */ private boolean isEmptyOrNull(PolygonDataset dataset) { if (dataset != null) { int seriesCount = dataset.getSeriesCount(); @@ -438,3 +599,4 @@ return true; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : \ No newline at end of file