summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2017-09-11 14:05:41 +0200
committerTobrun <tobrun@mapbox.com>2017-09-26 11:43:33 +0200
commit4ff9ce7486b51e00854508d4c6883a0f3f3413a0 (patch)
tree4edb52f1a80e4be306dc5197384966cebe18c3fe
parent6dbdf3aaeb8b1a18e989bc4e7672cb2d801b2426 (diff)
downloadqtlocation-mapboxgl-4ff9ce7486b51e00854508d4c6883a0f3f3413a0.tar.gz
[android] - avoid adding duplicate points to bounds
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java6
1 files changed, 4 insertions, 2 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 8b2ccffef1..4fcb91033c 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
@@ -450,7 +450,7 @@ public class LatLngBounds implements Parcelable {
*/
public Builder includes(List<LatLng> latLngs) {
for (LatLng point : latLngs) {
- latLngList.add(point);
+ include(point);
}
return this;
}
@@ -462,7 +462,9 @@ public class LatLngBounds implements Parcelable {
* @return this
*/
public Builder include(@NonNull LatLng latLng) {
- latLngList.add(latLng);
+ if (!latLngList.contains(latLng)) {
+ latLngList.add(latLng);
+ }
return this;
}
}