annotate gnv-artifacts/src/main/java/de/intevation/gnv/math/GridCell.java @ 591:b8ba642b6866

Fixed the broken JUnittests. gnv-artifacts/trunk@646 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 29 Jan 2010 13:19:34 +0000
parents 4e347624ee7c
children b248531fa20b
rev   line source
514
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.math;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import com.vividsolutions.jts.geom.Coordinate;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 import com.vividsolutions.jts.geom.Envelope;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import com.vividsolutions.jts.geom.Geometry;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import com.vividsolutions.jts.geom.GeometryFactory;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 import com.vividsolutions.jts.geom.LinearRing;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import com.vividsolutions.jts.geom.Point;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 import com.vividsolutions.jts.geom.Polygon;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 import com.vividsolutions.jts.index.ItemVisitor;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 import java.io.Serializable;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 import java.util.ArrayList;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 import java.util.HashMap;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 import java.util.List;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18
517
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
19 import org.apache.log4j.Logger;
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
20
514
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 /**
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 */
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 public class GridCell
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 implements Serializable
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 {
517
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
27 private static Logger log = Logger.getLogger(GridCell.class);
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
28
514
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 public static final class CellFinder
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 implements ItemVisitor
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 public GridCell found;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 protected Point point;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 public CellFinder() {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 public void prepare(Coordinate center) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 found = null;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 point = GEOMETRY_FACTORY.createPoint(center);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 public void visitItem(Object item) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 if (found == null) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 GridCell cell = (GridCell)item;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 if (cell.contains(point)) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 found = cell;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 } // class CellFinder
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 public Point2d p1;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 public Point2d p2;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 public Point2d p3;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 public Point2d p4;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 protected Polygon polygon;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 public static final GeometryFactory GEOMETRY_FACTORY
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 = new GeometryFactory();
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 public GridCell() {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 public GridCell(Point2d p1, Point2d p2, Point2d p3, Point2d p4) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 this.p1 = p1;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 this.p2 = p2;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 this.p3 = p3;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 this.p4 = p4;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 createPolygon();
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 protected void createPolygon() {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 LinearRing shell = GEOMETRY_FACTORY
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 .createLinearRing(new Coordinate [] { p1, p2, p3, p4, p1 });
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 polygon = GEOMETRY_FACTORY.createPolygon(shell, null);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 public Envelope getEnvelope() {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 return polygon.getEnvelopeInternal();
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 public boolean contains(Geometry coord) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 return polygon.contains(coord);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 public static List<GridCell> pointsToGridCells(
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 List<? extends Point2d> points
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 ) {
517
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
92 return pointsToGridCells(points, null);
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
93 }
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
94
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
95 public static List<GridCell> pointsToGridCells(
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
96 List<? extends Point2d> points,
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
97 Envelope relevantArea
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
98 ) {
514
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 int minI = Integer.MAX_VALUE;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 int maxI = Integer.MIN_VALUE;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 int minJ = Integer.MAX_VALUE;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 int maxJ = Integer.MIN_VALUE;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 HashMap<Integer, HashMap<Integer, Point2d>> rows =
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 new HashMap<Integer, HashMap<Integer, Point2d>>();
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106
517
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
107 int culled = 0;
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
108
514
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 for (Point2d p: points) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110
517
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
111 if (relevantArea != null && !relevantArea.contains(p.x, p.y)) {
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
112 ++culled;
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
113 continue;
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
114 }
96a1e92e7ed2 If the number of data points to generate a "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 514
diff changeset
115
514
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116 if (p.i < minI) minI = p.i;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117 if (p.i > maxI) maxI = p.i;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118 if (p.j < minJ) minJ = p.j;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 if (p.j > maxJ) maxJ = p.j;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121 HashMap<Integer, Point2d> row = rows.get(p.i);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123 if (row == null) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 rows.put(p.i, row = new HashMap<Integer, Point2d>());
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 row.put(p.j, p);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130 ArrayList<GridCell> cells = new ArrayList<GridCell>(points.size());
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 for (int i = minI + 1; i <= maxI; ++i) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 HashMap<Integer, Point2d> row1 = rows.get(i-1);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 HashMap<Integer, Point2d> row2 = rows.get(i);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135 if (row1 != null && row2 != null) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 for (int j = minJ + 1; j < maxJ; ++j) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137 Point2d p1 = row1.get(j-1);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138 Point2d p2 = row1.get(j);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139 Point2d p3 = row2.get(j);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
140 Point2d p4 = row2.get(j-1);
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142 if (p1 != null && p2 != null && p3 != null && p4 != null) {
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
143 cells.add(new GridCell(p1, p2, p3, p4));
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145 } // for all columns in row
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147 } // for all rows
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
148
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 517
diff changeset
149 if (log.isDebugEnabled()) {
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 517
diff changeset
150 log.debug("culled points: " + culled);
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 517
diff changeset
151 log.debug("min/max i: " + minI + " / " + maxI);
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 517
diff changeset
152 log.debug("min/max j: " + minJ + " / " + maxJ);
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 517
diff changeset
153 log.debug("cells found: " + cells.size());
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 517
diff changeset
154 }
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 517
diff changeset
155
514
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
156 return cells;
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
157 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
158 }
d9d933e06875 Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
159 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org