@rnmapbox/maps 10.0.13-rc.0 → 10.0.13
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.
- package/android/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +2 -2
- package/android/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapViewManager.kt +2 -1
- package/android/src/main/java-v10/com/mapbox/rctmgl/utils/extensions/ReadableArray.kt +15 -0
- package/package.json +1 -1
|
@@ -964,9 +964,9 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
|
|
967
|
-
fun queryRenderedFeaturesInRect(rect: RectF
|
|
967
|
+
fun queryRenderedFeaturesInRect(rect: RectF?, filter: Expression?, layerIDs: List<String>?, response: CommandResponse) {
|
|
968
968
|
val size = mMap!!.getMapOptions().size
|
|
969
|
-
val screenBox = if (rect
|
|
969
|
+
val screenBox = if (rect == null) ScreenBox(ScreenCoordinate(0.0, 0.0), ScreenCoordinate(size?.width!!.toDouble(), size?.height!!.toDouble())) else ScreenBox(
|
|
970
970
|
ScreenCoordinate(rect.right.toDouble(), rect.bottom.toDouble() ),
|
|
971
971
|
ScreenCoordinate(rect.left.toDouble(), rect.top.toDouble()),
|
|
972
972
|
)
|
package/android/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapViewManager.kt
CHANGED
|
@@ -19,6 +19,7 @@ import com.mapbox.rctmgl.utils.ConvertUtils
|
|
|
19
19
|
import com.mapbox.rctmgl.utils.ExpressionParser
|
|
20
20
|
import com.mapbox.rctmgl.utils.Logger
|
|
21
21
|
import com.mapbox.rctmgl.utils.extensions.toCoordinate
|
|
22
|
+
import com.mapbox.rctmgl.utils.extensions.toRectF
|
|
22
23
|
import com.mapbox.rctmgl.utils.extensions.toScreenCoordinate
|
|
23
24
|
import java.lang.Exception
|
|
24
25
|
import java.util.HashMap
|
|
@@ -325,7 +326,7 @@ open class RCTMGLMapViewManager(context: ReactApplicationContext) :
|
|
|
325
326
|
"queryRenderedFeaturesInRect" -> {
|
|
326
327
|
val layerIds = ConvertUtils.toStringList(args!!.getArray(3))
|
|
327
328
|
mapView.queryRenderedFeaturesInRect(
|
|
328
|
-
|
|
329
|
+
if ((args.getArray(1)?.size() ?: 0) == 0) null else args.getArray(1).toRectF(),
|
|
329
330
|
ExpressionParser.from(args!!.getArray(2)),
|
|
330
331
|
if (layerIds.size == 0) null else layerIds,
|
|
331
332
|
response
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
package com.mapbox.rctmgl.utils.extensions
|
|
2
2
|
|
|
3
|
+
import android.graphics.RectF
|
|
3
4
|
import com.facebook.react.bridge.ReadableArray
|
|
4
5
|
import com.mapbox.geojson.Point
|
|
5
6
|
import com.mapbox.maps.ScreenCoordinate
|
|
6
7
|
import com.mapbox.rctmgl.utils.Logger
|
|
8
|
+
import java.lang.Float.min
|
|
9
|
+
import java.lang.Float.max
|
|
7
10
|
|
|
8
11
|
fun ReadableArray.toCoordinate() : Point {
|
|
9
12
|
if (this.size() != 2) {
|
|
@@ -21,3 +24,15 @@ fun ReadableArray.toScreenCoordinate() : ScreenCoordinate {
|
|
|
21
24
|
}
|
|
22
25
|
return ScreenCoordinate(getDouble(0), getDouble(1))
|
|
23
26
|
}
|
|
27
|
+
|
|
28
|
+
fun ReadableArray.toRectF() : RectF? {
|
|
29
|
+
if (size() != 4) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return RectF(
|
|
33
|
+
min(getDouble(3).toFloat(), getDouble(1).toFloat()),
|
|
34
|
+
min(getDouble(0).toFloat(), getDouble(2).toFloat()),
|
|
35
|
+
max(getDouble(3).toFloat(), getDouble(1).toFloat()),
|
|
36
|
+
max(getDouble(0).toFloat(), getDouble(2).toFloat())
|
|
37
|
+
)
|
|
38
|
+
}
|