@@ -25,8 +25,6 @@ public class BBox {
25
25
double endLon ;
26
26
double startLat ;
27
27
double endLat ;
28
- double minZ ;
29
- double maxZ ;
30
28
31
29
static GeometryFactory geometryFactory = new GeometryFactory ();
32
30
@@ -37,64 +35,6 @@ public BBox(double startLon, double endLon, double startLat, double endLat) {
37
35
this .endLat = endLat ;
38
36
}
39
37
40
- public BBox (Geometry geom ) {
41
- startLon = Double .MAX_VALUE ;
42
- endLon = -Double .MAX_VALUE ;
43
- startLat = Double .MAX_VALUE ;
44
- endLat = -Double .MAX_VALUE ;
45
- minZ = Double .MAX_VALUE ;
46
- maxZ = -Double .MAX_VALUE ;
47
- processEnvelope (geom );
48
- }
49
-
50
- private void processEnvelope (Geometry geom ) {
51
- if (geom .getClass ().getSimpleName ().equals (Geometry .TYPENAME_POINT )) {
52
- processEnvelopePoint ((Point ) geom );
53
- } else if (geom .getClass ().getSimpleName ().equals (Geometry .TYPENAME_LINESTRING )) {
54
- processEnvelopeCoordinate (geom .getCoordinates ());
55
- } else if (geom .getClass ().getSimpleName ().equals (Geometry .TYPENAME_POLYGON )) {
56
- processEnvelopeCoordinate (((Polygon ) geom ).getExteriorRing ().getCoordinates ());
57
- } else if (geom .getClass ().getSimpleName ().equals (Geometry .TYPENAME_MULTIPOINT )) {
58
- for (int i = 0 ; i < geom .getNumGeometries (); i ++) {
59
- processEnvelope (geom .getGeometryN (i ));
60
- }
61
- } else if (geom .getClass ().getSimpleName ().equals (Geometry .TYPENAME_MULTILINESTRING )) {
62
- for (int i = 0 ; i < geom .getNumGeometries (); i ++) {
63
- processEnvelope (geom .getGeometryN (i ));
64
- }
65
- } else if (geom .getClass ().getSimpleName ().equals (Geometry .TYPENAME_MULTIPOLYGON )) {
66
- for (int i = 0 ; i < geom .getNumGeometries (); i ++) {
67
- processEnvelope (geom .getGeometryN (i ));
68
- }
69
- } else if (geom .getClass ().getSimpleName ().equals (Geometry .TYPENAME_GEOMETRYCOLLECTION )) {
70
- for (int i = 0 ; i < geom .getNumGeometries (); i ++) {
71
- processEnvelope (geom .getGeometryN (i ));
72
- }
73
- } else {
74
- throw new RuntimeException ("Unknown geometry type: " + geom .getGeometryType ());
75
- }
76
- }
77
-
78
- private void processEnvelopeCoordinate (Coordinate [] coords ) {
79
- for (Coordinate coord : coords ) {
80
- startLon = Math .min (startLon , coord .x );
81
- endLon = Math .max (endLon , coord .x );
82
- startLat = Math .min (startLat , coord .y );
83
- endLat = Math .max (endLat , coord .y );
84
- minZ = Math .min (minZ , coord .z );
85
- maxZ = Math .max (maxZ , coord .z );
86
- }
87
- }
88
-
89
- private void processEnvelopePoint (Point geom ) {
90
- startLon = Math .min (startLon , geom .getCoordinates ()[0 ].getX ());
91
- endLon = Math .max (endLon , geom .getCoordinates ()[0 ].getX ());
92
- startLat = Math .min (startLat , geom .getCoordinates ()[0 ].getY ());
93
- endLat = Math .max (endLat , geom .getCoordinates ()[0 ].getY ());
94
- minZ = Math .min (minZ , geom .getCoordinates ()[0 ].getZ ());
95
- maxZ = Math .max (maxZ , geom .getCoordinates ()[0 ].getZ ());
96
- }
97
-
98
38
public BBox (BBox other ) {
99
39
this (other .startLon , other .endLon , other .startLat , other .endLat );
100
40
}
@@ -115,28 +55,4 @@ public Polygon toPolygon() {
115
55
new Coordinate (this .startLon , this .startLat )
116
56
});
117
57
}
118
-
119
- public double getStartLon () {
120
- return startLon ;
121
- }
122
-
123
- public double getEndLon () {
124
- return endLon ;
125
- }
126
-
127
- public double getStartLat () {
128
- return startLat ;
129
- }
130
-
131
- public double getEndLat () {
132
- return endLat ;
133
- }
134
-
135
- public double getMinZ () {
136
- return minZ ;
137
- }
138
-
139
- public double getMaxZ () {
140
- return maxZ ;
141
- }
142
58
}
0 commit comments