@Test public void generateBBoxFromMultiple() { BBox[] bboxes = { new BBox(1.5, 2.5, -1.5, 1.5, 10, 20), new BBox(2.6, 8.5, -0.5, 1.7, 5, 25) }; BBox bbox = GeomUtility.generateBoundingFromMultiple(bboxes); Assert.assertEquals(-1.5, bbox.minLat, 0); Assert.assertEquals(1.7, bbox.maxLat, 0); Assert.assertEquals(1.5, bbox.minLon, 0); Assert.assertEquals(8.5, bbox.maxLon, 0); Assert.assertEquals(5, bbox.minEle, 0); Assert.assertEquals(25, bbox.maxEle, 0); }
public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); }
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); } }
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); } private  GeomUtility(); }
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); } private  GeomUtility(); static LineString createLinestring(Coordinate[] coords); static BBox calculateBoundingBox(PointList pointList); static BBox generateBoundingFromMultiple(BBox[] boundingBoxes); static double getLength(Geometry geom, boolean inMeters); static double metresToDegrees(double metres); static double getArea(Geometry geom, boolean inMeters); static double calculateMaxExtent(Geometry geom); }
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); } private  GeomUtility(); static LineString createLinestring(Coordinate[] coords); static BBox calculateBoundingBox(PointList pointList); static BBox generateBoundingFromMultiple(BBox[] boundingBoxes); static double getLength(Geometry geom, boolean inMeters); static double metresToDegrees(double metres); static double getArea(Geometry geom, boolean inMeters); static double calculateMaxExtent(Geometry geom);  }