# HG changeset patch # User Sascha L. Teichmann # Date 1270744502 0 # Node ID 2e951160c43d319656e1020f6de2608c6b236849 # Parent a645bd23c1c8fdafdab92ba7a19fa52fb8252cea Finished the javadoc of the math package. gnv-artifacts/trunk@890 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a645bd23c1c8 -r 2e951160c43d gnv-artifacts/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/gnv/math/ConstantFunction.java, diff -r a645bd23c1c8 -r 2e951160c43d gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.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 Sascha L. Teichmann + * Does an area interpolation for "Horizontalschnitte". + * + * @author Sascha L. Teichmann */ 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 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 diff -r a645bd23c1c8 -r 2e951160c43d gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java --- 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 Sascha L. Teichmann + * Stores the results of an area interpolation. + * Used to generate the final products. + * + * @author Sascha L. Teichmann */ public class AttributedPoint2ds implements Serializable { + /** + * The list of input points. + */ protected List 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> lineStrings; + + /** + * The JTS multi polygons to be written by GeoTools later. + */ protected Map polygons; + /** + * Default constructor. + */ public AttributedPoint2ds() { } + /** + * Constructor to create a AttributedPoint2ds with a list + * of input points. + * + * @param points The input points. + */ public AttributedPoint2ds(List 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 getPoints() { return points; } + /** + * Sets the input points. + * @param points The input points. + */ public void setPoints(List 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 polygons) { this.polygons = polygons; } + /** + * Returns the JTS multi polygons. + * @return The polygons. + */ public Map getPolygons() { return polygons; } + /** + * Set the produced JTS multi line strings. + * @param lineStrings The line strings. + */ public void setLineStrings( List> lineStrings ) { this.lineStrings = lineStrings; } + /** + * Returns the produced JTS multi line strings. + * @return The line strings. + */ public List> getLineStrings() { return lineStrings; } diff -r a645bd23c1c8 -r 2e951160c43d gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java --- 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 Ingo Weinzierl @@ -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 : diff -r a645bd23c1c8 -r 2e951160c43d gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java --- 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 Sascha L. Teichmann */ 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 path, List points, diff -r a645bd23c1c8 -r 2e951160c43d gnv-artifacts/src/main/java/de/intevation/gnv/math/package.html --- 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 @@ -DOCUMENT ME! +Classes and interface to do the different kinds of cross sections.