public final class Bounds extends Geometry implements AutoCloseable
GeometryFactory#createBounds
,
Bounds#Bounds
Constructor and Description |
---|
Bounds(Bounds other) |
Bounds(CoordinateReference reference,
Coordinate lowerLeft,
Coordinate upperRight)
Creates a new bounds instance based on lower left and upper right corners.
|
Bounds(CoordinateReference reference,
Coordinate location,
double width,
double height,
double depth)
Creates a new bounds instance based on a point, and the width, height and depth with respect to that point.
|
Modifier and Type | Method and Description |
---|---|
static Bounds |
boundsUnion(Bounds bounds1,
Bounds bounds2)
Returns the union of the two bounds objects, provided they are defined in the same coordinate reference.
|
void |
close() |
static boolean |
contains2D(Bounds bounds1,
Bounds bounds2)
Checks if the first bounds contains the second bounds, only considering x and y values.
|
static boolean |
contains2D(Bounds bounds1,
Bounds bounds2,
double eps)
Checks if the first bounds contains the second bounds, only considering x and y values.
|
static boolean |
contains2D(Bounds bounds,
Coordinate coordinate)
Checks if this bounds contains the specified coordinate, considering only the x and y values.
|
static boolean |
contains2D(Bounds bounds,
Coordinate coordinate,
double eps)
Checks if this bounds contains the specified coordinate, considering only the x and y values.
|
static boolean |
contains3D(Bounds bounds,
Coordinate coordinate)
Checks if the first bounds contains the second bounds.
|
static boolean |
contains3D(Bounds bounds,
Coordinate coordinate,
double eps)
Checks if the first bounds contains the second bounds.
|
boolean |
equals(Object other) |
protected void |
finalize() |
Coordinate |
getCenter()
Returns the center of this bounds instance.
|
double |
getDepth()
Returns the depth of this bounds instance.
|
double |
getHeight()
Returns the height of this bounds instance.
|
Coordinate |
getLocation()
Returns the lower left corner of this bounds instance.
|
Coordinate |
getLowerLeftCorner()
Returns the lower left corner of this bounds instance.
|
Coordinate |
getLowerRightCorner()
Returns the lower right corner of this bounds instance.
|
Coordinate |
getUpperLeftCorner()
Returns the upper left corner of this bounds instance.
|
Coordinate |
getUpperRightCorner()
Returns the upper right corner of this bounds instance.
|
double |
getWidth()
Returns the width of this bounds instance.
|
int |
hashCode() |
static boolean |
interacts2D(Bounds bounds1,
Bounds bounds2)
Checks of two given bounds geometries have an interaction, only considering x and y values.
|
static boolean |
interacts2D(Bounds bounds1,
Bounds bounds2,
double eps)
Checks of two given bounds geometries have an interaction, only considering x and y values.
|
static Bounds |
intersection2D(Bounds bounds1,
Bounds bounds2)
Returns the intersection of the two given bounds geometries.
|
getBounds, getReference
public Bounds(@NotNull Bounds other)
public Bounds(@NotNull CoordinateReference reference, @NotNull Coordinate location, double width, double height, double depth)
reference
- the coordinate referencelocation
- the lower left location of the boundswidth
- the widthheight
- the heightdepth
- the depthpublic Bounds(@NotNull CoordinateReference reference, @NotNull Coordinate lowerLeft, @NotNull Coordinate upperRight)
This method takes wrap-around the 180° meridian into account when the coordinate reference is geodetic.
reference
- the coordinate referencelowerLeft
- the lower left corner of the boundsupperRight
- the upper right corner of the boundspublic void close()
close
in interface AutoCloseable
close
in class Geometry
@NotNull public Coordinate getLocation()
public double getWidth()
public double getHeight()
public double getDepth()
@NotNull public Coordinate getCenter()
When this bounds uses a geodetic reference, this method normalizes the result.
@NotNull public Coordinate getLowerLeftCorner()
When this bounds uses a geodetic reference, this method normalizes the result.
@NotNull public Coordinate getLowerRightCorner()
When this bounds uses a geodetic reference, this method normalizes the result.
@NotNull public Coordinate getUpperLeftCorner()
When this bounds uses a geodetic reference, this method normalizes the result.
@NotNull public Coordinate getUpperRightCorner()
When this bounds uses a geodetic reference, this method normalizes the result.
@NotNull public static Bounds boundsUnion(@NotNull Bounds bounds1, @NotNull Bounds bounds2) throws IllegalArgumentException
bounds1
- the first bounds.bounds2
- the second bounds.IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.@Nullable public static Bounds intersection2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2)
bounds1
- a bounds instancebounds2
- an other bounds instancepublic static boolean interacts2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2, double eps) throws IllegalArgumentException
bounds1
- the first bounds.bounds2
- the second bounds.eps
- a tolerance for the interaction check.IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.public static boolean interacts2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2) throws IllegalArgumentException
bounds1
- the first bounds.bounds2
- the second bounds.IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.public static boolean contains2D(@NotNull Bounds bounds, @NotNull Coordinate coordinate, double eps)
public static boolean contains2D(@NotNull Bounds bounds, @NotNull Coordinate coordinate)
public static boolean contains2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2, double eps) throws IllegalArgumentException
bounds1
- a bounds instance.bounds2
- an other bounds instance.eps
- a tolerance for the contains check.IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.public static boolean contains2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2) throws IllegalArgumentException
bounds1
- a bounds instance.bounds2
- an other bounds instance.IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.public static boolean contains3D(@NotNull Bounds bounds, @NotNull Coordinate coordinate, double eps)
bounds
- a bounds instance.coordinate
- a coordinate.eps
- a tolerance for the contains check.public static boolean contains3D(@NotNull Bounds bounds, @NotNull Coordinate coordinate)
bounds
- a bounds instance.coordinate
- a coordinate.