react-native-maps 1.21.0-alpha.83 → 1.21.0-alpha.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -322,10 +322,6 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
322
322
|
((MapMarker) child).setImageLoadedListener((uri, drawable, b) -> {
|
|
323
323
|
parent.addFeature(child, parent.getFeatureCount());
|
|
324
324
|
});
|
|
325
|
-
// } else if (child instanceof MapOverlay && ((MapOverlay) child).isLoadingImage()){
|
|
326
|
-
// ((MapOverlay) child).setImageLoadedListener((uri, drawable, b) -> {
|
|
327
|
-
// parent.addFeature(child, parent.getFeatureCount());
|
|
328
|
-
// });
|
|
329
325
|
} else {
|
|
330
326
|
parent.addFeature(child, index);
|
|
331
327
|
}
|
|
@@ -84,7 +84,8 @@ public class OverlayManager extends ViewGroupManager<MapOverlay> implements RNMa
|
|
|
84
84
|
|
|
85
85
|
@Override
|
|
86
86
|
public void setOpacity(MapOverlay view, float value) {
|
|
87
|
-
|
|
87
|
+
// todo report to google that it's not working / fix it
|
|
88
|
+
// view.setTransparency(value);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
@Override
|
|
@@ -2,28 +2,21 @@ package com.rnmaps.maps;
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.graphics.Bitmap;
|
|
5
|
-
import android.graphics.BitmapFactory;
|
|
6
|
-
import android.graphics.Canvas;
|
|
7
|
-
import android.graphics.drawable.Animatable;
|
|
8
|
-
import android.graphics.drawable.Drawable;
|
|
9
5
|
import android.net.Uri;
|
|
10
|
-
|
|
11
|
-
import
|
|
6
|
+
import android.os.Handler;
|
|
7
|
+
import android.os.Looper;
|
|
12
8
|
|
|
13
9
|
import com.facebook.common.references.CloseableReference;
|
|
10
|
+
import com.facebook.datasource.BaseDataSubscriber;
|
|
14
11
|
import com.facebook.datasource.DataSource;
|
|
12
|
+
import com.facebook.datasource.DataSubscriber;
|
|
15
13
|
import com.facebook.drawee.backends.pipeline.Fresco;
|
|
16
|
-
import com.facebook.drawee.controller.BaseControllerListener;
|
|
17
|
-
import com.facebook.drawee.controller.ControllerListener;
|
|
18
14
|
import com.facebook.drawee.drawable.ScalingUtils;
|
|
19
15
|
import com.facebook.drawee.generic.GenericDraweeHierarchy;
|
|
20
16
|
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
|
|
21
|
-
import com.facebook.drawee.interfaces.DraweeController;
|
|
22
|
-
import com.facebook.drawee.view.DraweeHolder;
|
|
23
17
|
import com.facebook.imagepipeline.core.ImagePipeline;
|
|
18
|
+
import com.facebook.imagepipeline.image.CloseableBitmap;
|
|
24
19
|
import com.facebook.imagepipeline.image.CloseableImage;
|
|
25
|
-
import com.facebook.imagepipeline.image.CloseableStaticBitmap;
|
|
26
|
-
import com.facebook.imagepipeline.image.ImageInfo;
|
|
27
20
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
28
21
|
import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
|
29
22
|
import com.facebook.react.bridge.ReadableArray;
|
|
@@ -39,300 +32,251 @@ import com.google.maps.android.collections.GroundOverlayManager;
|
|
|
39
32
|
import com.rnmaps.fabric.event.OnPressEvent;
|
|
40
33
|
|
|
41
34
|
import java.util.Map;
|
|
35
|
+
import java.util.concurrent.Executors;
|
|
36
|
+
|
|
37
|
+
public class MapOverlay extends MapFeature {
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
private String imageUri;
|
|
41
|
+
|
|
42
|
+
private GroundOverlayOptions groundOverlayOptions;
|
|
43
|
+
private GroundOverlay groundOverlay;
|
|
44
|
+
private LatLngBounds bounds;
|
|
45
|
+
private float bearing;
|
|
46
|
+
private BitmapDescriptor bitmapDescriptor;
|
|
47
|
+
private boolean tappable;
|
|
48
|
+
private float zIndex;
|
|
49
|
+
private float transparency;
|
|
50
|
+
|
|
51
|
+
private DataSource<CloseableReference<CloseableImage>> dataSource;
|
|
52
|
+
|
|
53
|
+
private GroundOverlayManager.Collection groundOverlayCollection;
|
|
54
|
+
|
|
55
|
+
private ImageManager.OnImageLoadedListener imageLoadedListener;
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
private final DraweeHolder<?> logoHolder;
|
|
65
|
-
private ImageManager.OnImageLoadedListener imageLoadedListener;
|
|
66
|
-
|
|
67
|
-
public boolean isLoadingImage() {
|
|
68
|
-
return loadingImage;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public ImageManager.OnImageLoadedListener getImageLoadedListener() {
|
|
72
|
-
return imageLoadedListener;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public void setImageLoadedListener(ImageManager.OnImageLoadedListener imageLoadedListener) {
|
|
76
|
-
this.imageLoadedListener = imageLoadedListener;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
public MapOverlay(Context context) {
|
|
81
|
-
super(context);
|
|
82
|
-
this.mImageReader = new ImageReader(context, getResources(), this);
|
|
83
|
-
logoHolder = DraweeHolder.create(createDraweeHierarchy(), context);
|
|
84
|
-
logoHolder.onAttach();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private GenericDraweeHierarchy createDraweeHierarchy() {
|
|
88
|
-
return new GenericDraweeHierarchyBuilder(getResources())
|
|
89
|
-
.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
|
|
90
|
-
.setFadeDuration(0)
|
|
91
|
-
.build();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
private final ControllerListener<ImageInfo> mLogoControllerListener =
|
|
95
|
-
new BaseControllerListener<ImageInfo>() {
|
|
96
|
-
@Override
|
|
97
|
-
public void onSubmit(String id, Object callerContext){
|
|
98
|
-
loadingImage = true;
|
|
99
|
-
}
|
|
100
|
-
@Override
|
|
101
|
-
public void onFinalImageSet(
|
|
102
|
-
String id,
|
|
103
|
-
@Nullable final ImageInfo imageInfo,
|
|
104
|
-
@Nullable Animatable animatable) {
|
|
105
|
-
CloseableReference<CloseableImage> imageReference = null;
|
|
106
|
-
try {
|
|
107
|
-
imageReference = dataSource.getResult();
|
|
108
|
-
if (imageReference != null) {
|
|
109
|
-
CloseableImage image = imageReference.get();
|
|
110
|
-
if (image instanceof CloseableStaticBitmap) {
|
|
111
|
-
CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
|
|
112
|
-
Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
|
|
113
|
-
if (bitmap != null) {
|
|
114
|
-
bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
|
|
115
|
-
iconBitmap = bitmap;
|
|
116
|
-
iconBitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
} finally {
|
|
121
|
-
dataSource.close();
|
|
122
|
-
if (imageReference != null) {
|
|
123
|
-
CloseableReference.closeSafely(imageReference);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
loadingImage = false;
|
|
128
|
-
if (imageLoadedListener != null){
|
|
129
|
-
imageLoadedListener.onImageLoaded(null, null, false);
|
|
130
|
-
// fire and forget
|
|
131
|
-
imageLoadedListener = null;
|
|
132
|
-
}
|
|
133
|
-
update();
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
// seems like apple users north west, south east
|
|
138
|
-
// google uses north east, south west
|
|
139
|
-
private static LatLngBounds fixBoundsIfNecessary(ReadableArray bounds){
|
|
140
|
-
double lat1 = bounds.getArray(0).getDouble(0);
|
|
141
|
-
double lon1 = bounds.getArray(0).getDouble(1);
|
|
142
|
-
double lat2 = bounds.getArray(1).getDouble(0);
|
|
143
|
-
double lon2 = bounds.getArray(1).getDouble(1);
|
|
57
|
+
|
|
58
|
+
public MapOverlay(Context context) {
|
|
59
|
+
super(context);
|
|
60
|
+
transparency = 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private GenericDraweeHierarchy createDraweeHierarchy() {
|
|
64
|
+
return new GenericDraweeHierarchyBuilder(getResources())
|
|
65
|
+
.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
|
|
66
|
+
.setFadeDuration(0)
|
|
67
|
+
.build();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// seems like apple users north west, south east
|
|
72
|
+
// google uses north east, south west
|
|
73
|
+
private static LatLngBounds fixBoundsIfNecessary(ReadableArray bounds) {
|
|
74
|
+
double lat1 = bounds.getArray(0).getDouble(0);
|
|
75
|
+
double lon1 = bounds.getArray(0).getDouble(1);
|
|
76
|
+
double lat2 = bounds.getArray(1).getDouble(0);
|
|
77
|
+
double lon2 = bounds.getArray(1).getDouble(1);
|
|
144
78
|
|
|
145
79
|
// Ensure lat1/lon1 is the SW corner and lat2/lon2 is the NE corner
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
80
|
+
double southLat = Math.min(lat1, lat2);
|
|
81
|
+
double northLat = Math.max(lat1, lat2);
|
|
82
|
+
double westLon = Math.min(lon1, lon2);
|
|
83
|
+
double eastLon = Math.max(lon1, lon2);
|
|
150
84
|
|
|
151
85
|
// Create corrected LatLngs
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
86
|
+
LatLng sw = new LatLng(southLat, westLon);
|
|
87
|
+
LatLng ne = new LatLng(northLat, eastLon);
|
|
88
|
+
return new LatLngBounds(sw, ne);
|
|
89
|
+
}
|
|
156
90
|
|
|
157
|
-
|
|
91
|
+
public void setBounds(ReadableArray bounds) {
|
|
158
92
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
93
|
+
this.bounds = fixBoundsIfNecessary(bounds);
|
|
94
|
+
if (this.groundOverlay != null) {
|
|
95
|
+
this.groundOverlay.setPositionFromBounds(this.bounds);
|
|
96
|
+
}
|
|
162
97
|
}
|
|
163
|
-
}
|
|
164
98
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
99
|
+
public void setBearing(float bearing) {
|
|
100
|
+
this.bearing = bearing;
|
|
101
|
+
if (this.groundOverlay != null) {
|
|
102
|
+
this.groundOverlay.setBearing(bearing);
|
|
103
|
+
}
|
|
169
104
|
}
|
|
170
|
-
}
|
|
171
105
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
106
|
+
public void setZIndex(float zIndex) {
|
|
107
|
+
this.zIndex = zIndex;
|
|
108
|
+
if (this.groundOverlay != null) {
|
|
109
|
+
this.groundOverlay.setZIndex(zIndex);
|
|
110
|
+
}
|
|
176
111
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
public void setImage(String uri) {
|
|
187
|
-
this.mImageReader.setImage(uri);
|
|
188
|
-
boolean shouldLoadImage = true;
|
|
189
|
-
|
|
190
|
-
this.imageUri = uri;
|
|
191
|
-
if (!shouldLoadImage) {return;}
|
|
192
|
-
|
|
193
|
-
if (uri == null) {
|
|
194
|
-
iconBitmapDescriptor = null;
|
|
195
|
-
} else if (uri.startsWith("http://") || uri.startsWith("https://") ||
|
|
196
|
-
uri.startsWith("file://") || uri.startsWith("asset://") || uri.startsWith("data:")) {
|
|
197
|
-
ImageRequest imageRequest = ImageRequestBuilder
|
|
198
|
-
.newBuilderWithSource(Uri.parse(uri))
|
|
199
|
-
.build();
|
|
200
|
-
|
|
201
|
-
ImagePipeline imagePipeline = Fresco.getImagePipeline();
|
|
202
|
-
dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
|
|
203
|
-
DraweeController controller = Fresco.newDraweeControllerBuilder()
|
|
204
|
-
.setImageRequest(imageRequest)
|
|
205
|
-
.setControllerListener(mLogoControllerListener)
|
|
206
|
-
.setOldController(logoHolder.getController())
|
|
207
|
-
.build();
|
|
208
|
-
logoHolder.setController(controller);
|
|
209
|
-
} else {
|
|
210
|
-
iconBitmapDescriptor = getBitmapDescriptorByName(uri);
|
|
211
|
-
int drawableId = getDrawableResourceByName(uri);
|
|
212
|
-
iconBitmap = BitmapFactory.decodeResource(getResources(), drawableId);
|
|
213
|
-
if (iconBitmap == null) { // VectorDrawable or similar
|
|
214
|
-
Drawable drawable = getResources().getDrawable(drawableId);
|
|
215
|
-
iconBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
|
216
|
-
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
|
217
|
-
Canvas canvas = new Canvas(iconBitmap);
|
|
218
|
-
drawable.draw(canvas);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
}
|
|
112
|
+
|
|
113
|
+
public void setTransparency(float transparency) {
|
|
114
|
+
this.transparency = transparency;
|
|
115
|
+
if (groundOverlay != null) {
|
|
116
|
+
groundOverlay.setTransparency(transparency);
|
|
117
|
+
}
|
|
222
118
|
}
|
|
223
119
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
120
|
+
|
|
121
|
+
public void setImage(String uri) {
|
|
122
|
+
boolean shouldLoadImage = true;
|
|
123
|
+
|
|
124
|
+
this.imageUri = uri;
|
|
125
|
+
if (!shouldLoadImage) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (uri == null) {
|
|
130
|
+
bitmapDescriptor = null;
|
|
131
|
+
} else if (uri.startsWith("http://") || uri.startsWith("https://") ||
|
|
132
|
+
uri.startsWith("file://") || uri.startsWith("asset://") || uri.startsWith("data:")) {
|
|
133
|
+
|
|
134
|
+
ImageRequest imageRequest = ImageRequestBuilder
|
|
135
|
+
.newBuilderWithSource(Uri.parse(uri))
|
|
136
|
+
.build();
|
|
137
|
+
|
|
138
|
+
ImagePipeline imagePipeline = Fresco.getImagePipeline();
|
|
139
|
+
dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
|
|
140
|
+
|
|
141
|
+
DataSubscriber<CloseableReference<CloseableImage>> subscriber = new BaseDataSubscriber<CloseableReference<CloseableImage>>() {
|
|
142
|
+
@Override
|
|
143
|
+
protected void onNewResultImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
|
|
144
|
+
if (!dataSource.isFinished()) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
CloseableReference<CloseableImage> imageReference = dataSource.getResult();
|
|
149
|
+
if (imageReference != null) {
|
|
150
|
+
try {
|
|
151
|
+
CloseableImage closeableImage = imageReference.get();
|
|
152
|
+
if (closeableImage instanceof CloseableBitmap) {
|
|
153
|
+
Bitmap bitmap = ((CloseableBitmap) closeableImage).getUnderlyingBitmap();
|
|
154
|
+
if (bitmap != null) {
|
|
155
|
+
bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
} finally {
|
|
159
|
+
CloseableReference.closeSafely(imageReference);
|
|
160
|
+
}
|
|
161
|
+
new Handler(Looper.getMainLooper()).post(() -> update());
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@Override
|
|
166
|
+
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
|
|
167
|
+
// Handle failure
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
dataSource.subscribe(subscriber, Executors.newSingleThreadExecutor());
|
|
172
|
+
|
|
173
|
+
} else {
|
|
174
|
+
bitmapDescriptor = getBitmapDescriptorByName(uri);
|
|
175
|
+
}
|
|
239
176
|
}
|
|
240
|
-
}
|
|
241
177
|
|
|
242
|
-
public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
243
|
-
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
|
|
244
|
-
builder.put(OnPressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnPressEvent.EVENT_NAME));
|
|
245
|
-
return builder.build();
|
|
246
|
-
}
|
|
247
178
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
this.groundOverlayOptions = createGroundOverlayOptions();
|
|
179
|
+
private BitmapDescriptor getBitmapDescriptorByName(String name) {
|
|
180
|
+
return BitmapDescriptorFactory.fromResource(getDrawableResourceByName(name));
|
|
251
181
|
}
|
|
252
|
-
return this.groundOverlayOptions;
|
|
253
|
-
}
|
|
254
182
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
183
|
+
private int getDrawableResourceByName(String name) {
|
|
184
|
+
return getResources().getIdentifier(
|
|
185
|
+
name,
|
|
186
|
+
"drawable",
|
|
187
|
+
getContext().getPackageName());
|
|
258
188
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
189
|
+
|
|
190
|
+
public void setTappable(boolean tapabble) {
|
|
191
|
+
this.tappable = tapabble;
|
|
192
|
+
if (groundOverlay != null) {
|
|
193
|
+
groundOverlay.setClickable(tappable);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
198
|
+
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
|
|
199
|
+
builder.put(OnPressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnPressEvent.EVENT_NAME));
|
|
200
|
+
return builder.build();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
public GroundOverlayOptions getGroundOverlayOptions() {
|
|
204
|
+
if (this.groundOverlayOptions == null) {
|
|
205
|
+
this.groundOverlayOptions = createGroundOverlayOptions();
|
|
206
|
+
}
|
|
207
|
+
return this.groundOverlayOptions;
|
|
268
208
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
this.groundOverlayCollection = groundOverlayCollection;
|
|
209
|
+
|
|
210
|
+
private GroundOverlayOptions createGroundOverlayOptions() {
|
|
211
|
+
if (this.groundOverlayOptions != null) {
|
|
212
|
+
return this.groundOverlayOptions;
|
|
213
|
+
}
|
|
214
|
+
GroundOverlayOptions options = new GroundOverlayOptions();
|
|
215
|
+
if (this.bitmapDescriptor != null) {
|
|
216
|
+
options.image(bitmapDescriptor);
|
|
217
|
+
} else {
|
|
218
|
+
// add stub image to be able to instantiate the overlay
|
|
219
|
+
// and store a reference to it in MapView
|
|
220
|
+
options.image(BitmapDescriptorFactory.defaultMarker());
|
|
221
|
+
// hide overlay until real image gets added
|
|
222
|
+
options.visible(false);
|
|
223
|
+
}
|
|
224
|
+
options.positionFromBounds(bounds);
|
|
225
|
+
options.zIndex(zIndex);
|
|
226
|
+
options.bearing(bearing);
|
|
227
|
+
// options.transparency(transparency);
|
|
228
|
+
return options;
|
|
290
229
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (groundOverlay != null) {
|
|
296
|
-
GroundOverlayManager.Collection groundOverlayCollection = (GroundOverlayManager.Collection) collection;
|
|
297
|
-
groundOverlayCollection.remove(groundOverlay);
|
|
298
|
-
groundOverlay = null;
|
|
299
|
-
groundOverlayOptions = null;
|
|
230
|
+
|
|
231
|
+
@Override
|
|
232
|
+
public Object getFeature() {
|
|
233
|
+
return groundOverlay;
|
|
300
234
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
@Override
|
|
315
|
-
public void update() {
|
|
316
|
-
this.groundOverlay = getGroundOverlay();
|
|
317
|
-
if (this.groundOverlay != null) {
|
|
318
|
-
this.groundOverlay.setVisible(true);
|
|
319
|
-
this.groundOverlay.setImage(this.iconBitmapDescriptor);
|
|
320
|
-
this.groundOverlay.setTransparency(this.transparency);
|
|
321
|
-
this.groundOverlay.setClickable(this.tappable);
|
|
235
|
+
|
|
236
|
+
@Override
|
|
237
|
+
public void addToMap(Object collection) {
|
|
238
|
+
GroundOverlayManager.Collection groundOverlayCollection = (GroundOverlayManager.Collection) collection;
|
|
239
|
+
GroundOverlayOptions groundOverlayOptions = getGroundOverlayOptions();
|
|
240
|
+
if (groundOverlayOptions != null) {
|
|
241
|
+
groundOverlay = groundOverlayCollection.addGroundOverlay(groundOverlayOptions);
|
|
242
|
+
groundOverlay.setClickable(this.tappable);
|
|
243
|
+
} else {
|
|
244
|
+
this.groundOverlayCollection = groundOverlayCollection;
|
|
245
|
+
}
|
|
322
246
|
}
|
|
323
|
-
}
|
|
324
247
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
248
|
+
@Override
|
|
249
|
+
public void removeFromMap(Object collection) {
|
|
250
|
+
if (groundOverlay != null) {
|
|
251
|
+
GroundOverlayManager.Collection groundOverlayCollection = (GroundOverlayManager.Collection) collection;
|
|
252
|
+
groundOverlayCollection.remove(groundOverlay);
|
|
253
|
+
groundOverlay = null;
|
|
254
|
+
groundOverlayOptions = null;
|
|
255
|
+
}
|
|
256
|
+
groundOverlayCollection = null;
|
|
328
257
|
}
|
|
329
|
-
|
|
330
|
-
|
|
258
|
+
|
|
259
|
+
public void update() {
|
|
260
|
+
this.groundOverlay = getGroundOverlay();
|
|
261
|
+
if (this.groundOverlay != null) {
|
|
262
|
+
this.groundOverlay.setVisible(true);
|
|
263
|
+
this.groundOverlay.setImage(this.bitmapDescriptor);
|
|
264
|
+
// this.groundOverlay.setTransparency(this.transparency);
|
|
265
|
+
this.groundOverlay.setClickable(this.tappable);
|
|
266
|
+
}
|
|
331
267
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
268
|
+
|
|
269
|
+
private GroundOverlay getGroundOverlay() {
|
|
270
|
+
if (this.groundOverlay != null) {
|
|
271
|
+
return this.groundOverlay;
|
|
272
|
+
}
|
|
273
|
+
if (this.groundOverlayCollection == null) {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
GroundOverlayOptions groundOverlayOptions = getGroundOverlayOptions();
|
|
277
|
+
if (groundOverlayOptions != null) {
|
|
278
|
+
return this.groundOverlayCollection.addGroundOverlay(groundOverlayOptions);
|
|
279
|
+
}
|
|
280
|
+
return null;
|
|
335
281
|
}
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
282
|
}
|
package/lib/MapOverlay.js
CHANGED
|
@@ -54,7 +54,6 @@ class MapOverlay extends React.Component {
|
|
|
54
54
|
image = resolvedImage.uri || this.props.image;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
console.log('MapOverlay image: ' + image);
|
|
58
57
|
return (<AIRMapOverlay {...this.props} opacity={opacity}
|
|
59
58
|
// @ts-ignore
|
|
60
59
|
image={image} style={[styles.overlay, this.props.style]}/>);
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "1.21.0-alpha.
|
|
8
|
+
"version": "1.21.0-alpha.85",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|