Update versions
This commit is contained in:
parent
35fc7a7042
commit
4ec611eda3
@ -7,7 +7,7 @@ plugins {
|
||||
// id("org.jetbrains.kotlinx.kover") version "0.5.0"
|
||||
}
|
||||
|
||||
val dataforgeVersion by extra("0.6.0-dev-15")
|
||||
val dataforgeVersion by extra("0.6.1")
|
||||
val fxVersion by extra("11")
|
||||
|
||||
allprojects {
|
||||
|
@ -3,17 +3,12 @@ plugins {
|
||||
}
|
||||
|
||||
kscience{
|
||||
jvm()
|
||||
js()
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
}
|
||||
useSerialization {
|
||||
json()
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(project(":visionforge-solid"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,62 +1,62 @@
|
||||
import space.kscience.gradle.DependencyConfiguration
|
||||
import space.kscience.gradle.FXModule
|
||||
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
application
|
||||
}
|
||||
|
||||
kscience {
|
||||
val fxVersion: String by rootProject.extra
|
||||
useFx(FXModule.CONTROLS, version = fxVersion, configuration = DependencyConfiguration.IMPLEMENTATION)
|
||||
application()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
|
||||
jvm()
|
||||
js {
|
||||
useCommonJs()
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
cssSupport{
|
||||
cssSupport {
|
||||
enabled.set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-solid"))
|
||||
implementation(project(":visionforge-gdml"))
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-fx"))
|
||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(project(":ui:ring"))
|
||||
implementation(project(":visionforge-threejs"))
|
||||
implementation(npm("react-file-drop", "3.0.6"))
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation(projects.visionforgeSolid)
|
||||
implementation(projects.visionforgeGdml)
|
||||
}
|
||||
jvmMain {
|
||||
// implementation(project(":visionforge-fx"))
|
||||
implementation(spclibs.logback.classic)
|
||||
}
|
||||
jsMain {
|
||||
implementation(projects.ui.ring)
|
||||
implementation(projects.visionforgeThreejs)
|
||||
implementation(npm("react-file-drop", "3.0.6"))
|
||||
}
|
||||
application()
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("space.kscience.visionforge.gdml.demo.GdmlFxDemoAppKt")
|
||||
}
|
||||
//kotlin {
|
||||
//
|
||||
// sourceSets {
|
||||
// commonMain {
|
||||
// dependencies {
|
||||
// implementation(project(":visionforge-solid"))
|
||||
// implementation(project(":visionforge-gdml"))
|
||||
// }
|
||||
// }
|
||||
// jvmMain {
|
||||
// dependencies {
|
||||
//// implementation(project(":visionforge-fx"))
|
||||
// implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||
// }
|
||||
// }
|
||||
// jsMain {
|
||||
// dependencies {
|
||||
// implementation(project(":ui:ring"))
|
||||
// implementation(project(":visionforge-threejs"))
|
||||
// implementation(npm("react-file-drop", "3.0.6"))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
val convertGdmlToJson by tasks.creating(JavaExec::class) {
|
||||
group = "application"
|
||||
classpath = sourceSets["main"].runtimeClasspath
|
||||
mainClass.set("space.kscience.dataforge.vis.spatial.gdml.demo.SaveToJsonKt")
|
||||
}
|
||||
//val convertGdmlToJson by tasks.creating(JavaExec::class) {
|
||||
// group = "application"
|
||||
// classpath = sourceSets["main"].runtimeClasspath
|
||||
// mainClass.set("space.kscience.dataforge.vis.spatial.gdml.demo.SaveToJsonKt")
|
||||
//}
|
@ -3,7 +3,7 @@ package space.kscience.visionforge.gdml.demo
|
||||
import kotlinx.css.*
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.gdml.GdmlShowCase
|
||||
import space.kscience.visionforge.Application
|
||||
import space.kscience.visionforge.Colors
|
||||
@ -54,7 +54,7 @@ private class GDMLDemoApp : Application {
|
||||
}
|
||||
//println(context.plugins.fetch(VisionManager).encodeToString(vision))
|
||||
attrs {
|
||||
this.solids = context.fetch(Solids)
|
||||
this.solids = context.request(Solids)
|
||||
this.vision = vision
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +1,83 @@
|
||||
package space.kscience.visionforge.gdml.demo
|
||||
|
||||
import javafx.geometry.Orientation
|
||||
import javafx.scene.Parent
|
||||
import javafx.stage.FileChooser
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.gdml.GdmlShowCase
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.editor.VisionEditorFragment
|
||||
import space.kscience.visionforge.editor.VisionTreeFragment
|
||||
import space.kscience.visionforge.gdml.toVision
|
||||
import space.kscience.visionforge.solid.FX3DPlugin
|
||||
import space.kscience.visionforge.solid.FXCanvas3D
|
||||
import space.kscience.visionforge.solid.Solid
|
||||
import space.kscience.visionforge.solid.SolidMaterial
|
||||
import tornadofx.*
|
||||
|
||||
class GDMLDemoApp : App(GDMLView::class)
|
||||
|
||||
class GDMLView : View() {
|
||||
private val context = Context {
|
||||
plugin(FX3DPlugin)
|
||||
}
|
||||
|
||||
private val fx3d = context.fetch(FX3DPlugin)
|
||||
private val visionManager = context.fetch(VisionManager)
|
||||
private val canvas = FXCanvas3D(fx3d)
|
||||
|
||||
private val treeFragment = VisionTreeFragment().apply {
|
||||
this.itemProperty.bind(canvas.rootObjectProperty)
|
||||
}
|
||||
|
||||
private val propertyEditor = VisionEditorFragment().apply {
|
||||
descriptorProperty.set(SolidMaterial.descriptor)
|
||||
visionProperty.bind(treeFragment.selectedProperty)
|
||||
}
|
||||
|
||||
override val root: Parent = borderpane {
|
||||
top {
|
||||
buttonbar {
|
||||
button("Load GDML/json") {
|
||||
action {
|
||||
val file = chooseFile("Select a GDML/json file", filters = fileNameFilter).firstOrNull()
|
||||
if (file != null) {
|
||||
runAsync {
|
||||
visionManager.readFile(file) as Solid
|
||||
} ui {
|
||||
canvas.render(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
center {
|
||||
splitpane(Orientation.HORIZONTAL, treeFragment.root, canvas.root, propertyEditor.root) {
|
||||
setDividerPositions(0.2, 0.6, 0.2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
runAsync {
|
||||
GdmlShowCase.cubes().toVision()
|
||||
} ui {
|
||||
canvas.render(it)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val fileNameFilter = arrayOf(
|
||||
FileChooser.ExtensionFilter("GDML", "*.gdml", "*.xml"),
|
||||
FileChooser.ExtensionFilter("JSON", "*.json"),
|
||||
FileChooser.ExtensionFilter("JSON.ZIP", "*.json.zip"),
|
||||
FileChooser.ExtensionFilter("JSON.GZ", "*.json.gz")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
launch<GDMLDemoApp>()
|
||||
}
|
||||
//package space.kscience.visionforge.gdml.demo
|
||||
//
|
||||
//import javafx.geometry.Orientation
|
||||
//import javafx.scene.Parent
|
||||
//import javafx.stage.FileChooser
|
||||
//import space.kscience.dataforge.context.Context
|
||||
//import space.kscience.dataforge.context.fetch
|
||||
//import space.kscience.gdml.GdmlShowCase
|
||||
//import space.kscience.visionforge.VisionManager
|
||||
//import space.kscience.visionforge.editor.VisionEditorFragment
|
||||
//import space.kscience.visionforge.editor.VisionTreeFragment
|
||||
//import space.kscience.visionforge.gdml.toVision
|
||||
//import space.kscience.visionforge.solid.FX3DPlugin
|
||||
//import space.kscience.visionforge.solid.FXCanvas3D
|
||||
//import space.kscience.visionforge.solid.Solid
|
||||
//import space.kscience.visionforge.solid.SolidMaterial
|
||||
//import tornadofx.*
|
||||
//
|
||||
//class GDMLDemoApp : App(GDMLView::class)
|
||||
//
|
||||
//class GDMLView : View() {
|
||||
// private val context = Context {
|
||||
// plugin(FX3DPlugin)
|
||||
// }
|
||||
//
|
||||
// private val fx3d = context.fetch(FX3DPlugin)
|
||||
// private val visionManager = context.fetch(VisionManager)
|
||||
// private val canvas = FXCanvas3D(fx3d)
|
||||
//
|
||||
// private val treeFragment = VisionTreeFragment().apply {
|
||||
// this.itemProperty.bind(canvas.rootObjectProperty)
|
||||
// }
|
||||
//
|
||||
// private val propertyEditor = VisionEditorFragment().apply {
|
||||
// descriptorProperty.set(SolidMaterial.descriptor)
|
||||
// visionProperty.bind(treeFragment.selectedProperty)
|
||||
// }
|
||||
//
|
||||
// override val root: Parent = borderpane {
|
||||
// top {
|
||||
// buttonbar {
|
||||
// button("Load GDML/json") {
|
||||
// action {
|
||||
// val file = chooseFile("Select a GDML/json file", filters = fileNameFilter).firstOrNull()
|
||||
// if (file != null) {
|
||||
// runAsync {
|
||||
// visionManager.readFile(file) as Solid
|
||||
// } ui {
|
||||
// canvas.render(it)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// center {
|
||||
// splitpane(Orientation.HORIZONTAL, treeFragment.root, canvas.root, propertyEditor.root) {
|
||||
// setDividerPositions(0.2, 0.6, 0.2)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// init {
|
||||
// runAsync {
|
||||
// GdmlShowCase.cubes().toVision()
|
||||
// } ui {
|
||||
// canvas.render(it)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// companion object {
|
||||
// private val fileNameFilter = arrayOf(
|
||||
// FileChooser.ExtensionFilter("GDML", "*.gdml", "*.xml"),
|
||||
// FileChooser.ExtensionFilter("JSON", "*.json"),
|
||||
// FileChooser.ExtensionFilter("JSON.ZIP", "*.json.zip"),
|
||||
// FileChooser.ExtensionFilter("JSON.GZ", "*.json.gz")
|
||||
// )
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//fun main() {
|
||||
// launch<GDMLDemoApp>()
|
||||
//}
|
@ -3,7 +3,7 @@ import org.w3c.dom.Document
|
||||
import ringui.SmartTabs
|
||||
import ringui.Tab
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.plotly.scatter
|
||||
import space.kscience.visionforge.Application
|
||||
@ -52,7 +52,7 @@ private class JsPlaygroundApp : Application {
|
||||
Tab("gravity") {
|
||||
GravityDemo {
|
||||
attrs {
|
||||
this.solids = playgroundContext.fetch(Solids)
|
||||
this.solids = playgroundContext.request(Solids)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ private class JsPlaygroundApp : Application {
|
||||
child(ThreeCanvasWithControls) {
|
||||
val random = Random(112233)
|
||||
attrs {
|
||||
solids = playgroundContext.fetch(Solids)
|
||||
solids = playgroundContext.request(Solids)
|
||||
solid {
|
||||
ambientLight {
|
||||
color.set(Colors.white)
|
||||
|
@ -20,9 +20,9 @@ val Plotly = fc<PlotlyProps>("Plotly") { props ->
|
||||
useEffect(props.plot, elementRef) {
|
||||
val element = elementRef.current as? HTMLElement ?: error("Plotly element not found")
|
||||
props.plot?.let {
|
||||
element.plot(it, PlotlyConfig {
|
||||
element.plot(PlotlyConfig {
|
||||
responsive = true
|
||||
})
|
||||
}, it)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,74 +5,46 @@ plugins {
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
|
||||
val ktorVersion: String = npmlibs.versions.ktor.get()
|
||||
val ktorVersion: String = spclibs.versions.ktor.get()
|
||||
|
||||
kscience {
|
||||
useCoroutines()
|
||||
useSerialization()
|
||||
useKtor()
|
||||
fullStack(
|
||||
"muon-monitor.js",
|
||||
jvmConfig = { withJava() },
|
||||
jsConfig = { useCommonJs() }
|
||||
) {
|
||||
commonWebpackConfig {
|
||||
cssSupport {
|
||||
enabled.set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
commonMain {
|
||||
implementation(projects.visionforgeSolid)
|
||||
}
|
||||
jvmMain {
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("io.ktor:ktor-server-cio:${ktorVersion}")
|
||||
implementation("io.ktor:ktor-server-content-negotiation:${ktorVersion}")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:${ktorVersion}")
|
||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||
}
|
||||
jsMain {
|
||||
implementation(project(":ui:ring"))
|
||||
implementation(project(":visionforge-threejs"))
|
||||
//implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
|
||||
}
|
||||
application()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
js {
|
||||
useCommonJs()
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
cssSupport {
|
||||
enabled.set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-solid"))
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("io.ktor:ktor-server-cio:${ktorVersion}")
|
||||
implementation("io.ktor:ktor-server-content-negotiation:${ktorVersion}")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:${ktorVersion}")
|
||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(project(":ui:ring"))
|
||||
implementation(project(":visionforge-threejs"))
|
||||
//implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("ru.mipt.npm.muon.monitor.server.MMServerKt")
|
||||
}
|
||||
|
||||
val jsBrowserDistribution by tasks.getting
|
||||
val jsBrowserDevelopmentExecutableDistribution by tasks.getting
|
||||
|
||||
val devMode = rootProject.findProperty("visionforge.development") as? Boolean
|
||||
?: rootProject.version.toString().contains("dev")
|
||||
|
||||
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
if (devMode) {
|
||||
dependsOn(jsBrowserDevelopmentExecutableDistribution)
|
||||
from(jsBrowserDevelopmentExecutableDistribution)
|
||||
} else {
|
||||
dependsOn(jsBrowserDistribution)
|
||||
from(jsBrowserDistribution)
|
||||
}
|
||||
}
|
||||
|
||||
//distributions {
|
||||
// main {
|
||||
|
@ -2,7 +2,7 @@ package ru.mipt.npm.muon.monitor
|
||||
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.visionforge.Application
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.react.createRoot
|
||||
@ -19,7 +19,7 @@ private class MMDemoApp : Application {
|
||||
plugin(ThreePlugin)
|
||||
}
|
||||
|
||||
val visionManager = context.fetch(VisionManager)
|
||||
val visionManager = context.request(VisionManager)
|
||||
|
||||
val model = Model(visionManager)
|
||||
|
||||
@ -28,7 +28,7 @@ private class MMDemoApp : Application {
|
||||
child(MMApp) {
|
||||
attrs {
|
||||
this.model = model
|
||||
this.solids = context.fetch(Solids)
|
||||
this.solids = context.request(Solids)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ kotlin {
|
||||
}
|
||||
|
||||
jvm {
|
||||
withJava()
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
|
@ -6,7 +6,7 @@ import io.ktor.server.http.content.resources
|
||||
import io.ktor.server.routing.routing
|
||||
import kotlinx.html.*
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.html.VisionOfHtmlForm
|
||||
import space.kscience.visionforge.html.VisionPage
|
||||
@ -18,7 +18,7 @@ import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.visionPage
|
||||
|
||||
fun main() {
|
||||
val visionManager = Global.fetch(VisionManager)
|
||||
val visionManager = Global.request(VisionManager)
|
||||
|
||||
|
||||
val connector = EngineConnectorConfig("localhost", 7777)
|
||||
|
@ -6,6 +6,7 @@ import kotlinx.serialization.json.Json
|
||||
import space.kscience.visionforge.solid.SolidGroup
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
private val json = Json {
|
||||
serializersModule = Solids.serializersModuleForSolids
|
||||
prettyPrintIndent = " "
|
||||
|
@ -9,15 +9,14 @@ kscience {
|
||||
// json()
|
||||
// }
|
||||
application()
|
||||
dependencies{
|
||||
implementation(projects.visionforgeThreejs.visionforgeThreejsServer)
|
||||
implementation("ch.qos.logback:logback-classic:1.4.5")
|
||||
}
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
|
||||
dependencies{
|
||||
implementation(project(":visionforge-threejs:visionforge-threejs-server"))
|
||||
implementation("ch.qos.logback:logback-classic:1.4.5")
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("ru.mipt.npm.sat.SatServerKt")
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import kotlinx.coroutines.*
|
||||
import kotlinx.html.div
|
||||
import kotlinx.html.h1
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.meta.Null
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.Colors
|
||||
@ -29,7 +29,7 @@ fun main() {
|
||||
plugin(Solids)
|
||||
}
|
||||
|
||||
val solids = satContext.fetch(Solids)
|
||||
val solids = satContext.request(Solids)
|
||||
|
||||
//Create a geometry
|
||||
val sat = solids.visionOfSatellite(ySegments = 3).apply {
|
||||
|
@ -1,6 +1,3 @@
|
||||
import space.kscience.gradle.DependencyConfiguration
|
||||
import space.kscience.gradle.FXModule
|
||||
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
application
|
||||
@ -8,34 +5,18 @@ plugins {
|
||||
|
||||
kscience {
|
||||
useCoroutines()
|
||||
val fxVersion: String by rootProject.extra
|
||||
useFx(FXModule.CONTROLS, version = fxVersion, configuration = DependencyConfiguration.IMPLEMENTATION)
|
||||
application()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
js()
|
||||
dependencies {
|
||||
implementation(projects.visionforgeSolid)
|
||||
implementation(projects.visionforgeGdml)
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-solid"))
|
||||
// implementation(project(":visionforge-gdml"))
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-fx"))
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-threejs"))
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
implementation(projects.visionforgeThreejs)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.w3c.dom.Element
|
||||
import org.w3c.dom.HTMLDivElement
|
||||
import org.w3c.dom.HTMLElement
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.get
|
||||
import space.kscience.dataforge.meta.string
|
||||
@ -26,7 +26,7 @@ class ThreeDemoGrid(element: Element) : VisionLayout<Solid> {
|
||||
|
||||
private val outputs: MutableMap<Name, ThreeCanvas> = HashMap()
|
||||
|
||||
private val three = Global.fetch(ThreePlugin)
|
||||
private val three = Global.request(ThreePlugin)
|
||||
|
||||
override val solids: Solids get() = three.solids
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
kotlin.code.style=official
|
||||
kotlin.mpp.stability.nowarn=true
|
||||
kotlin.js.compiler=ir
|
||||
kotlin.incremental.js.ir=true
|
||||
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
|
||||
toolsVersion=0.13.4-kotlin-1.8.0
|
||||
toolsVersion=0.14.7-kotlin-1.8.20
|
@ -1,25 +1,22 @@
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
id("org.jetbrains.kotlin.jupyter.api")
|
||||
}
|
||||
|
||||
description = "Common visionforge jupyter module"
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
commonMain{
|
||||
dependencies{
|
||||
api(projects.visionforgeCore)
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
api(projects.visionforgeServer)
|
||||
}
|
||||
}
|
||||
kscience {
|
||||
jvm()
|
||||
js()
|
||||
jupyterLibrary()
|
||||
dependencies {
|
||||
api(projects.visionforgeCore)
|
||||
}
|
||||
dependencies(jvmMain){
|
||||
api(projects.visionforgeServer)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
readme {
|
||||
maturity = space.kscience.gradle.Maturity.EXPERIMENTAL
|
||||
}
|
@ -11,7 +11,6 @@ import space.kscience.visionforge.VisionClient
|
||||
import space.kscience.visionforge.renderAllVisions
|
||||
import space.kscience.visionforge.renderAllVisionsById
|
||||
import space.kscience.visionforge.renderAllVisionsIn
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@JsExport
|
||||
public class VFNotebookPlugin : AbstractPlugin() {
|
||||
@ -44,8 +43,6 @@ public class VFNotebookPlugin : AbstractPlugin() {
|
||||
override fun build(context: Context, meta: Meta): VFNotebookPlugin = VFNotebookPlugin()
|
||||
|
||||
override val tag: PluginTag = PluginTag(name = "vision.notebook", group = PluginTag.DATAFORGE_GROUP)
|
||||
|
||||
override val type: KClass<out VFNotebookPlugin> = VFNotebookPlugin::class
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,6 @@ import io.ktor.http.URLProtocol
|
||||
import io.ktor.server.application.install
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.ApplicationEngine
|
||||
import io.ktor.server.engine.EngineConnectorConfig
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.util.url
|
||||
import io.ktor.server.websocket.WebSockets
|
||||
@ -25,7 +24,6 @@ import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.html.HtmlVisionFragment
|
||||
import space.kscience.visionforge.html.visionFragment
|
||||
import space.kscience.visionforge.server.EngineConnectorConfig
|
||||
import space.kscience.visionforge.server.VisionRoute
|
||||
import space.kscience.visionforge.server.serveVisionData
|
||||
import space.kscience.visionforge.visionManager
|
||||
@ -74,7 +72,7 @@ public class VFForNotebook(override val context: Context) : ContextAware, Corout
|
||||
}
|
||||
}
|
||||
|
||||
val connector: EngineConnectorConfig = EngineConnectorConfig(host, port)
|
||||
//val connector: EngineConnectorConfig = EngineConnectorConfig(host, port)
|
||||
|
||||
engine?.stop(1000, 2000)
|
||||
engine = context.embeddedServer(CIO, port, host) {
|
||||
|
@ -4,56 +4,32 @@ plugins {
|
||||
|
||||
description = "Jupyter api artifact for GDML rendering"
|
||||
|
||||
kotlin {
|
||||
explicitApi = null
|
||||
js {
|
||||
useCommonJs()
|
||||
browser {
|
||||
webpackTask {
|
||||
this.outputFileName = "js/gdml-jupyter.js"
|
||||
}
|
||||
commonWebpackConfig {
|
||||
sourceMaps = false
|
||||
cssSupport{
|
||||
enabled.set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
binaries.executable()
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
val jsBrowserDistribution by tasks.getting
|
||||
|
||||
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
||||
dependsOn(jsBrowserDistribution)
|
||||
from(jsBrowserDistribution)
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(projects.visionforgeSolid)
|
||||
implementation(projects.jupyter)
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation(projects.visionforgeGdml)
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(projects.visionforgeThreejs)
|
||||
implementation(projects.ui.ring)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
kscience {
|
||||
fullStack("js/gdml-jupyter.js",
|
||||
jsConfig = { useCommonJs() }
|
||||
) {
|
||||
commonWebpackConfig {
|
||||
sourceMaps = false
|
||||
cssSupport {
|
||||
enabled.set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies{
|
||||
implementation(projects.visionforgeSolid)
|
||||
implementation(projects.jupyter)
|
||||
}
|
||||
|
||||
dependencies(jvmMain){
|
||||
implementation(projects.visionforgeGdml)
|
||||
}
|
||||
|
||||
dependencies(jsMain){
|
||||
implementation(projects.visionforgeThreejs)
|
||||
implementation(projects.ui.ring)
|
||||
}
|
||||
|
||||
jupyterLibrary("space.kscience.visionforge.gdml.jupyter.GdmlForJupyter")
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import space.kscience.visionforge.runVisionClient
|
||||
|
||||
@DFExperimental
|
||||
@JsExport
|
||||
fun main(): Unit = runVisionClient {
|
||||
public fun main(): Unit = runVisionClient {
|
||||
plugin(ThreeWithControlsPlugin)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ dependencyResolutionManagement {
|
||||
}
|
||||
|
||||
versionCatalogs {
|
||||
create("npmlibs") {
|
||||
create("spclibs") {
|
||||
from("space.kscience:version-catalog:$toolsVersion")
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ include(
|
||||
":ui:bootstrap",
|
||||
":visionforge-core",
|
||||
":visionforge-solid",
|
||||
":visionforge-fx",
|
||||
// ":visionforge-fx",
|
||||
":visionforge-threejs",
|
||||
":visionforge-threejs:visionforge-threejs-server",
|
||||
":visionforge-gdml",
|
||||
@ -62,7 +62,7 @@ include(
|
||||
":demo:muon-monitor",
|
||||
":demo:sat-demo",
|
||||
":demo:playground",
|
||||
":demo:plotly-fx",
|
||||
// ":demo:plotly-fx",
|
||||
":demo:js-playground",
|
||||
":jupyter",
|
||||
":jupyter:visionforge-jupyter-gdml"
|
||||
|
@ -5,7 +5,7 @@ import org.w3c.dom.Element
|
||||
import org.w3c.dom.HTMLElement
|
||||
import react.*
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.solid.Solid
|
||||
import space.kscience.visionforge.solid.specifications.Canvas3DOptions
|
||||
@ -25,7 +25,7 @@ public val ThreeCanvasComponent: FC<ThreeCanvasProps> = fc("ThreeCanvasComponent
|
||||
val elementRef = useRef<Element>(null)
|
||||
var canvas by useState<ThreeCanvas?>(null)
|
||||
|
||||
val three: ThreePlugin = useMemo(props.context) { props.context.fetch(ThreePlugin) }
|
||||
val three: ThreePlugin = useMemo(props.context) { props.context.request(ThreePlugin) }
|
||||
|
||||
useEffect(props.solid, props.options, elementRef) {
|
||||
if (canvas == null) {
|
||||
|
@ -14,7 +14,6 @@ import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.react.render
|
||||
import space.kscience.visionforge.solid.Solid
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
public class ThreeWithControlsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||
public val three: ThreePlugin by require(ThreePlugin)
|
||||
@ -44,7 +43,6 @@ public class ThreeWithControlsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||
|
||||
public companion object : PluginFactory<ThreeWithControlsPlugin> {
|
||||
override val tag: PluginTag = PluginTag("vision.threejs.withControls", PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<ThreeWithControlsPlugin> = ThreeWithControlsPlugin::class
|
||||
|
||||
override fun build(context: Context, meta: Meta): ThreeWithControlsPlugin = ThreeWithControlsPlugin()
|
||||
}
|
||||
|
@ -4,29 +4,20 @@ plugins {
|
||||
|
||||
val dataforgeVersion: String by rootProject.extra
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api("space.kscience:dataforge-context:$dataforgeVersion")
|
||||
api("org.jetbrains.kotlinx:kotlinx-html:0.8.0")
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-css")
|
||||
}
|
||||
}
|
||||
commonTest{
|
||||
dependencies{
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${space.kscience.gradle.KScienceVersions.coroutinesVersion}")
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-extensions")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kscience{
|
||||
jvm()
|
||||
js()
|
||||
dependencies {
|
||||
api("space.kscience:dataforge-context:$dataforgeVersion")
|
||||
api(spclibs.kotlinx.html)
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-css")
|
||||
}
|
||||
testDependencies {
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${space.kscience.gradle.KScienceVersions.coroutinesVersion}")
|
||||
}
|
||||
dependencies(jsMain){
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-extensions")
|
||||
}
|
||||
useSerialization{
|
||||
json()
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import space.kscience.visionforge.html.VisionOfCheckbox
|
||||
import space.kscience.visionforge.html.VisionOfHtmlForm
|
||||
import space.kscience.visionforge.html.VisionOfNumberField
|
||||
import space.kscience.visionforge.html.VisionOfTextField
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
public class VisionManager(meta: Meta) : AbstractPlugin(meta), MutableVisionContainer<Vision> {
|
||||
override val tag: PluginTag get() = Companion.tag
|
||||
@ -64,7 +63,6 @@ public class VisionManager(meta: Meta) : AbstractPlugin(meta), MutableVisionCont
|
||||
|
||||
public companion object : PluginFactory<VisionManager> {
|
||||
override val tag: PluginTag = PluginTag(name = "vision", group = PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<out VisionManager> = VisionManager::class
|
||||
|
||||
public const val VISION_SERIALIZER_MODULE_TARGET: String = "visionSerializerModule"
|
||||
|
||||
@ -110,7 +108,7 @@ public abstract class VisionPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(met
|
||||
/**
|
||||
* Fetch a [VisionManager] from this plugin or create a child plugin with a [VisionManager]
|
||||
*/
|
||||
public val Context.visionManager: VisionManager get() = fetch(VisionManager)
|
||||
public val Context.visionManager: VisionManager get() = request(VisionManager )
|
||||
|
||||
public fun Vision.encodeToString(): String =
|
||||
manager?.encodeToString(this) ?: error("Orphan vision could not be encoded")
|
||||
|
@ -1,12 +1,15 @@
|
||||
package space.kscience.visionforge.meta
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.take
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.meta.*
|
||||
import space.kscience.visionforge.*
|
||||
import kotlin.test.Test
|
||||
@ -23,7 +26,7 @@ private class TestScheme : Scheme() {
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
internal class VisionPropertyTest {
|
||||
|
||||
private val manager = Global.fetch(VisionManager)
|
||||
private val manager = Global.request(VisionManager)
|
||||
|
||||
@Test
|
||||
fun testPropertyWrite() {
|
||||
@ -56,7 +59,7 @@ internal class VisionPropertyTest {
|
||||
|
||||
@Test
|
||||
fun testChildrenPropertyPropagation() = runTest(dispatchTimeoutMs = 200) {
|
||||
val group = Global.fetch(VisionManager).group {
|
||||
val group = Global.request(VisionManager).group {
|
||||
properties {
|
||||
"test" put 11
|
||||
}
|
||||
@ -91,7 +94,7 @@ internal class VisionPropertyTest {
|
||||
|
||||
@Test
|
||||
fun testChildrenPropertyFlow() = runTest(dispatchTimeoutMs = 200) {
|
||||
val group = Global.fetch(VisionManager).group {
|
||||
val group = Global.request(VisionManager).group {
|
||||
|
||||
properties {
|
||||
"test" put 11
|
||||
|
@ -21,7 +21,6 @@ import space.kscience.visionforge.html.VisionTagConsumer.Companion.OUTPUT_ENDPOI
|
||||
import space.kscience.visionforge.html.VisionTagConsumer.Companion.OUTPUT_FETCH_ATTRIBUTE
|
||||
import space.kscience.visionforge.html.VisionTagConsumer.Companion.OUTPUT_NAME_ATTRIBUTE
|
||||
import space.kscience.visionforge.html.VisionTagConsumer.Companion.OUTPUT_RENDERED
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
/**
|
||||
@ -227,15 +226,13 @@ public class VisionClient : AbstractPlugin() {
|
||||
numberVisionRenderer(this),
|
||||
textVisionRenderer(this),
|
||||
formVisionRenderer(this)
|
||||
).toMap()
|
||||
).associateByName()
|
||||
} else super.content(target)
|
||||
|
||||
public companion object : PluginFactory<VisionClient> {
|
||||
override fun build(context: Context, meta: Meta): VisionClient = VisionClient()
|
||||
|
||||
override val tag: PluginTag = PluginTag(name = "vision.client", group = PluginTag.DATAFORGE_GROUP)
|
||||
|
||||
override val type: KClass<out VisionClient> = VisionClient::class
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,7 +293,7 @@ public fun VisionClient.renderAllVisions(): Unit = whenDocumentLoaded {
|
||||
}
|
||||
|
||||
public class VisionClientApplication(public val context: Context) : Application {
|
||||
private val client = context.fetch(VisionClient)
|
||||
private val client = context.request(VisionClient)
|
||||
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
context.logger.info {
|
||||
|
@ -2,21 +2,16 @@ plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js(IR){
|
||||
kscience {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
}
|
||||
sourceSets {
|
||||
commonMain{
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
api("space.kscience:gdml:0.4.0")
|
||||
}
|
||||
}
|
||||
jvmTest{
|
||||
dependencies{
|
||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
api("space.kscience:gdml:0.4.0")
|
||||
}
|
||||
dependencies(jvmTest) {
|
||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||
}
|
||||
}
|
@ -5,20 +5,13 @@ plugins {
|
||||
val markdownVersion = "0.2.4"
|
||||
|
||||
kscience {
|
||||
useSerialization()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(project(":visionforge-core"))
|
||||
api("org.jetbrains:markdown:$markdownVersion")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
api(project(":visionforge-core"))
|
||||
api("org.jetbrains:markdown:$markdownVersion")
|
||||
}
|
||||
useSerialization()
|
||||
}
|
@ -15,7 +15,6 @@ import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.*
|
||||
import space.kscience.visionforge.markup.VisionOfMarkup.Companion.COMMONMARK_FORMAT
|
||||
import space.kscience.visionforge.markup.VisionOfMarkup.Companion.GFM_FORMAT
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
public actual class MarkupPlugin : VisionPlugin(), ElementVisionRenderer {
|
||||
public val visionClient: VisionClient by require(VisionClient)
|
||||
@ -47,7 +46,6 @@ public actual class MarkupPlugin : VisionPlugin(), ElementVisionRenderer {
|
||||
|
||||
public companion object : PluginFactory<MarkupPlugin> {
|
||||
override val tag: PluginTag = PluginTag("vision.markup", PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<MarkupPlugin> = MarkupPlugin::class
|
||||
|
||||
override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin()
|
||||
|
||||
|
@ -6,7 +6,6 @@ import space.kscience.dataforge.context.PluginFactory
|
||||
import space.kscience.dataforge.context.PluginTag
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.visionforge.VisionPlugin
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
public actual class MarkupPlugin : VisionPlugin() {
|
||||
override val visionSerializersModule: SerializersModule get() = markupSerializersModule
|
||||
@ -16,8 +15,6 @@ public actual class MarkupPlugin : VisionPlugin() {
|
||||
public companion object : PluginFactory<MarkupPlugin> {
|
||||
override val tag: PluginTag = PluginTag("vision.plotly", PluginTag.DATAFORGE_GROUP)
|
||||
|
||||
override val type: KClass<out MarkupPlugin> = MarkupPlugin::class
|
||||
|
||||
override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin()
|
||||
|
||||
}
|
||||
|
@ -2,23 +2,16 @@ plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
}
|
||||
|
||||
val plotlyVersion = "0.5.3-dev-1"
|
||||
val plotlyVersion = "0.5.3"
|
||||
|
||||
kscience {
|
||||
useSerialization()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(project(":visionforge-core"))
|
||||
api("space.kscience:plotlykt-core:${plotlyVersion}")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
api(project(":visionforge-core"))
|
||||
api("space.kscience:plotlykt-core:${plotlyVersion}")
|
||||
}
|
||||
useSerialization()
|
||||
}
|
@ -14,7 +14,6 @@ import space.kscience.visionforge.ElementVisionRenderer
|
||||
import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.VisionClient
|
||||
import space.kscience.visionforge.VisionPlugin
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer {
|
||||
public val visionClient: VisionClient by require(VisionClient)
|
||||
@ -31,7 +30,7 @@ public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer {
|
||||
override fun render(element: Element, name: Name, vision: Vision, meta: Meta) {
|
||||
val plot = (vision as? VisionOfPlotly)?.plot ?: error("VisionOfPlotly expected but ${vision::class} found")
|
||||
val config = PlotlyConfig.read(meta)
|
||||
element.plot(plot, config)
|
||||
element.plot(config, plot)
|
||||
}
|
||||
|
||||
override fun content(target: String): Map<Name, Any> = when (target) {
|
||||
@ -41,7 +40,6 @@ public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer {
|
||||
|
||||
public actual companion object : PluginFactory<PlotlyPlugin> {
|
||||
override val tag: PluginTag = PluginTag("vision.plotly.js", PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<PlotlyPlugin> = PlotlyPlugin::class
|
||||
|
||||
override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin()
|
||||
|
||||
|
@ -6,7 +6,6 @@ import space.kscience.dataforge.context.PluginFactory
|
||||
import space.kscience.dataforge.context.PluginTag
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.visionforge.VisionPlugin
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
public actual class PlotlyPlugin : VisionPlugin() {
|
||||
|
||||
@ -16,7 +15,6 @@ public actual class PlotlyPlugin : VisionPlugin() {
|
||||
|
||||
public actual companion object : PluginFactory<PlotlyPlugin> {
|
||||
override val tag: PluginTag = PluginTag("vision.plotly", PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<PlotlyPlugin> = PlotlyPlugin::class
|
||||
|
||||
override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin()
|
||||
|
||||
|
@ -2,12 +2,14 @@ plugins {
|
||||
id("space.kscience.gradle.jvm")
|
||||
}
|
||||
|
||||
val ktorVersion = npmlibs.versions.ktor.get()
|
||||
|
||||
dependencies {
|
||||
api(project(":visionforge-core"))
|
||||
api("io.ktor:ktor-server-cio:${ktorVersion}")
|
||||
api("io.ktor:ktor-server-html-builder:${ktorVersion}")
|
||||
api("io.ktor:ktor-server-websockets:${ktorVersion}")
|
||||
implementation("io.ktor:ktor-server-cors:${ktorVersion}")
|
||||
kscience{
|
||||
useKtor()
|
||||
dependencies {
|
||||
api(projects.visionforgeCore)
|
||||
api("io.ktor:ktor-server-cio")
|
||||
api("io.ktor:ktor-server-html-builder")
|
||||
api("io.ktor:ktor-server-websockets")
|
||||
implementation("io.ktor:ktor-server-cors")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,35 +1,24 @@
|
||||
import space.kscience.gradle.KScienceVersions
|
||||
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
}
|
||||
|
||||
kscience{
|
||||
useSerialization{
|
||||
kscience {
|
||||
jvm()
|
||||
js()
|
||||
useSerialization {
|
||||
json()
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(project(":visionforge-core"))
|
||||
}
|
||||
}
|
||||
commonTest{
|
||||
dependencies{
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}")
|
||||
}
|
||||
}
|
||||
jvmTest{
|
||||
dependencies{
|
||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
api(projects.visionforgeCore)
|
||||
}
|
||||
testDependencies {
|
||||
implementation(spclibs.kotlinx.coroutines.test)
|
||||
}
|
||||
dependencies(jvmTest) {
|
||||
implementation(spclibs.logback.classic)
|
||||
}
|
||||
}
|
||||
|
||||
readme{
|
||||
readme {
|
||||
maturity = space.kscience.gradle.Maturity.DEVELOPMENT
|
||||
}
|
@ -169,14 +169,19 @@ internal fun float(name: Name, default: Number): ReadWriteProperty<Solid, Number
|
||||
}
|
||||
}
|
||||
|
||||
internal fun point(name: Name, default: Float): ReadWriteProperty<Solid, Point3D?> =
|
||||
internal fun point(
|
||||
name: Name,
|
||||
defaultX: Float,
|
||||
defaultY: Float = defaultX,
|
||||
defaultZ: Float = defaultX,
|
||||
): ReadWriteProperty<Solid, Point3D?> =
|
||||
object : ReadWriteProperty<Solid, Point3D?> {
|
||||
override fun getValue(thisRef: Solid, property: KProperty<*>): Point3D? {
|
||||
val item = thisRef.properties.own?.get(name) ?: return null
|
||||
return object : Point3D {
|
||||
override val x: Float get() = item[X_KEY]?.float ?: default
|
||||
override val y: Float get() = item[Y_KEY]?.float ?: default
|
||||
override val z: Float get() = item[Z_KEY]?.float ?: default
|
||||
override val x: Float get() = item[X_KEY]?.float ?: defaultX
|
||||
override val y: Float get() = item[Y_KEY]?.float ?: defaultY
|
||||
override val z: Float get() = item[Z_KEY]?.float ?: defaultZ
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,12 @@ import kotlinx.serialization.serializer
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.PluginFactory
|
||||
import space.kscience.dataforge.context.PluginTag
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.*
|
||||
import space.kscience.visionforge.html.VisionOutput
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
|
||||
public class Solids(meta: Meta) : VisionPlugin(meta), MutableVisionContainer<Solid> {
|
||||
@ -30,12 +29,11 @@ public class Solids(meta: Meta) : VisionPlugin(meta), MutableVisionContainer<Sol
|
||||
|
||||
public companion object : PluginFactory<Solids>, MutableVisionContainer<Solid> {
|
||||
override val tag: PluginTag = PluginTag(name = "vision.solid", group = PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<out Solids> = Solids::class
|
||||
|
||||
public val default: Solids by lazy {
|
||||
Context("@Solids") {
|
||||
plugin(Solids)
|
||||
}.fetch(Solids)
|
||||
}.request(Solids)
|
||||
}
|
||||
|
||||
override fun build(context: Context, meta: Meta): Solids = Solids(meta)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package space.kscience.visionforge.solid
|
||||
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.visionforge.getChild
|
||||
import kotlin.test.Test
|
||||
@ -19,7 +19,7 @@ class SolidPluginTest {
|
||||
@DFExperimental
|
||||
@Test
|
||||
fun testPluginConverter() {
|
||||
val visionManager = Global.fetch(Solids).visionManager
|
||||
val visionManager = Global.request(Solids).visionManager
|
||||
val meta = visionManager.encodeToMeta(vision)
|
||||
|
||||
val reconstructed = visionManager.decodeFromMeta(meta) as SolidGroup
|
||||
|
@ -1,7 +1,7 @@
|
||||
package space.kscience.visionforge.solid
|
||||
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.asValue
|
||||
import space.kscience.dataforge.names.asName
|
||||
@ -12,18 +12,18 @@ import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
internal class VisionUpdateTest {
|
||||
val solidManager = Global.fetch(Solids)
|
||||
val solidManager = Global.request(Solids)
|
||||
val visionManager = solidManager.visionManager
|
||||
|
||||
@Test
|
||||
fun testVisionUpdate(){
|
||||
fun testVisionUpdate() {
|
||||
val targetVision = Solids.solidGroup {
|
||||
box(200,200,200, name = "origin")
|
||||
box(200, 200, 200, name = "origin")
|
||||
}
|
||||
val dif = visionManager.VisionChange{
|
||||
solidGroup ("top") {
|
||||
val dif = visionManager.VisionChange {
|
||||
solidGroup("top") {
|
||||
color.set(123)
|
||||
box(100,100,100)
|
||||
box(100, 100, 100)
|
||||
}
|
||||
propertyChanged("top".asName(), SolidMaterial.MATERIAL_COLOR_KEY, Meta("red".asValue()))
|
||||
propertyChanged("origin".asName(), SolidMaterial.MATERIAL_COLOR_KEY, Meta("red".asValue()))
|
||||
@ -31,15 +31,18 @@ internal class VisionUpdateTest {
|
||||
targetVision.update(dif)
|
||||
assertTrue { targetVision.children.getChild("top") is SolidGroup }
|
||||
assertEquals("red", (targetVision.children.getChild("origin") as Solid).color.string) // Should work
|
||||
assertEquals("#00007b", (targetVision.children.getChild("top") as Solid).color.string) // new item always takes precedence
|
||||
assertEquals(
|
||||
"#00007b",
|
||||
(targetVision.children.getChild("top") as Solid).color.string
|
||||
) // new item always takes precedence
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testVisionChangeSerialization(){
|
||||
val change = visionManager.VisionChange{
|
||||
fun testVisionChangeSerialization() {
|
||||
val change = visionManager.VisionChange {
|
||||
solidGroup("top") {
|
||||
color.set(123)
|
||||
box(100,100,100)
|
||||
box(100, 100, 100)
|
||||
}
|
||||
propertyChanged("top".asName(), SolidMaterial.MATERIAL_COLOR_KEY, Meta("red".asValue()))
|
||||
propertyChanged("origin".asName(), SolidMaterial.MATERIAL_COLOR_KEY, Meta("red".asValue()))
|
||||
@ -47,6 +50,6 @@ internal class VisionUpdateTest {
|
||||
val serialized = visionManager.jsonFormat.encodeToString(VisionChange.serializer(), change)
|
||||
println(serialized)
|
||||
val reconstructed = visionManager.jsonFormat.decodeFromString(VisionChange.serializer(), serialized)
|
||||
assertEquals(change.properties,reconstructed.properties)
|
||||
assertEquals(change.properties, reconstructed.properties)
|
||||
}
|
||||
}
|
@ -2,13 +2,10 @@ plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
}
|
||||
|
||||
val tablesVersion = "0.2.0-dev-3"
|
||||
val tablesVersion = "0.2.0-dev-4"
|
||||
|
||||
kscience {
|
||||
useSerialization()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
useCommonJs()
|
||||
binaries.library()
|
||||
@ -20,21 +17,15 @@ kotlin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(project(":visionforge-core"))
|
||||
api("space.kscience:tables-kt:${tablesVersion}")
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(npm("tabulator-tables", "5.0.1"))
|
||||
implementation(npm("@types/tabulator-tables", "5.0.1"))
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
api(projects.visionforgeCore)
|
||||
api("space.kscience:tables-kt:${tablesVersion}")
|
||||
}
|
||||
dependencies(jsMain){
|
||||
implementation(npm("tabulator-tables", "5.0.1"))
|
||||
implementation(npm("@types/tabulator-tables", "5.0.1"))
|
||||
}
|
||||
useSerialization()
|
||||
}
|
||||
|
||||
readme{
|
||||
|
@ -9,7 +9,6 @@ import space.kscience.dataforge.context.PluginTag
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.VisionPlugin
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
public class TableVisionPlugin : VisionPlugin() {
|
||||
override val tag: PluginTag get() = Companion.tag
|
||||
@ -23,7 +22,6 @@ public class TableVisionPlugin : VisionPlugin() {
|
||||
|
||||
public companion object : PluginFactory<TableVisionPlugin> {
|
||||
override val tag: PluginTag = PluginTag("vision.table", PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<TableVisionPlugin> = TableVisionPlugin::class
|
||||
|
||||
override fun build(context: Context, meta: Meta): TableVisionPlugin = TableVisionPlugin()
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.VisionClient
|
||||
import tabulator.Tabulator
|
||||
import tabulator.TabulatorFull
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
public class TableVisionJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||
public val visionClient: VisionClient by require(VisionClient)
|
||||
@ -89,7 +88,6 @@ public class TableVisionJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||
|
||||
public companion object : PluginFactory<TableVisionJsPlugin> {
|
||||
override val tag: PluginTag = PluginTag("vision.table.js", PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<TableVisionJsPlugin> = TableVisionJsPlugin::class
|
||||
|
||||
override fun build(context: Context, meta: Meta): TableVisionJsPlugin = TableVisionJsPlugin()
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ kotlin{
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(project(":visionforge-solid"))
|
||||
api(projects.visionforgeSolid)
|
||||
implementation(npm("three", "0.143.0"))
|
||||
implementation(npm("three-csg-ts", "3.1.10"))
|
||||
implementation(npm("three.meshline","1.4.0"))
|
||||
|
@ -158,7 +158,6 @@ public class ThreePlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||
|
||||
public companion object : PluginFactory<ThreePlugin> {
|
||||
override val tag: PluginTag = PluginTag("vision.threejs", PluginTag.DATAFORGE_GROUP)
|
||||
override val type: KClass<ThreePlugin> = ThreePlugin::class
|
||||
|
||||
override fun build(context: Context, meta: Meta): ThreePlugin = ThreePlugin()
|
||||
}
|
||||
|
@ -4,55 +4,26 @@ plugins {
|
||||
|
||||
val ktorVersion: String by rootProject.extra
|
||||
|
||||
kotlin {
|
||||
js(IR) {
|
||||
browser {
|
||||
webpackTask {
|
||||
this.outputFileName = "js/visionforge-three.js"
|
||||
}
|
||||
commonWebpackConfig {
|
||||
cssSupport{
|
||||
enabled.set(false)
|
||||
}
|
||||
kscience {
|
||||
fullStack("js/visionforge-three.js") {
|
||||
commonWebpackConfig {
|
||||
cssSupport {
|
||||
enabled.set(false)
|
||||
}
|
||||
}
|
||||
binaries.executable()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
api(projects.visionforgeServer)
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
api(projects.visionforgeThreejs)
|
||||
api(projects.ui.ring)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val jsBrowserDistribution by tasks.getting
|
||||
val jsBrowserDevelopmentExecutableDistribution by tasks.getting
|
||||
|
||||
val devMode = rootProject.findProperty("visionforge.development") as? Boolean
|
||||
?: rootProject.version.toString().contains("dev")
|
||||
|
||||
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
if (devMode) {
|
||||
dependsOn(jsBrowserDevelopmentExecutableDistribution)
|
||||
from(jsBrowserDevelopmentExecutableDistribution)
|
||||
} else {
|
||||
dependsOn(jsBrowserDistribution)
|
||||
from(jsBrowserDistribution)
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
}
|
||||
|
||||
dependencies(jvmMain) {
|
||||
api(projects.visionforgeServer)
|
||||
}
|
||||
|
||||
dependencies(jsMain) {
|
||||
api(projects.visionforgeThreejs)
|
||||
api(projects.ui.ring)
|
||||
compileOnly(npm("webpack-bundle-analyzer","4.5.0"))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user