Move classes to common
This commit is contained in:
parent
3837af5886
commit
005ef17f8e
@ -1,4 +1,4 @@
|
|||||||
package centre.sciprog.maps.compose
|
package centre.sciprog.maps
|
||||||
|
|
||||||
import kotlin.math.PI
|
import kotlin.math.PI
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package centre.sciprog.maps.compose
|
package centre.sciprog.maps
|
||||||
|
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package centre.sciprog.maps.compose
|
package centre.sciprog.maps
|
||||||
|
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package centre.sciprog.maps.compose
|
package centre.sciprog.maps
|
||||||
|
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
|
|
@ -8,6 +8,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
|
|||||||
import androidx.compose.ui.graphics.vector.VectorPainter
|
import androidx.compose.ui.graphics.vector.VectorPainter
|
||||||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||||
import androidx.compose.ui.unit.IntSize
|
import androidx.compose.ui.unit.IntSize
|
||||||
|
import centre.sciprog.maps.GeodeticMapCoordinates
|
||||||
|
|
||||||
//TODO replace zoom range with zoom-based representation change
|
//TODO replace zoom range with zoom-based representation change
|
||||||
sealed class MapFeature(val zoomRange: IntRange)
|
sealed class MapFeature(val zoomRange: IntRange)
|
16
src/commonMain/kotlin/centre/sciprog/maps/compose/MapView.kt
Normal file
16
src/commonMain/kotlin/centre/sciprog/maps/compose/MapView.kt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package centre.sciprog.maps.compose
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import centre.sciprog.maps.GeodeticMapCoordinates
|
||||||
|
import centre.sciprog.maps.MapViewPoint
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
expect fun MapView(
|
||||||
|
initialViewPoint: MapViewPoint,
|
||||||
|
mapTileProvider: MapTileProvider,
|
||||||
|
features: Collection<MapFeature> = emptyList(),
|
||||||
|
modifier: Modifier = Modifier.fillMaxSize(),
|
||||||
|
onClick: (GeodeticMapCoordinates) -> Unit = {},
|
||||||
|
)
|
@ -8,6 +8,8 @@ import androidx.compose.material.icons.filled.Home
|
|||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.window.Window
|
import androidx.compose.ui.window.Window
|
||||||
import androidx.compose.ui.window.application
|
import androidx.compose.ui.window.application
|
||||||
|
import centre.sciprog.maps.GeodeticMapCoordinates
|
||||||
|
import centre.sciprog.maps.MapViewPoint
|
||||||
import centre.sciprog.maps.compose.*
|
import centre.sciprog.maps.compose.*
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.engine.cio.CIO
|
import io.ktor.client.engine.cio.CIO
|
||||||
|
@ -18,11 +18,11 @@ import androidx.compose.ui.input.pointer.PointerEventType
|
|||||||
import androidx.compose.ui.input.pointer.PointerInputChange
|
import androidx.compose.ui.input.pointer.PointerInputChange
|
||||||
import androidx.compose.ui.input.pointer.onPointerEvent
|
import androidx.compose.ui.input.pointer.onPointerEvent
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
|
import centre.sciprog.maps.*
|
||||||
import mu.KotlinLogging
|
import mu.KotlinLogging
|
||||||
import org.jetbrains.skia.Font
|
import org.jetbrains.skia.Font
|
||||||
import org.jetbrains.skia.Paint
|
import org.jetbrains.skia.Paint
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import kotlin.math.round
|
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
|
||||||
@ -38,12 +38,12 @@ private val logger = KotlinLogging.logger("MapView")
|
|||||||
*/
|
*/
|
||||||
@OptIn(ExperimentalComposeUiApi::class)
|
@OptIn(ExperimentalComposeUiApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun MapView(
|
actual fun MapView(
|
||||||
initialViewPoint: MapViewPoint,
|
initialViewPoint: MapViewPoint,
|
||||||
mapTileProvider: MapTileProvider,
|
mapTileProvider: MapTileProvider,
|
||||||
features: Collection<MapFeature> = emptyList(),
|
features: Collection<MapFeature>,
|
||||||
modifier: Modifier = Modifier.fillMaxSize(),
|
modifier: Modifier,
|
||||||
onClick: (GeodeticMapCoordinates) -> Unit = {},
|
onClick: (GeodeticMapCoordinates) -> Unit,
|
||||||
) {
|
) {
|
||||||
var viewPoint by remember { mutableStateOf(initialViewPoint) }
|
var viewPoint by remember { mutableStateOf(initialViewPoint) }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user