-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathIndoorBuildingExtension.kt
More file actions
33 lines (29 loc) · 883 Bytes
/
IndoorBuildingExtension.kt
File metadata and controls
33 lines (29 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.rngooglemapsplus.extensions
import com.google.android.gms.maps.model.IndoorBuilding
import com.google.android.gms.maps.model.IndoorLevel
import com.rngooglemapsplus.RNIndoorBuilding
import com.rngooglemapsplus.RNIndoorLevel
fun IndoorBuilding.toRNIndoorBuilding(): RNIndoorBuilding {
val mappedLevels =
levels
.mapIndexed { index, level ->
val active = index == activeLevelIndex
level.toRNIndoorLevel(index, active)
}.toTypedArray()
return RNIndoorBuilding(
activeLevelIndex = activeLevelIndex.toDouble(),
defaultLevelIndex = defaultLevelIndex.toDouble(),
levels = mappedLevels,
underground = isUnderground,
)
}
fun IndoorLevel.toRNIndoorLevel(
index: Int,
active: Boolean,
): RNIndoorLevel =
RNIndoorLevel(
index = index.toDouble(),
name = name,
shortName = shortName,
active = active,
)