From dab93fc136be370ff1bbef394232993cf8dd9b82 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 26 Jan 2021 21:05:56 +0300 Subject: [PATCH] [WIP] Documentation update --- README.md | 10 ++-- build.gradle.kts | 4 +- demo/gdml/README.md | 2 +- demo/muon-monitor/README.md | 2 +- demo/spatial-showcase/README.md | 4 +- {doc => docs}/Dependency structure.vsdx | Bin {doc => docs}/resources/class-diag-core.png | Bin {doc => docs}/resources/class-diag-solid.png | Bin {doc => docs}/resources/gdml-demo.png | Bin {doc => docs}/resources/muon-monitor.png | Bin .../resources/spatial-showcase-FX.png | Bin {doc => docs}/resources/spatial-showcase.png | Bin docs/uml/Vision.puml | 45 ++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- .../src/jsMain/kotlin/playgroundMain.kt | 1 + settings.gradle.kts | 4 +- .../hep/dataforge/vision/react/MetaViewer.kt | 8 ++-- .../dataforge/vision/react/PropertyEditor.kt | 2 +- .../kotlin/hep/dataforge/vision/Colors.kt | 6 +-- .../kotlin/hep/dataforge/vision/StyleSheet.kt | 2 +- .../kotlin/hep/dataforge/vision/Vision.kt | 2 +- .../kotlin/hep/dataforge/vision/VisionBase.kt | 22 +-------- .../kotlin/hep/dataforge/vision/misc.kt | 6 +-- .../dataforge/vision/client/elementOutput.kt | 2 +- .../hep/dataforge/vision/editor/FXMeta.kt | 2 +- .../dataforge/vision/editor/ValueChooser.kt | 6 +-- .../hep/dataforge/vision/solid/FX3DPlugin.kt | 2 +- .../hep/dataforge/vision/solid/FXMaterials.kt | 8 ++-- .../hep/dataforge/vision/solid/ConvexTest.kt | 2 +- visionforge-threejs/build.gradle.kts | 4 +- .../vision/solid/three/ThreeFactory.kt | 2 +- .../vision/solid/three/ThreeMaterials.kt | 4 +- 32 files changed, 91 insertions(+), 63 deletions(-) rename {doc => docs}/Dependency structure.vsdx (100%) rename {doc => docs}/resources/class-diag-core.png (100%) rename {doc => docs}/resources/class-diag-solid.png (100%) rename {doc => docs}/resources/gdml-demo.png (100%) rename {doc => docs}/resources/muon-monitor.png (100%) rename {doc => docs}/resources/spatial-showcase-FX.png (100%) rename {doc => docs}/resources/spatial-showcase.png (100%) create mode 100644 docs/uml/Vision.puml diff --git a/README.md b/README.md index ad589f69..df55c37c 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ The `visionforge-core` module also includes configuration editors for JS (in `js **Class diagram:** -![](doc/resources/class-diag-core.png) +![](docs/resources/class-diag-core.png) ### visionforge-solid @@ -82,7 +82,7 @@ Includes common classes and serializers for 3D visualization, as well as Three.j **Class diagram:** -![](doc/resources/class-diag-solid.png) +![](docs/resources/class-diag-solid.png) ##### Prototypes @@ -127,7 +127,7 @@ Some shapes will also periodically change their color and visibility. **Example view:** -![](doc/resources/spatial-showcase.png) +![](docs/resources/spatial-showcase.png) ### Full-Stack Application Example - Muon Monitor Visualization @@ -139,7 +139,7 @@ A full-stack application example, showing the **Example view:** -![](doc/resources/muon-monitor.png) +![](docs/resources/muon-monitor.png) ### GDML Example @@ -150,7 +150,7 @@ Visualization example for geometry defined as GDML file. ##### Example view: -![](doc/resources/gdml-demo.png) +![](docs/resources/gdml-demo.png) ## Thanks and references diff --git a/build.gradle.kts b/build.gradle.kts index 4589fe5e..1b60596b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("ru.mipt.npm.project") } -val dataforgeVersion by extra("0.3.0-dev") +val dataforgeVersion by extra("0.3.0-dev-1") val ktorVersion by extra("1.5.0") val htmlVersion by extra("0.7.2") val kotlinWrappersVersion by extra("pre.129-kotlin-1.4.20") @@ -17,7 +17,7 @@ allprojects { } group = "hep.dataforge" - version = "0.2.0-dev-3" + version = "0.2.0-dev-4" } val githubProject by extra("visionforge") diff --git a/demo/gdml/README.md b/demo/gdml/README.md index 5bdee058..9a20ac55 100644 --- a/demo/gdml/README.md +++ b/demo/gdml/README.md @@ -12,4 +12,4 @@ drag-and-drop GDML file to the window to see visualization. For an example file, ##### Example view: -![](../../doc/resources/gdml-demo.png) +![](../../docs/resources/gdml-demo.png) diff --git a/demo/muon-monitor/README.md b/demo/muon-monitor/README.md index 739a4956..1949cb1e 100644 --- a/demo/muon-monitor/README.md +++ b/demo/muon-monitor/README.md @@ -30,5 +30,5 @@ run `demo/muon-monitor/application/run` task. ##### Example view: -![](../../doc/resources/muon-monitor.png) +![](../../docs/resources/muon-monitor.png) diff --git a/demo/spatial-showcase/README.md b/demo/spatial-showcase/README.md index 41d3a5e3..2b30ef3e 100644 --- a/demo/spatial-showcase/README.md +++ b/demo/spatial-showcase/README.md @@ -12,8 +12,8 @@ To see Java FX demo, run `demo/spatial-showcase/Tasks/application/run` Gradle ta ##### Example view for JS: -![](../../doc/resources/spatial-showcase.png) +![](../../docs/resources/spatial-showcase.png) ##### Example view for Java FX: -![](../../doc/resources/spatial-showcase-FX.png) +![](../../docs/resources/spatial-showcase-FX.png) diff --git a/doc/Dependency structure.vsdx b/docs/Dependency structure.vsdx similarity index 100% rename from doc/Dependency structure.vsdx rename to docs/Dependency structure.vsdx diff --git a/doc/resources/class-diag-core.png b/docs/resources/class-diag-core.png similarity index 100% rename from doc/resources/class-diag-core.png rename to docs/resources/class-diag-core.png diff --git a/doc/resources/class-diag-solid.png b/docs/resources/class-diag-solid.png similarity index 100% rename from doc/resources/class-diag-solid.png rename to docs/resources/class-diag-solid.png diff --git a/doc/resources/gdml-demo.png b/docs/resources/gdml-demo.png similarity index 100% rename from doc/resources/gdml-demo.png rename to docs/resources/gdml-demo.png diff --git a/doc/resources/muon-monitor.png b/docs/resources/muon-monitor.png similarity index 100% rename from doc/resources/muon-monitor.png rename to docs/resources/muon-monitor.png diff --git a/doc/resources/spatial-showcase-FX.png b/docs/resources/spatial-showcase-FX.png similarity index 100% rename from doc/resources/spatial-showcase-FX.png rename to docs/resources/spatial-showcase-FX.png diff --git a/doc/resources/spatial-showcase.png b/docs/resources/spatial-showcase.png similarity index 100% rename from doc/resources/spatial-showcase.png rename to docs/resources/spatial-showcase.png diff --git a/docs/uml/Vision.puml b/docs/uml/Vision.puml new file mode 100644 index 00000000..2028b097 --- /dev/null +++ b/docs/uml/Vision.puml @@ -0,0 +1,45 @@ +@startuml +'https://plantuml.com/class-diagram + +interface Vision{ + val parent: Vision? + fun getProperty(name): MetaItem? + fun setProperty(name, value) +} + +class VisionBase{ + basic vision + implementation +} +Vision <|-- VisionBase + +interface VisionGroup{ + A group of Visions +} +Vision <|-- VisionGroup + +interface Solid{ + The base for 3D geometry +} + +Vision <|-- Solid + +class SolidGroup + +Solid <|-- SolidGroup +VisionGroup <|-- SolidGroup + +class Composite +Solid <|-- Composite +VisionGroup <|-- Composite + +class Box +Solid <|-- Box + +class Tube +Solid <|-- Tube + +class Sphere +Solid <|-- Sphere + +@enduml \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index da9702f9..28ff446a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/playground/src/jsMain/kotlin/playgroundMain.kt b/playground/src/jsMain/kotlin/playgroundMain.kt index a2a4bd90..b69e8a65 100644 --- a/playground/src/jsMain/kotlin/playgroundMain.kt +++ b/playground/src/jsMain/kotlin/playgroundMain.kt @@ -1,3 +1,4 @@ +//import hep.dataforge.vision.plotly.withPlotly import hep.dataforge.vision.plotly.withPlotly import hep.dataforge.vision.renderVisionsInWindow import hep.dataforge.vision.solid.three.loadThreeJs diff --git a/settings.gradle.kts b/settings.gradle.kts index 36931914..9da6e3f2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,6 @@ pluginManagement { - val kotlinVersion = "1.4.21" - val toolsVersion = "0.7.1" + val kotlinVersion = "1.4.30-RC" + val toolsVersion = "0.7.3-1.4.30-RC" repositories { mavenLocal() diff --git a/ui/react/src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt b/ui/react/src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt index b3b1b25f..14cb4bc1 100644 --- a/ui/react/src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt +++ b/ui/react/src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt @@ -1,8 +1,8 @@ package hep.dataforge.vision.react import hep.dataforge.meta.Meta -import hep.dataforge.meta.NodeItem -import hep.dataforge.meta.ValueItem +import hep.dataforge.meta.MetaItemNode +import hep.dataforge.meta.MetaItemValue import hep.dataforge.meta.descriptors.ItemDescriptor import hep.dataforge.meta.descriptors.NodeDescriptor import hep.dataforge.meta.descriptors.defaultItem @@ -52,7 +52,7 @@ private fun RBuilder.metaViewerItem(props: MetaViewerProps) { } when (actualItem) { - is NodeItem -> { + is MetaItemNode -> { styledDiv { css { +TreeStyles.treeLeaf @@ -109,7 +109,7 @@ private fun RBuilder.metaViewerItem(props: MetaViewerProps) { } } } - is ValueItem -> { + is MetaItemValue -> { styledDiv { css { +TreeStyles.treeLeaf diff --git a/ui/react/src/main/kotlin/hep/dataforge/vision/react/PropertyEditor.kt b/ui/react/src/main/kotlin/hep/dataforge/vision/react/PropertyEditor.kt index 28432ab0..dbee8a29 100644 --- a/ui/react/src/main/kotlin/hep/dataforge/vision/react/PropertyEditor.kt +++ b/ui/react/src/main/kotlin/hep/dataforge/vision/react/PropertyEditor.kt @@ -104,7 +104,7 @@ private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) { update() } - if (actualItem is NodeItem) { + if (actualItem is MetaItemNode) { val keys = buildSet { (descriptorItem as? NodeDescriptor)?.items?.filterNot { it.key.startsWith("@") || it.value.hidden diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Colors.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Colors.kt index 605f398c..c69e69fa 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Colors.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Colors.kt @@ -10,7 +10,7 @@ import kotlin.math.max * Definitions of common colors. Taken from * https://github.com/markaren/three.kt/blob/master/threejs-wrapper/src/main/kotlin/info/laht/threekt/math/ColorConstants.kt */ -@Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING") +@Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING", "unused") public object Colors { const val aliceblue = 0xF0F8FF const val antiquewhite = 0xFAEBD7 @@ -192,7 +192,7 @@ public object Colors { */ fun fromMeta(item: MetaItem): String { return when (item) { - is NodeItem -> { + is MetaItemNode -> { val node = item.node rgbToString( node[RED_KEY].number?.toByte()?.toUByte() ?: 0u, @@ -200,7 +200,7 @@ public object Colors { node[BLUE_KEY].number?.toByte()?.toUByte() ?: 0u ) } - is ValueItem -> { + is MetaItemValue -> { if (item.value.type == ValueType.NUMBER) { rgbToString(item.value.int) } else { diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleSheet.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleSheet.kt index 3662be02..233afde7 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleSheet.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleSheet.kt @@ -40,7 +40,7 @@ public inline class StyleSheet(private val owner: VisionGroup) { * Create and set a style */ public operator fun set(key: String, builder: MetaBuilder.() -> Unit) { - val newStyle = get(key)?.builder()?.apply(builder) ?: Meta(builder) + val newStyle = get(key)?.toMutableMeta()?.apply(builder) ?: Meta(builder) set(key, newStyle.seal()) } diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Vision.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Vision.kt index 503e9485..9aa3d90f 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Vision.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Vision.kt @@ -7,10 +7,10 @@ import hep.dataforge.meta.MutableItemProvider import hep.dataforge.meta.descriptors.Described import hep.dataforge.meta.descriptors.NodeDescriptor import hep.dataforge.meta.descriptors.get +import hep.dataforge.misc.Type import hep.dataforge.names.Name import hep.dataforge.names.asName import hep.dataforge.names.toName -import hep.dataforge.provider.Type import hep.dataforge.vision.Vision.Companion.TYPE import kotlinx.coroutines.* import kotlinx.coroutines.channels.awaitClose diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionBase.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionBase.kt index b3a2fafa..59f31c81 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionBase.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionBase.kt @@ -34,17 +34,6 @@ internal data class PropertyListener( @SerialName("vision") public open class VisionBase(internal var properties: Config? = null) : Vision { -// init { -// //used during deserialization only -// properties?.onChange(this) { name, oldItem, newItem -> -// if (oldItem != newItem) { -// scope.launch { -// notifyPropertyChanged(name) -// } -// } -// } -// } - @Transient override var parent: VisionGroup? = null @@ -54,13 +43,6 @@ public open class VisionBase(internal var properties: Config? = null) : Vision { protected fun getOrCreateConfig(): Config { if (properties == null) { val newProperties = Config() -// newProperties.onChange(this) { name, oldItem, newItem -> -// if (oldItem != newItem) { -// scope.launch { -// notifyPropertyChanged(name) -// } -// } -// } properties = newProperties } return properties!! @@ -146,13 +128,13 @@ public open class VisionBase(internal var properties: Config? = null) : Vision { public fun Vision.updateProperties(at: Name, item: MetaItem) { when (item) { - is ValueItem -> { + is MetaItemValue -> { if (item.value == Null) { setProperty(at, null) } else setProperty(at, item) } - is NodeItem -> item.node.items.forEach { (token, childItem) -> + is MetaItemNode -> item.node.items.forEach { (token, childItem) -> updateProperties(at + token, childItem) } } diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/misc.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/misc.kt index fb070582..b4c3c326 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/misc.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/misc.kt @@ -8,11 +8,11 @@ public annotation class VisionBuilder public fun Sequence.merge(): MetaItem? = when (val first = firstOrNull { it != null }) { null -> null - is ValueItem -> first //fast search for first entry if it is value - is NodeItem -> { + is MetaItemValue -> first //fast search for first entry if it is value + is MetaItemNode -> { //merge nodes if first encountered node is meta val laminate: Laminate = Laminate(mapNotNull { it.node }.toList()) - NodeItem(laminate) + MetaItemNode(laminate) } } diff --git a/visionforge-core/src/jsMain/kotlin/hep/dataforge/vision/client/elementOutput.kt b/visionforge-core/src/jsMain/kotlin/hep/dataforge/vision/client/elementOutput.kt index 22e327a5..bd2e2554 100644 --- a/visionforge-core/src/jsMain/kotlin/hep/dataforge/vision/client/elementOutput.kt +++ b/visionforge-core/src/jsMain/kotlin/hep/dataforge/vision/client/elementOutput.kt @@ -1,7 +1,7 @@ package hep.dataforge.vision.client import hep.dataforge.meta.Meta -import hep.dataforge.provider.Type +import hep.dataforge.misc.Type import hep.dataforge.vision.Vision import org.w3c.dom.Element diff --git a/visionforge-fx/src/main/kotlin/hep/dataforge/vision/editor/FXMeta.kt b/visionforge-fx/src/main/kotlin/hep/dataforge/vision/editor/FXMeta.kt index c7460ff3..150b5bb8 100644 --- a/visionforge-fx/src/main/kotlin/hep/dataforge/vision/editor/FXMeta.kt +++ b/visionforge-fx/src/main/kotlin/hep/dataforge/vision/editor/FXMeta.kt @@ -115,7 +115,7 @@ class FXMetaNode>( val actualItem = node?.items?.get(token) val actualDescriptor = descriptor?.items?.get(token.body) - if (actualItem is NodeItem || actualDescriptor is NodeDescriptor) { + if (actualItem is MetaItemNode || actualDescriptor is NodeDescriptor) { FXMetaNode(token, this@FXMetaNode) } else { FXMetaValue(token, this@FXMetaNode) diff --git a/visionforge-fx/src/main/kotlin/hep/dataforge/vision/editor/ValueChooser.kt b/visionforge-fx/src/main/kotlin/hep/dataforge/vision/editor/ValueChooser.kt index e1049eef..52d2a25e 100644 --- a/visionforge-fx/src/main/kotlin/hep/dataforge/vision/editor/ValueChooser.kt +++ b/visionforge-fx/src/main/kotlin/hep/dataforge/vision/editor/ValueChooser.kt @@ -6,11 +6,11 @@ package hep.dataforge.vision.editor import hep.dataforge.context.Context -import hep.dataforge.context.Named import hep.dataforge.meta.Meta import hep.dataforge.meta.descriptors.ValueDescriptor +import hep.dataforge.misc.Named +import hep.dataforge.misc.Type import hep.dataforge.names.toName -import hep.dataforge.provider.Type import hep.dataforge.provider.provideByType import hep.dataforge.values.Null import hep.dataforge.values.Value @@ -105,7 +105,7 @@ public interface ValueChooser { context: Context, value: ObservableValue, descriptor: ValueDescriptor? = null, - setter: (Value) -> Unit + setter: (Value) -> Unit, ): ValueChooser { val chooser = build(context, descriptor) chooser.setDisplayValue(value.value ?: Null) diff --git a/visionforge-fx/src/main/kotlin/hep/dataforge/vision/solid/FX3DPlugin.kt b/visionforge-fx/src/main/kotlin/hep/dataforge/vision/solid/FX3DPlugin.kt index 35cd6806..3cf8dec4 100644 --- a/visionforge-fx/src/main/kotlin/hep/dataforge/vision/solid/FX3DPlugin.kt +++ b/visionforge-fx/src/main/kotlin/hep/dataforge/vision/solid/FX3DPlugin.kt @@ -3,7 +3,7 @@ package hep.dataforge.vision.solid import hep.dataforge.context.* import hep.dataforge.meta.Meta import hep.dataforge.meta.boolean -import hep.dataforge.provider.Type +import hep.dataforge.misc.Type import hep.dataforge.vision.solid.FX3DFactory.Companion.TYPE import hep.dataforge.vision.solid.SolidMaterial.Companion.MATERIAL_KEY import hep.dataforge.vision.solid.SolidMaterial.Companion.MATERIAL_WIREFRAME_KEY diff --git a/visionforge-fx/src/main/kotlin/hep/dataforge/vision/solid/FXMaterials.kt b/visionforge-fx/src/main/kotlin/hep/dataforge/vision/solid/FXMaterials.kt index 9e417438..3f384f63 100644 --- a/visionforge-fx/src/main/kotlin/hep/dataforge/vision/solid/FXMaterials.kt +++ b/visionforge-fx/src/main/kotlin/hep/dataforge/vision/solid/FXMaterials.kt @@ -34,7 +34,7 @@ public object FXMaterials { */ public fun MetaItem.color(opacity: Double = 1.0): Color { return when (this) { - is ValueItem -> if (this.value.type == ValueType.NUMBER) { + is MetaItemValue -> if (this.value.type == ValueType.NUMBER) { val int = value.int val red = int and 0x00ff0000 shr 16 val green = int and 0x0000ff00 shr 8 @@ -43,7 +43,7 @@ public fun MetaItem.color(opacity: Double = 1.0): Color { } else { Color.web(this.value.string) } - is NodeItem -> { + is MetaItemNode -> { Color.rgb( node[Colors.RED_KEY]?.int ?: 0, node[Colors.GREEN_KEY]?.int ?: 0, @@ -60,8 +60,8 @@ public fun MetaItem.color(opacity: Double = 1.0): Color { public fun MetaItem?.material(): Material { return when (this) { null -> FXMaterials.GREY - is ValueItem -> PhongMaterial(color()) - is NodeItem -> PhongMaterial().apply { + is MetaItemValue -> PhongMaterial(color()) + is MetaItemNode -> PhongMaterial().apply { val opacity = node[SolidMaterial.OPACITY_KEY].double ?: 1.0 diffuseColor = node[SolidMaterial.COLOR_KEY]?.color(opacity) ?: Color.DARKGREY specularColor = node[SolidMaterial.SPECULAR_COLOR_KEY]?.color(opacity) ?: Color.WHITE diff --git a/visionforge-solid/src/commonTest/kotlin/hep/dataforge/vision/solid/ConvexTest.kt b/visionforge-solid/src/commonTest/kotlin/hep/dataforge/vision/solid/ConvexTest.kt index 912e3b5a..e2496d9a 100644 --- a/visionforge-solid/src/commonTest/kotlin/hep/dataforge/vision/solid/ConvexTest.kt +++ b/visionforge-solid/src/commonTest/kotlin/hep/dataforge/vision/solid/ConvexTest.kt @@ -28,7 +28,7 @@ class ConvexTest { val json = SolidManager.jsonForSolids.encodeToJsonElement(Convex.serializer(), convex) val meta = json.toMetaItem().node!! - val points = meta.getIndexed("points").values.map { (it as NodeItem<*>).node.point3D() } + val points = meta.getIndexed("points").values.map { (it as MetaItemNode<*>).node.point3D() } assertEquals(8, points.count()) assertEquals(8, convex.points.size) diff --git a/visionforge-threejs/build.gradle.kts b/visionforge-threejs/build.gradle.kts index d692c548..c893e845 100644 --- a/visionforge-threejs/build.gradle.kts +++ b/visionforge-threejs/build.gradle.kts @@ -14,6 +14,6 @@ kotlin{ dependencies { api(project(":visionforge-solid")) - implementation(npm("three", "0.122.0")) - implementation(npm("three-csg-ts", "2.0.0")) + implementation(npm("three", "0.124.0")) + implementation(npm("three-csg-ts", "2.2.0")) } diff --git a/visionforge-threejs/src/main/kotlin/hep/dataforge/vision/solid/three/ThreeFactory.kt b/visionforge-threejs/src/main/kotlin/hep/dataforge/vision/solid/three/ThreeFactory.kt index 9113dbc8..41cccd43 100644 --- a/visionforge-threejs/src/main/kotlin/hep/dataforge/vision/solid/three/ThreeFactory.kt +++ b/visionforge-threejs/src/main/kotlin/hep/dataforge/vision/solid/three/ThreeFactory.kt @@ -1,8 +1,8 @@ package hep.dataforge.vision.solid.three +import hep.dataforge.misc.Type import hep.dataforge.names.Name import hep.dataforge.names.startsWith -import hep.dataforge.provider.Type import hep.dataforge.vision.Vision import hep.dataforge.vision.solid.* import hep.dataforge.vision.solid.SolidMaterial.Companion.MATERIAL_KEY diff --git a/visionforge-threejs/src/main/kotlin/hep/dataforge/vision/solid/three/ThreeMaterials.kt b/visionforge-threejs/src/main/kotlin/hep/dataforge/vision/solid/three/ThreeMaterials.kt index 218533c6..e3905a21 100644 --- a/visionforge-threejs/src/main/kotlin/hep/dataforge/vision/solid/three/ThreeMaterials.kt +++ b/visionforge-threejs/src/main/kotlin/hep/dataforge/vision/solid/three/ThreeMaterials.kt @@ -95,13 +95,13 @@ public object ThreeMaterials { */ public fun MetaItem.getColor(): Color { return when (this) { - is ValueItem -> if (this.value.type == ValueType.NUMBER) { + is MetaItemValue -> if (this.value.type == ValueType.NUMBER) { val int = value.int Color(int) } else { Color(this.value.string) } - is NodeItem -> { + is MetaItemNode -> { Color( node[Colors.RED_KEY]?.int ?: 0, node[Colors.GREEN_KEY]?.int ?: 0,