diff gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java @ 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 c4156275c1e1
children feae2f9d6c6f
line wrap: on
line diff
--- 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