forked from kscience/visionforge
Migrate to new build tools and DF 0.6
This commit is contained in:
parent
86935ce52a
commit
4b1149b99b
@ -3,12 +3,12 @@ plugins {
|
|||||||
// id("org.jetbrains.kotlinx.kover") version "0.5.0"
|
// id("org.jetbrains.kotlinx.kover") version "0.5.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
val dataforgeVersion by extra("0.5.2")
|
val dataforgeVersion by extra("0.6.0-dev-10")
|
||||||
val fxVersion by extra("11")
|
val fxVersion by extra("11")
|
||||||
|
|
||||||
allprojects{
|
allprojects{
|
||||||
group = "space.kscience"
|
group = "space.kscience"
|
||||||
version = "0.3.0-dev-1"
|
version = "0.3.0-dev-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
@ -19,6 +19,12 @@ subprojects {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://maven.jzy3d.org/releases")
|
maven("https://maven.jzy3d.org/releases")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>{
|
||||||
|
kotlinOptions{
|
||||||
|
freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ksciencePublish {
|
ksciencePublish {
|
||||||
|
@ -2,12 +2,13 @@ package space.kscience.visionforge.gdml.demo
|
|||||||
|
|
||||||
import kotlinx.browser.document
|
import kotlinx.browser.document
|
||||||
import kotlinx.css.*
|
import kotlinx.css.*
|
||||||
import react.dom.render
|
import react.dom.client.createRoot
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.gdml.GdmlShowCase
|
import space.kscience.gdml.GdmlShowCase
|
||||||
import space.kscience.visionforge.Application
|
import space.kscience.visionforge.Application
|
||||||
import space.kscience.visionforge.Colors
|
import space.kscience.visionforge.Colors
|
||||||
import space.kscience.visionforge.gdml.toVision
|
import space.kscience.visionforge.gdml.toVision
|
||||||
|
import space.kscience.visionforge.react.render
|
||||||
import space.kscience.visionforge.solid.ambientLight
|
import space.kscience.visionforge.solid.ambientLight
|
||||||
import space.kscience.visionforge.solid.invoke
|
import space.kscience.visionforge.solid.invoke
|
||||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||||
@ -42,7 +43,7 @@ private class GDMLDemoApp : Application {
|
|||||||
|
|
||||||
val element = document.getElementById("application") ?: error("Element with id 'application' not found on page")
|
val element = document.getElementById("application") ?: error("Element with id 'application' not found on page")
|
||||||
|
|
||||||
render(element) {
|
createRoot(element).render {
|
||||||
child(GDMLApp) {
|
child(GDMLApp) {
|
||||||
val vision = GdmlShowCase.cubes().toVision().apply {
|
val vision = GdmlShowCase.cubes().toVision().apply {
|
||||||
ambientLight {
|
ambientLight {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import kotlinx.browser.document
|
import kotlinx.browser.document
|
||||||
import kotlinx.css.*
|
import kotlinx.css.*
|
||||||
import react.dom.render
|
import react.dom.client.createRoot
|
||||||
import ringui.SmartTabs
|
import ringui.SmartTabs
|
||||||
import ringui.Tab
|
import ringui.Tab
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
@ -10,6 +10,7 @@ import space.kscience.visionforge.Application
|
|||||||
import space.kscience.visionforge.Colors
|
import space.kscience.visionforge.Colors
|
||||||
import space.kscience.visionforge.VisionClient
|
import space.kscience.visionforge.VisionClient
|
||||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||||
|
import space.kscience.visionforge.react.render
|
||||||
import space.kscience.visionforge.ring.ThreeCanvasWithControls
|
import space.kscience.visionforge.ring.ThreeCanvasWithControls
|
||||||
import space.kscience.visionforge.ring.ThreeWithControlsPlugin
|
import space.kscience.visionforge.ring.ThreeWithControlsPlugin
|
||||||
import space.kscience.visionforge.ring.solid
|
import space.kscience.visionforge.ring.solid
|
||||||
@ -38,7 +39,7 @@ private class JsPlaygroundApp : Application {
|
|||||||
|
|
||||||
val element = document.getElementById("playground") ?: error("Element with id 'playground' not found on page")
|
val element = document.getElementById("playground") ?: error("Element with id 'playground' not found on page")
|
||||||
|
|
||||||
render(element) {
|
createRoot(element).render {
|
||||||
styledDiv {
|
styledDiv {
|
||||||
css {
|
css {
|
||||||
padding(0.pt)
|
padding(0.pt)
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package ru.mipt.npm.muon.monitor
|
package ru.mipt.npm.muon.monitor
|
||||||
|
|
||||||
import kotlinx.browser.document
|
import kotlinx.browser.document
|
||||||
import react.dom.render
|
import react.dom.client.createRoot
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.dataforge.context.fetch
|
import space.kscience.dataforge.context.fetch
|
||||||
import space.kscience.visionforge.Application
|
import space.kscience.visionforge.Application
|
||||||
import space.kscience.visionforge.VisionManager
|
import space.kscience.visionforge.VisionManager
|
||||||
|
import space.kscience.visionforge.react.render
|
||||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||||
import space.kscience.visionforge.startApplication
|
import space.kscience.visionforge.startApplication
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ private class MMDemoApp : Application {
|
|||||||
val model = Model(visionManager)
|
val model = Model(visionManager)
|
||||||
|
|
||||||
val element = document.getElementById("app") ?: error("Element with id 'app' not found on page")
|
val element = document.getElementById("app") ?: error("Element with id 'app' not found on page")
|
||||||
render(element) {
|
createRoot(element).render {
|
||||||
child(MMApp) {
|
child(MMApp) {
|
||||||
attrs {
|
attrs {
|
||||||
this.model = model
|
this.model = model
|
||||||
|
@ -6,4 +6,4 @@ kotlin.jupyter.add.scanner=false
|
|||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.jvmargs=-Xmx4G
|
org.gradle.jvmargs=-Xmx4G
|
||||||
|
|
||||||
toolsVersion=0.11.4-kotlin-1.6.20
|
toolsVersion=0.11.7-kotlin-1.7.0
|
@ -9,3 +9,7 @@ dependencies{
|
|||||||
// implementation(npm("react-select","4.3.0"))
|
// implementation(npm("react-select","4.3.0"))
|
||||||
implementation(project(":visionforge-threejs"))
|
implementation(project(":visionforge-threejs"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootProject.extensions.configure<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension> {
|
||||||
|
versions.webpackCli.version = "4.10.0"
|
||||||
|
}
|
@ -7,7 +7,7 @@ import org.w3c.dom.Element
|
|||||||
import org.w3c.dom.events.Event
|
import org.w3c.dom.events.Event
|
||||||
import react.*
|
import react.*
|
||||||
import react.dom.attrs
|
import react.dom.attrs
|
||||||
import react.dom.render
|
import react.dom.client.createRoot
|
||||||
import space.kscience.dataforge.meta.*
|
import space.kscience.dataforge.meta.*
|
||||||
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
|
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
|
||||||
import space.kscience.dataforge.meta.descriptors.ValueRequirement
|
import space.kscience.dataforge.meta.descriptors.ValueRequirement
|
||||||
@ -235,6 +235,6 @@ public fun Element.configEditor(
|
|||||||
default: Meta = config,
|
default: Meta = config,
|
||||||
descriptor: MetaDescriptor? = null,
|
descriptor: MetaDescriptor? = null,
|
||||||
key: Any? = null,
|
key: Any? = null,
|
||||||
): Unit = render(this) {
|
): Unit = createRoot(this).render {
|
||||||
configEditor(config, default, descriptor, key = key)
|
configEditor(config, default, descriptor, key = key)
|
||||||
}
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package space.kscience.visionforge.react
|
||||||
|
|
||||||
|
import react.Props
|
||||||
|
import react.RBuilder
|
||||||
|
import react.createElement
|
||||||
|
import react.dom.client.Root
|
||||||
|
|
||||||
|
public fun Root.render(block: RBuilder.() -> Unit) {
|
||||||
|
render(createElement<Props>(block))
|
||||||
|
}
|
@ -2,7 +2,7 @@ package space.kscience.visionforge.ring
|
|||||||
|
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
import react.child
|
import react.dom.client.createRoot
|
||||||
import space.kscience.dataforge.context.AbstractPlugin
|
import space.kscience.dataforge.context.AbstractPlugin
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.dataforge.context.PluginFactory
|
import space.kscience.dataforge.context.PluginFactory
|
||||||
@ -12,6 +12,7 @@ import space.kscience.dataforge.names.Name
|
|||||||
import space.kscience.dataforge.names.asName
|
import space.kscience.dataforge.names.asName
|
||||||
import space.kscience.visionforge.ElementVisionRenderer
|
import space.kscience.visionforge.ElementVisionRenderer
|
||||||
import space.kscience.visionforge.Vision
|
import space.kscience.visionforge.Vision
|
||||||
|
import space.kscience.visionforge.react.render
|
||||||
import space.kscience.visionforge.solid.Solid
|
import space.kscience.visionforge.solid.Solid
|
||||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
@ -25,7 +26,7 @@ public class ThreeWithControlsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
|||||||
if (vision is Solid) ElementVisionRenderer.DEFAULT_RATING * 2 else ElementVisionRenderer.ZERO_RATING
|
if (vision is Solid) ElementVisionRenderer.DEFAULT_RATING * 2 else ElementVisionRenderer.ZERO_RATING
|
||||||
|
|
||||||
override fun render(element: Element, vision: Vision, meta: Meta) {
|
override fun render(element: Element, vision: Vision, meta: Meta) {
|
||||||
react.dom.render(element) {
|
createRoot(element).render {
|
||||||
child(ThreeCanvasWithControls) {
|
child(ThreeCanvasWithControls) {
|
||||||
attrs {
|
attrs {
|
||||||
this.context = this@ThreeWithControlsPlugin.context
|
this.context = this@ThreeWithControlsPlugin.context
|
||||||
@ -45,6 +46,7 @@ public class ThreeWithControlsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
|||||||
public companion object : PluginFactory<ThreeWithControlsPlugin> {
|
public companion object : PluginFactory<ThreeWithControlsPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("vision.threejs.withControls", PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vision.threejs.withControls", PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<ThreeWithControlsPlugin> = ThreeWithControlsPlugin::class
|
override val type: KClass<ThreeWithControlsPlugin> = ThreeWithControlsPlugin::class
|
||||||
override fun invoke(meta: Meta, context: Context): ThreeWithControlsPlugin = ThreeWithControlsPlugin()
|
|
||||||
|
override fun build(context: Context, meta: Meta): ThreeWithControlsPlugin = ThreeWithControlsPlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,8 +2,8 @@ package space.kscience.visionforge.ring
|
|||||||
|
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
import react.RBuilder
|
import react.RBuilder
|
||||||
|
import react.dom.client.createRoot
|
||||||
import react.dom.p
|
import react.dom.p
|
||||||
import react.dom.render
|
|
||||||
import ringui.Island
|
import ringui.Island
|
||||||
import ringui.SmartTabs
|
import ringui.SmartTabs
|
||||||
import ringui.Tab
|
import ringui.Tab
|
||||||
@ -14,6 +14,7 @@ import space.kscience.visionforge.getStyle
|
|||||||
import space.kscience.visionforge.react.flexColumn
|
import space.kscience.visionforge.react.flexColumn
|
||||||
import space.kscience.visionforge.react.metaViewer
|
import space.kscience.visionforge.react.metaViewer
|
||||||
import space.kscience.visionforge.react.propertyEditor
|
import space.kscience.visionforge.react.propertyEditor
|
||||||
|
import space.kscience.visionforge.react.render
|
||||||
import space.kscience.visionforge.solid.SolidReference
|
import space.kscience.visionforge.solid.SolidReference
|
||||||
import space.kscience.visionforge.styles
|
import space.kscience.visionforge.styles
|
||||||
|
|
||||||
@ -72,6 +73,6 @@ public fun RBuilder.ringPropertyEditor(
|
|||||||
public fun Element.ringPropertyEditor(
|
public fun Element.ringPropertyEditor(
|
||||||
item: Vision,
|
item: Vision,
|
||||||
descriptor: MetaDescriptor? = item.descriptor,
|
descriptor: MetaDescriptor? = item.descriptor,
|
||||||
): Unit = render(this) {
|
): Unit = createRoot(this).render {
|
||||||
ringPropertyEditor(item, descriptor = descriptor)
|
ringPropertyEditor(item, descriptor = descriptor)
|
||||||
}
|
}
|
@ -63,7 +63,7 @@ public class VisionManager(meta: Meta) : AbstractPlugin(meta) {
|
|||||||
|
|
||||||
public const val VISION_SERIALIZER_MODULE_TARGET: String = "visionSerializerModule"
|
public const val VISION_SERIALIZER_MODULE_TARGET: String = "visionSerializerModule"
|
||||||
|
|
||||||
override fun invoke(meta: Meta, context: Context): VisionManager = VisionManager(meta)
|
override fun build(context: Context, meta: Meta): VisionManager = VisionManager(meta)
|
||||||
|
|
||||||
private val defaultSerialModule: SerializersModule = SerializersModule {
|
private val defaultSerialModule: SerializersModule = SerializersModule {
|
||||||
polymorphic(Vision::class) {
|
polymorphic(Vision::class) {
|
||||||
|
@ -203,8 +203,7 @@ public class VisionClient : AbstractPlugin() {
|
|||||||
) else super.content(target)
|
) else super.content(target)
|
||||||
|
|
||||||
public companion object : PluginFactory<VisionClient> {
|
public companion object : PluginFactory<VisionClient> {
|
||||||
|
override fun build(context: Context, meta: Meta): VisionClient = VisionClient()
|
||||||
override fun invoke(meta: Meta, context: Context): VisionClient = VisionClient()
|
|
||||||
|
|
||||||
override val tag: PluginTag = PluginTag(name = "vision.client", group = PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag(name = "vision.client", group = PluginTag.DATAFORGE_GROUP)
|
||||||
|
|
||||||
|
@ -95,8 +95,9 @@ public class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) {
|
|||||||
public companion object : PluginFactory<FXPlugin> {
|
public companion object : PluginFactory<FXPlugin> {
|
||||||
override val type: KClass<out FXPlugin> = FXPlugin::class
|
override val type: KClass<out FXPlugin> = FXPlugin::class
|
||||||
override val tag: PluginTag = PluginTag("vis.fx", group = PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vis.fx", group = PluginTag.DATAFORGE_GROUP)
|
||||||
override fun invoke(meta: Meta, context: Context): FXPlugin =
|
|
||||||
FXPlugin(meta)
|
override fun build(context: Context, meta: Meta): FXPlugin = FXPlugin(meta)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,8 @@ public class FX3DPlugin : AbstractPlugin() {
|
|||||||
public companion object : PluginFactory<FX3DPlugin> {
|
public companion object : PluginFactory<FX3DPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("vision.fx3D", PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vision.fx3D", PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<FX3DPlugin> = FX3DPlugin::class
|
override val type: KClass<FX3DPlugin> = FX3DPlugin::class
|
||||||
override fun invoke(meta: Meta, context: Context): FX3DPlugin = FX3DPlugin()
|
|
||||||
|
override fun build(context: Context, meta: Meta): FX3DPlugin = FX3DPlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ public class MarkupPlugin : VisionPlugin(), ElementVisionRenderer {
|
|||||||
public companion object : PluginFactory<MarkupPlugin> {
|
public companion object : PluginFactory<MarkupPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("vision.markup", PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vision.markup", PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<MarkupPlugin> = MarkupPlugin::class
|
override val type: KClass<MarkupPlugin> = MarkupPlugin::class
|
||||||
override fun invoke(meta: Meta, context: Context): MarkupPlugin = MarkupPlugin()
|
|
||||||
|
override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -42,6 +42,8 @@ public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer {
|
|||||||
public actual companion object : PluginFactory<PlotlyPlugin> {
|
public actual companion object : PluginFactory<PlotlyPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("vision.plotly.js", PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vision.plotly.js", PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<PlotlyPlugin> = PlotlyPlugin::class
|
override val type: KClass<PlotlyPlugin> = PlotlyPlugin::class
|
||||||
override fun invoke(meta: Meta, context: Context): PlotlyPlugin = PlotlyPlugin()
|
|
||||||
|
override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ package space.kscience.visionforge.plotly
|
|||||||
|
|
||||||
import kotlinx.serialization.modules.SerializersModule
|
import kotlinx.serialization.modules.SerializersModule
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.dataforge.context.Plugin
|
|
||||||
import space.kscience.dataforge.context.PluginFactory
|
import space.kscience.dataforge.context.PluginFactory
|
||||||
import space.kscience.dataforge.context.PluginTag
|
import space.kscience.dataforge.context.PluginTag
|
||||||
import space.kscience.dataforge.meta.Meta
|
import space.kscience.dataforge.meta.Meta
|
||||||
@ -18,6 +17,8 @@ public actual class PlotlyPlugin : VisionPlugin() {
|
|||||||
public actual companion object : PluginFactory<PlotlyPlugin> {
|
public actual companion object : PluginFactory<PlotlyPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("vision.plotly", PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vision.plotly", PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<PlotlyPlugin> = PlotlyPlugin::class
|
override val type: KClass<PlotlyPlugin> = PlotlyPlugin::class
|
||||||
override fun invoke(meta: Meta, context: Context): PlotlyPlugin = PlotlyPlugin()
|
|
||||||
|
override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,7 +24,8 @@ public class Solids(meta: Meta) : VisionPlugin(meta) {
|
|||||||
public companion object : PluginFactory<Solids> {
|
public companion object : PluginFactory<Solids> {
|
||||||
override val tag: PluginTag = PluginTag(name = "vision.solid", group = PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag(name = "vision.solid", group = PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<out Solids> = Solids::class
|
override val type: KClass<out Solids> = Solids::class
|
||||||
override fun invoke(meta: Meta, context: Context): Solids = Solids(meta)
|
|
||||||
|
override fun build(context: Context, meta: Meta): Solids = Solids(meta)
|
||||||
|
|
||||||
private fun PolymorphicModuleBuilder<Solid>.solids() {
|
private fun PolymorphicModuleBuilder<Solid>.solids() {
|
||||||
subclass(SolidGroup.serializer())
|
subclass(SolidGroup.serializer())
|
||||||
|
@ -2,7 +2,7 @@ plugins {
|
|||||||
id("ru.mipt.npm.gradle.mpp")
|
id("ru.mipt.npm.gradle.mpp")
|
||||||
}
|
}
|
||||||
|
|
||||||
val tablesVersion = "0.1.4"
|
val tablesVersion = "0.2.0-dev-1"
|
||||||
|
|
||||||
kscience {
|
kscience {
|
||||||
useSerialization()
|
useSerialization()
|
||||||
|
@ -8,7 +8,6 @@ import space.kscience.dataforge.context.PluginFactory
|
|||||||
import space.kscience.dataforge.context.PluginTag
|
import space.kscience.dataforge.context.PluginTag
|
||||||
import space.kscience.dataforge.meta.Meta
|
import space.kscience.dataforge.meta.Meta
|
||||||
import space.kscience.visionforge.Vision
|
import space.kscience.visionforge.Vision
|
||||||
import space.kscience.visionforge.VisionManager
|
|
||||||
import space.kscience.visionforge.VisionPlugin
|
import space.kscience.visionforge.VisionPlugin
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@ -25,6 +24,7 @@ public class TableVisionPlugin : VisionPlugin() {
|
|||||||
public companion object : PluginFactory<TableVisionPlugin> {
|
public companion object : PluginFactory<TableVisionPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("vision.table", PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vision.table", PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<TableVisionPlugin> = TableVisionPlugin::class
|
override val type: KClass<TableVisionPlugin> = TableVisionPlugin::class
|
||||||
override fun invoke(meta: Meta, context: Context): TableVisionPlugin = TableVisionPlugin()
|
|
||||||
|
override fun build(context: Context, meta: Meta): TableVisionPlugin = TableVisionPlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -86,7 +86,7 @@ public fun Table<Number>.toVision(): VisionOfTable = toVision { (it ?: Double.Na
|
|||||||
@DFExperimental
|
@DFExperimental
|
||||||
public inline fun VisionOutput.table(
|
public inline fun VisionOutput.table(
|
||||||
vararg headers: ColumnHeader<Value>,
|
vararg headers: ColumnHeader<Value>,
|
||||||
block: MutableRowTable<Value>.() -> Unit,
|
block: RowTableBuilder<Value>.() -> Unit,
|
||||||
): VisionOfTable {
|
): VisionOfTable {
|
||||||
requirePlugin(TableVisionPlugin)
|
requirePlugin(TableVisionPlugin)
|
||||||
return RowTable(*headers, block = block).toVision()
|
return RowTable(*headers, block = block).toVision()
|
||||||
@ -94,8 +94,8 @@ public inline fun VisionOutput.table(
|
|||||||
|
|
||||||
@DFExperimental
|
@DFExperimental
|
||||||
public inline fun VisionOutput.columnTable(
|
public inline fun VisionOutput.columnTable(
|
||||||
columnSize: UInt,
|
columnSize: Int,
|
||||||
block: MutableColumnTable<Value>.() -> Unit,
|
block: ColumnTableBuilder<Value>.() -> Unit,
|
||||||
): VisionOfTable = ColumnTable(columnSize, block).toVision()
|
): VisionOfTable = ColumnTable(columnSize, block).toVision()
|
||||||
|
|
||||||
@DFExperimental
|
@DFExperimental
|
||||||
|
@ -17,7 +17,7 @@ internal class VisionOfTableTest {
|
|||||||
val x by ColumnHeader.typed<Value>()
|
val x by ColumnHeader.typed<Value>()
|
||||||
val y by ColumnHeader.typed<Value>()
|
val y by ColumnHeader.typed<Value>()
|
||||||
|
|
||||||
val table = ColumnTable<Value>(100U) {
|
val table = ColumnTable(100) {
|
||||||
x.fill { it.asValue() }
|
x.fill { it.asValue() }
|
||||||
y.values = x.values.map { it?.double?.pow(2)?.asValue() }
|
y.values = x.values.map { it?.double?.pow(2)?.asValue() }
|
||||||
}
|
}
|
||||||
@ -27,6 +27,6 @@ internal class VisionOfTableTest {
|
|||||||
|
|
||||||
val rows = vision.rowSequence().toList()
|
val rows = vision.rowSequence().toList()
|
||||||
|
|
||||||
assertEquals(50, rows[50][x]?.int)
|
assertEquals(50, rows[50][x].int)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,6 @@ import space.kscience.dataforge.context.AbstractPlugin
|
|||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.dataforge.context.PluginFactory
|
import space.kscience.dataforge.context.PluginFactory
|
||||||
import space.kscience.dataforge.context.PluginTag
|
import space.kscience.dataforge.context.PluginTag
|
||||||
import space.kscience.dataforge.meta.DynamicMeta
|
|
||||||
import space.kscience.dataforge.meta.Meta
|
import space.kscience.dataforge.meta.Meta
|
||||||
import space.kscience.dataforge.meta.toDynamic
|
import space.kscience.dataforge.meta.toDynamic
|
||||||
import space.kscience.dataforge.names.Name
|
import space.kscience.dataforge.names.Name
|
||||||
@ -91,6 +90,7 @@ public class TableVisionJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
|||||||
public companion object : PluginFactory<TableVisionJsPlugin> {
|
public companion object : PluginFactory<TableVisionJsPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("vision.table.js", PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vision.table.js", PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<TableVisionJsPlugin> = TableVisionJsPlugin::class
|
override val type: KClass<TableVisionJsPlugin> = TableVisionJsPlugin::class
|
||||||
override fun invoke(meta: Meta, context: Context): TableVisionJsPlugin = TableVisionJsPlugin()
|
|
||||||
|
override fun build(context: Context, meta: Meta): TableVisionJsPlugin = TableVisionJsPlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ package space.kscience.visionforge.solid.three
|
|||||||
import info.laht.threekt.core.Object3D
|
import info.laht.threekt.core.Object3D
|
||||||
import info.laht.threekt.geometries.TextBufferGeometry
|
import info.laht.threekt.geometries.TextBufferGeometry
|
||||||
import info.laht.threekt.objects.Mesh
|
import info.laht.threekt.objects.Mesh
|
||||||
import kotlinext.js.jso
|
import kotlinx.js.jso
|
||||||
import space.kscience.dataforge.context.logger
|
import space.kscience.dataforge.context.logger
|
||||||
import space.kscience.dataforge.context.warn
|
import space.kscience.dataforge.context.warn
|
||||||
import space.kscience.visionforge.onPropertyChange
|
import space.kscience.visionforge.onPropertyChange
|
||||||
|
@ -151,7 +151,8 @@ public class ThreePlugin : AbstractPlugin(), ElementVisionRenderer {
|
|||||||
public companion object : PluginFactory<ThreePlugin> {
|
public companion object : PluginFactory<ThreePlugin> {
|
||||||
override val tag: PluginTag = PluginTag("vision.threejs", PluginTag.DATAFORGE_GROUP)
|
override val tag: PluginTag = PluginTag("vision.threejs", PluginTag.DATAFORGE_GROUP)
|
||||||
override val type: KClass<ThreePlugin> = ThreePlugin::class
|
override val type: KClass<ThreePlugin> = ThreePlugin::class
|
||||||
override fun invoke(meta: Meta, context: Context): ThreePlugin = ThreePlugin()
|
|
||||||
|
override fun build(context: Context, meta: Meta): ThreePlugin = ThreePlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user