Package com.graphhopper.util.shapes
Class BBox
java.lang.Object
com.graphhopper.util.shapes.BBox
A simple bounding box defined as follows: minLon, maxLon followed by minLat which is south(!) and
maxLat. Equally to EX_GeographicBoundingBox in the ISO 19115 standard see
http://osgeo-org.1560.n6.nabble.com/Boundingbox-issue-for-discussion-td3875533.html
Nice German overview: http://www.geoinf.uni-jena.de/fileadmin/Geoinformatik/Lehre/Diplomarbeiten/DA_Andres.pdf
- Author:
- Peter Karich
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBBox
(double[] coords) BBox
(double minLon, double maxLon, double minLat, double maxLat) BBox
(double minLon, double maxLon, double minLat, double maxLat, double minEle, double maxEle) BBox
(double minLon, double maxLon, double minLat, double maxLat, double minEle, double maxEle, boolean elevation) -
Method Summary
Modifier and TypeMethodDescriptioncalculateIntersection
(BBox bBox) Calculates the intersecting BBox between this and the specified BBoxclone()
boolean
contains
(double lat, double lon) boolean
static BBox
createInverse
(boolean elevation) Prefills BBox with minimum values so that it can increase.boolean
static BBox
fromEnvelope
(org.locationtech.jts.geom.Envelope envelope) static BBox
fromPoints
(double lat1, double lon1, double lat2, double lon2) boolean
int
hashCode()
boolean
intersects
(double minLon, double maxLon, double minLat, double maxLat) This method calculates if this BBox intersects with the specified BBoxboolean
intersects
(PointList pointList) boolean
intersects
(BBox o) This method calculates if this BBox intersects with the specified BBoxstatic boolean
intersects
(org.locationtech.jts.algorithm.RectangleLineIntersector intersector, PointList pointList) boolean
isValid()
static BBox
parseBBoxString
(String objectAsString) This method creates a BBox out of a string in format lon1,lon2,lat1,lat2static BBox
parseTwoPoints
(String objectAsString) This method creates a BBox out of a string in format lat1,lon1,lat2,lon2static org.locationtech.jts.geom.Envelope
toEnvelope
(BBox bbox) toString()
void
update
(double lat, double lon) void
update
(double lat, double lon, double elev)
-
Field Details
-
minLon
public double minLon -
maxLon
public double maxLon -
minLat
public double minLat -
maxLat
public double maxLat -
minEle
public double minEle -
maxEle
public double maxEle
-
-
Constructor Details
-
BBox
public BBox(double[] coords) -
BBox
public BBox(double minLon, double maxLon, double minLat, double maxLat) -
BBox
public BBox(double minLon, double maxLon, double minLat, double maxLat, double minEle, double maxEle) -
BBox
public BBox(double minLon, double maxLon, double minLat, double maxLat, double minEle, double maxEle, boolean elevation)
-
-
Method Details
-
createInverse
Prefills BBox with minimum values so that it can increase. -
hasElevation
public boolean hasElevation() -
update
public void update(double lat, double lon) -
update
public void update(double lat, double lon, double elev) -
calculateIntersection
Calculates the intersecting BBox between this and the specified BBox- Returns:
- the intersecting BBox or null if not intersecting
-
clone
-
intersects
public static boolean intersects(org.locationtech.jts.algorithm.RectangleLineIntersector intersector, PointList pointList) -
intersects
- Specified by:
intersects
in interfaceShape
-
intersects
public boolean intersects(double minLon, double maxLon, double minLat, double maxLat) This method calculates if this BBox intersects with the specified BBox -
intersects
This method calculates if this BBox intersects with the specified BBox -
contains
public boolean contains(double lat, double lon) -
contains
-
toString
-
toLessPrecisionString
-
getBounds
-
equals
-
hashCode
public int hashCode() -
isValid
public boolean isValid() -
toGeoJson
- Returns:
- array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even worse: lon,lat,ele
-
fromEnvelope
-
toEnvelope
-
parseTwoPoints
This method creates a BBox out of a string in format lat1,lon1,lat2,lon2 -
fromPoints
-
parseBBoxString
This method creates a BBox out of a string in format lon1,lon2,lat1,lat2
-