@rnmapbox/maps 10.0.0-beta.57 → 10.0.0-beta.59
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/rctmgl/build.gradle +1 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +76 -94
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapViewManager.kt +10 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +26 -5
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +2 -7
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/location/LocationManager.kt +18 -6
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/utils/extensions/CoordinateBounds.kt +3 -9
- package/ios/RCTMGL/RCTMGLLocation.m +1 -1
- package/ios/RCTMGL-v10/MGLModule.swift +1 -1
- package/ios/RCTMGL-v10/RCTMGLBackgroundLayer.swift +3 -1
- package/ios/RCTMGL-v10/RCTMGLCircleLayer.swift +3 -1
- package/ios/RCTMGL-v10/RCTMGLFillExtrustionLayer.swift +3 -1
- package/ios/RCTMGL-v10/RCTMGLFillLayer.swift +3 -1
- package/ios/RCTMGL-v10/RCTMGLHeatmapLayer.swift +3 -1
- package/ios/RCTMGL-v10/RCTMGLLineLayer.swift +3 -1
- package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +1 -1
- package/ios/RCTMGL-v10/RCTMGLRasterLayer.swift +3 -1
- package/ios/RCTMGL-v10/RCTMGLSkyLayer.swift +3 -1
- package/ios/RCTMGL-v10/RCTMGLSymbolLayer.swift +3 -1
- package/{assets → javascript/assets}/heading.png +0 -0
- package/{assets → javascript/assets}/heading@2x.png +0 -0
- package/{assets → javascript/assets}/heading@3x.png +0 -0
- package/javascript/components/Atmosphere.tsx +6 -3
- package/javascript/components/Camera.tsx +1 -1
- package/javascript/components/HeadingIndicator.tsx +1 -1
- package/javascript/components/MarkerView.tsx +2 -3
- package/javascript/components/PointAnnotation.tsx +7 -9
- package/javascript/components/ShapeSource.tsx +2 -4
- package/lib/commonjs/assets/heading.png +0 -0
- package/lib/commonjs/assets/heading@2x.png +0 -0
- package/lib/commonjs/assets/heading@3x.png +0 -0
- package/lib/commonjs/components/Atmosphere.js.map +1 -1
- package/lib/commonjs/components/Camera.js.map +1 -1
- package/lib/commonjs/components/HeadingIndicator.js +1 -1
- package/lib/commonjs/components/MarkerView.js.map +1 -1
- package/lib/commonjs/components/PointAnnotation.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/module/assets/heading.png +0 -0
- package/lib/module/assets/heading@2x.png +0 -0
- package/lib/module/assets/heading@3x.png +0 -0
- package/lib/module/components/Atmosphere.js.map +1 -1
- package/lib/module/components/Camera.js.map +1 -1
- package/lib/module/components/HeadingIndicator.js +1 -1
- package/lib/module/components/HeadingIndicator.js.map +1 -1
- package/lib/module/components/MarkerView.js.map +1 -1
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/typescript/components/Camera.d.ts +1 -1
- package/lib/typescript/components/Camera.d.ts.map +1 -1
- package/lib/typescript/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/components/PointAnnotation.d.ts +6 -6
- package/lib/typescript/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/components/ShapeSource.d.ts.map +1 -1
- package/package.json +1 -1
- package/rnmapbox-maps.podspec +1 -1
|
@@ -130,7 +130,7 @@ dependencies {
|
|
|
130
130
|
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.1.0'
|
|
131
131
|
}
|
|
132
132
|
else if (safeExtGet("RNMapboxMapsImpl", defaultMapboxMapsImpl) == "mapbox") {
|
|
133
|
-
implementation 'com.mapbox.maps:android:10.9.
|
|
133
|
+
implementation 'com.mapbox.maps:android:10.9.1'
|
|
134
134
|
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:6.8.0'
|
|
135
135
|
implementation 'androidx.asynclayoutinflater:asynclayoutinflater:1.0.0'
|
|
136
136
|
}
|
package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt
CHANGED
|
@@ -4,6 +4,7 @@ import android.content.Context
|
|
|
4
4
|
import android.graphics.BitmapFactory
|
|
5
5
|
import android.graphics.PointF
|
|
6
6
|
import android.graphics.RectF
|
|
7
|
+
import android.util.Log
|
|
7
8
|
import android.view.Gravity
|
|
8
9
|
import android.view.View
|
|
9
10
|
import android.view.ViewGroup
|
|
@@ -113,6 +114,9 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
113
114
|
var tintColor: Int? = null
|
|
114
115
|
private set
|
|
115
116
|
|
|
117
|
+
val mapView: MapView
|
|
118
|
+
get() = this
|
|
119
|
+
|
|
116
120
|
val pointAnnotationManager: PointAnnotationManager?
|
|
117
121
|
get() {
|
|
118
122
|
if (mPointAnnotationManager == null) {
|
|
@@ -709,7 +713,7 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
709
713
|
val density: Float = getDisplayDensity()
|
|
710
714
|
val screenCoordinate = ScreenCoordinate(pixel.x * density, pixel.y * density)
|
|
711
715
|
|
|
712
|
-
val coordinate = mMap!!.coordinateForPixel(
|
|
716
|
+
val coordinate = mMap!!.coordinateForPixel(screenCoordinate)
|
|
713
717
|
|
|
714
718
|
sendResponse(callbackID, {
|
|
715
719
|
it.putArray("coordinateFromView", coordinate.toReadableArray())
|
|
@@ -902,17 +906,17 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
902
906
|
}
|
|
903
907
|
})
|
|
904
908
|
|
|
905
|
-
RCTMGLMarkerViewManager.markerViewContainerSizeFixer(this, viewAnnotationManager)
|
|
909
|
+
RCTMGLMarkerViewManager.markerViewContainerSizeFixer(this, this.viewAnnotationManager)
|
|
906
910
|
}
|
|
907
911
|
|
|
908
912
|
// region Ornaments
|
|
909
913
|
|
|
910
914
|
private fun toGravity(kind: String, viewPosition: Int): Int {
|
|
911
915
|
return when (viewPosition) {
|
|
912
|
-
0 -> (Gravity.TOP or Gravity.
|
|
913
|
-
1 -> (Gravity.TOP or Gravity.
|
|
914
|
-
2 -> (Gravity.BOTTOM or Gravity.
|
|
915
|
-
3 -> (Gravity.BOTTOM or Gravity.
|
|
916
|
+
0 -> (Gravity.TOP or Gravity.START)
|
|
917
|
+
1 -> (Gravity.TOP or Gravity.END)
|
|
918
|
+
2 -> (Gravity.BOTTOM or Gravity.START)
|
|
919
|
+
3 -> (Gravity.BOTTOM or Gravity.END)
|
|
916
920
|
else -> {
|
|
917
921
|
Logger.e(
|
|
918
922
|
"MapView",
|
|
@@ -991,6 +995,7 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
991
995
|
fadeWhenFacingNorth = mCompassFadeWhenNorth
|
|
992
996
|
updateOrnament("compass", mCompassSettings, this.toGenericOrnamentSettings())
|
|
993
997
|
}
|
|
998
|
+
workaroundToRelayoutChildOfMapView()
|
|
994
999
|
}
|
|
995
1000
|
|
|
996
1001
|
var mScaleBarSettings = OrnamentSettings(enabled = false)
|
|
@@ -1016,9 +1021,25 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
1016
1021
|
}
|
|
1017
1022
|
|
|
1018
1023
|
private fun updateScaleBar() {
|
|
1019
|
-
scalebar.updateSettings {
|
|
1024
|
+
mapView.scalebar.updateSettings {
|
|
1020
1025
|
updateOrnament("scaleBar", mScaleBarSettings, this.toGenericOrnamentSettings())
|
|
1021
1026
|
}
|
|
1027
|
+
workaroundToRelayoutChildOfMapView()
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
fun workaroundToRelayoutChildOfMapView() {
|
|
1031
|
+
if (mapView.width == 0 && mapView.height == 0) {
|
|
1032
|
+
return
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
mapView.requestLayout();
|
|
1036
|
+
mapView.forceLayout();
|
|
1037
|
+
|
|
1038
|
+
mapView.measure(
|
|
1039
|
+
MeasureSpec.makeMeasureSpec(mapView.measuredWidth, MeasureSpec.EXACTLY),
|
|
1040
|
+
MeasureSpec.makeMeasureSpec(mapView.measuredHeight, MeasureSpec.EXACTLY)
|
|
1041
|
+
);
|
|
1042
|
+
mapView.layout(mapView.left, mapView.top, mapView.right, mapView.bottom)
|
|
1022
1043
|
}
|
|
1023
1044
|
|
|
1024
1045
|
// endregion
|
|
@@ -1048,48 +1069,33 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
1048
1069
|
}
|
|
1049
1070
|
|
|
1050
1071
|
// region Attribution
|
|
1051
|
-
|
|
1052
|
-
private var mAttributionGravity: Int? = null
|
|
1053
|
-
private var mAttributionMargin: IntArray? = null
|
|
1072
|
+
var mAttributionSettings = OrnamentSettings(enabled = AttributionSettings().enabled)
|
|
1054
1073
|
|
|
1055
1074
|
fun setReactAttributionEnabled(attributionEnabled: Boolean?) {
|
|
1056
|
-
|
|
1075
|
+
mAttributionSettings.enabled = attributionEnabled
|
|
1057
1076
|
updateAttribution()
|
|
1058
1077
|
}
|
|
1059
1078
|
|
|
1060
|
-
fun
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
val defaultOptions = AttributionSettings()
|
|
1065
|
-
mAttributionGravity = defaultOptions.position
|
|
1066
|
-
mAttributionMargin = intArrayOf(defaultOptions.marginLeft.toInt(),defaultOptions.marginTop.toInt(),defaultOptions.marginRight.toInt(),defaultOptions.marginBottom.toInt())
|
|
1067
|
-
updateAttribution()
|
|
1068
|
-
}
|
|
1069
|
-
return
|
|
1070
|
-
}
|
|
1079
|
+
fun setReactAttributionViewMargins(margins: ReadableMap) {
|
|
1080
|
+
mAttributionSettings.margins = margins
|
|
1081
|
+
updateAttribution()
|
|
1082
|
+
}
|
|
1071
1083
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1084
|
+
fun setReactAttributionViewPosition(position: Int) {
|
|
1085
|
+
mAttributionSettings.position = position
|
|
1086
|
+
updateAttribution()
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
fun setReactAttributionPosition(position: ReadableMap?) {
|
|
1090
|
+
mAttributionSettings.setPosAndMargins(position)
|
|
1075
1091
|
updateAttribution()
|
|
1076
1092
|
}
|
|
1077
1093
|
|
|
1078
1094
|
private fun updateAttribution() {
|
|
1079
1095
|
attribution.updateSettings {
|
|
1080
|
-
|
|
1081
|
-
enabled = mAttributionEnabled!!
|
|
1082
|
-
}
|
|
1083
|
-
if(mAttributionGravity != null){
|
|
1084
|
-
position = mAttributionGravity!!
|
|
1085
|
-
}
|
|
1086
|
-
if(mAttributionMargin != null){
|
|
1087
|
-
marginLeft = mAttributionMargin!![0].toFloat()
|
|
1088
|
-
marginTop = mAttributionMargin!![1].toFloat()
|
|
1089
|
-
marginRight = mAttributionMargin!![2].toFloat()
|
|
1090
|
-
marginBottom = mAttributionMargin!![3].toFloat()
|
|
1091
|
-
}
|
|
1096
|
+
updateOrnament("attribution", mAttributionSettings, this.toGenericOrnamentSettings())
|
|
1092
1097
|
}
|
|
1098
|
+
workaroundToRelayoutChildOfMapView()
|
|
1093
1099
|
}
|
|
1094
1100
|
//endregion
|
|
1095
1101
|
|
|
@@ -1124,57 +1130,8 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
1124
1130
|
logo.updateSettings {
|
|
1125
1131
|
updateOrnament("logo", mLogoSettings, this.toGenericOrnamentSettings())
|
|
1126
1132
|
}
|
|
1127
|
-
|
|
1128
|
-
logo.updateSettings {
|
|
1129
|
-
println(String.format("logo :: position - before 0x%08x", position))
|
|
1130
|
-
//position = Gravity.BOTTOM or Gravity.RIGHT
|
|
1131
|
-
println(String.format("eq bottom|right %b", position == (Gravity.BOTTOM or Gravity.RIGHT)))
|
|
1132
|
-
if (position == Gravity.BOTTOM or Gravity.RIGHT) {
|
|
1133
|
-
position = Gravity.BOTTOM or Gravity.RIGHT
|
|
1134
|
-
}
|
|
1135
|
-
println(String.format("logo :: position - after 0x%08x", position))
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
/*
|
|
1139
|
-
fun setReactLogoEnabled(logoEnabled: Boolean?) {
|
|
1140
|
-
mLogoEnabled = logoEnabled ?: LogoSettings().enabled
|
|
1141
|
-
updateLogo()
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
fun setReactLogoPosition(position: ReadableMap?) {
|
|
1145
|
-
if (position == null) {
|
|
1146
|
-
// reset from explicit to default
|
|
1147
|
-
if (mLogoGravity != null) {
|
|
1148
|
-
val defaultOptions = LogoSettings()
|
|
1149
|
-
mLogoGravity = defaultOptions.position
|
|
1150
|
-
mLogoMargin = intArrayOf(defaultOptions.marginLeft.toInt(),defaultOptions.marginTop.toInt(),defaultOptions.marginRight.toInt(),defaultOptions.marginBottom.toInt())
|
|
1151
|
-
updateLogo()
|
|
1152
|
-
}
|
|
1153
|
-
return
|
|
1154
|
-
}
|
|
1155
|
-
val (logoGravity, logoMargin) = getGravityAndMargin(position)
|
|
1156
|
-
mLogoGravity = logoGravity
|
|
1157
|
-
mLogoMargin = logoMargin
|
|
1158
|
-
updateLogo()
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
private fun updateLogo() {
|
|
1162
|
-
logo.updateSettings {
|
|
1163
|
-
if(mLogoEnabled != null){
|
|
1164
|
-
enabled = mLogoEnabled!!
|
|
1165
|
-
}
|
|
1166
|
-
if(mLogoGravity != null){
|
|
1167
|
-
position = mLogoGravity!!
|
|
1168
|
-
}
|
|
1169
|
-
if(mLogoMargin != null){
|
|
1170
|
-
marginLeft = mLogoMargin!![0].toFloat()
|
|
1171
|
-
marginTop = mLogoMargin!![1].toFloat()
|
|
1172
|
-
marginRight = mLogoMargin!![2].toFloat()
|
|
1173
|
-
marginBottom = mLogoMargin!![3].toFloat()
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1133
|
+
workaroundToRelayoutChildOfMapView()
|
|
1176
1134
|
}
|
|
1177
|
-
*/
|
|
1178
1135
|
// endregion
|
|
1179
1136
|
|
|
1180
1137
|
// region lifecycle
|
|
@@ -1208,7 +1165,11 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
1208
1165
|
}
|
|
1209
1166
|
|
|
1210
1167
|
override fun handleLifecycleEvent(event: Lifecycle.Event) {
|
|
1211
|
-
|
|
1168
|
+
try {
|
|
1169
|
+
lifecycleRegistry.handleLifecycleEvent(event)
|
|
1170
|
+
} catch (e: RuntimeException) {
|
|
1171
|
+
Log.e("RCTMGLMapView", "onAttachedToWindow error: $e")
|
|
1172
|
+
}
|
|
1212
1173
|
}
|
|
1213
1174
|
|
|
1214
1175
|
override fun getLifecycle(): Lifecycle {
|
|
@@ -1228,8 +1189,8 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
1228
1189
|
fun OrnamentSettings.setPosAndMargins(posAndMargins: ReadableMap?) {
|
|
1229
1190
|
if (posAndMargins == null) { return }
|
|
1230
1191
|
|
|
1231
|
-
val bottom_mask =
|
|
1232
|
-
val right_mask =
|
|
1192
|
+
val bottom_mask = 2;
|
|
1193
|
+
val right_mask = 1;
|
|
1233
1194
|
|
|
1234
1195
|
var margins = WritableNativeMap()
|
|
1235
1196
|
var position = 0;
|
|
@@ -1281,7 +1242,7 @@ fun ScaleBarSettings.toGenericOrnamentSettings() = object : GenericOrnamentSetti
|
|
|
1281
1242
|
}
|
|
1282
1243
|
|
|
1283
1244
|
fun CompassSettings.toGenericOrnamentSettings() = object : GenericOrnamentSettings {
|
|
1284
|
-
private
|
|
1245
|
+
private var settings = this@toGenericOrnamentSettings
|
|
1285
1246
|
override fun setHMargins(left: Float?, right: Float?) {
|
|
1286
1247
|
left?.let { settings.marginLeft = it }
|
|
1287
1248
|
right?.let { settings.marginRight = it }
|
|
@@ -1295,11 +1256,33 @@ fun CompassSettings.toGenericOrnamentSettings() = object : GenericOrnamentSettin
|
|
|
1295
1256
|
set(value) { settings.enabled = value }
|
|
1296
1257
|
override var position: Int
|
|
1297
1258
|
get() = settings.position
|
|
1298
|
-
set(value) {
|
|
1259
|
+
set(value) {
|
|
1260
|
+
settings.position = value
|
|
1261
|
+
}
|
|
1299
1262
|
}
|
|
1300
1263
|
|
|
1301
1264
|
fun LogoSettings.toGenericOrnamentSettings() = object : GenericOrnamentSettings {
|
|
1302
|
-
private
|
|
1265
|
+
private var settings = this@toGenericOrnamentSettings
|
|
1266
|
+
override fun setHMargins(left: Float?, right: Float?) {
|
|
1267
|
+
left?.let { settings.marginLeft = it }
|
|
1268
|
+
right?.let { settings.marginRight = it }
|
|
1269
|
+
}
|
|
1270
|
+
override fun setVMargins(top: Float?, bottom: Float?) {
|
|
1271
|
+
top?.let { settings.marginTop = it }
|
|
1272
|
+
bottom?.let { settings.marginBottom = it }
|
|
1273
|
+
}
|
|
1274
|
+
override var enabled: Boolean
|
|
1275
|
+
get() = settings.enabled
|
|
1276
|
+
set(value) { settings.enabled = value }
|
|
1277
|
+
override var position: Int
|
|
1278
|
+
get() = settings.position
|
|
1279
|
+
set(value) {
|
|
1280
|
+
settings.position = value
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
fun AttributionSettings.toGenericOrnamentSettings() = object : GenericOrnamentSettings {
|
|
1285
|
+
private var settings = this@toGenericOrnamentSettings;
|
|
1303
1286
|
override fun setHMargins(left: Float?, right: Float?) {
|
|
1304
1287
|
left?.let { settings.marginLeft = it }
|
|
1305
1288
|
right?.let { settings.marginRight = it }
|
|
@@ -1314,7 +1297,6 @@ fun LogoSettings.toGenericOrnamentSettings() = object : GenericOrnamentSettings
|
|
|
1314
1297
|
override var position: Int
|
|
1315
1298
|
get() = settings.position
|
|
1316
1299
|
set(value) {
|
|
1317
|
-
println(String.format("logo :: position: 0x%08x", value))
|
|
1318
1300
|
settings.position = value
|
|
1319
1301
|
}
|
|
1320
1302
|
}
|
|
@@ -132,6 +132,16 @@ open class RCTMGLMapViewManager(context: ReactApplicationContext?) :
|
|
|
132
132
|
mapView!!.setReactAttributionPosition(attributionPosition);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
@ReactProp(name = "attributionViewMargins")
|
|
136
|
+
fun setAttributionViewMargins(mapView: RCTMGLMapView?, scaleBarMargins: ReadableMap?) {
|
|
137
|
+
mapView!!.setReactAttributionViewMargins(scaleBarMargins!!);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@ReactProp(name = "attributionViewPosition")
|
|
141
|
+
fun setAttributionViewPosition(mapView: RCTMGLMapView?, scaleBarPosition: Int) {
|
|
142
|
+
mapView!!.setReactAttributionViewPosition(scaleBarPosition!!)
|
|
143
|
+
}
|
|
144
|
+
|
|
135
145
|
@ReactProp(name = "logoEnabled")
|
|
136
146
|
fun setLogoEnabled(mapView: RCTMGLMapView?, logoEnabled: Boolean?) {
|
|
137
147
|
mapView!!.setReactLogoEnabled(logoEnabled);
|
package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java
CHANGED
|
@@ -24,6 +24,7 @@ import com.mapbox.maps.extension.style.types.StyleTransition;
|
|
|
24
24
|
import com.mapbox.maps.extension.style.light.generated.Light;
|
|
25
25
|
import com.mapbox.maps.extension.style.light.LightPosition;
|
|
26
26
|
import com.mapbox.rctmgl.utils.DownloadMapImageTask;
|
|
27
|
+
import com.mapbox.rctmgl.utils.Logger;
|
|
27
28
|
|
|
28
29
|
import java.util.List;
|
|
29
30
|
|
|
@@ -82,7 +83,11 @@ public class RCTMGLStyleFactory {
|
|
|
82
83
|
style.addImage(styleValue, new DownloadMapImageTask.OnAllImagesLoaded() {
|
|
83
84
|
@Override
|
|
84
85
|
public void onAllImagesLoaded() {
|
|
85
|
-
|
|
86
|
+
try {
|
|
87
|
+
RCTMGLStyleFactory.setFillPattern(layer, styleValue);
|
|
88
|
+
} catch (RuntimeException exception) {
|
|
89
|
+
Logger.INSTANCE.e("RCTMGLFill",String.format("Exception failed during setFillPattern: %s", exception.getMessage()));
|
|
90
|
+
}
|
|
86
91
|
}
|
|
87
92
|
});
|
|
88
93
|
break;
|
|
@@ -176,7 +181,11 @@ public class RCTMGLStyleFactory {
|
|
|
176
181
|
style.addImage(styleValue, new DownloadMapImageTask.OnAllImagesLoaded() {
|
|
177
182
|
@Override
|
|
178
183
|
public void onAllImagesLoaded() {
|
|
179
|
-
|
|
184
|
+
try {
|
|
185
|
+
RCTMGLStyleFactory.setLinePattern(layer, styleValue);
|
|
186
|
+
} catch (RuntimeException exception) {
|
|
187
|
+
Logger.INSTANCE.e("RCTMGLLine",String.format("Exception failed during setLinePattern: %s", exception.getMessage()));
|
|
188
|
+
}
|
|
180
189
|
}
|
|
181
190
|
});
|
|
182
191
|
break;
|
|
@@ -243,7 +252,11 @@ public class RCTMGLStyleFactory {
|
|
|
243
252
|
style.addImage(styleValue, new DownloadMapImageTask.OnAllImagesLoaded() {
|
|
244
253
|
@Override
|
|
245
254
|
public void onAllImagesLoaded() {
|
|
246
|
-
|
|
255
|
+
try {
|
|
256
|
+
RCTMGLStyleFactory.setIconImage(layer, styleValue);
|
|
257
|
+
} catch (RuntimeException exception) {
|
|
258
|
+
Logger.INSTANCE.e("RCTMGLSymbol",String.format("Exception failed during setIconImage: %s", exception.getMessage()));
|
|
259
|
+
}
|
|
247
260
|
}
|
|
248
261
|
});
|
|
249
262
|
break;
|
|
@@ -572,7 +585,11 @@ public class RCTMGLStyleFactory {
|
|
|
572
585
|
style.addImage(styleValue, new DownloadMapImageTask.OnAllImagesLoaded() {
|
|
573
586
|
@Override
|
|
574
587
|
public void onAllImagesLoaded() {
|
|
575
|
-
|
|
588
|
+
try {
|
|
589
|
+
RCTMGLStyleFactory.setFillExtrusionPattern(layer, styleValue);
|
|
590
|
+
} catch (RuntimeException exception) {
|
|
591
|
+
Logger.INSTANCE.e("RCTMGLFillExtrusion",String.format("Exception failed during setFillExtrusionPattern: %s", exception.getMessage()));
|
|
592
|
+
}
|
|
576
593
|
}
|
|
577
594
|
});
|
|
578
595
|
break;
|
|
@@ -727,7 +744,11 @@ public class RCTMGLStyleFactory {
|
|
|
727
744
|
style.addImage(styleValue, new DownloadMapImageTask.OnAllImagesLoaded() {
|
|
728
745
|
@Override
|
|
729
746
|
public void onAllImagesLoaded() {
|
|
730
|
-
|
|
747
|
+
try {
|
|
748
|
+
RCTMGLStyleFactory.setBackgroundPattern(layer, styleValue);
|
|
749
|
+
} catch (RuntimeException exception) {
|
|
750
|
+
Logger.INSTANCE.e("RCTMGLBackground",String.format("Exception failed during setBackgroundPattern: %s", exception.getMessage()));
|
|
751
|
+
}
|
|
731
752
|
}
|
|
732
753
|
});
|
|
733
754
|
break;
|
package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt
CHANGED
|
@@ -21,8 +21,6 @@ import com.mapbox.rctmgl.utils.ExpressionParser
|
|
|
21
21
|
import java.lang.ClassCastException
|
|
22
22
|
import com.mapbox.rctmgl.utils.Logger
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
// import com.mapbox.rctmgl.utils.ExpressionParser;
|
|
26
24
|
abstract class RCTLayer<T : Layer?>(protected var mContext: Context) : AbstractSourceConsumer(
|
|
27
25
|
mContext
|
|
28
26
|
) {
|
|
@@ -253,15 +251,12 @@ abstract class RCTLayer<T : Layer?>(protected var mContext: Context) : AbstractS
|
|
|
253
251
|
super.removeFromMap(mapView)
|
|
254
252
|
}
|
|
255
253
|
|
|
256
|
-
// v10TOOD: adding anything seems to make getStyle null
|
|
257
|
-
// return mMap.getStyle();
|
|
258
254
|
private val style: Style?
|
|
259
|
-
private get()
|
|
255
|
+
private get() =
|
|
260
256
|
if (mMap == null) {
|
|
261
257
|
null
|
|
262
|
-
} else mMapView
|
|
258
|
+
} else mMapView?.savedStyle
|
|
263
259
|
|
|
264
|
-
// return mMap.getStyle();
|
|
265
260
|
abstract fun makeLayer(): T
|
|
266
261
|
abstract fun addStyles()
|
|
267
262
|
private fun hasInitialized(): Boolean {
|
|
@@ -17,9 +17,9 @@ import android.os.Looper
|
|
|
17
17
|
import android.util.Log
|
|
18
18
|
import com.mapbox.geojson.Point
|
|
19
19
|
import com.mapbox.maps.plugin.locationcomponent.LocationProvider
|
|
20
|
-
import java.lang.Exception
|
|
21
20
|
import java.lang.ref.WeakReference
|
|
22
21
|
import java.util.ArrayList
|
|
22
|
+
import kotlin.Exception
|
|
23
23
|
|
|
24
24
|
internal class LocationProviderForEngine(var mEngine: LocationEngine?) : LocationProvider, LocationEngineCallback<LocationEngineResult> {
|
|
25
25
|
var mConsumers = ArrayList<LocationConsumer>()
|
|
@@ -51,8 +51,8 @@ internal class LocationProviderForEngine(var mEngine: LocationEngine?) : Locatio
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// * LocationEngineCallback
|
|
54
|
-
override fun onSuccess(locationEngineResult: LocationEngineResult) {
|
|
55
|
-
val location = locationEngineResult
|
|
54
|
+
override fun onSuccess(locationEngineResult: LocationEngineResult?) {
|
|
55
|
+
val location = locationEngineResult?.lastLocation
|
|
56
56
|
location?.let { notifyLocationUpdates(it) }
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -154,7 +154,19 @@ class LocationManager private constructor(private val context: Context) : Locati
|
|
|
154
154
|
callback.onFailure(Exception("LocationEngine not initialized"))
|
|
155
155
|
}
|
|
156
156
|
try {
|
|
157
|
-
engine?.getLastLocation(
|
|
157
|
+
engine?.getLastLocation(object : LocationEngineCallback<LocationEngineResult> {
|
|
158
|
+
override fun onSuccess(result: LocationEngineResult?) {
|
|
159
|
+
if (result == null) {
|
|
160
|
+
callback.onFailure( NullPointerException("LocationEngineResult is null"))
|
|
161
|
+
} else {
|
|
162
|
+
callback.onSuccess(result)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
override fun onFailure(exception: Exception) {
|
|
167
|
+
callback.onFailure(exception)
|
|
168
|
+
}
|
|
169
|
+
})
|
|
158
170
|
} catch (exception: Exception) {
|
|
159
171
|
Log.w(LOG_TAG, exception)
|
|
160
172
|
callback.onFailure(exception)
|
|
@@ -172,8 +184,8 @@ class LocationManager private constructor(private val context: Context) : Locati
|
|
|
172
184
|
// FMTODO handle this.
|
|
173
185
|
}
|
|
174
186
|
|
|
175
|
-
override fun onSuccess(result: LocationEngineResult) {
|
|
176
|
-
onLocationChanged(result
|
|
187
|
+
override fun onSuccess(result: LocationEngineResult?) {
|
|
188
|
+
onLocationChanged(result?.lastLocation)
|
|
177
189
|
if (locationProvider != null) {
|
|
178
190
|
locationProvider!!.onSuccess(result)
|
|
179
191
|
}
|
package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/utils/extensions/CoordinateBounds.kt
CHANGED
|
@@ -10,14 +10,8 @@ fun CoordinateBounds.toReadableArray() : ReadableArray {
|
|
|
10
10
|
val array = Arguments.createArray()
|
|
11
11
|
val ne = northeast
|
|
12
12
|
val sw = southwest
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
LatLng(sw.latitude(), sw.longitude()),
|
|
17
|
-
LatLng(sw.latitude(), ne.longitude())
|
|
18
|
-
)
|
|
19
|
-
for (latLng in latLngs) {
|
|
20
|
-
array.pushArray(GeoJSONUtils.fromLatLng(latLng))
|
|
21
|
-
}
|
|
13
|
+
|
|
14
|
+
array.pushArray(GeoJSONUtils.fromLatLng(LatLng(ne.latitude(), ne.longitude())));
|
|
15
|
+
array.pushArray(GeoJSONUtils.fromLatLng(LatLng(sw.latitude(), sw.longitude())));
|
|
22
16
|
return array
|
|
23
17
|
}
|
|
@@ -20,7 +20,7 @@ class MGLModule : NSObject {
|
|
|
20
20
|
"Light": StyleURI.light.rawValue,
|
|
21
21
|
"Dark": StyleURI.dark.rawValue,
|
|
22
22
|
"Satellite": StyleURI.satellite.rawValue,
|
|
23
|
-
"
|
|
23
|
+
"SatelliteStreet": StyleURI.satelliteStreets.rawValue,
|
|
24
24
|
],
|
|
25
25
|
"OfflinePackDownloadState":
|
|
26
26
|
[
|
|
@@ -33,7 +33,9 @@ class RCTMGLBackgroundLayer: RCTMGLLayer {
|
|
|
33
33
|
styler.backgroundLayer(
|
|
34
34
|
layer: &styleLayer,
|
|
35
35
|
reactStyle: reactStyle,
|
|
36
|
-
applyUpdater: { (updater) in
|
|
36
|
+
applyUpdater: { (updater) in logged("RCTMGLBackgroundLayer.addStyles") {
|
|
37
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
|
|
38
|
+
}},
|
|
37
39
|
isValid: { return self.isAddedToMap() })
|
|
38
40
|
self.styleLayer = styleLayer
|
|
39
41
|
}
|
|
@@ -34,7 +34,9 @@ class RCTMGLCircleLayer: RCTMGLVectorLayer {
|
|
|
34
34
|
styler.circleLayer(
|
|
35
35
|
layer: &styleLayer,
|
|
36
36
|
reactStyle: reactStyle,
|
|
37
|
-
applyUpdater: { (updater) in
|
|
37
|
+
applyUpdater: { (updater) in logged("RCTMGLCircleLayer.updateLayer") {
|
|
38
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
|
|
39
|
+
}},
|
|
38
40
|
isValid: { return self.isAddedToMap() })
|
|
39
41
|
self.styleLayer = styleLayer
|
|
40
42
|
}
|
|
@@ -33,7 +33,9 @@ class RCTMGLFillExtrusionLayer: RCTMGLVectorLayer {
|
|
|
33
33
|
styler.fillExtrusionLayer(
|
|
34
34
|
layer: &styleLayer,
|
|
35
35
|
reactStyle: reactStyle,
|
|
36
|
-
applyUpdater: { (updater) in
|
|
36
|
+
applyUpdater: { (updater) in logged("RCTMGLFillExtrusionLayer.updateLayer") {
|
|
37
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
|
|
38
|
+
}},
|
|
37
39
|
isValid: { return self.isAddedToMap() })
|
|
38
40
|
self.styleLayer = styleLayer
|
|
39
41
|
}
|
|
@@ -34,7 +34,9 @@ class RCTMGLFillLayer: RCTMGLVectorLayer {
|
|
|
34
34
|
styler.fillLayer(
|
|
35
35
|
layer: &styleLayer,
|
|
36
36
|
reactStyle: reactStyle ?? [:],
|
|
37
|
-
applyUpdater: { (updater) in
|
|
37
|
+
applyUpdater: { (updater) in logged("RCTMGLFillLayer.updateLayer") {
|
|
38
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout FillLayer) in updater(&layer) }
|
|
39
|
+
}},
|
|
38
40
|
isValid: { return self.isAddedToMap() }
|
|
39
41
|
)
|
|
40
42
|
self.styleLayer = styleLayer
|
|
@@ -34,7 +34,9 @@ class RCTMGLHeatmapLayer: RCTMGLVectorLayer {
|
|
|
34
34
|
styler.heatmapLayer(
|
|
35
35
|
layer: &styleLayer,
|
|
36
36
|
reactStyle: reactStyle!,
|
|
37
|
-
applyUpdater: { (updater) in
|
|
37
|
+
applyUpdater: { (updater) in logged("RCTMGLHeatmapLayer.updateLayer") {
|
|
38
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout HeatmapLayer) in updater(&layer) }
|
|
39
|
+
}},
|
|
38
40
|
isValid: { return self.isAddedToMap() }
|
|
39
41
|
)
|
|
40
42
|
self.styleLayer = styleLayer
|
|
@@ -37,7 +37,9 @@ class RCTMGLLineLayer: RCTMGLVectorLayer {
|
|
|
37
37
|
styler.lineLayer(
|
|
38
38
|
layer: &styleLayer,
|
|
39
39
|
reactStyle: reactStyle,
|
|
40
|
-
applyUpdater: { (updater) in
|
|
40
|
+
applyUpdater: { (updater) in logged("RCTMGLLineLayer.updateLayer") {
|
|
41
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
|
|
42
|
+
}},
|
|
41
43
|
isValid: {
|
|
42
44
|
return self.isAddedToMap()
|
|
43
45
|
})
|
|
@@ -28,7 +28,9 @@ class RCTMGLRasterLayer: RCTMGLLayer {
|
|
|
28
28
|
styler.rasterLayer(
|
|
29
29
|
layer: &styleLayer,
|
|
30
30
|
reactStyle: reactStyle!,
|
|
31
|
-
applyUpdater:{ (updater) in
|
|
31
|
+
applyUpdater:{ (updater) in logged("RCTMGLRasterLayer.updateLayer") {
|
|
32
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
|
|
33
|
+
}},
|
|
32
34
|
isValid: { return self.isAddedToMap() }
|
|
33
35
|
)
|
|
34
36
|
self.styleLayer = styleLayer
|
|
@@ -32,7 +32,9 @@ class RCTMGLSkyLayer: RCTMGLLayer {
|
|
|
32
32
|
styler.skyLayer(
|
|
33
33
|
layer: &styleLayer,
|
|
34
34
|
reactStyle: reactStyle,
|
|
35
|
-
applyUpdater: { (updater) in
|
|
35
|
+
applyUpdater: { (updater) in logged("RCTMGLSkyLayer.addStyles") {
|
|
36
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
|
|
37
|
+
}},
|
|
36
38
|
isValid: {
|
|
37
39
|
return self.isAddedToMap()
|
|
38
40
|
}
|
|
@@ -35,7 +35,9 @@ class RCTMGLSymbolLayer: RCTMGLVectorLayer {
|
|
|
35
35
|
styler.symbolLayer(
|
|
36
36
|
layer: &styleLayer,
|
|
37
37
|
reactStyle: reactStyle,
|
|
38
|
-
applyUpdater: { (updater) in
|
|
38
|
+
applyUpdater: { (updater) in logged("RCTMGLSymbolLayer.updateLayer") {
|
|
39
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
|
|
40
|
+
}},
|
|
39
41
|
isValid: {
|
|
40
42
|
return self.isAddedToMap()
|
|
41
43
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { requireNativeComponent } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import type { AtmosphereLayerStyleProps } from '../utils/MapboxStyles';
|
|
5
5
|
import { StyleValue, transformStyle } from '../utils/StyleValue';
|
|
@@ -22,7 +22,10 @@ export const Atmosphere = memo((props: Props) => {
|
|
|
22
22
|
return <RCTMGLAtmosphere {...baseProps} />;
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
type NativeProps = {
|
|
26
26
|
reactStyle?: { [key: string]: StyleValue };
|
|
27
27
|
style?: undefined;
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const RCTMGLAtmosphere =
|
|
31
|
+
requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
@@ -14,7 +14,7 @@ import { makeLatLngBounds, makePoint } from '../utils/geoUtils';
|
|
|
14
14
|
|
|
15
15
|
const NativeModule = NativeModules.MGLModule;
|
|
16
16
|
|
|
17
|
-
export
|
|
17
|
+
export enum UserTrackingMode {
|
|
18
18
|
Follow = 'normal',
|
|
19
19
|
FollowWithHeading = 'compass',
|
|
20
20
|
FollowWithCourse = 'course',
|