react-native-google-maps-plus 1.7.0-dev.12 → 1.7.0-dev.14
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/com/rngooglemapsplus/GoogleMapsViewImpl.kt +29 -24
- package/android/src/main/java/com/rngooglemapsplus/MapCircleBuilder.kt +2 -3
- package/android/src/main/java/com/rngooglemapsplus/MapMarkerBuilder.kt +20 -28
- package/android/src/main/java/com/rngooglemapsplus/MapPolygonBuilder.kt +6 -23
- package/android/src/main/java/com/rngooglemapsplus/MapPolylineBuilder.kt.kt +12 -39
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +2 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNLineCapTypeExtension.kt +14 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNLineJoinTypeExtension.kt +12 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNMapCircleExtension.kt +7 -1
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNMarkerExtension.kt +54 -17
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNPolygonExtension.kt +31 -1
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNPolylineExtension.kt +6 -1
- package/ios/GoogleMapViewImpl.swift +14 -3
- package/ios/MapCircleBuilder.swift +2 -3
- package/ios/MapMarkerBuilder.swift +54 -46
- package/ios/MapPolygonBuilder.swift +6 -41
- package/ios/MapPolylineBuilder.swift +2 -10
- package/ios/RNGoogleMapsPlusView.swift +3 -0
- package/ios/extensions/RNCircle+Extension.swift +14 -5
- package/ios/extensions/RNLatLng+Extension.swift +11 -0
- package/ios/extensions/RNLineCapType+Extension.swift +10 -0
- package/ios/extensions/RNLineJoinType+Extension.swift +11 -0
- package/ios/extensions/RNMarker+Extension.swift +43 -12
- package/ios/extensions/RNPolygon+Extension.swift.swift +50 -21
- package/ios/extensions/RNPolyline+Extension.swift.swift +15 -26
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/types.d.ts +1 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JRNInitialProps.hpp +7 -3
- package/nitrogen/generated/android/c++/JRNMarker.hpp +1 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNInitialProps.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNMarker.kt +2 -5
- package/nitrogen/generated/ios/swift/RNInitialProps.swift +31 -1
- package/nitrogen/generated/ios/swift/RNMarker.swift +1 -31
- package/nitrogen/generated/shared/c++/RNInitialProps.hpp +6 -2
- package/nitrogen/generated/shared/c++/RNMarker.hpp +1 -5
- package/package.json +1 -1
- package/src/types.ts +1 -1
|
@@ -10,7 +10,6 @@ import android.location.Location
|
|
|
10
10
|
import android.util.Size
|
|
11
11
|
import android.view.View
|
|
12
12
|
import android.widget.FrameLayout
|
|
13
|
-
import androidx.core.graphics.scale
|
|
14
13
|
import com.facebook.react.bridge.LifecycleEventListener
|
|
15
14
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
16
15
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
@@ -224,31 +223,31 @@ class GoogleMapsViewImpl(
|
|
|
224
223
|
locationConfig = locationConfig
|
|
225
224
|
|
|
226
225
|
if (pendingMarkers.isNotEmpty()) {
|
|
227
|
-
pendingMarkers.forEach { (id, opts, markerTag) ->
|
|
226
|
+
pendingMarkers.forEach { (id, opts, markerTag) -> addMarkerInternal(id, opts, markerTag) }
|
|
228
227
|
pendingMarkers.clear()
|
|
229
228
|
}
|
|
230
229
|
if (pendingPolylines.isNotEmpty()) {
|
|
231
|
-
pendingPolylines.forEach { (id, opts) ->
|
|
230
|
+
pendingPolylines.forEach { (id, opts) -> addPolylineInternal(id, opts) }
|
|
232
231
|
pendingPolylines.clear()
|
|
233
232
|
}
|
|
234
233
|
if (pendingPolygons.isNotEmpty()) {
|
|
235
|
-
pendingPolygons.forEach { (id, opts) ->
|
|
234
|
+
pendingPolygons.forEach { (id, opts) -> addPolygonInternal(id, opts) }
|
|
236
235
|
pendingPolygons.clear()
|
|
237
236
|
}
|
|
238
237
|
if (pendingCircles.isNotEmpty()) {
|
|
239
|
-
pendingCircles.forEach { (id, opts) ->
|
|
238
|
+
pendingCircles.forEach { (id, opts) -> addCircleInternal(id, opts) }
|
|
240
239
|
pendingCircles.clear()
|
|
241
240
|
}
|
|
242
241
|
if (pendingHeatmaps.isNotEmpty()) {
|
|
243
|
-
pendingHeatmaps.forEach { (id, opts) ->
|
|
242
|
+
pendingHeatmaps.forEach { (id, opts) -> addHeatmapInternal(id, opts) }
|
|
244
243
|
pendingHeatmaps.clear()
|
|
245
244
|
}
|
|
246
245
|
if (pendingKmlLayers.isNotEmpty()) {
|
|
247
|
-
pendingKmlLayers.forEach { (id, str) ->
|
|
246
|
+
pendingKmlLayers.forEach { (id, str) -> addKmlLayerInternal(id, str) }
|
|
248
247
|
pendingKmlLayers.clear()
|
|
249
248
|
}
|
|
250
249
|
if (pendingUrlTilesOverlays.isNotEmpty()) {
|
|
251
|
-
pendingUrlTilesOverlays.forEach { (id, opts) ->
|
|
250
|
+
pendingUrlTilesOverlays.forEach { (id, opts) -> addUrlTileOverlayInternal(id, opts) }
|
|
252
251
|
pendingUrlTilesOverlays.clear()
|
|
253
252
|
}
|
|
254
253
|
}
|
|
@@ -496,10 +495,10 @@ class GoogleMapsViewImpl(
|
|
|
496
495
|
}
|
|
497
496
|
|
|
498
497
|
markersById.remove(id)?.remove()
|
|
499
|
-
|
|
498
|
+
addMarkerInternal(id, opts, markerTag)
|
|
500
499
|
}
|
|
501
500
|
|
|
502
|
-
private fun
|
|
501
|
+
private fun addMarkerInternal(
|
|
503
502
|
id: String,
|
|
504
503
|
opts: MarkerOptions,
|
|
505
504
|
markerTag: MarkerTag,
|
|
@@ -547,10 +546,10 @@ class GoogleMapsViewImpl(
|
|
|
547
546
|
return@onUi
|
|
548
547
|
}
|
|
549
548
|
polylinesById.remove(id)?.remove()
|
|
550
|
-
|
|
549
|
+
addPolylineInternal(id, opts)
|
|
551
550
|
}
|
|
552
551
|
|
|
553
|
-
private fun
|
|
552
|
+
private fun addPolylineInternal(
|
|
554
553
|
id: String,
|
|
555
554
|
opts: PolylineOptions,
|
|
556
555
|
) = onUi {
|
|
@@ -590,10 +589,10 @@ class GoogleMapsViewImpl(
|
|
|
590
589
|
return@onUi
|
|
591
590
|
}
|
|
592
591
|
polygonsById.remove(id)?.remove()
|
|
593
|
-
|
|
592
|
+
addPolygonInternal(id, opts)
|
|
594
593
|
}
|
|
595
594
|
|
|
596
|
-
private fun
|
|
595
|
+
private fun addPolygonInternal(
|
|
597
596
|
id: String,
|
|
598
597
|
opts: PolygonOptions,
|
|
599
598
|
) = onUi {
|
|
@@ -633,10 +632,10 @@ class GoogleMapsViewImpl(
|
|
|
633
632
|
return@onUi
|
|
634
633
|
}
|
|
635
634
|
circlesById.remove(id)?.remove()
|
|
636
|
-
|
|
635
|
+
addCircleInternal(id, opts)
|
|
637
636
|
}
|
|
638
637
|
|
|
639
|
-
private fun
|
|
638
|
+
private fun addCircleInternal(
|
|
640
639
|
id: String,
|
|
641
640
|
opts: CircleOptions,
|
|
642
641
|
) = onUi {
|
|
@@ -676,10 +675,10 @@ class GoogleMapsViewImpl(
|
|
|
676
675
|
return@onUi
|
|
677
676
|
}
|
|
678
677
|
heatmapsById.remove(id)?.remove()
|
|
679
|
-
|
|
678
|
+
addHeatmapInternal(id, opts)
|
|
680
679
|
}
|
|
681
680
|
|
|
682
|
-
private fun
|
|
681
|
+
private fun addHeatmapInternal(
|
|
683
682
|
id: String,
|
|
684
683
|
opts: TileOverlayOptions,
|
|
685
684
|
) = onUi {
|
|
@@ -697,7 +696,10 @@ class GoogleMapsViewImpl(
|
|
|
697
696
|
|
|
698
697
|
fun clearHeatmaps() =
|
|
699
698
|
onUi {
|
|
700
|
-
heatmapsById.values.forEach {
|
|
699
|
+
heatmapsById.values.forEach {
|
|
700
|
+
it.clearTileCache()
|
|
701
|
+
it.remove()
|
|
702
|
+
}
|
|
701
703
|
heatmapsById.clear()
|
|
702
704
|
pendingHeatmaps.clear()
|
|
703
705
|
}
|
|
@@ -711,10 +713,10 @@ class GoogleMapsViewImpl(
|
|
|
711
713
|
return@onUi
|
|
712
714
|
}
|
|
713
715
|
kmlLayersById.remove(id)?.removeLayerFromMap()
|
|
714
|
-
|
|
716
|
+
addKmlLayerInternal(id, kmlString)
|
|
715
717
|
}
|
|
716
718
|
|
|
717
|
-
private fun
|
|
719
|
+
private fun addKmlLayerInternal(
|
|
718
720
|
id: String,
|
|
719
721
|
kmlString: String,
|
|
720
722
|
) = onUi {
|
|
@@ -749,10 +751,10 @@ class GoogleMapsViewImpl(
|
|
|
749
751
|
return@onUi
|
|
750
752
|
}
|
|
751
753
|
urlTileOverlaysById.remove(id)?.remove()
|
|
752
|
-
|
|
754
|
+
addUrlTileOverlayInternal(id, opts)
|
|
753
755
|
}
|
|
754
756
|
|
|
755
|
-
private fun
|
|
757
|
+
private fun addUrlTileOverlayInternal(
|
|
756
758
|
id: String,
|
|
757
759
|
opts: TileOverlayOptions,
|
|
758
760
|
) = onUi {
|
|
@@ -770,7 +772,10 @@ class GoogleMapsViewImpl(
|
|
|
770
772
|
|
|
771
773
|
fun clearUrlTileOverlays() =
|
|
772
774
|
onUi {
|
|
773
|
-
urlTileOverlaysById.values.forEach {
|
|
775
|
+
urlTileOverlaysById.values.forEach {
|
|
776
|
+
it.clearTileCache()
|
|
777
|
+
it.remove()
|
|
778
|
+
}
|
|
774
779
|
urlTileOverlaysById.clear()
|
|
775
780
|
pendingUrlTilesOverlays.clear()
|
|
776
781
|
}
|
|
@@ -4,6 +4,7 @@ import android.graphics.Color
|
|
|
4
4
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
5
5
|
import com.google.android.gms.maps.model.Circle
|
|
6
6
|
import com.google.android.gms.maps.model.CircleOptions
|
|
7
|
+
import com.rngooglemapsplus.extensions.centerEquals
|
|
7
8
|
import com.rngooglemapsplus.extensions.onUi
|
|
8
9
|
import com.rngooglemapsplus.extensions.toColor
|
|
9
10
|
import com.rngooglemapsplus.extensions.toLatLng
|
|
@@ -25,9 +26,7 @@ class MapCircleBuilder {
|
|
|
25
26
|
next: RNCircle,
|
|
26
27
|
circle: Circle,
|
|
27
28
|
) = onUi {
|
|
28
|
-
if (prev.
|
|
29
|
-
prev.center.longitude != next.center.longitude
|
|
30
|
-
) {
|
|
29
|
+
if (!prev.centerEquals(next)) {
|
|
31
30
|
circle.center = next.center.toLatLng()
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -19,6 +19,10 @@ import com.google.android.gms.maps.model.BitmapDescriptor
|
|
|
19
19
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory
|
|
20
20
|
import com.google.android.gms.maps.model.Marker
|
|
21
21
|
import com.google.android.gms.maps.model.MarkerOptions
|
|
22
|
+
import com.rngooglemapsplus.extensions.anchorEquals
|
|
23
|
+
import com.rngooglemapsplus.extensions.coordinatesEquals
|
|
24
|
+
import com.rngooglemapsplus.extensions.infoWindowAnchorEquals
|
|
25
|
+
import com.rngooglemapsplus.extensions.markerInfoWindowStyleEquals
|
|
22
26
|
import com.rngooglemapsplus.extensions.markerStyleEquals
|
|
23
27
|
import com.rngooglemapsplus.extensions.onUi
|
|
24
28
|
import com.rngooglemapsplus.extensions.styleHash
|
|
@@ -169,51 +173,39 @@ class MapMarkerBuilder(
|
|
|
169
173
|
next: RNMarker,
|
|
170
174
|
marker: Marker,
|
|
171
175
|
) = onUi {
|
|
172
|
-
if (prev.
|
|
173
|
-
prev.coordinate.longitude != next.coordinate.longitude
|
|
174
|
-
) {
|
|
176
|
+
if (!prev.coordinatesEquals(next)) {
|
|
175
177
|
marker.position = next.coordinate.toLatLng()
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
if (!prev.markerStyleEquals(next)) {
|
|
179
181
|
buildIconAsync(marker.id, next) { icon ->
|
|
180
182
|
marker.setIcon(icon)
|
|
181
|
-
if (prev.
|
|
182
|
-
prev.infoWindowAnchor?.y != next.infoWindowAnchor?.y
|
|
183
|
-
) {
|
|
184
|
-
marker.setInfoWindowAnchor(
|
|
185
|
-
(next.infoWindowAnchor?.x ?: 0.5f).toFloat(),
|
|
186
|
-
(next.infoWindowAnchor?.y ?: 0f).toFloat(),
|
|
187
|
-
)
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (prev.anchor?.x != next.anchor?.x ||
|
|
191
|
-
prev.anchor?.y != next.anchor?.y
|
|
192
|
-
) {
|
|
183
|
+
if (!prev.anchorEquals(next)) {
|
|
193
184
|
marker.setAnchor(
|
|
194
185
|
(next.anchor?.x ?: 0.5f).toFloat(),
|
|
195
186
|
(next.anchor?.y ?: 1.0f).toFloat(),
|
|
196
187
|
)
|
|
197
188
|
}
|
|
189
|
+
if (!prev.infoWindowAnchorEquals(next)) {
|
|
190
|
+
marker.setInfoWindowAnchor(
|
|
191
|
+
(next.infoWindowAnchor?.x ?: 0.5f).toFloat(),
|
|
192
|
+
(next.infoWindowAnchor?.y ?: 0f).toFloat(),
|
|
193
|
+
)
|
|
194
|
+
}
|
|
198
195
|
}
|
|
199
196
|
} else {
|
|
200
|
-
if (prev.
|
|
201
|
-
prev.infoWindowAnchor?.y != next.infoWindowAnchor?.y
|
|
202
|
-
) {
|
|
203
|
-
marker.setInfoWindowAnchor(
|
|
204
|
-
(next.infoWindowAnchor?.x ?: 0.5f).toFloat(),
|
|
205
|
-
(next.infoWindowAnchor?.y ?: 0f).toFloat(),
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (prev.anchor?.x != next.anchor?.x ||
|
|
210
|
-
prev.anchor?.y != next.anchor?.y
|
|
211
|
-
) {
|
|
197
|
+
if (!prev.anchorEquals(next)) {
|
|
212
198
|
marker.setAnchor(
|
|
213
199
|
(next.anchor?.x ?: 0.5f).toFloat(),
|
|
214
200
|
(next.anchor?.y ?: 1.0f).toFloat(),
|
|
215
201
|
)
|
|
216
202
|
}
|
|
203
|
+
if (!prev.infoWindowAnchorEquals(next)) {
|
|
204
|
+
marker.setInfoWindowAnchor(
|
|
205
|
+
(next.infoWindowAnchor?.x ?: 0.5f).toFloat(),
|
|
206
|
+
(next.infoWindowAnchor?.y ?: 0f).toFloat(),
|
|
207
|
+
)
|
|
208
|
+
}
|
|
217
209
|
}
|
|
218
210
|
|
|
219
211
|
if (prev.title != next.title) {
|
|
@@ -244,7 +236,7 @@ class MapMarkerBuilder(
|
|
|
244
236
|
marker.zIndex = next.zIndex?.toFloat() ?: 0f
|
|
245
237
|
}
|
|
246
238
|
|
|
247
|
-
if (prev.
|
|
239
|
+
if (!prev.markerInfoWindowStyleEquals(next)) {
|
|
248
240
|
marker.tag = MarkerTag(id = next.id, iconSvg = next.infoWindowIconSvg)
|
|
249
241
|
}
|
|
250
242
|
}
|
|
@@ -4,9 +4,12 @@ import android.graphics.Color
|
|
|
4
4
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
5
5
|
import com.google.android.gms.maps.model.Polygon
|
|
6
6
|
import com.google.android.gms.maps.model.PolygonOptions
|
|
7
|
+
import com.rngooglemapsplus.extensions.coordinatesEquals
|
|
8
|
+
import com.rngooglemapsplus.extensions.holesEquals
|
|
7
9
|
import com.rngooglemapsplus.extensions.onUi
|
|
8
10
|
import com.rngooglemapsplus.extensions.toColor
|
|
9
11
|
import com.rngooglemapsplus.extensions.toLatLng
|
|
12
|
+
import com.rngooglemapsplus.extensions.toMapsPolygonHoles
|
|
10
13
|
|
|
11
14
|
class MapPolygonBuilder {
|
|
12
15
|
fun build(poly: RNPolygon): PolygonOptions =
|
|
@@ -32,32 +35,12 @@ class MapPolygonBuilder {
|
|
|
32
35
|
next: RNPolygon,
|
|
33
36
|
poly: Polygon,
|
|
34
37
|
) = onUi {
|
|
35
|
-
|
|
36
|
-
prev.coordinates.size != next.coordinates.size ||
|
|
37
|
-
!prev.coordinates.zip(next.coordinates).all { (a, b) ->
|
|
38
|
-
a.latitude == b.latitude && a.longitude == b.longitude
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (coordsChanged) {
|
|
38
|
+
if (!prev.coordinatesEquals(next)) {
|
|
42
39
|
poly.points = next.coordinates.map { it.toLatLng() }
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
val holesChanged =
|
|
48
|
-
prevHoles.size != nextHoles.size ||
|
|
49
|
-
!prevHoles.zip(nextHoles).all { (ha, hb) ->
|
|
50
|
-
ha.coordinates.size == hb.coordinates.size &&
|
|
51
|
-
ha.coordinates.zip(hb.coordinates).all { (a, b) ->
|
|
52
|
-
a.latitude == b.latitude && a.longitude == b.longitude
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (holesChanged) {
|
|
57
|
-
poly.holes =
|
|
58
|
-
nextHoles.map { hole ->
|
|
59
|
-
hole.coordinates.map { it.toLatLng() }
|
|
60
|
-
}
|
|
42
|
+
if (!prev.holesEquals(next)) {
|
|
43
|
+
poly.holes = next.holes?.toMapsPolygonHoles() ?: emptyList()
|
|
61
44
|
}
|
|
62
45
|
|
|
63
46
|
if (prev.fillColor != next.fillColor) {
|
|
@@ -2,16 +2,14 @@ package com.rngooglemapsplus
|
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color
|
|
4
4
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
5
|
-
import com.google.android.gms.maps.model.ButtCap
|
|
6
|
-
import com.google.android.gms.maps.model.Cap
|
|
7
|
-
import com.google.android.gms.maps.model.JointType
|
|
8
5
|
import com.google.android.gms.maps.model.Polyline
|
|
9
6
|
import com.google.android.gms.maps.model.PolylineOptions
|
|
10
|
-
import com.
|
|
11
|
-
import com.google.android.gms.maps.model.SquareCap
|
|
7
|
+
import com.rngooglemapsplus.extensions.coordinatesEquals
|
|
12
8
|
import com.rngooglemapsplus.extensions.onUi
|
|
13
9
|
import com.rngooglemapsplus.extensions.toColor
|
|
14
10
|
import com.rngooglemapsplus.extensions.toLatLng
|
|
11
|
+
import com.rngooglemapsplus.extensions.toMapJointType
|
|
12
|
+
import com.rngooglemapsplus.extensions.toMapLineCap
|
|
15
13
|
|
|
16
14
|
class MapPolylineBuilder {
|
|
17
15
|
fun build(pl: RNPolyline): PolylineOptions =
|
|
@@ -21,10 +19,10 @@ class MapPolylineBuilder {
|
|
|
21
19
|
}
|
|
22
20
|
pl.width?.let { width(it.dpToPx()) }
|
|
23
21
|
pl.lineCap?.let {
|
|
24
|
-
startCap(
|
|
25
|
-
endCap(
|
|
22
|
+
startCap(it.toMapLineCap())
|
|
23
|
+
endCap(it.toMapLineCap())
|
|
26
24
|
}
|
|
27
|
-
pl.lineJoin?.let { jointType(
|
|
25
|
+
pl.lineJoin?.let { jointType(it.toMapJointType()) }
|
|
28
26
|
pl.color?.let { color(it.toColor()) }
|
|
29
27
|
pl.geodesic?.let { geodesic(it) }
|
|
30
28
|
pl.pressable?.let { clickable(it) }
|
|
@@ -36,13 +34,7 @@ class MapPolylineBuilder {
|
|
|
36
34
|
next: RNPolyline,
|
|
37
35
|
polyline: Polyline,
|
|
38
36
|
) = onUi {
|
|
39
|
-
|
|
40
|
-
prev.coordinates.size != next.coordinates.size ||
|
|
41
|
-
!prev.coordinates.zip(next.coordinates).all { (a, b) ->
|
|
42
|
-
a.latitude == b.latitude && a.longitude == b.longitude
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (coordsChanged) {
|
|
37
|
+
if (!prev.coordinatesEquals(next)) {
|
|
46
38
|
polyline.points = next.coordinates.map { it.toLatLng() }
|
|
47
39
|
}
|
|
48
40
|
|
|
@@ -50,17 +42,13 @@ class MapPolylineBuilder {
|
|
|
50
42
|
polyline.width = next.width?.dpToPx() ?: 1f
|
|
51
43
|
}
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
polyline.startCap = newCap
|
|
57
|
-
polyline.endCap = newCap
|
|
45
|
+
if (prev.lineCap != next.lineCap) {
|
|
46
|
+
polyline.startCap = next.lineCap.toMapLineCap()
|
|
47
|
+
polyline.endCap = next.lineCap.toMapLineCap()
|
|
58
48
|
}
|
|
59
49
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (newJoin != prevJoin) {
|
|
63
|
-
polyline.jointType = newJoin
|
|
50
|
+
if (prev.lineJoin != next.lineJoin) {
|
|
51
|
+
polyline.jointType = next.lineJoin.toMapJointType()
|
|
64
52
|
}
|
|
65
53
|
|
|
66
54
|
if (prev.color != next.color) {
|
|
@@ -79,19 +67,4 @@ class MapPolylineBuilder {
|
|
|
79
67
|
polyline.zIndex = next.zIndex?.toFloat() ?: 0f
|
|
80
68
|
}
|
|
81
69
|
}
|
|
82
|
-
|
|
83
|
-
private fun mapLineCap(type: RNLineCapType?): Cap =
|
|
84
|
-
when (type) {
|
|
85
|
-
RNLineCapType.ROUND -> RoundCap()
|
|
86
|
-
RNLineCapType.SQUARE -> SquareCap()
|
|
87
|
-
else -> ButtCap()
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
private fun mapLineJoin(type: RNLineJoinType?): Int =
|
|
91
|
-
when (type) {
|
|
92
|
-
RNLineJoinType.ROUND -> JointType.ROUND
|
|
93
|
-
RNLineJoinType.BEVEL -> JointType.BEVEL
|
|
94
|
-
RNLineJoinType.MITER -> JointType.DEFAULT
|
|
95
|
-
null -> JointType.DEFAULT
|
|
96
|
-
}
|
|
97
70
|
}
|
|
@@ -12,6 +12,7 @@ import com.rngooglemapsplus.extensions.markerEquals
|
|
|
12
12
|
import com.rngooglemapsplus.extensions.polygonEquals
|
|
13
13
|
import com.rngooglemapsplus.extensions.polylineEquals
|
|
14
14
|
import com.rngooglemapsplus.extensions.toCameraPosition
|
|
15
|
+
import com.rngooglemapsplus.extensions.toColor
|
|
15
16
|
import com.rngooglemapsplus.extensions.toCompressFormat
|
|
16
17
|
import com.rngooglemapsplus.extensions.toFileExtension
|
|
17
18
|
import com.rngooglemapsplus.extensions.toGoogleMapType
|
|
@@ -48,6 +49,7 @@ class RNGoogleMapsPlusView(
|
|
|
48
49
|
initialProps?.mapId?.let { mapId(it) }
|
|
49
50
|
initialProps?.liteMode?.let { liteMode(it) }
|
|
50
51
|
initialProps?.camera?.let { camera(it.toCameraPosition(current = null)) }
|
|
52
|
+
initialProps?.backgroundColor?.let { backgroundColor(it.toColor()) }
|
|
51
53
|
}
|
|
52
54
|
view.initMapView(options)
|
|
53
55
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package com.rngooglemapsplus.extensions
|
|
2
|
+
|
|
3
|
+
import com.google.android.gms.maps.model.ButtCap
|
|
4
|
+
import com.google.android.gms.maps.model.Cap
|
|
5
|
+
import com.google.android.gms.maps.model.RoundCap
|
|
6
|
+
import com.google.android.gms.maps.model.SquareCap
|
|
7
|
+
import com.rngooglemapsplus.RNLineCapType
|
|
8
|
+
|
|
9
|
+
fun RNLineCapType?.toMapLineCap(): Cap =
|
|
10
|
+
when (this) {
|
|
11
|
+
RNLineCapType.ROUND -> RoundCap()
|
|
12
|
+
RNLineCapType.SQUARE -> SquareCap()
|
|
13
|
+
else -> ButtCap()
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.rngooglemapsplus.extensions
|
|
2
|
+
|
|
3
|
+
import com.google.android.gms.maps.model.JointType
|
|
4
|
+
import com.rngooglemapsplus.RNLineJoinType
|
|
5
|
+
|
|
6
|
+
fun RNLineJoinType?.toMapJointType(): Int =
|
|
7
|
+
when (this) {
|
|
8
|
+
RNLineJoinType.ROUND -> JointType.ROUND
|
|
9
|
+
RNLineJoinType.BEVEL -> JointType.BEVEL
|
|
10
|
+
RNLineJoinType.MITER -> JointType.DEFAULT
|
|
11
|
+
null -> JointType.DEFAULT
|
|
12
|
+
}
|
|
@@ -3,12 +3,18 @@ package com.rngooglemapsplus.extensions
|
|
|
3
3
|
import com.rngooglemapsplus.RNCircle
|
|
4
4
|
|
|
5
5
|
fun RNCircle.circleEquals(b: RNCircle): Boolean {
|
|
6
|
+
if (!centerEquals(b)) return false
|
|
6
7
|
if (zIndex != b.zIndex) return false
|
|
7
8
|
if (pressable != b.pressable) return false
|
|
8
|
-
if (center != b.center) return false
|
|
9
9
|
if (radius != b.radius) return false
|
|
10
10
|
if (strokeWidth != b.strokeWidth) return false
|
|
11
11
|
if (strokeColor != b.strokeColor) return false
|
|
12
12
|
if (fillColor != b.fillColor) return false
|
|
13
13
|
return true
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
fun RNCircle.centerEquals(b: RNCircle): Boolean {
|
|
17
|
+
if (center.latitude != b.center.latitude) return false
|
|
18
|
+
if (center.longitude != b.center.longitude) return false
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
@@ -2,24 +2,61 @@ package com.rngooglemapsplus.extensions
|
|
|
2
2
|
|
|
3
3
|
import com.rngooglemapsplus.RNMarker
|
|
4
4
|
|
|
5
|
-
fun RNMarker.markerEquals(b: RNMarker): Boolean
|
|
6
|
-
id
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
fun RNMarker.markerEquals(b: RNMarker): Boolean {
|
|
6
|
+
if (id != b.id) return false
|
|
7
|
+
if (zIndex != b.zIndex) return false
|
|
8
|
+
if (!coordinatesEquals(b)) return false
|
|
9
|
+
if (!anchorEquals(b)) return false
|
|
10
|
+
if (!infoWindowAnchorEquals(b)) return false
|
|
11
|
+
if (title != b.title) return false
|
|
12
|
+
if (snippet != b.snippet) return false
|
|
13
|
+
if (opacity != b.opacity) return false
|
|
14
|
+
if (flat != b.flat) return false
|
|
15
|
+
if (draggable != b.draggable) return false
|
|
16
|
+
if (rotation != b.rotation) return false
|
|
17
|
+
if (!markerInfoWindowStyleEquals(b)) return false
|
|
18
|
+
if (!markerStyleEquals(b)) return false
|
|
19
|
+
|
|
20
|
+
return true
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fun RNMarker.coordinatesEquals(b: RNMarker): Boolean {
|
|
24
|
+
if (coordinate.latitude != b.coordinate.latitude) return false
|
|
25
|
+
if (coordinate.longitude != b.coordinate.longitude) return false
|
|
26
|
+
return true
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fun RNMarker.anchorEquals(b: RNMarker): Boolean {
|
|
30
|
+
if (anchor?.x != b.anchor?.x) return false
|
|
31
|
+
if (anchor?.y != b.anchor?.y) return false
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fun RNMarker.infoWindowAnchorEquals(b: RNMarker): Boolean {
|
|
36
|
+
if (infoWindowAnchor?.x != b.infoWindowAnchor?.x) return false
|
|
37
|
+
if (infoWindowAnchor?.y != b.infoWindowAnchor?.y) return false
|
|
38
|
+
return true
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fun RNMarker.markerInfoWindowStyleEquals(b: RNMarker): Boolean {
|
|
42
|
+
if (infoWindowIconSvg?.width != b.infoWindowIconSvg?.width) return false
|
|
43
|
+
if (infoWindowIconSvg?.height != b.infoWindowIconSvg?.height) return false
|
|
44
|
+
if (infoWindowIconSvg?.svgString != b.infoWindowIconSvg?.svgString) return false
|
|
45
|
+
|
|
46
|
+
return true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fun RNMarker.markerStyleEquals(b: RNMarker): Boolean {
|
|
50
|
+
if (iconSvg?.width != b.iconSvg?.width) return false
|
|
51
|
+
if (iconSvg?.height != b.iconSvg?.height) return false
|
|
52
|
+
if (iconSvg?.svgString != b.iconSvg?.svgString) return false
|
|
53
|
+
|
|
54
|
+
return true
|
|
55
|
+
}
|
|
21
56
|
|
|
22
57
|
fun RNMarker.styleHash(): Int =
|
|
23
58
|
arrayOf<Any?>(
|
|
24
|
-
iconSvg,
|
|
59
|
+
iconSvg?.width,
|
|
60
|
+
iconSvg?.height,
|
|
61
|
+
iconSvg?.svgString,
|
|
25
62
|
).contentHashCode()
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.rngooglemapsplus.extensions
|
|
2
2
|
|
|
3
|
+
import com.google.android.gms.maps.model.LatLng
|
|
3
4
|
import com.rngooglemapsplus.RNPolygon
|
|
5
|
+
import com.rngooglemapsplus.RNPolygonHole
|
|
4
6
|
|
|
5
7
|
fun RNPolygon.polygonEquals(b: RNPolygon): Boolean {
|
|
6
8
|
if (zIndex != b.zIndex) return false
|
|
@@ -9,7 +11,12 @@ fun RNPolygon.polygonEquals(b: RNPolygon): Boolean {
|
|
|
9
11
|
if (fillColor != b.fillColor) return false
|
|
10
12
|
if (strokeColor != b.strokeColor) return false
|
|
11
13
|
if (geodesic != b.geodesic) return false
|
|
12
|
-
if (!
|
|
14
|
+
if (!coordinatesEquals(b)) return false
|
|
15
|
+
if (!holesEquals(b)) return false
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
fun RNPolygon.coordinatesEquals(b: RNPolygon): Boolean {
|
|
13
20
|
val ac = coordinates
|
|
14
21
|
val bc = b.coordinates
|
|
15
22
|
if (ac.size != bc.size) return false
|
|
@@ -20,3 +27,26 @@ fun RNPolygon.polygonEquals(b: RNPolygon): Boolean {
|
|
|
20
27
|
}
|
|
21
28
|
return true
|
|
22
29
|
}
|
|
30
|
+
|
|
31
|
+
fun RNPolygon.holesEquals(b: RNPolygon): Boolean {
|
|
32
|
+
if (holes?.size != b.holes?.size) return false
|
|
33
|
+
if (holes != null && b.holes != null) {
|
|
34
|
+
for (i in holes.indices) {
|
|
35
|
+
val ah = holes[i]
|
|
36
|
+
val bh = b.holes[i]
|
|
37
|
+
|
|
38
|
+
if (ah.coordinates.size != bh.coordinates.size) return false
|
|
39
|
+
for (j in ah.coordinates.indices) {
|
|
40
|
+
val p = ah.coordinates[j]
|
|
41
|
+
val q = bh.coordinates[j]
|
|
42
|
+
if (p.latitude != q.latitude || p.longitude != q.longitude) return false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fun Array<RNPolygonHole>.toMapsPolygonHoles(): List<List<LatLng>> =
|
|
50
|
+
this.map { hole ->
|
|
51
|
+
hole.coordinates.map { it.toLatLng() }
|
|
52
|
+
}
|
|
@@ -5,11 +5,16 @@ import com.rngooglemapsplus.RNPolyline
|
|
|
5
5
|
fun RNPolyline.polylineEquals(b: RNPolyline): Boolean {
|
|
6
6
|
if (zIndex != b.zIndex) return false
|
|
7
7
|
if (pressable != b.pressable) return false
|
|
8
|
-
if (
|
|
8
|
+
if (width != b.width) return false
|
|
9
9
|
if (lineCap != b.lineCap) return false
|
|
10
10
|
if (lineJoin != b.lineJoin) return false
|
|
11
11
|
if (geodesic != b.geodesic) return false
|
|
12
12
|
if (color != b.color) return false
|
|
13
|
+
if (!coordinatesEquals(b)) return false
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fun RNPolyline.coordinatesEquals(b: RNPolyline): Boolean {
|
|
13
18
|
val ac = coordinates
|
|
14
19
|
val bc = b.coordinates
|
|
15
20
|
if (ac.size != bc.size) return false
|
|
@@ -574,7 +574,10 @@ GMSIndoorDisplayDelegate {
|
|
|
574
574
|
|
|
575
575
|
@MainActor
|
|
576
576
|
func removeHeatmap(id: String) {
|
|
577
|
-
heatmapsById.removeValue(forKey: id).map {
|
|
577
|
+
heatmapsById.removeValue(forKey: id).map {
|
|
578
|
+
$0.clearTileCache()
|
|
579
|
+
$0.map = nil
|
|
580
|
+
}
|
|
578
581
|
}
|
|
579
582
|
|
|
580
583
|
@MainActor
|
|
@@ -608,6 +611,7 @@ GMSIndoorDisplayDelegate {
|
|
|
608
611
|
geometries: parser.placemarks
|
|
609
612
|
)
|
|
610
613
|
renderer.render()
|
|
614
|
+
kmlLayerById[id] = renderer
|
|
611
615
|
}
|
|
612
616
|
}
|
|
613
617
|
|
|
@@ -639,16 +643,23 @@ GMSIndoorDisplayDelegate {
|
|
|
639
643
|
urlTileOverlay: GMSURLTileLayer
|
|
640
644
|
) {
|
|
641
645
|
urlTileOverlay.map = mapView
|
|
646
|
+
urlTileOverlays[id] = urlTileOverlay
|
|
642
647
|
}
|
|
643
648
|
|
|
644
649
|
@MainActor
|
|
645
650
|
func removeUrlTileOverlay(id: String) {
|
|
646
|
-
urlTileOverlays.removeValue(forKey: id).map {
|
|
651
|
+
urlTileOverlays.removeValue(forKey: id).map {
|
|
652
|
+
$0.clearTileCache()
|
|
653
|
+
$0.map = nil
|
|
654
|
+
}
|
|
647
655
|
}
|
|
648
656
|
|
|
649
657
|
@MainActor
|
|
650
658
|
func clearUrlTileOverlay() {
|
|
651
|
-
urlTileOverlays.values.forEach {
|
|
659
|
+
urlTileOverlays.values.forEach {
|
|
660
|
+
$0.clearTileCache()
|
|
661
|
+
$0.map = nil
|
|
662
|
+
}
|
|
652
663
|
urlTileOverlays.removeAll()
|
|
653
664
|
pendingUrlTileOverlays.removeAll()
|
|
654
665
|
}
|
|
@@ -17,13 +17,12 @@ final class MapCircleBuilder {
|
|
|
17
17
|
|
|
18
18
|
@MainActor
|
|
19
19
|
func update(_ prev: RNCircle, _ next: RNCircle, _ c: GMSCircle) {
|
|
20
|
-
if prev.
|
|
21
|
-
|| prev.center.longitude != next.center.longitude {
|
|
20
|
+
if !prev.centerEquals(next) {
|
|
22
21
|
c.position = next.center.toCLLocationCoordinate2D()
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
if prev.radius != next.radius {
|
|
26
|
-
c.radius = next.radius
|
|
25
|
+
c.radius = next.radius
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
if prev.fillColor != next.fillColor {
|