[android] #2631 - Removing AnnotationsOptions and MultiPointOptions in favor of concrete implementation

This commit is contained in:
Brad Leege
2015-10-16 17:43:34 -05:00
committed by Leith Bade
parent 053b9ae012
commit ace137beb1
6 changed files with 68 additions and 41 deletions

View File

@@ -1,22 +0,0 @@
package com.mapbox.mapboxsdk.annotations;
public abstract class AnnotationOptions {
protected Annotation annotation;
public AnnotationOptions() {}
public AnnotationOptions alpha(float alpha) {
annotation.alpha = alpha;
return this;
}
public float getAlpha() {
return annotation.alpha;
}
public boolean isVisible() {
return annotation.visible;
}
}

View File

@@ -9,7 +9,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
* https://github.com/mapbox/mapbox-gl-native/issues/1882
* https://github.com/mapbox/mapbox-gl-native/issues/1726
*/
public class CircleOptions extends AnnotationOptions {
public class CircleOptions {
private Circle circle;
@@ -61,4 +61,16 @@ public class CircleOptions extends AnnotationOptions {
return this;
}
public CircleOptions alpha(float alpha) {
circle.alpha = alpha;
return this;
}
public float getAlpha() {
return circle.alpha;
}
public boolean isVisible() {
return circle.visible;
}
}

View File

@@ -4,7 +4,9 @@ import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.mapbox.mapboxsdk.geometry.LatLng;
public class MarkerOptions extends AnnotationOptions {
public class MarkerOptions {
protected Annotation annotation;
public MarkerOptions() {
annotation = new Marker();
@@ -119,6 +121,14 @@ public class MarkerOptions extends AnnotationOptions {
return this;
}
public MarkerOptions alpha(float alpha) {
annotation.setAlpha(alpha);
return this;
}
public float getAlpha() {
return annotation.alpha;
}
// TODO: Implement this method of Google Maps Android API
// public MarkerOptions icon(BitmapDescriptor icon) {

View File

@@ -1,15 +0,0 @@
package com.mapbox.mapboxsdk.annotations;
import com.mapbox.mapboxsdk.geometry.LatLng;
import java.util.List;
public abstract class MultiPointOptions extends AnnotationOptions {
public MultiPointOptions() {}
public List<LatLng> getPoints() {
// the getter gives us a copy, which is the safe thing to do...
return ((MultiPoint)annotation).getPoints();
}
}

View File

@@ -6,7 +6,9 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
import java.util.ArrayList;
import java.util.List;
public class PolygonOptions extends MultiPointOptions {
public class PolygonOptions {
protected Annotation annotation;
public PolygonOptions() {
annotation = new Polygon();
@@ -47,6 +49,15 @@ public class PolygonOptions extends MultiPointOptions {
return this;
}
public PolygonOptions alpha(float alpha) {
annotation.alpha = alpha;
return this;
}
public float getAlpha() {
return annotation.alpha;
}
/**
* Sets the color of the polygon.
*
@@ -117,6 +128,15 @@ public class PolygonOptions extends MultiPointOptions {
return this;
}
public boolean isVisible() {
return annotation.visible;
}
public List<LatLng> getPoints() {
// the getter gives us a copy, which is the safe thing to do...
return ((MultiPoint)annotation).getPoints();
}
// TODO: Implement writeToParcel of Google Maps Android API
// public void writeToParcel(Parcel out, int flags) {
//

View File

@@ -2,7 +2,11 @@ package com.mapbox.mapboxsdk.annotations;
import com.mapbox.mapboxsdk.geometry.LatLng;
public class PolylineOptions extends MultiPointOptions {
import java.util.List;
public class PolylineOptions {
protected Annotation annotation;
public PolylineOptions() {
annotation = new Polyline();
@@ -27,6 +31,15 @@ public class PolylineOptions extends MultiPointOptions {
return this;
}
public PolylineOptions alpha(float alpha) {
annotation.alpha = alpha;
return this;
}
public float getAlpha() {
return annotation.alpha;
}
/**
* Sets the color of the polyline.
*
@@ -54,6 +67,10 @@ public class PolylineOptions extends MultiPointOptions {
return this;
}
public boolean isVisible() {
return annotation.visible;
}
/**
* Sets the width of the polyline.
*
@@ -65,6 +82,11 @@ public class PolylineOptions extends MultiPointOptions {
return this;
}
public List<LatLng> getPoints() {
// the getter gives us a copy, which is the safe thing to do...
return ((MultiPoint)annotation).getPoints();
}
// TODO: Implement writeToParcel of Google Maps Android API
// public void writeToParcel(Parcel out, int flags) {
//