diff --git a/build.gradle.kts b/build.gradle.kts index a606292..8cf152e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ val ktorVersion by extra("2.0.3") allprojects { group = "center.sciprog" - version = "0.1.0-dev-9" + version = "0.1.0-dev-10" } ksciencePublish{ diff --git a/maps-kt-compose/src/commonMain/kotlin/center/sciprog/maps/compose/MapFeature.kt b/maps-kt-compose/src/commonMain/kotlin/center/sciprog/maps/compose/MapFeature.kt index d3487a1..faec6ea 100644 --- a/maps-kt-compose/src/commonMain/kotlin/center/sciprog/maps/compose/MapFeature.kt +++ b/maps-kt-compose/src/commonMain/kotlin/center/sciprog/maps/compose/MapFeature.kt @@ -1,10 +1,11 @@ package center.sciprog.maps.compose import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.ImageBitmap -import androidx.compose.ui.graphics.PointMode +import androidx.compose.ui.geometry.Rect +import androidx.compose.ui.graphics.* import androidx.compose.ui.graphics.drawscope.DrawScope +import androidx.compose.ui.graphics.drawscope.DrawStyle +import androidx.compose.ui.graphics.drawscope.Fill import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.VectorPainter import androidx.compose.ui.graphics.vector.rememberVectorPainter @@ -57,20 +58,20 @@ public class MapDrawFeature( MapDrawFeature(newCoordinates, zoomRange, drawFeature) } -//public class MapPathFeature( -// public val rectangle: GmcRectangle, -// public val path: Path, -// public val brush: Brush, -// public val style: DrawStyle = Fill, -// public val targetRect: Rect = path.getBounds(), -// override val zoomRange: IntRange = defaultZoomRange, -//) : DraggableMapFeature { -// override fun withCoordinates(newCoordinates: GeodeticMapCoordinates): MapFeature = -// MapPathFeature(rectangle.moveTo(newCoordinates), path, brush, style, targetRect, zoomRange) -// -// override fun getBoundingBox(zoom: Double): GmcRectangle = rectangle -// -//} +public class MapPathFeature( + public val rectangle: GmcRectangle, + public val path: Path, + public val brush: Brush, + public val style: DrawStyle = Fill, + public val targetRect: Rect = path.getBounds(), + override val zoomRange: IntRange = defaultZoomRange, +) : DraggableMapFeature { + override fun withCoordinates(newCoordinates: GeodeticMapCoordinates): MapFeature = + MapPathFeature(rectangle.moveTo(newCoordinates), path, brush, style, targetRect, zoomRange) + + override fun getBoundingBox(zoom: Double): GmcRectangle = rectangle + +} public class MapPointsFeature( public val points: List, diff --git a/maps-kt-compose/src/jvmMain/kotlin/center/sciprog/maps/compose/MapViewJvm.kt b/maps-kt-compose/src/jvmMain/kotlin/center/sciprog/maps/compose/MapViewJvm.kt index 66fcdab..7ba95e4 100644 --- a/maps-kt-compose/src/jvmMain/kotlin/center/sciprog/maps/compose/MapViewJvm.kt +++ b/maps-kt-compose/src/jvmMain/kotlin/center/sciprog/maps/compose/MapViewJvm.kt @@ -303,13 +303,14 @@ public actual fun MapView( } } -// is MapPathFeature -> { + is MapPathFeature -> { + TODO("MapPathFeature not implemented") // val offset = feature.rectangle.center.toOffset() - feature.targetRect.center // translate(offset.x, offset.y) { // sca // drawPath(feature.path, brush = feature.brush, style = feature.style) // } -// } + } is MapPointsFeature -> { val points = feature.points.map { it.toOffset() } diff --git a/maps-kt-core/src/commonMain/kotlin/center/sciprog/maps/coordinates/GmcCurve.kt b/maps-kt-core/src/commonMain/kotlin/center/sciprog/maps/coordinates/GmcCurve.kt index 7d8c2a4..e09281f 100644 --- a/maps-kt-core/src/commonMain/kotlin/center/sciprog/maps/coordinates/GmcCurve.kt +++ b/maps-kt-core/src/commonMain/kotlin/center/sciprog/maps/coordinates/GmcCurve.kt @@ -190,7 +190,7 @@ public fun GeoEllipsoid.curveInDirection( val L = lambda - (1 - C) * f * sinAlpha * (sigma.value + C * sinSigma * (cosSigmaM2 + C * cosSigma * (-1 + 2 * cos2SigmaM2))) - val endPoint = Gmc(phi2, L.radians) + val endPoint = Gmc(phi2, start.longitude + L.radians) // eq. 12 diff --git a/maps-kt-core/src/commonTest/kotlin/center/sciprog/maps/coordinates/DistanceTest.kt b/maps-kt-core/src/commonTest/kotlin/center/sciprog/maps/coordinates/DistanceTest.kt index e956e31..9e6442a 100644 --- a/maps-kt-core/src/commonTest/kotlin/center/sciprog/maps/coordinates/DistanceTest.kt +++ b/maps-kt-core/src/commonTest/kotlin/center/sciprog/maps/coordinates/DistanceTest.kt @@ -30,5 +30,6 @@ internal class DistanceTest { ) assertEquals(spb.latitude.radians.value,curve.backward.latitude.radians.value, 0.0001) + assertEquals(spb.longitude.radians.value,curve.backward.longitude.radians.value, 0.0001) } } \ No newline at end of file