@Test public void testIntersect() { OSHDBBoundingBox first = new OSHDBBoundingBox(0.0, 89.0, 1.0, 90.0); OSHDBBoundingBox second = new OSHDBBoundingBox(0.0, 89.9, 2.0, 90.0); OSHDBBoundingBox expResult = new OSHDBBoundingBox(0.0, 89.9, 1.0, 90.0); OSHDBBoundingBox result = OSHDBBoundingBox.intersect(first, second); assertEquals(expResult, result); }
public static OSHDBBoundingBox intersect(OSHDBBoundingBox first, OSHDBBoundingBox second) { return new OSHDBBoundingBox( Math.max(first.minLon, second.minLon), Math.max(first.minLat, second.minLat), Math.min(first.maxLon, second.maxLon), Math.min(first.maxLat, second.maxLat) ); }
OSHDBBoundingBox implements Serializable { public static OSHDBBoundingBox intersect(OSHDBBoundingBox first, OSHDBBoundingBox second) { return new OSHDBBoundingBox( Math.max(first.minLon, second.minLon), Math.max(first.minLat, second.minLat), Math.min(first.maxLon, second.maxLon), Math.min(first.maxLat, second.maxLat) ); } }
OSHDBBoundingBox implements Serializable { public static OSHDBBoundingBox intersect(OSHDBBoundingBox first, OSHDBBoundingBox second) { return new OSHDBBoundingBox( Math.max(first.minLon, second.minLon), Math.max(first.minLat, second.minLat), Math.min(first.maxLon, second.maxLon), Math.min(first.maxLat, second.maxLat) ); } OSHDBBoundingBox(long minLon, long minLat, long maxLon, long maxLat);  OSHDBBoundingBox(double minLon, double minLat, double maxLon, double maxLat);  OSHDBBoundingBox(int minLon, int minLat, int maxLon, int maxLat); }
OSHDBBoundingBox implements Serializable { public static OSHDBBoundingBox intersect(OSHDBBoundingBox first, OSHDBBoundingBox second) { return new OSHDBBoundingBox( Math.max(first.minLon, second.minLon), Math.max(first.minLat, second.minLat), Math.min(first.maxLon, second.maxLon), Math.min(first.maxLat, second.maxLat) ); } OSHDBBoundingBox(long minLon, long minLat, long maxLon, long maxLat);  OSHDBBoundingBox(double minLon, double minLat, double maxLon, double maxLat);  OSHDBBoundingBox(int minLon, int minLat, int maxLon, int maxLat); static OSHDBBoundingBox intersect(OSHDBBoundingBox first, OSHDBBoundingBox second); static OVERLAP overlap(OSHDBBoundingBox a, OSHDBBoundingBox b); void set(long minLon, long minLat, long maxLon, long maxLat); void set(OSHDBBoundingBox bbox); void add(OSHDBBoundingBox bbox); double getMinLon(); long getMinLonLong(); double getMaxLon(); long getMaxLonLong(); double getMinLat(); long getMinLatLong(); double getMaxLat(); long getMaxLatLong(); long[] getLon(); long[] getLat(); boolean intersects(OSHDBBoundingBox otherBbox); boolean isInside(OSHDBBoundingBox otherBbox); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); boolean isPoint(); boolean isValid(); }
OSHDBBoundingBox implements Serializable { public static OSHDBBoundingBox intersect(OSHDBBoundingBox first, OSHDBBoundingBox second) { return new OSHDBBoundingBox( Math.max(first.minLon, second.minLon), Math.max(first.minLat, second.minLat), Math.min(first.maxLon, second.maxLon), Math.min(first.maxLat, second.maxLat) ); } OSHDBBoundingBox(long minLon, long minLat, long maxLon, long maxLat);  OSHDBBoundingBox(double minLon, double minLat, double maxLon, double maxLat);  OSHDBBoundingBox(int minLon, int minLat, int maxLon, int maxLat); static OSHDBBoundingBox intersect(OSHDBBoundingBox first, OSHDBBoundingBox second); static OVERLAP overlap(OSHDBBoundingBox a, OSHDBBoundingBox b); void set(long minLon, long minLat, long maxLon, long maxLat); void set(OSHDBBoundingBox bbox); void add(OSHDBBoundingBox bbox); double getMinLon(); long getMinLonLong(); double getMaxLon(); long getMaxLonLong(); double getMinLat(); long getMinLatLong(); double getMaxLat(); long getMaxLatLong(); long[] getLon(); long[] getLat(); boolean intersects(OSHDBBoundingBox otherBbox); boolean isInside(OSHDBBoundingBox otherBbox); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); boolean isPoint(); boolean isValid(); static final OSHDBBoundingBox EMPTY; static final OSHDBBoundingBox INVALID; }