Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java @ 492:79e80c289018
Added labels and titles to 'Profilschnitt' charts.
gnv-artifacts/trunk@569 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 19 Jan 2010 10:06:03 +0000 |
parents | 537e663d6c0c |
children | 234d9892e497 |
rev | line source |
---|---|
434
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.math; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import java.util.Arrays; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.util.Collections; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
445
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
7 import java.io.Serializable; |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
8 |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
9 import java.awt.Dimension; |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
10 |
434
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import com.vividsolutions.jts.geom.Coordinate; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import com.vividsolutions.jts.geom.Envelope; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import com.vividsolutions.jts.index.quadtree.Quadtree; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import org.apache.log4j.Logger; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
445
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
18 /** |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
19 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
20 */ |
434
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 public class Interpolation3D |
445
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
22 implements Serializable |
434
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 private static Logger log = Logger.getLogger(Interpolation3D.class); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 public static final int DEFAULT_WIDTH = 1024; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 public static final int DEFAULT_HEIGHT = 768; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 protected int width; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 protected int height; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 protected double [] raster; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 protected double [] depths; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 public Interpolation3D() { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 this(DEFAULT_WIDTH, DEFAULT_HEIGHT); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 |
445
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
39 public Interpolation3D(Dimension size) { |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
40 this(size.width, size.height); |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
41 } |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
42 |
434
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 public Interpolation3D(int width, int height) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 this.width = width; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 this.height = height; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 public int getHeight() { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 return height; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 public int getWidth() { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 return width; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 public double [] getRaster() { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 return raster; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 public double [] getDepths() { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 return depths; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
445
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
64 public double getMaxDepth() { |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
65 double maxDepth = Double.MAX_VALUE; |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
66 for (int i = depths!=null?depths.length-1:0; i >= 0; --i) { |
446
f5a041000357
Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
445
diff
changeset
|
67 double d = depths[i]; |
f5a041000357
Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
445
diff
changeset
|
68 if (!Double.isNaN(d) && d < maxDepth) { |
f5a041000357
Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
445
diff
changeset
|
69 maxDepth = d; |
445
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
70 } |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
71 } |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
72 return maxDepth; |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
73 } |
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
74 |
434
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 public boolean interpolate( |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 List<? extends Coordinate> path, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 List<? extends XYColumn> points, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 double from, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 double to, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 Metrics metrics, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 XYDepth xyDepth |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 ) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 boolean debug = log.isDebugEnabled(); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 int N = path.size(); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 int M = points.size(); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 if (debug) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 log.debug("Size of path: " + N); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 log.debug("Size of points: " + M); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 if (M < 1 || N < 2) { // nothing to do |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 return false; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 double [] buffer = Interpolation2D.calculateBuffer(points); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 double dxMax = buffer[0]; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 double dyMax = buffer[1]; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 if (debug) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 log.debug("buffer size: " + dxMax + " / " + dyMax); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 // put into spatial index to speed up finding neighbors. |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 Quadtree spatialIndex = new Quadtree(); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 for (int i = 0; i < M; ++i) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 Point2d p = points.get(i); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 spatialIndex.insert(p.envelope(), p); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 LinearToMap linearToMap = new LinearToMap( |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 path, from, to, metrics); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 double [] depths = new double[width]; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 Arrays.fill(depths, Double.NaN); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 double cellWidth = (to - from)/width; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 double maxDepth = Double.MAX_VALUE; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 int i = 0; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 Coordinate center = new Coordinate(); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 for (double p = cellWidth*0.5; i < depths.length; ++i, p += cellWidth) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 if (linearToMap.locate(p, center)) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 double depth = xyDepth.depth(center); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 depths[i] = depth; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 if (depth < maxDepth) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 maxDepth = depth; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 if (maxDepth == Double.MAX_VALUE) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 log.warn("no depth found -> no interpolation"); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 return false; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 double cellHeight = Math.abs(maxDepth)/height; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 if (debug) { |
445
f42ed4f10b79
Fixed some bugs and create "Profilschnitt" polygons via configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
434
diff
changeset
|
143 log.debug("max depth found: " + maxDepth); |
434
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 log.debug("cell size: " + cellWidth + " x " + cellHeight); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 double [] raster = new double[width*height]; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 Arrays.fill(raster, Double.NaN); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 Envelope queryBuffer = new Envelope(); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 XYColumn [] neighbors = new XYColumn[4]; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 i = 0; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 for (double p = cellWidth*0.5; i < depths.length; ++i, p += cellWidth) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 double depth = depths[i]; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 if (Double.isNaN(depth)) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 continue; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 linearToMap.locate(p, center); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 queryBuffer.init( |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 center.x - dxMax, center.x + dxMax, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 center.y - dyMax, center.y + dyMax); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 List potential = spatialIndex.query(queryBuffer); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
167 L1Comparator invL1 = new L1Comparator(center); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 Collections.sort(potential, invL1); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 neighbors[0] = neighbors[1] = |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
171 neighbors[2] = neighbors[3] = null; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
173 /* bit code of neighbors |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
174 0---1 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
175 | x | |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
176 2---3 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
177 */ |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
178 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
179 int mask = 0; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
180 // reversed order is essential here! |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
181 for (int j = potential.size()-1; j >= 0; --j) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
182 XYColumn n = (XYColumn)potential.get(j); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
183 int code = n.x > center.x ? 1 : 0; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
184 if (n.y > center.y) code |= 2; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
185 neighbors[code] = n; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
186 mask |= 1 << code; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
187 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
188 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
189 int numNeighbors = Integer.bitCount(mask); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
190 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
191 // only interpolate if we have all four neighbors |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
192 // and we do not have any gaps. |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 if (numNeighbors == 4 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 && !neighbors[0].hasIGap(neighbors[1]) |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
195 && !neighbors[1].hasJGap(neighbors[3]) |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
196 && !neighbors[3].hasIGap(neighbors[2]) |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
197 && !neighbors[2].hasJGap(neighbors[0]) |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
198 && neighbors[0].prepare(xyDepth) |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
199 && neighbors[1].prepare(xyDepth) |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
200 && neighbors[2].prepare(xyDepth) |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 && neighbors[3].prepare(xyDepth) |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
202 ) { |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
203 double y1 = Interpolation2D.interpolate( |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
204 neighbors[0].x, neighbors[0].y, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 neighbors[1].x, neighbors[1].y, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
206 center.x); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
207 double y2 = Interpolation2D.interpolate( |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 neighbors[2].x, neighbors[2].y, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
209 neighbors[3].x, neighbors[3].y, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 center.x); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 int j = i; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
212 for (double z = -cellHeight*0.5; |
453
537e663d6c0c
vertical cross section: Fixed problem with running to max depth on every column in interpolation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
446
diff
changeset
|
213 j < raster.length && z >= depth; |
537e663d6c0c
vertical cross section: Fixed problem with running to max depth on every column in interpolation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
446
diff
changeset
|
214 z -= cellHeight, j += width) { |
434
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
215 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
216 double v0 = neighbors[0].value(z); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
217 double v1 = neighbors[1].value(z); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
218 double v2 = neighbors[2].value(z); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
219 double v3 = neighbors[3].value(z); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
220 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
221 double z1 = Interpolation2D.interpolate( |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
222 neighbors[0].x, v0, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
223 neighbors[1].x, v1, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
224 center.x); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
225 double z2 = Interpolation2D.interpolate( |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
226 neighbors[2].x, v2, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
227 neighbors[3].x, v3, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
228 center.x); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
229 double value = Interpolation2D.interpolate( |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 y1, z1, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 y2, z2, |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
232 center.y); |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
233 raster[j] = value; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
234 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
235 } // down the x/y column |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
236 } // all along the track |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
237 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
238 this.depths = depths; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
239 this.raster = raster; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
240 |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
241 return true; |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
242 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
243 } |
0eed5749fd63
Implemented the raster interpolation for the 'Profilschnitt'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |