changeset 808:2e951160c43d

Finished the javadoc of the math package. gnv-artifacts/trunk@890 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 08 Apr 2010 16:35:02 +0000
parents a645bd23c1c8
children d05b17a4f3d0
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.java gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java gnv-artifacts/src/main/java/de/intevation/gnv/math/package.html
diffstat 6 files changed, 214 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Thu Apr 08 15:24:45 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Thu Apr 08 16:35:02 2010 +0000
@@ -1,3 +1,12 @@
+2010-04-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java,
+	  src/main/java/de/intevation/gnv/math/package.html,
+	  src/main/java/de/intevation/gnv/math/AreaInterpolation.java,
+	  src/main/java/de/intevation/gnv/math/AttributedXYColumns.java,
+	  src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java:
+	  Finished the javadoc of the math package.
+
 2010-04-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/math/ConstantFunction.java,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.java	Thu Apr 08 15:24:45 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.java	Thu Apr 08 16:35:02 2010 +0000
@@ -15,36 +15,75 @@
 import org.apache.log4j.Logger;
 
 /**
- *  @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ * Does an area interpolation for "Horizontalschnitte".
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class AreaInterpolation
 implements   Serializable
 {
     private static Logger log = Logger.getLogger(AreaInterpolation.class);
 
+    /**
+     * The generated raster.
+     */
     protected double [] raster;
 
+    /**
+     * The width of the raster.
+     */
     protected int width;
+    /**
+     * The height of the raster.
+     */
     protected int height;
 
+    /**
+     * Default constructor.
+     */
     public AreaInterpolation() {
     }
 
+    /**
+     * Returns the width of the generated raster.
+     * @return the width of the raster.
+     */
     public int getWidth() {
         return width;
     }
 
+    /**
+     * Returns the height of the raster.
+     * @return The height of the raster.
+     */
     public int getHeight() {
         return height;
     }
 
+    /**
+     * The generated raster.
+     * @return
+     */
     public double [] getRaster() {
         return raster;
     }
 
+    /**
+     * Epsilon for numerical stability.
+     */
     public static final double EPS = 1e-6d;
 
 
+    /**
+     * Fills a raster by interpolating the input values.
+     * @param points The attributed input values.
+     * @param boundingBox The world area where to interpolate.
+     * @param samples The width and height of the raster.
+     * @param depth The callback to query the depth at a given point.
+     * @param extrapolationRounds Number of extrapolation point layers
+     * to generate before doing the interpolation.
+     * @return true if the interpolation succeeds else false.
+     */
     public boolean interpolate(
         List<? extends Point2d> points,
         Envelope                boundingBox,
@@ -160,4 +199,4 @@
         return true;
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
\ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java	Thu Apr 08 15:24:45 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java	Thu Apr 08 16:35:02 2010 +0000
@@ -12,30 +12,73 @@
 import java.util.Map;
 
 /**
- *  @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ * Stores the results of an area interpolation.
+ * Used to generate the final products.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class AttributedPoint2ds
 implements   Serializable
 {
+    /**
+     * The list of input points.
+     */
     protected List<? extends Point2d>             points;
+
+    /**
+     * The map of input attributes that are need to generate
+     * the products.
+     */
     protected Map                                 attributes;
+
+    /**
+     * The interpolation result.
+     */
     protected AreaInterpolation                   interpolation;
+
+    /**
+     * The JTS multi line strings to be written by GeoTools later.
+     */
     protected List<Pair<Object, MultiLineString>> lineStrings;
+
+    /**
+     * The JTS multi polygons to be written by GeoTools later.
+     */
     protected Map<Integer, MultiPolygon>          polygons;
 
+    /**
+     * Default constructor.
+     */
     public AttributedPoint2ds() {
     }
 
+    /**
+     * Constructor to create a AttributedPoint2ds with a list
+     * of input points.
+     *
+     * @param points The input points.
+     */
     public AttributedPoint2ds(List<? extends Point2d> points) {
         this.points = points;
     }
 
+    /**
+     * Returns an attribute from the map of external attributes.
+     * @param key The key of the attribute.
+     * @return The attribute or null if the attribute was not found.
+     */
     public Object getAttribute(Object key) {
         return attributes != null
             ? attributes.get(key)
             : null;
     }
 
+    /**
+     * Stores an attribute under a given key in
+     * the map of external attributes.
+     * @param key The key of the attribute.
+     * @param value The attribute value.
+     */
     public void setAttribute(Object key, Object value) {
         if (attributes == null) {
             attributes = new HashMap();
@@ -43,36 +86,68 @@
         attributes.put(key, value);
     }
 
+    /**
+     * Returns the input points.
+     * @return The input points.
+     */
     public List<? extends Point2d> getPoints() {
         return points;
     }
 
+    /**
+     * Sets the input points.
+     * @param points The input points.
+     */
     public void setPoints(List<? extends Point2d> points) {
         this.points = points;
     }
 
+    /**
+     * Sets the area interpolation result.
+     * @param interpolation The new interpolation result.
+     */
     public void setInterpolation(AreaInterpolation interpolation) {
         this.interpolation = interpolation;
     }
 
+    /**
+     * Returns the area interpolation result.
+     * @return The interpolation result.
+     */
     public AreaInterpolation getInterpolation() {
         return interpolation;
     }
 
+    /**
+     * Sets the produced JTS multi polygons.
+     * @param polygons The multi polygons.
+     */
     public void setPolygons(Map<Integer, MultiPolygon> polygons) {
         this.polygons = polygons;
     }
 
+    /**
+     * Returns the JTS multi polygons.
+     * @return The polygons.
+     */
     public Map<Integer, MultiPolygon> getPolygons() {
         return polygons;
     }
 
+    /**
+     * Set the produced JTS multi line strings.
+     * @param lineStrings The line strings.
+     */
     public void setLineStrings(
         List<Pair<Object, MultiLineString>> lineStrings
     ) {
         this.lineStrings = lineStrings;
     }
 
+    /**
+     * Returns the produced JTS multi line strings.
+     * @return The line strings.
+     */
     public List<Pair<Object, MultiLineString>> getLineStrings() {
         return lineStrings;
     }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java	Thu Apr 08 15:24:45 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java	Thu Apr 08 16:35:02 2010 +0000
@@ -9,7 +9,7 @@
 import java.util.Map;
 
 /**
- * Stores the results of a 3D interpolation. Used to generated the final
+ * Stores the results of a 3D interpolation. Used to generate the final
  * products.
  *
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
@@ -141,4 +141,4 @@
         return dataset;
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
\ No newline at end of file
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java	Thu Apr 08 15:24:45 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java	Thu Apr 08 16:35:02 2010 +0000
@@ -15,6 +15,9 @@
 import org.apache.log4j.Logger;
 
 /**
+ * Interpolates parameter values along a given line string from surface
+ * to the sea ground to generate "Profilschnitte".
+ *
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class Interpolation3D
@@ -22,57 +25,128 @@
 {
     private static Logger log = Logger.getLogger(Interpolation3D.class);
 
+    /**
+     * The default width of the interpolation: {@value}
+     */
     public static final int DEFAULT_WIDTH  = 1024;
+
+    /**
+     * The default height of the interpolation: {@value}
+     */
     public static final int DEFAULT_HEIGHT =  768;
 
+    /**
+     * Epsilon for numerical stability.
+     */
     public static final double EPS = 1e-6d;
 
+    /**
+     * The width of the interpolation.
+     */
     protected int width;
+
+    /**
+     * The height of the interpolation.
+     */
     protected int height;
 
+    /**
+     * The cell width of the interpolation in world units.
+     */
     protected double cellWidth;
+
+    /**
+     * The cell height of the interpolation in world units.
+     */
     protected double cellHeight;
 
+    /**
+     * The generated raster.
+     */
     protected double [] raster;
+
+    /**
+     * The sea ground depth along the line string.
+     */
     protected double [] depths;
 
+    /**
+     * Default constructor.
+     */
     public Interpolation3D() {
         this(DEFAULT_WIDTH, DEFAULT_HEIGHT);
     }
 
+    /**
+     * Constructor to create a Interpolation3D with a given size.
+     * @param size The size of the interpolation.
+     */
     public Interpolation3D(Dimension size) {
         this(size.width, size.height);
     }
 
+    /**
+     * Constructor to create a Interpolation3D with a given size.
+     * @param width The width of the interpolation.
+     * @param height the height of the interpolation.
+     */
     public Interpolation3D(int width, int height) {
         this.width  = width;
         this.height = height;
     }
 
+    /**
+     * Returns the raster height of the interpolation.
+     * @return The raster height of the interpolation.
+     */
     public int getHeight() {
         return height;
     }
 
+    /**
+     * Returns the raster width of the interpolation.
+     * @return The raster width of the interpolation.
+     */
     public int getWidth() {
         return width;
     }
 
+    /**
+     * Returns the cell width of the interpolation in world units.
+     * @return The cell width of the interpolation in world units.
+     */
     public double getCellWidth() {
         return cellWidth;
     }
 
+    /**
+     * Returns the cell height of the interpolation in world units.
+     * @return The cell height of the interpolation in world units.
+     */
     public double getCellHeight() {
         return cellHeight;
     }
 
+    /**
+     * Returns the generated raster.
+     * @return The generated raster.
+     */
     public double [] getRaster() {
         return raster;
     }
 
+    /**
+     * Returns the depths along the line string path.
+     * @return The depth along the line string path.
+     */
     public double [] getDepths() {
         return depths;
     }
 
+    /**
+     * Returns the deepest depth along the line string path.
+     * @return The deepest depth along the line string path.
+     */
     public double getMaxDepth() {
         double maxDepth = Double.MAX_VALUE;
         for (int i = depths!=null?depths.length-1:0; i >= 0; --i) {
@@ -84,6 +158,17 @@
         return maxDepth;
     }
 
+    /**
+     * Interpolates parameters along a given line string path from the surface
+     * to the sea ground.
+     * @param path The line string path.
+     * @param points The sample points.
+     * @param from Start point in scalar terms of the line string.
+     * @param to End point in scalar terms of the line string.
+     * @param metrics The used metric.
+     * @param xyDepth The callback to query the depth at a given point.
+     * @return true if the interpolation succeeds, else false.
+     */
     public boolean interpolate(
         List<? extends Coordinate> path,
         List<? extends XYColumn>   points,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/package.html	Thu Apr 08 15:24:45 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/package.html	Thu Apr 08 16:35:02 2010 +0000
@@ -3,6 +3,6 @@
 <head>
 </head>
 <body>
-DOCUMENT ME!
+Classes and interface to do the different kinds of cross sections.
 </body>
 </html>

http://dive4elements.wald.intevation.org