Class GeoBox
Class GeoBox
- java.lang.Object
-
- com.here.sdk.core.GeoBox
-
public final class GeoBox extends java.lang.ObjectRepresents a bounding rectangle aligned with latitude and longitude. Geographic area represented by this would be visualised as a rectangle when using a normal cylindrical projection (such as Mercator). The box has a maximum span of 360 degrees in longitude and 180 degrees in latitude direction. The box with equal values in longitude for the corners is considered as a span of 360 degrees. The box is considered empty if the latitude of the
southWestCorneris larger than the the latitude of thenorthEastCorner.
-
-
Field Summary
Fields Modifier and Type Field Description GeoCoordinatesnorthEastCornerNorth east corner coordinates.GeoCoordinatessouthWestCornerSouth west corner coordinates.
-
Constructor Summary
Constructors Constructor Description GeoBox(GeoCoordinates southWestCorner, GeoCoordinates northEastCorner)Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GeoBoxcontaining(java.util.List<GeoCoordinates> geoCoordinates)Creates aGeoBoxwhich encompases all coordinates from the list.booleancontains(GeoBox geoBox)Determines whether the specifiedGeoBoxis covered entirely by thisGeoBox.booleancontains(GeoCoordinates geoCoordinates)Determines whether the specified GeoCoordinates is contained within thisGeoBox.GeoBoxenvelope(GeoBox geoBox)Envelopes twoGeoBoxareas by returning the smallestGeoBoxcovering both this GeoBox and the specifiedGeoBox.static GeoBoxenvelopeGeoBoxes(java.util.List<GeoBox> geoBoxes)Envelopes the list ofGeoBoxareas by returning the smallestGeoBoxcovering all specifiedGeoBoxobjects.booleanequals(java.lang.Object obj)GeoBoxexpandedBy(double southMeters, double westMeters, double northMeters, double eastMeters)Creates aGeoBoxwhich is expanded by a fixed distance.inthashCode()java.util.List<GeoBox>intersection(GeoBox geoBox)Computes the intersection with the passedGeoBox.static java.util.List<GeoBox>intersection(java.util.List<GeoBox> geoBoxes)Computes intersection of list ofGeoBoxinstances.booleanintersects(GeoBox geoBox)Determines whether thisGeoBoxintersects with the passedGeoBox.
-
-
-
Field Detail
-
southWestCorner
@NonNull public final GeoCoordinates southWestCorner
South west corner coordinates.
-
northEastCorner
@NonNull public final GeoCoordinates northEastCorner
North east corner coordinates.
-
-
Constructor Detail
-
GeoBox
public GeoBox(@NonNull GeoCoordinates southWestCorner, @NonNull GeoCoordinates northEastCorner)Creates a new instance.
- Parameters:
southWestCorner-South west corner coordinates.
northEastCorner-North east corner coordinates.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
containing
@Nullable public static GeoBox containing(@NonNull java.util.List<GeoCoordinates> geoCoordinates)
Creates a
GeoBoxwhich encompases all coordinates from the list. The provided list must contain at least two points. The altitude values of the input coordinates are not considered for the result.- Parameters:
geoCoordinates-List of coordinates to encompass inside bounding box.
- Returns:
GeoBoxcontaining all supplied coordinates, ornullif less than two coordinates were provided.
-
envelope
@NonNull public GeoBox envelope(@NonNull GeoBox geoBox)
Envelopes two
GeoBoxareas by returning the smallestGeoBoxcovering both this GeoBox and the specifiedGeoBox.- Parameters:
geoBox-Another
GeoBoxto envelope with.- Returns:
GeoBoxcovering twoGeoBoxareas
-
envelopeGeoBoxes
@Nullable public static GeoBox envelopeGeoBoxes(@NonNull java.util.List<GeoBox> geoBoxes)
Envelopes the list of
GeoBoxareas by returning the smallestGeoBoxcovering all specifiedGeoBoxobjects.- Parameters:
geoBoxes-List of
GeoBoxobjects.- Returns:
GeoBoxcovering allGeoBoxareas, ornullif input is empty.
-
intersects
public boolean intersects(@NonNull GeoBox geoBox)Determines whether this
GeoBoxintersects with the passedGeoBox. The altitude values are ignored.- Parameters:
geoBox-A
GeoBoxto check for intersection.- Returns:
trueif intersects with theGeoBox,falseotherwise.
-
intersection
@NonNull public java.util.List<GeoBox> intersection(@NonNull GeoBox geoBox)
Computes the intersection with the passed
GeoBox. The altitude values are ignored. Limitation: Geo boxes are considered as non-intersecting if they overlap only on a single point, horizontal line or vertical line.Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
- Parameters:
geoBox-Another geo box to check intersection with.
- Returns:
It will be empty if there is no overlap. Otherwise, 1 or more geo boxes covering common area by this and passed
GeoBox.
-
intersection
@NonNull public static java.util.List<GeoBox> intersection(@NonNull java.util.List<GeoBox> geoBoxes)
Computes intersection of list of
GeoBoxinstances. The altitude values are ignored. Limitation: Geo boxes are considered as non-intersecting if they overlap only on a single point, horizontal line or vertical line.Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
contains
public boolean contains(@NonNull GeoBox geoBox)Determines whether the specified
GeoBoxis covered entirely by thisGeoBox. The altitude values are ignored.- Parameters:
geoBox-A
GeoBoxto check for containment within thisGeoBox.- Returns:
trueif covered by theGeoBox,falseotherwise.
-
contains
public boolean contains(@NonNull GeoCoordinates geoCoordinates)Determines whether the specified GeoCoordinates is contained within this
GeoBox. The altitude values are ignored.- Parameters:
geoCoordinates-A GeoCoordinates to check for containment within this
GeoBox.- Returns:
trueif contained within theGeoBox,falseotherwise.
-
expandedBy
@NonNull public GeoBox expandedBy(double southMeters, double westMeters, double northMeters, double eastMeters) throws InstantiationErrorException
Creates a
GeoBoxwhich is expanded by a fixed distance. Throws an InstantiationError if it is not possible to create a validGeoBoxwith the given arguments.- Parameters:
southMeters-Distance in the south direction in meters to expand the
GeoBox.westMeters-Distance in the west direction in meters to expand the
GeoBox.northMeters-Distance in the north direction in meters to expand the
GeoBox.eastMeters-Distance in the east direction in meters to expand the
GeoBox.- Returns:
The expanded
GeoBox.- Throws:
InstantiationErrorException-Instantiation error.
-
-