Compare commits
10 Commits
kotlin/2.3
...
v0.5.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 917b5b263f | |||
| 3c20583b5e | |||
| 2bb20dea68 | |||
| 41949329ba | |||
| d578efa17b | |||
| b6100bdce1 | |||
| 636938087a | |||
| 9782721cb9 | |||
| 29dacbdd2f | |||
| ad5ec93598 |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3.5.1
|
||||
with:
|
||||
java-version: '17'
|
||||
java-version: '21'
|
||||
distribution: 'liberica'
|
||||
cache: 'gradle'
|
||||
- name: Gradle Wrapper Validation
|
||||
|
||||
2
.github/workflows/pages.yml
vendored
2
.github/workflows/pages.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
java-version: 21
|
||||
distribution: liberica
|
||||
- uses: gradle/gradle-build-action@v3
|
||||
with:
|
||||
|
||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -11,10 +11,22 @@
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
- Fix the problem where property listeners do not react on property child node changa
|
||||
|
||||
### Security
|
||||
|
||||
## 0.5.1 - 2026-01-10
|
||||
|
||||
### Changed
|
||||
|
||||
- Kotlin 2.3
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix DSLMarker annotations for builders
|
||||
- Flaky test
|
||||
- Fix the problem where property listeners do not react on property child node changes
|
||||
- Plotly plot title now writes proper field
|
||||
|
||||
## 0.5.0 - 2025-03-21
|
||||
|
||||
### Added
|
||||
|
||||
40
README.md
40
README.md
@@ -5,14 +5,14 @@
|
||||
|
||||
[](https://kotlinlang.slack.com/archives/CEXV2QWNM)
|
||||
|
||||
# DataForge Visualization Platform
|
||||
# VisionForge platform
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Introduction](#introduction)
|
||||
* [Requirements](#requirements)
|
||||
* [Features](#features)
|
||||
* [About DataForge](#about-dataforge)
|
||||
* [About VisionForge](#about-VisionForge)
|
||||
* [Modules contained in this repository](#modules-contained-in-this-repository)
|
||||
* [Visualization for External Systems](#visualization-for-external-systems)
|
||||
* [Demonstrations](#demonstrations)
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
This repository contains a [DataForge](#about-dataforge)\-based framework
|
||||
This repository contains a [VisionForge](#about-VisionForge) framework
|
||||
used for visualization in various scientific applications.
|
||||
|
||||
The main framework's use case for now is 3D visualization for particle physics experiments.
|
||||
@@ -41,16 +41,16 @@ JVM backend requires JDK 11 or later
|
||||
The main framework's features for now include:
|
||||
- 3D visualization of complex experimental set-ups
|
||||
- Event display such as particle tracks, etc.
|
||||
- Scales up to few hundred thousands of elements
|
||||
- Camera move, rotate, zoom-in and zoom-out
|
||||
- Scales up to hundreds of thousands of elements
|
||||
- The camera moves, rotates, zoom-in and zoom-out
|
||||
- Scene graph as an object tree with property editor
|
||||
- Settings export and import
|
||||
- Multiple platform support
|
||||
|
||||
## About DataForge
|
||||
## About VisionForge
|
||||
|
||||
DataForge is a software framework for automated scientific data processing. DataForge Visualization
|
||||
Platform uses some of the concepts and modules of DataForge, including: `Meta`, `Configuration`, `Context`,
|
||||
[DataForge](https://git.sciprog.center/kscience/dataforge-core) is a software framework for automated scientific data processing. VisionForge
|
||||
Platform uses some concepts and modules of DataForge, including: `Meta`, `Configuration`, `Context`,
|
||||
`Provider`, and some others.
|
||||
|
||||
To learn more about DataForge, please consult the following URLs:
|
||||
@@ -66,10 +66,6 @@ To learn more about DataForge, please consult the following URLs:
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [demo](demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly-kt](plotly-kt)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
@@ -131,10 +127,6 @@ To learn more about DataForge, please consult the following URLs:
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [demo/playground](demo/playground)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [demo/sat-demo](demo/sat-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
@@ -143,10 +135,6 @@ To learn more about DataForge, please consult the following URLs:
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly-kt/examples](plotly-kt/examples)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly-kt/plotly-kt-core](plotly-kt/plotly-kt-core)
|
||||
>
|
||||
> **Maturity**: DEVELOPMENT
|
||||
@@ -164,18 +152,6 @@ To learn more about DataForge, please consult the following URLs:
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly-kt/examples/compose-demo](plotly-kt/examples/compose-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly-kt/examples/js-demo](plotly-kt/examples/js-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly-kt/examples/native-demo](plotly-kt/examples/native-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
|
||||
**Class diagram:**
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ plugins {
|
||||
alias(spclibs.plugins.kotlinx.kover)
|
||||
}
|
||||
|
||||
val dataforgeVersion by extra("0.10.1")
|
||||
val dataforgeVersion by extra("0.10.2")
|
||||
|
||||
allprojects {
|
||||
group = "space.kscience"
|
||||
version = "0.6.0-dev-1"
|
||||
version = "0.5.1"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:cern-root-loader:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:cern-root-loader:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:cern-root-loader:0.5.0")
|
||||
implementation("space.kscience:cern-root-loader:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -81,10 +81,12 @@ fun GravityDemo(context: Context) {
|
||||
y = h
|
||||
|
||||
|
||||
box(200, 5, 200, name = "floor") {
|
||||
y = -2.5
|
||||
}
|
||||
}
|
||||
|
||||
box(200, 5, 200, name = "floor") {
|
||||
y = -2.5
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ suspend fun main() = serve(
|
||||
//axes(200)
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
intensity = 3.0
|
||||
intensity = 1.5
|
||||
}
|
||||
val platform = solidGroup("platform") {
|
||||
cylinder(50, 5, name = "base")
|
||||
@@ -88,7 +88,7 @@ suspend fun main() = serve(
|
||||
val incRot = Quaternion.fromRotation(30.degrees, Float64Space3D.zAxis)
|
||||
|
||||
|
||||
context.launch {
|
||||
this@vision.context.launch {
|
||||
var time: Long = 0L
|
||||
while (isActive) {
|
||||
with(QuaternionAlgebra) {
|
||||
|
||||
@@ -8,4 +8,4 @@ org.gradle.workers.max=4
|
||||
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
|
||||
kotlin.native.enableKlibsCrossCompilation=true
|
||||
|
||||
toolsVersion=0.20.0-kotlin-2.3.0-Beta1
|
||||
toolsVersion=0.20.2-kotlin-2.3.0
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -15,10 +15,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
- Fix legend orientation constants
|
||||
|
||||
### Security
|
||||
|
||||
## 0.5.1 - 2026-01-10
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix legend orientation constants
|
||||
|
||||
## 0.5.0 (package and versioning change!)
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -15,14 +15,14 @@ import space.kscience.plotly.models.geo.openStreetMap
|
||||
import space.kscience.plotly.plot
|
||||
import space.kscience.visionforge.plotly.serveSinglePage
|
||||
import space.kscience.visionforge.server.openInBrowser
|
||||
import java.net.URL
|
||||
import java.net.URI
|
||||
import kotlin.random.Random
|
||||
|
||||
suspend fun main() {
|
||||
|
||||
//downloading GeoJson
|
||||
val geoJsonString =
|
||||
URL("https://raw.githubusercontent.com/isellsoap/deutschlandGeoJSON/main/4_kreise/4_niedrig.geo.json").readText()
|
||||
URI("https://raw.githubusercontent.com/isellsoap/deutschlandGeoJSON/main/4_kreise/4_niedrig.geo.json").toURL().readText()
|
||||
|
||||
|
||||
// Filtering GeoJson features and creating new feature set
|
||||
@@ -50,7 +50,7 @@ suspend fun main() {
|
||||
locations.numbers = features.map { it.id!!.int }
|
||||
// Set random values to locations
|
||||
z.numbers = features.map { Random.nextDouble(1.0, 10.0) }
|
||||
context.launch {
|
||||
this@serveSinglePage.context.launch {
|
||||
while (isActive) {
|
||||
delay(300)
|
||||
z.numbers = features.map { Random.nextDouble(1.0, 10.0) }
|
||||
|
||||
@@ -10,7 +10,7 @@ import space.kscience.plotly.models.geo.json.GeoJsonFeatureCollection
|
||||
import space.kscience.plotly.models.geo.json.combine
|
||||
import space.kscience.plotly.models.geo.openStreetMap
|
||||
import space.kscience.plotly.openInBrowser
|
||||
import java.net.URL
|
||||
import java.net.URI
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ fun main() {
|
||||
|
||||
//downloading GeoJson
|
||||
val geoJsonString =
|
||||
URL("https://raw.githubusercontent.com/isellsoap/deutschlandGeoJSON/main/4_kreise/4_niedrig.geo.json").readText()
|
||||
URI("https://raw.githubusercontent.com/isellsoap/deutschlandGeoJSON/main/4_kreise/4_niedrig.geo.json").toURL().readText()
|
||||
|
||||
|
||||
// Filtering GeoJson features and creating new feature set
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:plotly-kt-core:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:plotly-kt-core:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:plotly-kt-core:0.5.0")
|
||||
implementation("space.kscience:plotly-kt-core:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -8,7 +8,6 @@ import kotlinx.serialization.json.buildJsonObject
|
||||
import space.kscience.dataforge.meta.*
|
||||
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
|
||||
import space.kscience.dataforge.meta.descriptors.node
|
||||
import space.kscience.dataforge.misc.DFBuilder
|
||||
import space.kscience.dataforge.names.NameToken
|
||||
import space.kscience.plotly.models.Layout
|
||||
import space.kscience.plotly.models.Trace
|
||||
@@ -18,7 +17,6 @@ import space.kscience.visionforge.*
|
||||
* The main plot class.
|
||||
*
|
||||
*/
|
||||
@DFBuilder
|
||||
@Serializable
|
||||
public class Plot : AbstractVision(), MutableVisionGroup<Trace> {
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Axis : Scheme() {
|
||||
public var title: String?
|
||||
get() = meta["title.text"].string ?: meta["title"].string
|
||||
set(value) {
|
||||
meta["title"] = value?.asValue()
|
||||
meta["title.text"] = value?.asValue()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,3 +2,20 @@
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:plotly-kt-server:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
repositories {
|
||||
maven("https://repo.kotlin.link")
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:plotly-kt-server:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-compose-html:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-compose-html:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-compose-html:0.5.0")
|
||||
implementation("space.kscience:visionforge-compose-html:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-compose-multiplatform:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-compose-multiplatform:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-compose-multiplatform:0.5.0")
|
||||
implementation("space.kscience:visionforge-compose-multiplatform:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-core:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-core:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-core:0.5.0")
|
||||
implementation("space.kscience:visionforge-core:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -16,14 +16,12 @@ private tailrec fun styleIsDefined(vision: Vision, reference: StyleReference): B
|
||||
else -> styleIsDefined(vision.parent!!, reference)
|
||||
}
|
||||
|
||||
@VisionBuilder
|
||||
public fun MutableVision.useStyle(reference: StyleReference) {
|
||||
//check that style is defined in a parent
|
||||
//check(styleIsDefined(this, reference)) { "Style reference does not belong to a Vision parent" }
|
||||
useStyle(reference.name)
|
||||
}
|
||||
|
||||
@VisionBuilder
|
||||
public fun MutableVision.style(
|
||||
styleKey: String? = null,
|
||||
builder: MutableMeta.() -> Unit,
|
||||
@@ -33,7 +31,6 @@ public fun MutableVision.style(
|
||||
StyleReference(this, styleName)
|
||||
}
|
||||
|
||||
@VisionBuilder
|
||||
public fun <T : Scheme> MutableVision.style(
|
||||
spec: SchemeSpec<T>,
|
||||
styleKey: String? = null,
|
||||
|
||||
@@ -45,6 +45,7 @@ public interface VisionGroup<out V : Vision> : Vision, VisionContainer<V> {
|
||||
// public val propertyName: Name
|
||||
//) : VisionEvent
|
||||
|
||||
@VisionBuilder
|
||||
public interface MutableVisionGroup<V : Vision> : VisionGroup<V>, MutableVision, MutableVisionContainer<V> {
|
||||
|
||||
/**
|
||||
@@ -123,7 +124,6 @@ public class SimpleVisionGroup : AbstractVision(), MutableVisionGroup<Vision> {
|
||||
}
|
||||
}
|
||||
|
||||
@VisionBuilder
|
||||
public inline fun MutableVisionContainer<Vision>.group(
|
||||
name: NameToken? = null,
|
||||
builder: SimpleVisionGroup.() -> Unit = {},
|
||||
@@ -134,7 +134,6 @@ public inline fun MutableVisionContainer<Vision>.group(
|
||||
/**
|
||||
* Define a group with given [token], attach it to this parent and return it.
|
||||
*/
|
||||
@VisionBuilder
|
||||
public inline fun MutableVisionContainer<Vision>.group(
|
||||
token: String,
|
||||
builder: SimpleVisionGroup.() -> Unit = {},
|
||||
|
||||
@@ -27,7 +27,6 @@ public class VisionOfHtmlForm(
|
||||
/**
|
||||
* Create a [VisionOfHtmlForm] and bind this form to the id
|
||||
*/
|
||||
@HtmlTagMarker
|
||||
public inline fun <T, C : TagConsumer<T>> C.visionOfForm(
|
||||
vision: VisionOfHtmlForm,
|
||||
action: String? = null,
|
||||
|
||||
@@ -9,19 +9,13 @@ import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.NameToken
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.dataforge.names.parseAsName
|
||||
import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.*
|
||||
import space.kscience.visionforge.html.VisionTagConsumer.Companion.DEFAULT_VISION_NAME
|
||||
import space.kscience.visionforge.setAsRoot
|
||||
import space.kscience.visionforge.visionManager
|
||||
|
||||
@DslMarker
|
||||
public annotation class VisionDSL
|
||||
|
||||
/**
|
||||
* A placeholder object to attach inline vision builders.
|
||||
*/
|
||||
@VisionDSL
|
||||
@VisionBuilder
|
||||
public class VisionOutput(override val context: Context, public val name: Name) : ContextAware {
|
||||
public var meta: Meta = Meta.EMPTY
|
||||
|
||||
@@ -55,7 +49,7 @@ public fun VisionOutput.meta(metaRepr: MetaRepr) {
|
||||
/**
|
||||
* Modified [TagConsumer] that allows rendering output fragments and visions in them
|
||||
*/
|
||||
@VisionDSL
|
||||
@VisionBuilder
|
||||
public abstract class VisionTagConsumer<R>(
|
||||
private val root: TagConsumer<R>,
|
||||
public val visionManager: VisionManager,
|
||||
@@ -111,7 +105,6 @@ public abstract class VisionTagConsumer<R>(
|
||||
* Insert a vision in this HTML.
|
||||
* TODO replace by multi-receiver
|
||||
*/
|
||||
@VisionDSL
|
||||
public open fun <T> TagConsumer<T>.vision(
|
||||
name: Name? = null,
|
||||
buildOutput: VisionOutput.() -> Vision,
|
||||
@@ -125,13 +118,11 @@ public abstract class VisionTagConsumer<R>(
|
||||
/**
|
||||
* TODO to be replaced by multi-receiver
|
||||
*/
|
||||
@VisionDSL
|
||||
public fun <T> TagConsumer<T>.vision(
|
||||
name: String?,
|
||||
buildOutput: VisionOutput.() -> Vision,
|
||||
): T = vision(name?.parseAsName(), buildOutput)
|
||||
|
||||
@VisionDSL
|
||||
public open fun <T> TagConsumer<T>.vision(
|
||||
vision: Vision,
|
||||
name: Name? = null,
|
||||
|
||||
@@ -75,7 +75,6 @@ private fun <T> TagConsumer<T>.vision(
|
||||
* Insert a vision in this HTML.
|
||||
*/
|
||||
context(htmlContext: HtmlVisionContext)
|
||||
@VisionDSL
|
||||
public fun <T> TagConsumer<T>.vision(
|
||||
name: Name? = null,
|
||||
visionProvider: VisionOutput.() -> Vision,
|
||||
@@ -90,7 +89,6 @@ public fun <T> TagConsumer<T>.vision(
|
||||
* Insert a vision in this HTML.
|
||||
*/
|
||||
context(htmlContext: HtmlVisionContext)
|
||||
@VisionDSL
|
||||
public fun <T> TagConsumer<T>.vision(
|
||||
name: String?,
|
||||
visionProvider: VisionOutput.() -> Vision,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package space.kscience.visionforge.meta
|
||||
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.test.advanceUntilIdle
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.meta.int
|
||||
@@ -13,14 +13,14 @@ import space.kscience.dataforge.meta.set
|
||||
import space.kscience.visionforge.*
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
internal class PropertyFlowTest {
|
||||
|
||||
private val manager = Global.request(VisionManager)
|
||||
|
||||
@Test
|
||||
fun testChildrenPropertyFlow() = runTest(timeout = 200.milliseconds) {
|
||||
fun testChildrenPropertyFlow(): Unit = runBlocking {
|
||||
|
||||
val parent = MutableVisionGroup(manager) {
|
||||
|
||||
properties {
|
||||
@@ -37,33 +37,30 @@ internal class PropertyFlowTest {
|
||||
|
||||
val child = parent.getVision("child") as MutableVisionGroup<*>
|
||||
|
||||
val changesFlow = child.flowProperty("test", inherited = true)
|
||||
launch {
|
||||
val changesFlow = child.flowProperty("test", inherited = true).stateIn(this)
|
||||
|
||||
val collectedValues = ArrayList<Int>(5)
|
||||
assertEquals(22, child.readProperty("test", true).int)
|
||||
|
||||
changesFlow.onEach {
|
||||
collectedValues.add(it.int!!)
|
||||
}.launchIn(backgroundScope)
|
||||
delay(10)
|
||||
assertEquals(22, changesFlow.value.int)
|
||||
|
||||
delay(1)
|
||||
assertEquals(22, child.readProperty("test", true).int)
|
||||
parent.properties["test1"] = 88 // another property
|
||||
|
||||
parent.properties["test1"] = 88 // another property
|
||||
child.properties.remove("test")
|
||||
|
||||
child.properties.remove("test")
|
||||
assertEquals(11, child.readProperty("test", true).int)
|
||||
delay(10)
|
||||
assertEquals(11, changesFlow.value.int)
|
||||
|
||||
delay(1)
|
||||
assertEquals(11, child.readProperty("test", true).int)
|
||||
parent.properties["test"] = 33
|
||||
assertEquals(33, child.readProperty("test", true).int)
|
||||
|
||||
parent.properties["test"] = 33
|
||||
delay(1)
|
||||
assertEquals(33, child.readProperty("test", true).int)
|
||||
delay(10)
|
||||
assertEquals(33, changesFlow.value.int)
|
||||
|
||||
advanceUntilIdle()
|
||||
//assertEquals(listOf(22, 11, 33), collectedValues)
|
||||
assertEquals(22, collectedValues.first())
|
||||
assertEquals(33, collectedValues.last())
|
||||
|
||||
println("finished")
|
||||
cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-gdml:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-gdml:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-gdml:0.5.0")
|
||||
implementation("space.kscience:visionforge-gdml:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@ Common visionforge jupyter module
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-jupyter:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-jupyter:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-jupyter:0.5.0")
|
||||
implementation("space.kscience:visionforge-jupyter:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@ Jupyter api artifact including all common modules
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-jupyter-common:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-jupyter-common:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-jupyter-common:0.5.0")
|
||||
implementation("space.kscience:visionforge-jupyter-common:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-markdown:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-markdown:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-markdown:0.5.0")
|
||||
implementation("space.kscience:visionforge-markdown:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-server:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-server:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-server:0.5.0")
|
||||
implementation("space.kscience:visionforge-server:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-solid:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-solid:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-solid:0.5.0")
|
||||
implementation("space.kscience:visionforge-solid:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -84,7 +84,6 @@ public class Solids(meta: Meta) : VisionPlugin(meta), MutableVisionContainer<Sol
|
||||
}
|
||||
}
|
||||
|
||||
@VisionBuilder
|
||||
public inline fun VisionOutput.solid(options: Canvas3DOptions? = null, block: SolidGroup.() -> Unit): SolidGroup {
|
||||
requirePlugin(Solids)
|
||||
options?.let {
|
||||
@@ -97,6 +96,5 @@ public inline fun VisionOutput.solid(options: Canvas3DOptions? = null, block: So
|
||||
}
|
||||
}
|
||||
|
||||
@VisionBuilder
|
||||
public inline fun VisionOutput.solid(options: Canvas3DOptions.() -> Unit, block: SolidGroup.() -> Unit): SolidGroup =
|
||||
solid(Canvas3DOptions(options), block)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-tables:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-tables:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-tables:0.5.0")
|
||||
implementation("space.kscience:visionforge-tables:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-threejs:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-threejs:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-threejs:0.5.0")
|
||||
implementation("space.kscience:visionforge-threejs:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-threejs-server:0.5.0`.
|
||||
The Maven coordinates of this project are `space.kscience:visionforge-threejs-server:0.5.1`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
@@ -16,6 +16,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:visionforge-threejs-server:0.5.0")
|
||||
implementation("space.kscience:visionforge-threejs-server:0.5.1")
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user