@@ -13,48 +13,50 @@ import com.mapbox.maps.plugin.locationcomponent.generated.LocationComponentSetti
13
13
import java.io.ByteArrayOutputStream
14
14
15
15
fun LocationComponentSettingsInterface.applyFromFLT (settings : LocationComponentSettings , useDefaultPuck2DIfNeeded : Boolean , context : Context ) {
16
- settings.enabled?.let { enabled = it }
17
- settings.pulsingEnabled?.let { pulsingEnabled = it }
18
- settings.pulsingColor?.let { pulsingColor = it.toInt() }
19
- settings.pulsingMaxRadius?.let { pulsingMaxRadius = it.toFloat() }
20
- settings.showAccuracyRing?.let { showAccuracyRing = it }
21
- settings.accuracyRingColor?.let { accuracyRingColor = it.toInt() }
22
- settings.accuracyRingBorderColor?.let { accuracyRingBorderColor = it.toInt() }
23
- settings.layerAbove?.let { layerAbove = it }
24
- settings.layerBelow?.let { layerBelow = it }
25
- settings.puckBearingEnabled?.let { puckBearingEnabled = it }
26
- settings.puckBearing?.let {
27
- puckBearing = com.mapbox.maps.plugin.PuckBearing .values()[it.ordinal]
28
- }
29
- settings.locationPuck?.let {
30
- val puck2D = it.locationPuck2D
31
- val puck3D = it.locationPuck3D
32
- locationPuck = if (puck3D != null ) {
33
- com.mapbox.maps.plugin.LocationPuck3D (
34
- puck3D.modelUri!!
35
- ).apply {
36
- puck3D.modelUri?.let { modelUri = it }
37
- puck3D.position?.let { position = it.mapNotNull { it?.toFloat() } }
38
- puck3D.modelOpacity?.let { modelOpacity = it.toFloat() }
39
- puck3D.modelScale?.let { modelScale = it.mapNotNull { it?.toFloat() } }
40
- puck3D.modelScaleExpression?.let { modelScaleExpression = it }
41
- puck3D.modelTranslation?.let { modelTranslation = it.mapNotNull { it?.toFloat() } }
42
- puck3D.modelRotation?.let { modelRotation = it.mapNotNull { it?.toFloat() } }
43
- puck3D.modelCastShadows?.let { modelCastShadows = it }
44
- puck3D.modelReceiveShadows?.let { modelReceiveShadows = it }
45
- puck3D.modelScaleMode?.let { modelScaleMode = it.toModelScaleMode() }
46
- puck3D.modelEmissiveStrength?.let { modelEmissiveStrength = it.toFloat() }
47
- puck3D.modelEmissiveStrengthExpression?.let { modelEmissiveStrengthExpression = it }
48
- }
49
- } else {
50
- (if (useDefaultPuck2DIfNeeded) createDefault2DPuck(withBearing = settings.puckBearingEnabled == true ) else com.mapbox.maps.plugin.LocationPuck2D ())
51
- .apply {
52
- puck2D?.topImage?.let { topImage = if (it.isNotEmpty()) ImageHolder .from(BitmapFactory .decodeByteArray(it, 0 , it.size)) else null }
53
- puck2D?.bearingImage?.let { bearingImage = if (it.isNotEmpty()) ImageHolder .from(BitmapFactory .decodeByteArray(it, 0 , it.size)) else null }
54
- puck2D?.shadowImage?.let { shadowImage = if (it.isNotEmpty()) ImageHolder .from(BitmapFactory .decodeByteArray(it, 0 , it.size)) else null }
55
- puck2D?.scaleExpression?.let { scaleExpression = it }
56
- puck2D?.opacity?.let { opacity = it.toFloat() }
16
+ updateSettings {
17
+ settings.enabled?.let { this .enabled = it }
18
+ settings.pulsingEnabled?.let { this .pulsingEnabled = it }
19
+ settings.pulsingColor?.let { this .pulsingColor = it.toInt() }
20
+ settings.pulsingMaxRadius?.let { this .pulsingMaxRadius = it.toFloat() }
21
+ settings.showAccuracyRing?.let { this .showAccuracyRing = it }
22
+ settings.accuracyRingColor?.let { this .accuracyRingColor = it.toInt() }
23
+ settings.accuracyRingBorderColor?.let { this .accuracyRingBorderColor = it.toInt() }
24
+ settings.layerAbove?.let { this .layerAbove = it }
25
+ settings.layerBelow?.let { this .layerBelow = it }
26
+ settings.puckBearingEnabled?.let { this .puckBearingEnabled = it }
27
+ settings.puckBearing?.let {
28
+ this .puckBearing = com.mapbox.maps.plugin.PuckBearing .values()[it.ordinal]
29
+ }
30
+ settings.locationPuck?.let {
31
+ val puck2D = it.locationPuck2D
32
+ val puck3D = it.locationPuck3D
33
+ this .locationPuck = if (puck3D != null ) {
34
+ com.mapbox.maps.plugin.LocationPuck3D (
35
+ puck3D.modelUri!!
36
+ ).apply {
37
+ puck3D.modelUri?.let { this .modelUri = it }
38
+ puck3D.position?.let { this .position = it.mapNotNull { it?.toFloat() } }
39
+ puck3D.modelOpacity?.let { this .modelOpacity = it.toFloat() }
40
+ puck3D.modelScale?.let { this .modelScale = it.mapNotNull { it?.toFloat() } }
41
+ puck3D.modelScaleExpression?.let { this .modelScaleExpression = it }
42
+ puck3D.modelTranslation?.let { this .modelTranslation = it.mapNotNull { it?.toFloat() } }
43
+ puck3D.modelRotation?.let { this .modelRotation = it.mapNotNull { it?.toFloat() } }
44
+ puck3D.modelCastShadows?.let { this .modelCastShadows = it }
45
+ puck3D.modelReceiveShadows?.let { this .modelReceiveShadows = it }
46
+ puck3D.modelScaleMode?.let { this .modelScaleMode = it.toModelScaleMode() }
47
+ puck3D.modelEmissiveStrength?.let { this .modelEmissiveStrength = it.toFloat() }
48
+ puck3D.modelEmissiveStrengthExpression?.let { this .modelEmissiveStrengthExpression = it }
57
49
}
50
+ } else {
51
+ (if (useDefaultPuck2DIfNeeded) createDefault2DPuck(withBearing = settings.puckBearingEnabled == true ) else com.mapbox.maps.plugin.LocationPuck2D ())
52
+ .apply {
53
+ puck2D?.topImage?.let { this .topImage = if (it.isNotEmpty()) ImageHolder .from(BitmapFactory .decodeByteArray(it, 0 , it.size)) else null }
54
+ puck2D?.bearingImage?.let { this .bearingImage = if (it.isNotEmpty()) ImageHolder .from(BitmapFactory .decodeByteArray(it, 0 , it.size)) else null }
55
+ puck2D?.shadowImage?.let { this .shadowImage = if (it.isNotEmpty()) ImageHolder .from(BitmapFactory .decodeByteArray(it, 0 , it.size)) else null }
56
+ puck2D?.scaleExpression?.let { this .scaleExpression = it }
57
+ puck2D?.opacity?.let { this .opacity = it.toFloat() }
58
+ }
59
+ }
58
60
}
59
61
}
60
62
}
0 commit comments