diff gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java @ 837:43f3c0cd60f2

First implementation of an odv export of a 'Profilschnitt' (issue217). gnv-artifacts/trunk@944 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 19 Apr 2010 10:55:25 +0000
parents 2e951160c43d
children f953c9a559d8
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java	Sun Apr 18 09:17:25 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java	Mon Apr 19 10:55:25 2010 +0000
@@ -61,6 +61,11 @@
     protected double cellHeight;
 
     /**
+     * The coordinates of the interpolation.
+     */
+    protected Coordinate[] coordinates;
+
+    /**
      * The generated raster.
      */
     protected double [] raster;
@@ -128,6 +133,14 @@
     }
 
     /**
+     * Returns the coordinates used for the interpolation.
+     * @return the coordinates used for the interpolation.
+     */
+    public Coordinate[] getCoordinates() {
+        return coordinates;
+    }
+
+    /**
      * Returns the generated raster.
      * @return The generated raster.
      */
@@ -212,6 +225,8 @@
         double [] depths = new double[width];
         Arrays.fill(depths, Double.NaN);
 
+        Coordinate[] coordinates = new Coordinate[width];
+
         double cellWidth = (to - from)/width;
 
         double maxDepth = Double.MAX_VALUE;
@@ -220,6 +235,7 @@
         Coordinate center = new Coordinate();
         for (double p = cellWidth*0.5; i < depths.length; ++i, p += cellWidth) {
             if (linearToMap.locate(p, center)) {
+                coordinates[i] = (Coordinate) center.clone();
                 double depth = xyDepth.depth(center);
                 depths[i] = depth;
                 if (depth < maxDepth) {
@@ -315,10 +331,11 @@
             } // down the x/y column
         } // all along the track
 
-        this.depths     = depths;
-        this.raster     = raster;
-        this.cellWidth  = cellWidth;
-        this.cellHeight = cellHeight;
+        this.coordinates = coordinates;
+        this.depths      = depths;
+        this.raster      = raster;
+        this.cellWidth   = cellWidth;
+        this.cellHeight  = cellHeight;
 
         return true;
     }

http://dive4elements.wald.intevation.org