Update feature builder AP

This commit is contained in:
Alexander Nozik 2022-09-10 15:20:01 +03:00
parent 7939677e5a
commit cda8d8e76f
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
5 changed files with 43 additions and 15 deletions

View File

@ -10,7 +10,7 @@ val ktorVersion by extra("2.0.3")
allprojects { allprojects {
group = "center.sciprog" group = "center.sciprog"
version = "0.1.0-SNAPSHOT" version = "0.1.0-dev-2"
} }
ksciencePublish{ ksciencePublish{

View File

@ -12,7 +12,7 @@ kotlin {
explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Warning explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Warning
jvm { jvm {
compilations.all { compilations.all {
kotlinOptions.jvmTarget = "11" kotlinOptions.jvmTarget = space.kscience.gradle.KScienceVersions.JVM_TARGET.toString()
} }
} }
sourceSets { sourceSets {
@ -28,3 +28,7 @@ kotlin {
val jvmTest by getting val jvmTest by getting
} }
} }
java{
targetCompatibility = space.kscience.gradle.KScienceVersions.JVM_TARGET
}

View File

@ -109,8 +109,8 @@ public class MapLineFeature(
public class MapArcFeature( public class MapArcFeature(
public val oval: GmcRectangle, public val oval: GmcRectangle,
public val startAngle: Float, public val startAngle: Angle,
public val endAngle: Float, public val endAngle: Angle,
override val zoomRange: IntRange = defaultZoomRange, override val zoomRange: IntRange = defaultZoomRange,
public val color: Color = Color.Red, public val color: Color = Color.Red,
) : MapFeature { ) : MapFeature {

View File

@ -9,9 +9,7 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import center.sciprog.maps.coordinates.Distance import center.sciprog.maps.coordinates.*
import center.sciprog.maps.coordinates.GeodeticMapCoordinates
import center.sciprog.maps.coordinates.GmcRectangle
public typealias FeatureId = String public typealias FeatureId = String
@ -101,6 +99,27 @@ public fun MapFeatureBuilder.draw(
drawFeature: DrawScope.() -> Unit, drawFeature: DrawScope.() -> Unit,
): FeatureId = addFeature(id, MapDrawFeature(position.toCoordinates(), zoomRange, drawFeature)) ): FeatureId = addFeature(id, MapDrawFeature(position.toCoordinates(), zoomRange, drawFeature))
public fun MapFeatureBuilder.line(
aCoordinates: Gmc,
bCoordinates: Gmc,
zoomRange: IntRange = defaultZoomRange,
color: Color = Color.Red,
id: FeatureId? = null,
): FeatureId = addFeature(
id,
MapLineFeature(aCoordinates, bCoordinates, zoomRange, color)
)
public fun MapFeatureBuilder.line(
curve: GmcCurve,
zoomRange: IntRange = defaultZoomRange,
color: Color = Color.Red,
id: FeatureId? = null,
): FeatureId = addFeature(
id,
MapLineFeature(curve.forward.coordinates, curve.backward.coordinates, zoomRange, color)
)
public fun MapFeatureBuilder.line( public fun MapFeatureBuilder.line(
aCoordinates: Pair<Double, Double>, aCoordinates: Pair<Double, Double>,
bCoordinates: Pair<Double, Double>, bCoordinates: Pair<Double, Double>,
@ -114,14 +133,14 @@ public fun MapFeatureBuilder.line(
public fun MapFeatureBuilder.arc( public fun MapFeatureBuilder.arc(
oval: GmcRectangle, oval: GmcRectangle,
startAngle: Number, startAngle: Angle,
endAngle: Number, endAngle: Angle,
zoomRange: IntRange = defaultZoomRange, zoomRange: IntRange = defaultZoomRange,
color: Color = Color.Red, color: Color = Color.Red,
id: FeatureId? = null, id: FeatureId? = null,
): FeatureId = addFeature( ): FeatureId = addFeature(
id, id,
MapArcFeature(oval, startAngle.toFloat(), endAngle.toFloat(), zoomRange, color) MapArcFeature(oval, startAngle, endAngle, zoomRange, color)
) )
public fun MapFeatureBuilder.arc( public fun MapFeatureBuilder.arc(
@ -136,21 +155,21 @@ public fun MapFeatureBuilder.arc(
id, id,
MapArcFeature( MapArcFeature(
GmcRectangle.square(center.toCoordinates(), radius, radius), GmcRectangle.square(center.toCoordinates(), radius, radius),
startAngle.toFloat(), startAngle.degrees,
endAngle.toFloat(), endAngle.degrees,
zoomRange, zoomRange,
color color
) )
) )
public fun MapFeatureBuilder.points( public fun MapFeatureBuilder.points(
points: List<Pair<Double, Double>>, points: List<Gmc>,
zoomRange: IntRange = defaultZoomRange, zoomRange: IntRange = defaultZoomRange,
stroke: Float = 2f, stroke: Float = 2f,
color: Color = Color.Red, color: Color = Color.Red,
pointMode: PointMode = PointMode.Points, pointMode: PointMode = PointMode.Points,
id: FeatureId? = null, id: FeatureId? = null,
): FeatureId = addFeature(id, MapPointsFeature(points.map { it.toCoordinates() }, zoomRange, stroke, color, pointMode)) ): FeatureId = addFeature(id, MapPointsFeature(points, zoomRange, stroke, color, pointMode))
@Composable @Composable
public fun MapFeatureBuilder.image( public fun MapFeatureBuilder.image(

View File

@ -1,4 +1,5 @@
import org.jetbrains.compose.compose import org.jetbrains.compose.compose
import space.kscience.gradle.KScienceVersions.JVM_TARGET
plugins { plugins {
@ -9,7 +10,7 @@ plugins {
kotlin { kotlin {
jvm { jvm {
compilations.all { compilations.all {
kotlinOptions.jvmTarget = "11" kotlinOptions.jvmTarget = JVM_TARGET.toString()
} }
} }
sourceSets { sourceSets {
@ -26,3 +27,7 @@ kotlin {
} }
} }
} }
java{
targetCompatibility = JVM_TARGET
}