2022-07-11 09:36:43 +03:00
|
|
|
package centre.sciprog.maps.compose
|
|
|
|
|
|
|
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
|
|
import androidx.compose.runtime.Composable
|
2022-07-11 18:32:36 +03:00
|
|
|
import androidx.compose.runtime.mutableStateMapOf
|
|
|
|
import androidx.compose.runtime.snapshots.SnapshotStateMap
|
2022-07-11 09:36:43 +03:00
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
import centre.sciprog.maps.GeodeticMapCoordinates
|
|
|
|
import centre.sciprog.maps.MapViewPoint
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
expect fun MapView(
|
|
|
|
initialViewPoint: MapViewPoint,
|
|
|
|
mapTileProvider: MapTileProvider,
|
2022-07-11 18:32:36 +03:00
|
|
|
features: SnapshotStateMap<FeatureId, MapFeature> = mutableStateMapOf(),
|
|
|
|
onClick: (GeodeticMapCoordinates) -> Unit = {},
|
|
|
|
modifier: Modifier = Modifier.fillMaxSize(),
|
|
|
|
)
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun MapView(
|
|
|
|
initialViewPoint: MapViewPoint,
|
|
|
|
mapTileProvider: MapTileProvider,
|
2022-07-11 09:36:43 +03:00
|
|
|
modifier: Modifier = Modifier.fillMaxSize(),
|
|
|
|
onClick: (GeodeticMapCoordinates) -> Unit = {},
|
2022-07-11 18:32:36 +03:00
|
|
|
addFeatures: @Composable FeatureBuilder.() -> Unit,
|
|
|
|
) {
|
|
|
|
val featuresBuilder = MapFeatureBuilder()
|
|
|
|
featuresBuilder.addFeatures()
|
|
|
|
MapView(initialViewPoint, mapTileProvider, featuresBuilder.build(), onClick, modifier)
|
|
|
|
}
|