summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Hole.java53
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java15
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java28
3 files changed, 22 insertions, 74 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Hole.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Hole.java
deleted file mode 100644
index cabe16cc5c..0000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Hole.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.mapbox.mapboxsdk.annotations;
-
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.mapbox.mapboxsdk.geometry.LatLng;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Encapsulates a {@link List} of {@link LatLng} points defining a hole
- */
-public class Hole extends ArrayList<LatLng> implements Parcelable {
-
- public Hole() {
- super();
- }
-
- /**
- * Creates a Hole.
- *
- * @param holePoints {@link List} list of {@link LatLng} points defining a hole
- */
- public Hole(List<LatLng> holePoints) {
- super(holePoints);
- }
-
- protected Hole(Parcel in) {
- in.readTypedList(this, LatLng.CREATOR);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel parcel, int i) {
- parcel.writeTypedList(this);
- }
-
- public static final Parcelable.Creator<Hole> CREATOR = new Parcelable.Creator<Hole>() {
- public Hole createFromParcel(Parcel in) {
- return new Hole(in);
- }
-
- public Hole[] newArray(int size) {
- return new Hole[size];
- }
- };
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java
index 9245d9cdc8..dd2c37762a 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.annotations;
import android.graphics.Color;
+import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import java.util.ArrayList;
@@ -14,7 +15,7 @@ public final class Polygon extends BasePointCollection {
private int fillColor = Color.BLACK; // default fillColor is black
private int strokeColor = Color.BLACK; // default strokeColor is black
- private List<Hole> holes;
+ private List<List<LatLng>> holes;
Polygon() {
super();
@@ -42,9 +43,9 @@ public final class Polygon extends BasePointCollection {
/**
* Returns a copy of the holes.
*
- * @return A {@link List} of holes.
+ * @return A {@link List} of {@link List} of {@link LatLng} points making up the holes.
*/
- public List<Hole> getHoles() {
+ public List<List<LatLng>> getHoles() {
return new ArrayList<>(holes);
}
@@ -72,9 +73,9 @@ public final class Polygon extends BasePointCollection {
* Sets the holes of this polygon. This method will take a copy of the holes, so further
* mutations to holes will have no effect on this polygon.
*
- * @param holes A {@link List} of {@link Hole} points making up the holes.
+ * @param holes A {@link List} of {@link List} of {@link LatLng} points making up the holes.
*/
- public void setHoles(List<? extends Hole> holes) {
+ public void setHoles(List<? extends List<LatLng>> holes) {
this.holes = new ArrayList<>(holes);
update();
}
@@ -82,9 +83,9 @@ public final class Polygon extends BasePointCollection {
/**
* Add a hole to the polygon.
*
- * @param hole A {@link Hole} hole to be added.
+ * @param hole A {@link List} of {@link List} of {@link LatLng} points making up the hole to be added.
*/
- void addHole(Hole hole) {
+ void addHole(List<LatLng> hole) {
holes.add(hole);
update();
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java
index 7405ebfb4a..eaad25133e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java
@@ -27,11 +27,11 @@ public final class PolygonOptions implements Parcelable {
private PolygonOptions(Parcel in) {
polygon = new Polygon();
- ArrayList<LatLng> pointsList = new ArrayList<>();
+ List<LatLng> pointsList = new ArrayList<>();
in.readList(pointsList, LatLng.class.getClassLoader());
addAll(pointsList);
- ArrayList<Hole> holes = new ArrayList<>();
- in.readTypedList(holes, Hole.CREATOR);
+ List<List<LatLng>> holes = new ArrayList<>();
+ in.readList(holes, LatLng.class.getClassLoader());
addAllHoles(holes);
alpha(in.readFloat());
fillColor(in.readInt());
@@ -59,7 +59,7 @@ public final class PolygonOptions implements Parcelable {
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeList(getPoints());
- out.writeTypedList(getHoles());
+ out.writeList(getHoles());
out.writeFloat(getAlpha());
out.writeInt(getFillColor());
out.writeInt(getStrokeColor());
@@ -115,10 +115,10 @@ public final class PolygonOptions implements Parcelable {
/**
* Adds a hole to the outline of the polygon being built.
*
- * @param hole {@link Hole} list made up of {@link LatLng} points defining the hole
+ * @param hole {@link List} list made up of {@link LatLng} points defining the hole
* @return This {@link PolygonOptions} object with the given hole added to the outline.
*/
- public PolygonOptions addHole(Hole hole) {
+ public PolygonOptions addHole(List<LatLng> hole) {
polygon.addHole(hole);
return this;
}
@@ -126,11 +126,11 @@ public final class PolygonOptions implements Parcelable {
/**
* Adds holes to the outline of the polygon being built.
*
- * @param holes {@link Hole} holes to be added to polygon geometry.
+ * @param holes {@link List} list made up of {@link LatLng} holes to be added to polygon geometry
* @return This {@link PolygonOptions} object with the given holes added to the outline.
*/
- public PolygonOptions addHole(Hole... holes) {
- for (Hole hole : holes) {
+ public PolygonOptions addHole(List<LatLng>... holes) {
+ for (List<LatLng> hole : holes) {
addHole(hole);
}
return this;
@@ -139,11 +139,11 @@ public final class PolygonOptions implements Parcelable {
/**
* Adds holes to the outline of the polygon being built.
*
- * @param holes {@link Iterable} list made up of {@link Hole} holes defining the hole geometry
+ * @param holes {@link Iterable} list made up of {@link List} list of {@link LatLng} holes defining the hole geometry
* @return This {@link PolygonOptions} object with the given holes added to the outline.
*/
- public PolygonOptions addAllHoles(Iterable<Hole> holes) {
- for (Hole hole : holes) {
+ public PolygonOptions addAllHoles(Iterable<List<LatLng>> holes) {
+ for (List<LatLng> hole : holes) {
addHole(hole);
}
return this;
@@ -231,9 +231,9 @@ public final class PolygonOptions implements Parcelable {
/**
* Gets the holes set for this {@link PolygonOptions} object.
*
- * @return The list made up of {@link List} of {@link LatLng} points defining the holes.
+ * @return The list made up of {@link List} of {@link List} of {@link LatLng} points defining the holes.
*/
- public List<Hole> getHoles() {
+ public List<List<LatLng>> getHoles() {
return polygon.getHoles();
}