public class BBox extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private double |
xmax |
private double |
xmin |
private double |
ymax |
private double |
ymin |
Constructor and Description |
---|
BBox(BBox copy)
Constructs a new
BBox from another one. |
BBox(double x,
double y)
Constructs a new
BBox defined by a single point. |
BBox(double ax,
double ay,
double bx,
double by) |
BBox(LatLon a,
LatLon b)
Constructs a new
BBox defined by points a and b . |
BBox(Node n) |
BBox(Way w) |
Modifier and Type | Method and Description |
---|---|
void |
add(BBox box) |
void |
add(double x,
double y)
Extends this bbox to include the point (x, y)
|
void |
add(LatLon c) |
void |
addPrimitive(OsmPrimitive primitive,
double extraSpace) |
boolean |
bounds(BBox b)
Tests, whether the bbox
b lies completely inside this bbox. |
boolean |
bounds(LatLon c)
Tests, whether the Point
c lies within the bbox. |
boolean |
equals(java.lang.Object o) |
LatLon |
getBottomRight()
Returns the bottom-right point.
|
double |
getBottomRightLat()
Returns the latitude of bottom-right point.
|
double |
getBottomRightLon()
Returns the longitude of bottom-right point.
|
LatLon |
getCenter() |
(package private) int |
getIndex(int level) |
LatLon |
getTopLeft()
Returns the top-left point.
|
double |
getTopLeftLat()
Returns the latitude of top-left point.
|
double |
getTopLeftLon()
Returns the longitude of top-left point.
|
int |
hashCode() |
double |
height() |
boolean |
intersects(BBox b)
Tests, whether two BBoxes intersect as an area.
|
private void |
sanity() |
java.awt.geom.Rectangle2D |
toRectangle() |
java.lang.String |
toString() |
java.lang.String |
toStringCSV(java.lang.String separator) |
double |
width() |
private double xmin
private double xmax
private double ymin
private double ymax
public BBox(double x, double y)
BBox
defined by a single point.x
- X coordinatey
- Y coordinatepublic BBox(LatLon a, LatLon b)
BBox
defined by points a
and b
.
Result is minimal BBox containing both points.a
- first pointb
- second pointpublic BBox(BBox copy)
BBox
from another one.copy
- the BBox to copypublic BBox(double ax, double ay, double bx, double by)
private void sanity()
public final void add(double x, double y)
x
- X coordinatey
- Y coordinatepublic void addPrimitive(OsmPrimitive primitive, double extraSpace)
public double height()
public double width()
public boolean bounds(BBox b)
b
lies completely inside this bbox.b
- bounding boxtrue
if b
lies completely inside this bboxpublic boolean bounds(LatLon c)
c
lies within the bbox.c
- pointtrue
if c
lies within the bboxpublic boolean intersects(BBox b)
b
- other bounding boxtrue
if this bbox intersects with the otherpublic LatLon getTopLeft()
public double getTopLeftLat()
public double getTopLeftLon()
public LatLon getBottomRight()
public double getBottomRightLat()
public double getBottomRightLon()
int getIndex(int level)
public java.awt.geom.Rectangle2D toRectangle()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringCSV(java.lang.String separator)