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 {
group = "center.sciprog"
version = "0.1.0-SNAPSHOT"
version = "0.1.0-dev-2"
}
ksciencePublish{

View File

@ -12,7 +12,7 @@ kotlin {
explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Warning
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
kotlinOptions.jvmTarget = space.kscience.gradle.KScienceVersions.JVM_TARGET.toString()
}
}
sourceSets {
@ -27,4 +27,8 @@ kotlin {
val jvmMain 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 val oval: GmcRectangle,
public val startAngle: Float,
public val endAngle: Float,
public val startAngle: Angle,
public val endAngle: Angle,
override val zoomRange: IntRange = defaultZoomRange,
public val color: Color = Color.Red,
) : 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.unit.DpSize
import androidx.compose.ui.unit.dp
import center.sciprog.maps.coordinates.Distance
import center.sciprog.maps.coordinates.GeodeticMapCoordinates
import center.sciprog.maps.coordinates.GmcRectangle
import center.sciprog.maps.coordinates.*
public typealias FeatureId = String
@ -101,6 +99,27 @@ public fun MapFeatureBuilder.draw(
drawFeature: DrawScope.() -> Unit,
): 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(
aCoordinates: Pair<Double, Double>,
bCoordinates: Pair<Double, Double>,
@ -114,14 +133,14 @@ public fun MapFeatureBuilder.line(
public fun MapFeatureBuilder.arc(
oval: GmcRectangle,
startAngle: Number,
endAngle: Number,
startAngle: Angle,
endAngle: Angle,
zoomRange: IntRange = defaultZoomRange,
color: Color = Color.Red,
id: FeatureId? = null,
): FeatureId = addFeature(
id,
MapArcFeature(oval, startAngle.toFloat(), endAngle.toFloat(), zoomRange, color)
MapArcFeature(oval, startAngle, endAngle, zoomRange, color)
)
public fun MapFeatureBuilder.arc(
@ -136,21 +155,21 @@ public fun MapFeatureBuilder.arc(
id,
MapArcFeature(
GmcRectangle.square(center.toCoordinates(), radius, radius),
startAngle.toFloat(),
endAngle.toFloat(),
startAngle.degrees,
endAngle.degrees,
zoomRange,
color
)
)
public fun MapFeatureBuilder.points(
points: List<Pair<Double, Double>>,
points: List<Gmc>,
zoomRange: IntRange = defaultZoomRange,
stroke: Float = 2f,
color: Color = Color.Red,
pointMode: PointMode = PointMode.Points,
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
public fun MapFeatureBuilder.image(

View File

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