Mercurial > dive4elements > gnv-client
comparison 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 |
comparison
equal
deleted
inserted
replaced
836:05bf8534a35a | 837:43f3c0cd60f2 |
---|---|
59 * The cell height of the interpolation in world units. | 59 * The cell height of the interpolation in world units. |
60 */ | 60 */ |
61 protected double cellHeight; | 61 protected double cellHeight; |
62 | 62 |
63 /** | 63 /** |
64 * The coordinates of the interpolation. | |
65 */ | |
66 protected Coordinate[] coordinates; | |
67 | |
68 /** | |
64 * The generated raster. | 69 * The generated raster. |
65 */ | 70 */ |
66 protected double [] raster; | 71 protected double [] raster; |
67 | 72 |
68 /** | 73 /** |
123 * Returns the cell height of the interpolation in world units. | 128 * Returns the cell height of the interpolation in world units. |
124 * @return The cell height of the interpolation in world units. | 129 * @return The cell height of the interpolation in world units. |
125 */ | 130 */ |
126 public double getCellHeight() { | 131 public double getCellHeight() { |
127 return cellHeight; | 132 return cellHeight; |
133 } | |
134 | |
135 /** | |
136 * Returns the coordinates used for the interpolation. | |
137 * @return the coordinates used for the interpolation. | |
138 */ | |
139 public Coordinate[] getCoordinates() { | |
140 return coordinates; | |
128 } | 141 } |
129 | 142 |
130 /** | 143 /** |
131 * Returns the generated raster. | 144 * Returns the generated raster. |
132 * @return The generated raster. | 145 * @return The generated raster. |
210 path, from, to, metrics); | 223 path, from, to, metrics); |
211 | 224 |
212 double [] depths = new double[width]; | 225 double [] depths = new double[width]; |
213 Arrays.fill(depths, Double.NaN); | 226 Arrays.fill(depths, Double.NaN); |
214 | 227 |
228 Coordinate[] coordinates = new Coordinate[width]; | |
229 | |
215 double cellWidth = (to - from)/width; | 230 double cellWidth = (to - from)/width; |
216 | 231 |
217 double maxDepth = Double.MAX_VALUE; | 232 double maxDepth = Double.MAX_VALUE; |
218 | 233 |
219 int i = 0; | 234 int i = 0; |
220 Coordinate center = new Coordinate(); | 235 Coordinate center = new Coordinate(); |
221 for (double p = cellWidth*0.5; i < depths.length; ++i, p += cellWidth) { | 236 for (double p = cellWidth*0.5; i < depths.length; ++i, p += cellWidth) { |
222 if (linearToMap.locate(p, center)) { | 237 if (linearToMap.locate(p, center)) { |
238 coordinates[i] = (Coordinate) center.clone(); | |
223 double depth = xyDepth.depth(center); | 239 double depth = xyDepth.depth(center); |
224 depths[i] = depth; | 240 depths[i] = depth; |
225 if (depth < maxDepth) { | 241 if (depth < maxDepth) { |
226 maxDepth = depth; | 242 maxDepth = depth; |
227 } | 243 } |
313 // between last value and ground. | 329 // between last value and ground. |
314 depths[i] = z+0.5d*cellHeight; | 330 depths[i] = z+0.5d*cellHeight; |
315 } // down the x/y column | 331 } // down the x/y column |
316 } // all along the track | 332 } // all along the track |
317 | 333 |
318 this.depths = depths; | 334 this.coordinates = coordinates; |
319 this.raster = raster; | 335 this.depths = depths; |
320 this.cellWidth = cellWidth; | 336 this.raster = raster; |
321 this.cellHeight = cellHeight; | 337 this.cellWidth = cellWidth; |
338 this.cellHeight = cellHeight; | |
322 | 339 |
323 return true; | 340 return true; |
324 } | 341 } |
325 } | 342 } |
326 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 343 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |