changeset 802:4abe172be970

Finished Javadoc of the raster package. gnv-artifacts/trunk@884 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 07 Apr 2010 07:49:12 +0000
parents d766fe2d917a
children feae2f9d6c6f
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java gnv-artifacts/src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoProducer.java gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java
diffstat 8 files changed, 212 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Tue Apr 06 16:53:43 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Wed Apr 07 07:49:12 2010 +0000
@@ -1,3 +1,14 @@
+2010-04-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java,
+	  src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java,
+	  src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java,
+	  src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java,
+	  src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java,
+	  src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java,
+	  src/main/java/de/intevation/gnv/raster/IsoProducer.java:
+	  Finished Javadoc of the raster package.
+
 2010-04-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/**/*.java: More javadoc.
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java	Tue Apr 06 16:53:43 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java	Wed Apr 07 07:49:12 2010 +0000
@@ -7,17 +7,31 @@
 import java.util.List;
 
 /**
+ * Ring Handler that demultiplexes to a list of other ring handlers.
+ * Handy if you want to pipe the polygons and line strings produced
+ * by the Vectorize to more than one handler at once.
+ * 
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class DemuxRingsHandler
 implements   RingsHandler
 {
+    /**
+     * The list of internal ring handlers.
+     */
     protected ArrayList<RingsHandler> handlers;
 
+    /**
+     * Default constructor.
+     */
     public DemuxRingsHandler() {
         handlers = new ArrayList<RingsHandler>();
     }
 
+    /**
+     * Add a ring handler to the list of handlers.
+     * @param handler The handler to add to the internal list.
+     */
     public void addHandler(RingsHandler handler) {
         handlers.add(handler);
     }
@@ -33,6 +47,9 @@
         }
     }
 
+    /**
+     * Empties the internal list of ring handlers.
+     */
     public void clear() {
         handlers.clear();
     }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java	Tue Apr 06 16:53:43 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java	Wed Apr 07 07:49:12 2010 +0000
@@ -3,6 +3,9 @@
 import org.apache.log4j.Logger;
 
 /**
+ * Converts the interal color index of a polygon to the external index
+ * defined by the corresponding palette entry.
+ * 
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class ExternalIndexConverter
@@ -11,15 +14,33 @@
     private static Logger log = Logger.getLogger(
         ExternalIndexConverter.class);
 
+    /**
+     * The palette where to find the color indices.
+     */
     protected Palette palette;
 
+    /**
+     * Default constructor.
+     */
     public ExternalIndexConverter() {
     }
 
+    /**
+     * Constrcutor to create an ExternalIndexConverter with
+     * a given palette.
+     * @param palette The palette where to find the color indices.
+     */
     public ExternalIndexConverter(Palette palette) {
         this.palette = palette;
     }
 
+    /**
+     * Maps the color index of a polygon to the external index
+     * defined by the corresponing palette entry.
+     * @param value The value to convert
+     * @return The mapped value or the original value if
+     * no corresponing palette entry was found.
+     */
     public Integer convert(Integer value) {
         if (value == null) {
             return value;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java	Tue Apr 06 16:53:43 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java	Wed Apr 07 07:49:12 2010 +0000
@@ -1,16 +1,30 @@
 package de.intevation.gnv.raster;
 
 /**
+ * Generates label attributes for iso lines. It takes the
+ * neighboring palette ranges and calculates the mid point
+ * between these two ranges.
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class IsoAttributeGenerator
 implements   IsoProducer.AttributeGenerator
 {
+    /**
+     * The palette where to look for the ranges.
+     */
     protected Palette palette;
 
+    /**
+     * Default constructor.
+     */
     public IsoAttributeGenerator() {
     }
 
+    /**
+     * Constructor to create an IsoAttributeGenerator with
+     * a given lookup palette.
+     * @param palette The palette.
+     */
     public IsoAttributeGenerator(Palette palette) {
         this.palette = palette;
     }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java	Tue Apr 06 16:53:43 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java	Wed Apr 07 07:49:12 2010 +0000
@@ -16,6 +16,10 @@
 import org.apache.log4j.Logger;
 
 /**
+ * Vectorizer backend to generate iso lines which are able to be visualized
+ * via {@link de.intevation.gnv.jfreechart.PolygonPlot} as line strings
+ * and custom labels on the chart.
+ *
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class IsoPolygonSeriesProducer
@@ -24,8 +28,19 @@
     private static Logger log = Logger.getLogger(
         IsoPolygonSeriesProducer.class);
 
-	public static final Float LINE_WIDTH = Float.valueOf(0.1f);
+    /**
+     * The line width of the line string used in the chart.
+     */
+    public static final Float LINE_WIDTH = Float.valueOf(0.1f);
 
+    /**
+     * Constructor to create an IsoPolygonSeriesProducer with a
+     * given world bounding box.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
     public IsoPolygonSeriesProducer(
         double minX, double minY,
         double maxX, double maxY
@@ -33,10 +48,22 @@
         super(minX, minY, maxX, maxY);
     }
 
+    /**
+     * Returns a collection of series with line strings
+     * with no AttributeGenerator.
+     * @return The collection with line strings.
+     */
     public Collection<PolygonSeries> getSeries() {
         return getSeries(null);
     }
 
+    /**
+     * Returns a collection of series with line strings.
+     * The label attributes are generated with a given generator.
+     * @param attributeGenerator The attribute generator. Maybe null
+     * if no attributes should be generated.
+     * @return The collection with the line strings.
+     */
     public Collection<PolygonSeries> getSeries(
         AttributeGenerator attributeGenerator
     ) {
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoProducer.java	Tue Apr 06 16:53:43 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoProducer.java	Wed Apr 07 07:49:12 2010 +0000
@@ -14,8 +14,7 @@
 import java.util.List;
 
 /**
- * Vectorizer backend to generate iso lines which are able to be visualized
- * via {@link de.intevation.gnv.jfreechart.PolygonPlot} as line strings
+ * Vectorizer backend to generate iso lines as line strings
  * and custom labels on the chart.
  *
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java	Tue Apr 06 16:53:43 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java	Wed Apr 07 07:49:12 2010 +0000
@@ -22,6 +22,9 @@
 import org.apache.log4j.Logger;
 
 /**
+ * Vectorizer backend to generated iso lines in form of
+ * JTS multi linestrings.
+ * 
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class JTSMultiLineStringProducer
@@ -30,10 +33,25 @@
     private static Logger log = Logger.getLogger(
         JTSMultiLineStringProducer.class);
 
+    /**
+     * The JTS geometry factory of this producer.
+     */
     protected GeometryFactory geometryFactory;
 
+    /**
+     * The polygon used to clip the produced multe line strings.
+     */
     protected Polygon clip;
 
+    /**
+     * Constructor to create a JTSMultiLineStringProducer with
+     * a given clipping polygon and a world bounding box.
+     * @param clip The clipping polygon.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
     public JTSMultiLineStringProducer(
         Polygon clip,
         double minX, double minY,
@@ -47,6 +65,17 @@
             maxX, maxY);
     }
 
+    /**
+     * Constructor to create a JTSMultiLineStringProducer with
+     * a given clipping polygon, a geometry factory
+     * and a world bounding box.
+     * @param clip The clipping polygon.
+     * @param geometryFactory The geometry factory.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
     public JTSMultiLineStringProducer(
         Polygon clip,
         GeometryFactory geometryFactory,
@@ -58,6 +87,12 @@
         this.geometryFactory = geometryFactory;
     }
 
+    /**
+     * Clips a given line string against the clippin polygon. The
+     * result is stored in the given list of line strings.
+     * @param lineString The line string to be clipped.
+     * @param lineStrings The result line string list.
+     */
     protected void clipLineString(
         LineString            lineString,
         ArrayList<LineString> lineStrings
@@ -99,6 +134,13 @@
         }
     }
 
+    /**
+     * Returns a list of pairs attribute -&gt; multi line string.
+     * All line strings produced are grouped by there attribute
+     * which is generated with the given attribute generator.
+     * @param attributeGenerator The attribute generator.
+     * @return The list of attribute/multi line strings.
+     */
     public List<Pair<Object, MultiLineString>> getMultiLineStrings(
         AttributeGenerator attributeGenerator
     ) {
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java	Tue Apr 06 16:53:43 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java	Wed Apr 07 07:49:12 2010 +0000
@@ -24,6 +24,9 @@
 import org.apache.log4j.Logger;
 
 /**
+ * Vectorizer backend to generated polygons in form of
+ * JTS multi multi polygons.
+ * 
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class JTSMultiPolygonProducer
@@ -32,23 +35,57 @@
     private static Logger log = Logger.getLogger(
         JTSMultiPolygonProducer.class);
 
+    /**
+     * The reference system of used coordinates: {@value}
+     */
     public static final int SRID_WGS84 = 4326;
 
+    /**
+     * Interface to decouple the conversion of the internal
+     * index scheme of the polygons to an external one.
+     */
     public interface ValueConverter {
 
+        /**
+         * Maps integer index schemes.
+         * @param value The input value.
+         * @return The resulting index.
+         */
         Integer convert(Integer value);
 
     } // interface ValueConverter
 
+    /**
+     * The JTS geometry factory.
+     */
     protected GeometryFactory geometryFactory;
 
+    /**
+     * The clipping polygon.
+     */
     protected Polygon clip;
 
+    /**
+     * Internal map to map the internal polygons indices to a
+     * list of generated polygons.
+     */
     protected HashMap<Integer, ArrayList<Polygon>> valueToPolygons;
 
+    /**
+     * Default constructor.
+     */
     public JTSMultiPolygonProducer() {
     }
 
+    /**
+     * Constructor to create a JTSMultiPolygonProducer with a
+     * given clipping polygon and a world bounding box.
+     * @param clip The clipping polygon.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
     public JTSMultiPolygonProducer(
         Polygon clip,
         double minX, double minY,
@@ -61,6 +98,16 @@
             maxX, maxY);
     }
 
+    /**
+     *  Constructor to create a JTSMultiPolygonProducer with a
+     * given clipping polygon, a geometry factory and a world bounding box.
+     * @param clip The clipping polygon.
+     * @param geometryFactory The geometry factory.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
     public JTSMultiPolygonProducer(
         Polygon clip,
         GeometryFactory geometryFactory,
@@ -73,10 +120,20 @@
         valueToPolygons = new HashMap<Integer, ArrayList<Polygon>>();
     }
 
+    /**
+     * Creates a 3D geometry factory via
+     * {@link #createDefaultGeometryFactory(int)}.
+     * @return The new geometry factory.
+     */
     public static GeometryFactory createDefaultGeometryFactory() {
         return createDefaultGeometryFactory(3);
     }
 
+    /**
+     * Creates a geometry factory with a given dimension.
+     * @param dim The dimension.
+     * @return The new geometry factory.
+     */
     public static GeometryFactory createDefaultGeometryFactory(int dim) {
         return new GeometryFactory(
             new PrecisionModel(
@@ -162,10 +219,21 @@
         }
     }
 
+    /**
+     * Returns a index -&gt; multi polyon map. The internal index scheme
+     * is retained.
+     * {@link #getMultiPolygons(de.intevation.gnv.raster.JTSMultiPolygonProducer.ValueConverter)}
+     * @return The new map.
+     */
     public Map<Integer, MultiPolygon> getMultiPolygons() {
         return getMultiPolygons(null);
     }
 
+    /**
+     * Flattend a JTS geometry to a multi polygon if possible
+     * @param result The geometry to be flattend
+     * @return The resulting multi polygon.
+     */
     protected MultiPolygon flattenCollection(Geometry result) {
 
         if (result instanceof MultiPolygon) {
@@ -182,6 +250,13 @@
         return null;
     }
 
+    /**
+     * Returns a index -&gt; multi polyon map. The internal index scheme
+     * is remapped with the given value converter.
+     * @param valueConverter Converter to remap the index scheme. Maybe null
+     * if no remapping is required.
+     * @return The new map.
+     */
     public Map<Integer, MultiPolygon> getMultiPolygons(
         ValueConverter valueConverter
     ) {
@@ -218,6 +293,9 @@
         return multiPolygons;
     }
 
+    /**
+     * Empties internal temporary data structures to save some memory.
+     */
     public void clear() {
         valueToPolygons.clear();
     }

http://dive4elements.wald.intevation.org