Move classes to common

This commit is contained in:
Alexander Nozik 2022-07-11 09:36:43 +03:00
parent 3837af5886
commit 005ef17f8e
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
9 changed files with 28 additions and 9 deletions

View File

@ -1,4 +1,4 @@
package centre.sciprog.maps.compose
package centre.sciprog.maps
import kotlin.math.PI

View File

@ -1,4 +1,4 @@
package centre.sciprog.maps.compose
package centre.sciprog.maps
import kotlin.math.roundToInt

View File

@ -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.
*/
package centre.sciprog.maps.compose
package centre.sciprog.maps
import kotlin.math.*

View File

@ -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.
*/
package centre.sciprog.maps.compose
package centre.sciprog.maps
import kotlin.math.*

View File

@ -8,6 +8,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.VectorPainter
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.unit.IntSize
import centre.sciprog.maps.GeodeticMapCoordinates
//TODO replace zoom range with zoom-based representation change
sealed class MapFeature(val zoomRange: IntRange)

View 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 = {},
)

View File

@ -8,6 +8,8 @@ import androidx.compose.material.icons.filled.Home
import androidx.compose.runtime.*
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import centre.sciprog.maps.GeodeticMapCoordinates
import centre.sciprog.maps.MapViewPoint
import centre.sciprog.maps.compose.*
import io.ktor.client.HttpClient
import io.ktor.client.engine.cio.CIO

View File

@ -18,11 +18,11 @@ import androidx.compose.ui.input.pointer.PointerEventType
import androidx.compose.ui.input.pointer.PointerInputChange
import androidx.compose.ui.input.pointer.onPointerEvent
import androidx.compose.ui.input.pointer.pointerInput
import centre.sciprog.maps.*
import mu.KotlinLogging
import org.jetbrains.skia.Font
import org.jetbrains.skia.Paint
import kotlin.math.pow
import kotlin.math.round
import kotlin.math.roundToInt
@ -38,12 +38,12 @@ private val logger = KotlinLogging.logger("MapView")
*/
@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun MapView(
actual fun MapView(
initialViewPoint: MapViewPoint,
mapTileProvider: MapTileProvider,
features: Collection<MapFeature> = emptyList(),
modifier: Modifier = Modifier.fillMaxSize(),
onClick: (GeodeticMapCoordinates) -> Unit = {},
features: Collection<MapFeature>,
modifier: Modifier,
onClick: (GeodeticMapCoordinates) -> Unit,
) {
var viewPoint by remember { mutableStateOf(initialViewPoint) }