summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java
index 76036c475e..ca39c99c4a 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java
@@ -68,6 +68,7 @@ public class LatLngBounds implements Parcelable {
*
* @return LatLng center of this LatLngBounds
*/
+ @NonNull
public LatLng getCenter() {
double latCenter = (this.latitudeNorth + this.latitudeSouth) / 2.0;
double longCenter;
@@ -126,6 +127,7 @@ public class LatLngBounds implements Parcelable {
*
* @return LatLng of the south west corner
*/
+ @NonNull
public LatLng getSouthWest() {
return new LatLng(latitudeSouth, longitudeWest);
}
@@ -135,6 +137,7 @@ public class LatLngBounds implements Parcelable {
*
* @return LatLng of the north east corner
*/
+ @NonNull
public LatLng getNorthEast() {
return new LatLng(latitudeNorth, longitudeEast);
}
@@ -144,6 +147,7 @@ public class LatLngBounds implements Parcelable {
*
* @return LatLng of the south east corner
*/
+ @NonNull
public LatLng getSouthEast() {
return new LatLng(latitudeSouth, longitudeEast);
}
@@ -153,6 +157,7 @@ public class LatLngBounds implements Parcelable {
*
* @return LatLng of the north west corner
*/
+ @NonNull
public LatLng getNorthWest() {
return new LatLng(latitudeNorth, longitudeWest);
}
@@ -162,6 +167,7 @@ public class LatLngBounds implements Parcelable {
*
* @return LatLngSpan area
*/
+ @NonNull
public LatLngSpan getSpan() {
return new LatLngSpan(getLatitudeSpan(), getLongitudeSpan());
}
@@ -216,6 +222,7 @@ public class LatLngBounds implements Parcelable {
*
* @return the string representation
*/
+ @NonNull
@Override
public String toString() {
return "N:" + this.latitudeNorth + "; E:" + this.longitudeEast + "; S:" + this.latitudeSouth
@@ -276,6 +283,7 @@ public class LatLngBounds implements Parcelable {
*
* @return an array of 2 LatLng objects.
*/
+ @NonNull
public LatLng[] toLatLngs() {
return new LatLng[] {getNorthEast(), getSouthWest()};
}
@@ -365,7 +373,8 @@ public class LatLngBounds implements Parcelable {
* @param latLng the latitude lognitude pair to include in the bounds.
* @return the newly constructed bounds
*/
- public LatLngBounds include(LatLng latLng) {
+ @NonNull
+ public LatLngBounds include(@NonNull LatLng latLng) {
return new LatLngBounds.Builder()
.include(getNorthEast())
.include(getSouthWest())
@@ -418,7 +427,7 @@ public class LatLngBounds implements Parcelable {
* @param latLng the point which may be contained
* @return true, if the point is contained within the bounds
*/
- public boolean contains(final LatLng latLng) {
+ public boolean contains(@NonNull final LatLng latLng) {
return containsLatitude(latLng.getLatitude())
&& containsLongitude(latLng.getLongitude());
}
@@ -429,7 +438,7 @@ public class LatLngBounds implements Parcelable {
* @param other the bounds which may be contained
* @return true, if the bounds is contained within the bounds
*/
- public boolean contains(final LatLngBounds other) {
+ public boolean contains(@NonNull final LatLngBounds other) {
return contains(other.getNorthEast())
&& contains(other.getSouthWest());
}
@@ -629,7 +638,7 @@ public class LatLngBounds implements Parcelable {
public static final Parcelable.Creator<LatLngBounds> CREATOR =
new Parcelable.Creator<LatLngBounds>() {
@Override
- public LatLngBounds createFromParcel(final Parcel in) {
+ public LatLngBounds createFromParcel(@NonNull final Parcel in) {
return readFromParcel(in);
}
@@ -669,7 +678,7 @@ public class LatLngBounds implements Parcelable {
* @param flags Additional flags about how the object should be written
*/
@Override
- public void writeToParcel(final Parcel out, final int flags) {
+ public void writeToParcel(@NonNull final Parcel out, final int flags) {
out.writeDouble(this.latitudeNorth);
out.writeDouble(this.longitudeEast);
out.writeDouble(this.latitudeSouth);
@@ -712,7 +721,8 @@ public class LatLngBounds implements Parcelable {
* @param latLngs the List of LatLng objects to be added
* @return this
*/
- public Builder includes(List<LatLng> latLngs) {
+ @NonNull
+ public Builder includes(@NonNull List<LatLng> latLngs) {
latLngList.addAll(latLngs);
return this;
}
@@ -723,6 +733,7 @@ public class LatLngBounds implements Parcelable {
* @param latLng the LatLng to be added
* @return this
*/
+ @NonNull
public Builder include(@NonNull LatLng latLng) {
latLngList.add(latLng);
return this;