working on pollens #1716

This commit is contained in:
Nicholas Hallahan
2015-07-15 10:36:24 -07:00
parent 82e88a6a77
commit 297190ecf1
2 changed files with 12 additions and 3 deletions

View File

@@ -216,8 +216,8 @@ public class MapView extends SurfaceView {
public Marker addMarker(MarkerOptions markerOptions) {
Marker marker = markerOptions.getMarker();
Long markerId = mNativeMapView.addMarker(marker);
marker.setId(markerId); // the annotation needs to know its id
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);
return marker;
@@ -225,7 +225,10 @@ public class MapView extends SurfaceView {
public Polyline addPolyline(PolylineOptions polylineOptions) {
Polyline polyline = polylineOptions.getPolyline();
Long id = mNativeMapView.addPolyline(polyline);
polyline.setId(id);
polyline.setMapView(this);
annotations.add(polyline);
return polyline;
}

View File

@@ -4,6 +4,7 @@ import android.graphics.PointF;
import android.view.Surface;
import com.mapbox.mapboxgl.annotations.Marker;
import com.mapbox.mapboxgl.annotations.Polyline;
import com.mapbox.mapboxgl.geometry.LatLng;
import com.mapbox.mapboxgl.geometry.LatLngZoom;
import com.mapbox.mapboxgl.geometry.ProjectedMeters;
@@ -219,6 +220,11 @@ class NativeMapView {
return nativeAddMarker(mNativeMapViewPtr, latLng);
}
public long addPolyline(Polyline polyline) {
return -1;
}
public void removeAnnotation(long id) {
nativeRemoveAnnotation(mNativeMapViewPtr, id);
}