Fix for #22 (default hairline size for points)

This commit is contained in:
Alexander Nozik 2023-05-26 15:49:14 +03:00
parent a059697f5c
commit 1caf141d27
5 changed files with 29 additions and 12 deletions

View File

@ -9,17 +9,17 @@ job("Publish") {
gitPush { enabled = false } gitPush { enabled = false }
} }
container("spc.registry.jetbrains.space/p/sci/containers/kotlin-ci:1.0.3") { container("spc.registry.jetbrains.space/p/sci/containers/kotlin-ci:1.0.3") {
env["SPACE_USER"] = Secrets("space_user") env["SPACE_USER"] = "{{ project:space_user }}"
env["SPACE_TOKEN"] = Secrets("space_token") env["SPACE_TOKEN"] = "{{ project:space_token }}"
kotlinScript { api -> kotlinScript { api ->
val spaceUser = System.getenv("SPACE_USER") val spaceUser = System.getenv("SPACE_USER")
val spaceToken = System.getenv("SPACE_TOKEN") val spaceToken = System.getenv("SPACE_TOKEN")
// write version to the build directory // write the version to the build directory
api.gradlew("version") api.gradlew("version")
//read version from build file //read the version from build file
val version = java.nio.file.Path.of("build/project-version.txt").readText() val version = java.nio.file.Path.of("build/project-version.txt").readText()
val revisionSuffix = if (version.endsWith("SNAPSHOT")) { val revisionSuffix = if (version.endsWith("SNAPSHOT")) {
@ -32,7 +32,7 @@ job("Publish") {
project = api.projectIdentifier(), project = api.projectIdentifier(),
targetIdentifier = TargetIdentifier.Key("maps-kt"), targetIdentifier = TargetIdentifier.Key("maps-kt"),
version = version+revisionSuffix, version = version+revisionSuffix,
// automatically update deployment status based on a status of a job // automatically update deployment status based on the status of a job
syncWithAutomationJob = true syncWithAutomationJob = true
) )
api.gradlew( api.gradlew(

View File

@ -6,11 +6,11 @@ plugins {
id("space.kscience.gradle.project") id("space.kscience.gradle.project")
} }
val kmathVersion: String by extra("0.3.1-dev-RC") val kmathVersion: String by extra("0.3.1")
allprojects { allprojects {
group = "center.sciprog" group = "center.sciprog"
version = "0.2.2" version = "0.2.3-dev-1"
repositories { repositories {
mavenLocal() mavenLocal()

View File

@ -55,7 +55,6 @@ fun App() {
val centerCoordinates = MutableStateFlow<Gmc?>(null) val centerCoordinates = MutableStateFlow<Gmc?>(null)
val pointOne = 55.568548 to 37.568604 val pointOne = 55.568548 to 37.568604
val pointTwo = 55.929444 to 37.518434 val pointTwo = 55.929444 to 37.518434
// val pointThree = 60.929444 to 37.518434 // val pointThree = 60.929444 to 37.518434
@ -90,6 +89,7 @@ fun App() {
println("line 3 clicked") println("line 3 clicked")
} }
multiLine( multiLine(
points = listOf( points = listOf(
55.742465 to 37.615812, 55.742465 to 37.615812,
@ -101,6 +101,15 @@ fun App() {
), ),
) )
points(
points = listOf(
55.744 to 38.614,
55.8 to 38.5,
56.0 to 38.5,
)
).pointSize(5f)
//remember feature ID //remember feature ID
val circleId = circle( val circleId = circle(
centerCoordinates = pointTwo, centerCoordinates = pointTwo,
@ -120,9 +129,11 @@ fun App() {
arc(pointOne, 10.0.kilometers, (PI / 4).radians, -Angle.pi / 2) arc(pointOne, 10.0.kilometers, (PI / 4).radians, -Angle.pi / 2)
line(pointOne, pointTwo, id = "line") line(pointOne, pointTwo, id = "line")
text(pointOne, "Home", font = { size = 32f }) text(pointOne, "Home", font = { size = 32f })
pixelMap( pixelMap(
space.Rectangle( space.Rectangle(
Gmc(latitude = 55.58461879539754.degrees, longitude = 37.8746197303493.degrees), Gmc(latitude = 55.58461879539754.degrees, longitude = 37.8746197303493.degrees),
@ -132,8 +143,8 @@ fun App() {
0.005.degrees 0.005.degrees
) { gmc -> ) { gmc ->
Color( Color(
red = ((gmc.latitude + Angle.piDiv2).degrees*10 % 1f).toFloat(), red = ((gmc.latitude + Angle.piDiv2).degrees * 10 % 1f).toFloat(),
green = ((gmc.longitude + Angle.pi).degrees*10 % 1f).toFloat(), green = ((gmc.longitude + Angle.pi).degrees * 10 % 1f).toFloat(),
blue = 0f blue = 0f
).copy(alpha = 0.3f) ).copy(alpha = 0.3f)
} }

View File

@ -169,4 +169,7 @@ public fun <T : Any> FeatureRef<T, LineSegmentFeature<T>>.pathEffect(effect: Pat
public object StrokeAttribute : Attribute<Float> public object StrokeAttribute : Attribute<Float>
public fun <T : Any, F : LineSegmentFeature<T>> FeatureRef<T, F>.stroke(width: Float): FeatureRef<T, F> = public fun <T : Any, F : LineSegmentFeature<T>> FeatureRef<T, F>.stroke(width: Float): FeatureRef<T, F> =
modifyAttribute(StrokeAttribute, width)
public fun <T : Any, F : PointsFeature<T>> FeatureRef<T, F>.pointSize(width: Float): FeatureRef<T, F> =
modifyAttribute(StrokeAttribute, width) modifyAttribute(StrokeAttribute, width)

View File

@ -3,7 +3,10 @@ package center.sciprog.maps.features
import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.* import androidx.compose.ui.graphics.*
import androidx.compose.ui.graphics.drawscope.* import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.drawscope.translate
import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.painter.Painter
import center.sciprog.attributes.plus import center.sciprog.attributes.plus
import org.jetbrains.skia.Font import org.jetbrains.skia.Font
@ -121,7 +124,7 @@ public fun <T : Any> DrawScope.drawFeature(
drawPoints( drawPoints(
points = points, points = points,
color = color, color = color,
strokeWidth = feature.attributes[StrokeAttribute] ?: Stroke.HairlineWidth, strokeWidth = feature.attributes[StrokeAttribute] ?: 5f,
pointMode = PointMode.Points, pointMode = PointMode.Points,
pathEffect = feature.attributes[PathEffectAttribute], pathEffect = feature.attributes[PathEffectAttribute],
alpha = alpha alpha = alpha