forked from mapbox/mapbox-gl-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Java Annotation API cleaner mapbox#1716
- Loading branch information
Showing
11 changed files
with
166 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/AnnotationOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.mapbox.mapboxgl.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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,49 +2,34 @@ | |
|
||
import com.mapbox.mapboxgl.geometry.LatLng; | ||
|
||
/** | ||
* Created by Nicholas Hallahan on 7/13/15. | ||
* [email protected] | ||
*/ | ||
public class MarkerOptions { | ||
|
||
private Marker marker; | ||
public class MarkerOptions extends AnnotationOptions { | ||
|
||
public MarkerOptions() { | ||
marker = new Marker(); | ||
} | ||
|
||
public MarkerOptions alpha(float alpha) { | ||
marker.alpha = alpha; | ||
return this; | ||
annotation = new Marker(); | ||
} | ||
|
||
public MarkerOptions anchor(float u, float v) { | ||
marker.anchorU = u; | ||
marker.anchorV = v; | ||
((Marker)annotation).anchorU = u; | ||
((Marker)annotation).anchorV = v; | ||
return this; | ||
} | ||
|
||
public MarkerOptions draggable(boolean draggable) { | ||
marker.draggable = draggable; | ||
((Marker)annotation).draggable = draggable; | ||
return this; | ||
} | ||
|
||
public MarkerOptions flat(boolean flat) { | ||
marker.flat = flat; | ||
((Marker)annotation).flat = flat; | ||
return this; | ||
} | ||
|
||
public float getAlpha() { | ||
return marker.alpha; | ||
} | ||
|
||
public float getAnchorU() { | ||
return marker.anchorU; | ||
return ((Marker)annotation).anchorU; | ||
} | ||
|
||
public float getAnchorV() { | ||
return marker.anchorV; | ||
return ((Marker)annotation).anchorV; | ||
} | ||
|
||
// TODO: Implement this method of Google Maps Android API | ||
|
@@ -53,81 +38,82 @@ public float getAnchorV() { | |
// } | ||
|
||
public float getInfoWindowAnchorU() { | ||
return marker.infoWindowAnchorU; | ||
return ((Marker)annotation).infoWindowAnchorU; | ||
} | ||
|
||
public float getInfoWindowAnchorV() { | ||
return marker.infoWindowAnchorV; | ||
return ((Marker)annotation).infoWindowAnchorV; | ||
} | ||
|
||
public Marker getMarker() { | ||
return marker; | ||
return (Marker)annotation; | ||
} | ||
|
||
public LatLng getPosition() { | ||
return marker.position; | ||
return ((Marker)annotation).position; | ||
} | ||
|
||
public float getRotation() { | ||
return marker.rotation; | ||
return ((Marker)annotation).rotation; | ||
} | ||
|
||
public String getSnippet() { | ||
return marker.snippet; | ||
return ((Marker)annotation).snippet; | ||
} | ||
|
||
public String getTitle() { | ||
return marker.title; | ||
return ((Marker)annotation).title; | ||
} | ||
|
||
// TODO: Implement this method of Google Maps Android API | ||
// public MarkerOptions icon(BitmapDescriptor icon) { | ||
// | ||
// } | ||
|
||
public MarkerOptions infoWindowAnchor(float u, float v) { | ||
marker.infoWindowAnchorU = u; | ||
marker.infoWindowAnchorV = v; | ||
((Marker)annotation).infoWindowAnchorU = u; | ||
((Marker)annotation).infoWindowAnchorV = v; | ||
return this; | ||
} | ||
|
||
public boolean isDraggable() { | ||
return marker.draggable; | ||
return ((Marker)annotation).draggable; | ||
} | ||
|
||
public boolean isFlat() { | ||
return marker.flat; | ||
return ((Marker)annotation).flat; | ||
} | ||
|
||
public boolean isVisible() { | ||
return marker.visible; | ||
return ((Marker)annotation).visible; | ||
} | ||
|
||
public MarkerOptions position(LatLng position) { | ||
marker.position = position; | ||
((Marker)annotation).position = position; | ||
return this; | ||
} | ||
|
||
public MarkerOptions rotation(float rotation) { | ||
marker.rotation = rotation; | ||
((Marker)annotation).rotation = rotation; | ||
return this; | ||
} | ||
|
||
public MarkerOptions snippet(String snippet) { | ||
marker.snippet = snippet; | ||
((Marker)annotation).snippet = snippet; | ||
return this; | ||
} | ||
|
||
public MarkerOptions title(String title) { | ||
marker.title = title; | ||
((Marker)annotation).title = title; | ||
return this; | ||
} | ||
|
||
public MarkerOptions visible(boolean visible) { | ||
marker.visible = visible; | ||
annotation.visible = visible; | ||
return this; | ||
} | ||
|
||
|
||
// TODO: Implement this method of Google Maps Android API | ||
// public MarkerOptions icon(BitmapDescriptor icon) { | ||
// | ||
// } | ||
|
||
// TODO: Implement this method of Google Maps Android API | ||
// public void writeToParcel (Parcel out, int flags) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPointOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.mapbox.mapboxgl.annotations; | ||
|
||
import com.mapbox.mapboxgl.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(); | ||
} | ||
} |
Oops, something went wrong.