Skip to content

Commit

Permalink
Merge pull request #24 from SciProgCentre/dev
Browse files Browse the repository at this point in the history
0.3.0
  • Loading branch information
SPC-code authored Jun 12, 2024
2 parents a059697 + f62f818 commit bd6d8e2
Show file tree
Hide file tree
Showing 114 changed files with 1,767 additions and 1,423 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build/
.gradle/
.idea/
.kotlin
/*.iml

mapCache/
10 changes: 5 additions & 5 deletions .space.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ job("Publish") {
gitPush { enabled = false }
}
container("spc.registry.jetbrains.space/p/sci/containers/kotlin-ci:1.0.3") {
env["SPACE_USER"] = Secrets("space_user")
env["SPACE_TOKEN"] = Secrets("space_token")
env["SPACE_USER"] = "{{ project:space_user }}"
env["SPACE_TOKEN"] = "{{ project:space_token }}"
kotlinScript { api ->

val spaceUser = System.getenv("SPACE_USER")
val spaceToken = System.getenv("SPACE_TOKEN")

// write version to the build directory
// write the version to the build directory
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 revisionSuffix = if (version.endsWith("SNAPSHOT")) {
Expand All @@ -32,7 +32,7 @@ job("Publish") {
project = api.projectIdentifier(),
targetIdentifier = TargetIdentifier.Key("maps-kt"),
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
)
api.gradlew(
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@
## Unreleased

### Added
- `alpha` extension for feature attribute builder

### Changed
- avoid drawing features with VisibleAttribute false

### Deprecated

### Removed

### Fixed
- Add alpha attribute comprehension for all standard features.

### Security

## 0.3.0 - 2024-06-04

### Changed

- Package changed to `space.kscience`
- Kotlin 2.0

### Fixed

- Use of generated resources for Wasm
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ This repository is a work-in-progress implementation of Map-with-markers compone


### [demo](demo)
>
>
> **Maturity**: EXPERIMENTAL
Expand All @@ -33,17 +32,14 @@ This repository is a work-in-progress implementation of Map-with-markers compone

### [maps-kt-features](maps-kt-features)
>
>
> **Maturity**: EXPERIMENTAL
### [maps-kt-geojson](maps-kt-geojson)
>
>
> **Maturity**: EXPERIMENTAL
### [maps-kt-scheme](maps-kt-scheme)
>
>
> **Maturity**: EXPERIMENTAL
Expand All @@ -53,21 +49,21 @@ This repository is a work-in-progress implementation of Map-with-markers compone
> **Maturity**: EXPERIMENTAL
### [demo/maps](demo/maps)
>
>
> **Maturity**: EXPERIMENTAL
### [demo/maps-wasm](demo/maps-wasm)
>
> **Maturity**: EXPERIMENTAL
### [demo/polygon-editor](demo/polygon-editor)
>
>
> **Maturity**: EXPERIMENTAL
### [demo/scheme](demo/scheme)
>
>
> **Maturity**: EXPERIMENTAL
### [demo/trajectory-playground](demo/trajectory-playground)
>
>
> **Maturity**: EXPERIMENTAL
21 changes: 5 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import space.kscience.gradle.isInDevelopment
import space.kscience.gradle.useApache2Licence
import space.kscience.gradle.useSPCTeam

plugins {
id("space.kscience.gradle.project")
}

val kmathVersion: String by extra("0.3.1-dev-RC")
val kmathVersion: String by extra("0.4.0")

allprojects {
group = "center.sciprog"
version = "0.2.2"
group = "space.kscience"
version = "0.3.1-dev"

repositories {
mavenLocal()
maven("https://repo.kotlin.link")
maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev")
}
}

Expand All @@ -24,20 +22,12 @@ ksciencePublish {
useApache2Licence()
useSPCTeam()
}
github("SciProgCentre", "maps-kt")
space(
if (isInDevelopment) {
"https://maven.pkg.jetbrains.space/spc/p/sci/dev"
} else {
"https://maven.pkg.jetbrains.space/spc/p/sci/maven"
}
)
sonatype()
repository("spc","https://maven.sciprog.center/kscience")
sonatype("https://oss.sonatype.org")
}

subprojects {
repositories {
maven("https://maven.pkg.jetbrains.space/mipt-npm/p/sci/dev")
google()
mavenCentral()
maven("https://repo.kotlin.link")
Expand All @@ -48,4 +38,3 @@ subprojects {
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")



4 changes: 4 additions & 0 deletions demo/maps-wasm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Module maps-wasm



37 changes: 37 additions & 0 deletions demo/maps-wasm/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
kotlin("multiplatform")
alias(spclibs.plugins.compose.compiler)
alias(spclibs.plugins.compose.jb)
}

//val ktorVersion: String by rootProject.extra

kotlin {
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
binaries.executable()
}
sourceSets {
commonMain {
dependencies {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
api(compose.components.resources)
}
}

wasmJsMain {
dependencies {
implementation(projects.mapsKtScheme)
}
}
}
}

compose {
web {

}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions demo/maps-wasm/src/wasmJsMain/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
@file:OptIn(ExperimentalComposeUiApi::class, ExperimentalResourceApi::class)

import androidx.compose.runtime.*
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.window.CanvasBasedWindow
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource
import space.kscience.kmath.geometry.Angle
import space.kscience.maps.features.FeatureGroup
import space.kscience.maps.features.ViewConfig
import space.kscience.maps.features.ViewPoint
import space.kscience.maps.features.color
import space.kscience.maps.scheme.*
import space.kscience.maps_wasm.generated.resources.Res
import space.kscience.maps_wasm.generated.resources.middle_earth


@Composable
fun App() {

val scope = rememberCoroutineScope()


val features: FeatureGroup<XY> = FeatureGroup.remember(XYCoordinateSpace) {
background(1600f, 1200f) {
painterResource(Res.drawable.middle_earth)
}
circle(410.52737 to 868.7676).color(Color.Blue)
text(410.52737 to 868.7676, "Shire").color(Color.Blue)
circle(1132.0881 to 394.99127).color(Color.Red)
text(1132.0881 to 394.99127, "Ordruin").color(Color.Red)
arc(center = 1132.0881 to 394.99127, radius = 20f, startAngle = Angle.zero, Angle.piTimes2)

//circle(410.52737 to 868.7676, id = "hobbit")

scope.launch {
var t = 0.0
while (isActive) {
val x = 410.52737 + t * (1132.0881 - 410.52737)
val y = 868.7676 + t * (394.99127 - 868.7676)
circle(x to y, id = "hobbit").color(Color.Green)
delay(100)
t += 0.005
if (t >= 1.0) t = 0.0
}
}
}

val initialViewPoint: ViewPoint<XY> = remember {
features.getBoundingBox(1f)?.computeViewPoint() ?: XYViewPoint(XY(0f, 0f))
}

var viewPoint: ViewPoint<XY> by remember { mutableStateOf(initialViewPoint) }

val mapState: XYCanvasState = XYCanvasState.remember(
ViewConfig(
onClick = { _, click ->
println("${click.focus.x}, ${click.focus.y}")
},
onViewChange = { viewPoint = this }
),
initialViewPoint = initialViewPoint,
)

SchemeView(
mapState,
features,
)

}


fun main() {
// renderComposable(rootElementId = "root") {
CanvasBasedWindow("Maps demo", canvasElementId = "ComposeTarget") {
App()
}
}
12 changes: 12 additions & 0 deletions demo/maps-wasm/src/wasmJsMain/resources/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Compose App</title>
<script type="application/javascript" src="skiko.js"></script>
<script type="application/javascript" src="maps-wasm.js"></script>
</head>
<body>
<canvas id="ComposeTarget"></canvas>
</body>
</html>
5 changes: 3 additions & 2 deletions demo/maps/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
alias(spclibs.plugins.compose.compiler)
alias(spclibs.plugins.compose.jb)
}

val ktorVersion: String by rootProject.extra
Expand All @@ -17,7 +18,7 @@ kotlin {
implementation(projects.mapsKtGeojson)
implementation(compose.desktop.currentOs)
implementation("io.ktor:ktor-client-cio")
implementation("ch.qos.logback:logback-classic:1.2.11")
implementation(spclibs.logback.classic)
}
}
val jvmTest by getting
Expand Down
Loading

0 comments on commit bd6d8e2

Please sign in to comment.