Merge branch 'master' into 1940-user-location-in-sdk

This commit is contained in:
Brad Leege
2015-08-05 15:52:53 -05:00
78 changed files with 1033 additions and 1035 deletions

View File

@@ -10,20 +10,19 @@ public abstract class Annotation {
*
* Internal C++ id is stored as unsigned int.
*/
protected Long id; // null unless added to a MapView
protected long id = -1; // -1 unless added to a MapView
private MapView mapView;
float alpha = 1;
float alpha = 1.0f;
boolean visible = true;
public Annotation() {}
public float getAlpha() {
return alpha;
}
public Long getId() {
public long getId() {
return id;
}
@@ -40,7 +39,7 @@ public abstract class Annotation {
this.alpha = alpha;
}
public void setId(Long id) {
public void setId(long id) {
this.id = id;
}

View File

@@ -314,7 +314,7 @@ public class MapView extends FrameLayout implements LocationListener {
public Marker addMarker(MarkerOptions markerOptions) {
Marker marker = markerOptions.getMarker();
Long id = mNativeMapView.addMarker(marker);
long id = mNativeMapView.addMarker(marker);
marker.setId(id); // the annotation needs to know its id
marker.setMapView(this); // the annotation needs to know which map view it is in
annotations.add(marker);
@@ -323,7 +323,7 @@ public class MapView extends FrameLayout implements LocationListener {
public Polyline addPolyline(PolylineOptions polylineOptions) {
Polyline polyline = polylineOptions.getPolyline();
Long id = mNativeMapView.addPolyline(polyline);
long id = mNativeMapView.addPolyline(polyline);
polyline.setId(id);
polyline.setMapView(this);
annotations.add(polyline);
@@ -332,7 +332,7 @@ public class MapView extends FrameLayout implements LocationListener {
public Polygon addPolygon(PolygonOptions polygonOptions) {
Polygon polygon = polygonOptions.getPolygon();
Long id = mNativeMapView.addPolygon(polygon);
long id = mNativeMapView.addPolygon(polygon);
polygon.setId(id);
polygon.setMapView(this);
annotations.add(polygon);
@@ -347,7 +347,7 @@ public class MapView extends FrameLayout implements LocationListener {
long[] ids = mNativeMapView.addPolygons(polygons);
for(int i=0; i<polygons.size(); i++) {
for(int i=0; i < polygons.size(); i++) {
polygons.get(i).setId(ids[i]);
polygons.get(i).setMapView(this);
annotations.add(polygons.get(i));
@@ -367,13 +367,9 @@ public class MapView extends FrameLayout implements LocationListener {
public void removeAnnotations() {
long[] ids = new long[annotations.size()];
for(int i=0; i<annotations.size(); i++) {
Long id = annotations.get(i).getId();
if(id == null) {
ids[i] = -1;
} else {
ids[i] = id;
}
for(int i = 0; i < annotations.size(); i++) {
long id = annotations.get(i).getId();
ids[i] = id;
}
mNativeMapView.removeAnnotations(ids);
}

View File

@@ -224,37 +224,6 @@ class NativeMapView {
nativeSetLatLng(mNativeMapViewPtr, latLng, duration);
}
public void setSprite(String symbol, int width, int height, float scale, byte[] pixels) {
nativeSetSprite(mNativeMapViewPtr, symbol, width, height, scale, pixels);
}
public long addMarker(Marker marker) {
return nativeAddMarker(mNativeMapViewPtr, marker);
}
public long addPolyline(Polyline polyline) {
// NH TODO Throw exception if returns -1
return nativeAddPolyline(mNativeMapViewPtr, polyline);
}
public long addPolygon(Polygon polygon) {
// NH TODO Throw exception if returns -1
return nativeAddPolygon(mNativeMapViewPtr, polygon);
}
public long[] addPolygons(List<Polygon> polygon) {
// NH TODO Throw exception if returns -1
return nativeAddPolygons(mNativeMapViewPtr, polygon);
}
public void removeAnnotation(long id) {
nativeRemoveAnnotation(mNativeMapViewPtr, id);
}
public void removeAnnotations(long[] ids) {
nativeRemoveAnnotations(mNativeMapViewPtr, ids);
}
public LatLng getLatLng() {
return nativeGetLatLng(mNativeMapViewPtr);
}
@@ -356,6 +325,34 @@ class NativeMapView {
nativeResetNorth(mNativeMapViewPtr);
}
public long addMarker(Marker marker) {
return nativeAddMarker(mNativeMapViewPtr, marker);
}
public long addPolyline(Polyline polyline) {
return nativeAddPolyline(mNativeMapViewPtr, polyline);
}
public long addPolygon(Polygon polygon) {
return nativeAddPolygon(mNativeMapViewPtr, polygon);
}
public long[] addPolygons(List<Polygon> polygon) {
return nativeAddPolygons(mNativeMapViewPtr, polygon);
}
public void removeAnnotation(long id) {
nativeRemoveAnnotation(mNativeMapViewPtr, id);
}
public void removeAnnotations(long[] ids) {
nativeRemoveAnnotations(mNativeMapViewPtr, ids);
}
public void setSprite(String symbol, int width, int height, float scale, byte[] pixels) {
nativeSetSprite(mNativeMapViewPtr, symbol, width, height, scale, pixels);
}
public void onLowMemory() {
nativeOnLowMemory(mNativeMapViewPtr);
}
@@ -392,7 +389,7 @@ class NativeMapView {
nativeSetReachability(mNativeMapViewPtr, status);
}
//public void getWorldBoundsMeters();
//public void ();
//public void getWorldBoundsLatLng();
@@ -507,21 +504,6 @@ class NativeMapView {
private native void nativeSetLatLng(long nativeMapViewPtr, LatLng latLng,
long duration);
private native void nativeSetSprite(long nativeMapViewPtr, String symbol,
int width, int height, float scale, byte[] pixels);
private native long nativeAddMarker(long nativeMapViewPtr, Marker marker);
private native long nativeAddPolyline(long nativeMapViewPtr, Polyline polyline);
private native long nativeAddPolygon(long mNativeMapViewPtr, Polygon polygon);
private native long[] nativeAddPolygons(long mNativeMapViewPtr, List<Polygon> polygon);
private native void nativeRemoveAnnotation(long nativeMapViewPtr, long id);
private native void nativeRemoveAnnotations(long nativeMapViewPtr, long[] id);
private native LatLng nativeGetLatLng(long nativeMapViewPtr);
private native void nativeResetPosition(long nativeMapViewPtr);
@@ -563,6 +545,21 @@ class NativeMapView {
private native void nativeResetNorth(long nativeMapViewPtr);
private native long nativeAddMarker(long nativeMapViewPtr, Marker marker);
private native long nativeAddPolyline(long nativeMapViewPtr, Polyline polyline);
private native long nativeAddPolygon(long mNativeMapViewPtr, Polygon polygon);
private native long[] nativeAddPolygons(long mNativeMapViewPtr, List<Polygon> polygon);
private native void nativeRemoveAnnotation(long nativeMapViewPtr, long id);
private native void nativeRemoveAnnotations(long nativeMapViewPtr, long[] id);
private native void nativeSetSprite(long nativeMapViewPtr, String symbol,
int width, int height, float scale, byte[] pixels);
private native void nativeOnLowMemory(long nativeMapViewPtr);
private native void nativeSetDebug(long nativeMapViewPtr, boolean debug);