diff gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.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/PolygonRenderer.java	Wed Mar 31 12:18:03 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java	Wed Mar 31 13:48:07 2010 +0000
@@ -27,6 +27,8 @@
 import org.jfree.ui.RectangleEdge;
 
 /**
+ * This renderer is used to draw polygons into a Graphics object.
+ * 
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
@@ -35,40 +37,83 @@
 	private static Logger log = Logger.getLogger(
 		PolygonRenderer.class);
 
-    public interface PaintLookup {
+        /**
+         * This interfaces describes a single method to retrieve a Paint object
+         * for a given index.
+         */
+        public interface PaintLookup {
 
-        Paint getPaint(int index);
+            /**
+             *
+             * @param index Index.
+             * @return Paint
+             */
+            Paint getPaint(int index);
 
     } // interface PaintLookup
 
-    public static class DefaultLabelGenerator
+        /**
+         * This class is used to generate labels for a given series.
+         */
+        public static class DefaultLabelGenerator
     implements          PolygonSeriesLabelGenerator
     {
-        public DefaultLabelGenerator() {
+            /**
+             * Construts an empty DefaultLabelGenerator.
+             */
+            public DefaultLabelGenerator() {
         }
 
-        public String generateLabel(PolygonSeries series) {
+            /**
+             *
+             * @param series A PolygonSeries.
+             * @return The label of series.
+             */
+            public String generateLabel(PolygonSeries series) {
             Object label = series.getAttribute("label");
             return label != null
                 ? toString(label)
                 : null;
         }
 
-        protected String toString(Object label) {
+            /**
+             *
+             * @param label Object
+             * @return String representaton of label.
+             */
+            protected String toString(Object label) {
             return label.toString();
         }
     } // class DefaultLabelGenerator
 
-    public static final PolygonSeriesLabelGenerator
+        /**
+         * Constructor.
+         */
+        public static final PolygonSeriesLabelGenerator
         DEFAULT_LABEL_GENERATOR_INSTANCE = new DefaultLabelGenerator();
 
-    protected PaintLookup                 lookup;
+        /**
+         *
+         */
+        protected PaintLookup                 lookup;
+    /**
+     *
+     */
     protected PolygonSeriesLabelGenerator labelGenerator;
 
+    /**
+     *
+     * @param lookup
+     */
     public PolygonRenderer(PaintLookup lookup) {
         this(lookup, null);
     }
 
+    /**
+     *
+     * @param lookup
+     * @param labelGenerator
+     */
     public PolygonRenderer(
         PaintLookup                 lookup,
         PolygonSeriesLabelGenerator labelGenerator
@@ -77,6 +122,16 @@
         this.labelGenerator = labelGenerator;
     }
 
+    /**
+     * This method draws polygons of each series in <code>dataset</code> into
+     * the given graphics object. If a polygon has no attribute 'fill', we
+     * expect that it is a line, otherwise the polygon is filled.
+     *
+     * @param graphics
+     * @param plot
+     * @param area
+     * @param dataset
+     */
     public void drawPolygons(
         Graphics2D     graphics,
         PolygonPlot    plot,
@@ -104,6 +159,15 @@
         }
     }
 
+    /**
+     * Draw labels at each item of a series in the given dataset. If the series
+     * has no label attritue, no label is drawn.
+     * 
+     * @param graphics
+     * @param plot
+     * @param area
+     * @param dataset
+     */
     public void drawLabels(
         final Graphics2D  graphics,
         final PolygonPlot plot,
@@ -169,6 +233,16 @@
         } // for all series
     }
 
+    /**
+     * Creates a shape made up of the CompactXYItems object stored in the given
+     * series.
+     *
+     * @param plot The plot.
+     * @param area The boundary.
+     * @param series The series storing the items.
+     * @param close Specifies if the polygon should be closed or not.
+     * @return
+     */
     protected Shape constructShape(
         PolygonPlot   plot,
         Rectangle2D   area,
@@ -206,6 +280,12 @@
         return path;
     }
 
+    /**
+     * Retrieves the bounding box of a dataset.
+     *
+     * @param dataset
+     * @return
+     */
     public Rectangle2D getBoundingBox(PolygonDataset dataset) {
         Rectangle2D bbox = null;
 
@@ -229,6 +309,11 @@
         return bbox;
     }
 
+    /**
+     *
+     * @param series
+     * @return the bounds of a series.
+     */
     public Rectangle2D getBounds(PolygonSeries series) {
 
         Range domain = series.getDomainBounds();

http://dive4elements.wald.intevation.org