From 1da4381a4c1f564d0c1354749919dfd6ebedf225 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Feb 2021 14:49:15 +0300 Subject: [PATCH] Documentation and refactoring --- build.gradle.kts | 6 +- .../dataforge/vision/gdml/demo/readFile.kt | 2 +- demo/muon-monitor/build.gradle.kts | 2 +- .../mipt/npm/muon/monitor/server/MMServer.kt | 7 +- demo/sat-demo/build.gradle.kts | 6 +- .../README.md | 0 .../build.gradle.kts | 5 +- .../hep/dataforge/vision/solid/demo/demo.kt | 0 .../vision/solid/demo/ThreeDemoApp.kt | 0 .../vision/solid/demo/ThreeDemoGrid.kt | 0 .../vision/solid/demo/VariableBox.kt | 3 - .../src/jsMain/resources/index.html | 0 .../src/jsMain/resources/styles.css | 0 .../dataforge/vision/solid/demo/FXDemoApp.kt | 22 ++++++ .../dataforge/vision/solid/demo/FXDemoGrid.kt | 0 .../vision/solid/demo/MetaEditorDemo.kt | 0 .../dataforge/vision/solid/demo/FXDemoApp.kt | 35 --------- docs/appendix.md | 4 +- docs/design.md | 4 + docs/features.md | 5 ++ docs/solids.md | 77 +++++++++++++++++++ docs/uml/prototypes.puml | 14 ++++ playground/src/jvmMain/kotlin/plotlyVision.kt | 4 +- .../src/jvmMain/kotlin/randomSpheres.kt | 2 +- .../src/jvmMain/kotlin/serverExtensions.kt | 2 +- playground/src/jvmMain/kotlin/simpleCube.kt | 2 +- settings.gradle.kts | 12 +-- .../hep/dataforge/vision/StyleReference.kt | 2 +- .../kotlin/hep/dataforge/vision/VisionBase.kt | 1 + .../hep/dataforge/vision/VisionChange.kt | 3 +- .../vision/html/HtmlVisionFragment.kt | 2 +- .../vision/html/VisionTagConsumer.kt | 8 +- .../hep/dataforge/vision/html/HtmlTagTest.kt | 2 +- .../hep/dataforge/vision/html/headers.kt | 2 +- .../hep/dataforge/vision/html/htmlExport.kt | 2 +- visionforge-fx/build.gradle.kts | 1 - visionforge-gdml/build.gradle.kts | 2 +- .../dataforge/vision/gdml/GDMLTransformer.kt | 9 ++- .../dataforge/vision/gdml/GdmlOptimizer.kt | 2 +- visionforge-plotly/build.gradle.kts | 6 +- .../dataforge/vision/plotly/VisionOfPlotly.kt | 2 +- .../dataforge/vision/plotly/plotlyHeaders.kt | 2 +- .../vision/three/server/VisionServer.kt | 1 + visionforge-solid/build.gradle.kts | 2 +- .../kotlin/hep/dataforge/vision/solid/Box.kt | 39 +++++----- .../hep/dataforge/vision/solid/SolidGroup.kt | 3 +- .../dataforge/vision/solid/SolidManager.kt | 2 +- .../dataforge/vision/solid/SolidReference.kt | 10 ++- .../solid/transform/RemoveSingleChild.kt | 2 +- .../dataforge/vision/solid/transform/UnRef.kt | 6 +- .../hep/dataforge/vision/solid/ConvexTest.kt | 7 +- .../dataforge/vision/solid/SolidPluginTest.kt | 2 +- visionforge-threejs/build.gradle.kts | 4 - .../build.gradle.kts | 7 -- .../vision/three/server/serverExtensions.kt | 2 +- 55 files changed, 221 insertions(+), 126 deletions(-) rename demo/{spatial-showcase => solid-showcase}/README.md (100%) rename demo/{spatial-showcase => solid-showcase}/build.gradle.kts (86%) rename demo/{spatial-showcase => solid-showcase}/src/commonMain/kotlin/hep/dataforge/vision/solid/demo/demo.kt (100%) rename demo/{spatial-showcase => solid-showcase}/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoApp.kt (100%) rename demo/{spatial-showcase => solid-showcase}/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoGrid.kt (100%) rename demo/{spatial-showcase => solid-showcase}/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/VariableBox.kt (96%) rename demo/{spatial-showcase => solid-showcase}/src/jsMain/resources/index.html (100%) rename demo/{spatial-showcase => solid-showcase}/src/jsMain/resources/styles.css (100%) create mode 100644 demo/solid-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoApp.kt rename demo/{spatial-showcase => solid-showcase}/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoGrid.kt (100%) rename demo/{spatial-showcase => solid-showcase}/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/MetaEditorDemo.kt (100%) delete mode 100644 demo/spatial-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoApp.kt create mode 100644 docs/features.md create mode 100644 docs/solids.md create mode 100644 docs/uml/prototypes.puml diff --git a/build.gradle.kts b/build.gradle.kts index 1b60596b..3b6598a3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,16 +2,16 @@ plugins { id("ru.mipt.npm.project") } -val dataforgeVersion by extra("0.3.0-dev-1") -val ktorVersion by extra("1.5.0") +val dataforgeVersion by extra("0.3.0") +val ktorVersion by extra("1.5.1") val htmlVersion by extra("0.7.2") val kotlinWrappersVersion by extra("pre.129-kotlin-1.4.20") val fxVersion by extra("14") - allprojects { repositories { mavenLocal() + jcenter() maven("https://dl.bintray.com/pdvrieze/maven") maven("http://maven.jzy3d.org/releases") } diff --git a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/readFile.kt b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/readFile.kt index bcf18e51..0a8876b2 100644 --- a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/readFile.kt +++ b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/readFile.kt @@ -1,6 +1,6 @@ package hep.dataforge.vision.gdml.demo -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.values.asValue import hep.dataforge.vision.gdml.readFile import hep.dataforge.vision.gdml.toVision diff --git a/demo/muon-monitor/build.gradle.kts b/demo/muon-monitor/build.gradle.kts index 57727447..7665ce21 100644 --- a/demo/muon-monitor/build.gradle.kts +++ b/demo/muon-monitor/build.gradle.kts @@ -10,7 +10,7 @@ group = "ru.mipt.npm" val ktorVersion: String by rootProject.extra kscience { - useSerialization() +// useSerialization() application() } diff --git a/demo/muon-monitor/src/jvmMain/kotlin/ru/mipt/npm/muon/monitor/server/MMServer.kt b/demo/muon-monitor/src/jvmMain/kotlin/ru/mipt/npm/muon/monitor/server/MMServer.kt index a4c6354a..ada656cc 100644 --- a/demo/muon-monitor/src/jvmMain/kotlin/ru/mipt/npm/muon/monitor/server/MMServer.kt +++ b/demo/muon-monitor/src/jvmMain/kotlin/ru/mipt/npm/muon/monitor/server/MMServer.kt @@ -3,7 +3,7 @@ package ru.mipt.npm.muon.monitor.server import hep.dataforge.context.Context import hep.dataforge.context.Global -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.solid.SolidManager import io.ktor.application.Application import io.ktor.application.call @@ -13,25 +13,24 @@ import io.ktor.features.CallLogging import io.ktor.features.ContentNegotiation import io.ktor.features.DefaultHeaders import io.ktor.http.ContentType +import io.ktor.http.HttpStatusCode import io.ktor.http.content.resources import io.ktor.http.content.static import io.ktor.response.respond +import io.ktor.response.respondText import io.ktor.routing.Routing import io.ktor.routing.get import io.ktor.serialization.json import io.ktor.server.cio.CIO import io.ktor.server.engine.embeddedServer import io.ktor.util.KtorExperimentalAPI -import kotlinx.serialization.json.Json import org.apache.commons.math3.random.JDKRandomGenerator import ru.mipt.npm.muon.monitor.Model import ru.mipt.npm.muon.monitor.sim.Cos2TrackGenerator import ru.mipt.npm.muon.monitor.sim.simulateOne -import io.ktor.response.respondText import java.awt.Desktop import java.io.File import java.net.URI -import io.ktor.http.HttpStatusCode private val generator = Cos2TrackGenerator(JDKRandomGenerator(223)) diff --git a/demo/sat-demo/build.gradle.kts b/demo/sat-demo/build.gradle.kts index 048ebd84..16e5d24e 100644 --- a/demo/sat-demo/build.gradle.kts +++ b/demo/sat-demo/build.gradle.kts @@ -5,9 +5,9 @@ plugins { kscience { - useSerialization { - json() - } +// useSerialization { +// json() +// } application() } diff --git a/demo/spatial-showcase/README.md b/demo/solid-showcase/README.md similarity index 100% rename from demo/spatial-showcase/README.md rename to demo/solid-showcase/README.md diff --git a/demo/spatial-showcase/build.gradle.kts b/demo/solid-showcase/build.gradle.kts similarity index 86% rename from demo/spatial-showcase/build.gradle.kts rename to demo/solid-showcase/build.gradle.kts index e3b4d0f4..ff6e017c 100644 --- a/demo/spatial-showcase/build.gradle.kts +++ b/demo/solid-showcase/build.gradle.kts @@ -13,6 +13,8 @@ kscience { application() } +val kotlinWrappersVersion: String by rootProject.extra + kotlin { jvm { @@ -25,7 +27,7 @@ kotlin { commonMain { dependencies { implementation(project(":visionforge-solid")) - implementation(project(":visionforge-gdml")) +// implementation(project(":visionforge-gdml")) } } jvmMain{ @@ -36,7 +38,6 @@ kotlin { jsMain{ dependencies { implementation(project(":visionforge-threejs")) - implementation("org.jetbrains:kotlin-css:1.0.0-pre.129-kotlin-1.4.10") } } } diff --git a/demo/spatial-showcase/src/commonMain/kotlin/hep/dataforge/vision/solid/demo/demo.kt b/demo/solid-showcase/src/commonMain/kotlin/hep/dataforge/vision/solid/demo/demo.kt similarity index 100% rename from demo/spatial-showcase/src/commonMain/kotlin/hep/dataforge/vision/solid/demo/demo.kt rename to demo/solid-showcase/src/commonMain/kotlin/hep/dataforge/vision/solid/demo/demo.kt diff --git a/demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoApp.kt b/demo/solid-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoApp.kt similarity index 100% rename from demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoApp.kt rename to demo/solid-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoApp.kt diff --git a/demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoGrid.kt b/demo/solid-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoGrid.kt similarity index 100% rename from demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoGrid.kt rename to demo/solid-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/ThreeDemoGrid.kt diff --git a/demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/VariableBox.kt b/demo/solid-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/VariableBox.kt similarity index 96% rename from demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/VariableBox.kt rename to demo/solid-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/VariableBox.kt index e90cc845..f9ed1443 100644 --- a/demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/VariableBox.kt +++ b/demo/solid-showcase/src/jsMain/kotlin/hep/dataforge/vision/solid/demo/VariableBox.kt @@ -4,10 +4,7 @@ import hep.dataforge.meta.* import hep.dataforge.names.plus import hep.dataforge.names.startsWith import hep.dataforge.values.asValue -import hep.dataforge.vision.getProperty import hep.dataforge.vision.onPropertyChange -import hep.dataforge.vision.set -import hep.dataforge.vision.setProperty import hep.dataforge.vision.solid.* import hep.dataforge.vision.solid.Solid.Companion.GEOMETRY_KEY import hep.dataforge.vision.solid.three.* diff --git a/demo/spatial-showcase/src/jsMain/resources/index.html b/demo/solid-showcase/src/jsMain/resources/index.html similarity index 100% rename from demo/spatial-showcase/src/jsMain/resources/index.html rename to demo/solid-showcase/src/jsMain/resources/index.html diff --git a/demo/spatial-showcase/src/jsMain/resources/styles.css b/demo/solid-showcase/src/jsMain/resources/styles.css similarity index 100% rename from demo/spatial-showcase/src/jsMain/resources/styles.css rename to demo/solid-showcase/src/jsMain/resources/styles.css diff --git a/demo/solid-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoApp.kt b/demo/solid-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoApp.kt new file mode 100644 index 00000000..0491941c --- /dev/null +++ b/demo/solid-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoApp.kt @@ -0,0 +1,22 @@ +package hep.dataforge.vision.solid.demo + +import javafx.stage.Stage +import tornadofx.* + +class FXDemoApp : App(FXDemoGrid::class) { + + val view: FXDemoGrid by inject() + + override fun start(stage: Stage) { + super.start(stage) + + stage.width = 600.0 + stage.height = 600.0 + + view.showcase() + } +} + +fun main() { + launch() +} \ No newline at end of file diff --git a/demo/spatial-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoGrid.kt b/demo/solid-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoGrid.kt similarity index 100% rename from demo/spatial-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoGrid.kt rename to demo/solid-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoGrid.kt diff --git a/demo/spatial-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/MetaEditorDemo.kt b/demo/solid-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/MetaEditorDemo.kt similarity index 100% rename from demo/spatial-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/MetaEditorDemo.kt rename to demo/solid-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/MetaEditorDemo.kt diff --git a/demo/spatial-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoApp.kt b/demo/spatial-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoApp.kt deleted file mode 100644 index 5b337ad9..00000000 --- a/demo/spatial-showcase/src/jvmMain/kotlin/hep/dataforge/vision/solid/demo/FXDemoApp.kt +++ /dev/null @@ -1,35 +0,0 @@ -package hep.dataforge.vision.solid.demo - -import hep.dataforge.vision.gdml.gdml -import javafx.stage.Stage -import tornadofx.* -import java.nio.file.NoSuchFileException -import java.nio.file.Paths - -class FXDemoApp : App(FXDemoGrid::class) { - - val view: FXDemoGrid by inject() - - override fun start(stage: Stage) { - super.start(stage) - - stage.width = 600.0 - stage.height = 600.0 - - view.showcase() - try { - view.demo("gdml", "gdml-cubes") { - gdml(Paths.get("D:\\Work\\Projects\\gdml.kt\\gdml-source\\cubes.gdml")) - //setProperty(Material3D.MATERIAL_WIREFRAME_KEY, true) - } - } - catch (e: NoSuchFileException) { - println("GDML demo: Please specify the correct file path e.g. " + - "visionforge\\demo\\gdml\\src\\commonMain\\resources\\cubes.gdml") - } - } -} - -fun main() { - launch() -} \ No newline at end of file diff --git a/docs/appendix.md b/docs/appendix.md index 7d928911..b42b2c13 100644 --- a/docs/appendix.md +++ b/docs/appendix.md @@ -2,4 +2,6 @@ ### DataForge Name -### DataForge Meta \ No newline at end of file +### DataForge Meta + +### DataForge Context \ No newline at end of file diff --git a/docs/design.md b/docs/design.md index 36764d30..ca84e64f 100644 --- a/docs/design.md +++ b/docs/design.md @@ -11,3 +11,7 @@ When the user or a part of inner program mechanics requests a property, it searc ### Styling The actual layering scheme is more complicated. All objects support styling. The styles are named `Meta` nodes that could be used to define groups of properties together and use in different `Vision`s. The styles are defined as named `Meta` nodes in a `VisionGroup` `@stylesheet` property (DataForge states that names starting with `@` are reserved for system properties, not visible by default to the user). The style or a list of styles could be applied to a `Vision` by setting the reserved `@style` property to the name of the style being used or by using `Vision::style` extension property. The style name is then resolved to the nearest ancestor that defines it. The key difference from the CSS styling in HTML is that the stylesheets could be added to any node, not only to the hierarchy root. It allows to decouple the whole subtrees together with styles from the main `Vision` graph, or create stand-alone branches. One must note, that the same style could be defined on different levels of the tree, only the nearest ancestor is resolved, meaning that one can override styles for a sub-tree. + +### Intermediate representation + +### Kotlin DSL for creating vision-graphs \ No newline at end of file diff --git a/docs/features.md b/docs/features.md new file mode 100644 index 00000000..2a426e07 --- /dev/null +++ b/docs/features.md @@ -0,0 +1,5 @@ +## Features + +### Customization and plugins + +### Full-stack development \ No newline at end of file diff --git a/docs/solids.md b/docs/solids.md new file mode 100644 index 00000000..a5d9441c --- /dev/null +++ b/docs/solids.md @@ -0,0 +1,77 @@ +## Solids + +The primary initial goal of creating the library was to provide a flexible API and rendering engine to draw solid geometric forms for so-called event display task in particle physics. Event display is used to provide visualization for particle hit events in both accelerator and non-accelerator experiments (see [add links here] for examples). The event display system must have a way to render basic 3D shapes like boxes, tubes and spheres and particle tracks. An additional requirement is to be able to change coloring and transparency of different elements as well as custom attributes specific to the problem. + +The `Solid` class inherits the `Vision` and has three additional nullable real vector properties: `position`, `rotation` and `scale`. Those properties are placed on the top level of the class instead of `properties` tree for performance optimization purposes. The `position` and `rotation` properties reflect the position offset in absolute units and rotation in radians relative to the parent and have defaults of `0.0`. Relativity means that if the parent `Vision` (`SolidGroup`) has `position = (1.0, 0.0, 1.0)` and a child has `position = (0.0, 2.0, 0.0)`, then the real offset of rendered object will be `(1.0, 2.0, 1.0)`. The same goes for the rotation. By default, the rotation uses intrinsic Cordan (Tait–Bryan) angles with `XYZ` order, but order could be changed with an inherited property `rotation.order`. The `scale` property is not inherited and represents local `Solid` scaling factor with default value of `1.0`. + +The `SolidGroup` represents the specific kind of `VisionGroup` that has properties of a `Solid` and has one additional special property: the prototype container. + +### Solid prototypes + +One of the important requirements for event display system is the ability to render a huge number of primitives (tens and hundreds of thousands). This is especially important for accelerator experiments with fine-grained calorimeter detectors ([ref here]). The most memory and CPU-consuming task to render such structures is computing the geometry o equal elements (like calorimeter cells). In order to optimize rendering and model representation for such cases, we introduced so-called prototypes. The idea is that multiple visions could have the same prototype and share the definition and actual rendered geometry. The prototypes are stored in a special container property called `prototypes` in a `SolidGroup` object. In order to access those prototypes there is a special `Solid` object called `SolidReference`. It inherits `Solid` (has properties container, position, rotation and scale), but does not define any geometry. Instead, it has a single `refName` property which stores a fully qualified DataForge `Name` (see [Appendix](appendix.md)) that designates the name of the prototype to be used. During rendering phase, the system searches for appropriate prototype in the nearest parent. If the prototype is not found, the search continues in the next parent in the chain. Like property resolution, the prototype resolution is fine-grained and local, meaning that a part of `Vision` graph could be self-contained together with prototypes. + +An important point is that prototypes are resolved in a parent vision container, and the parent vision container for prototypes is the vision group. It means that prototype itself could reference a prototype, or even in corner cases reference itself (such cases should be checked for infinite loops). The prototype relation example is shown in [prototypes.uml](uml/prototypes.puml). Here `Prototype Ref` vision references the `Prototype` vision by first seeking up to `VirionGroup`, the resolving the prototype with appropriate name. In theory, vision groups inside prototypes groups could contain the prototypes of their own, but such constructs should be used with care. + +### Solid definitions + +Solid models are defined as kotlin classes that also serve as builders for DSL and serialization models. For example, here is the definition for a `Box` class: + +```kotlin +@Serializable +@SerialName("solid.box") +class Box( + val xSize: Float, + val ySize: Float, + val zSize: Float +) : SolidBase(), GeometrySolid +``` + +In general, one does not define how specific solid is rendered, it is done in the rendering back-end. It means that in general, there should be a specific renderer defined for each type of solids defined in the model. Some solids have additional mechanism to avoid providing renderers for each primitive. Classes that inherit `GeometrySolid` interface provide a way to define geometry via polygons like this: + +```kotlin + override fun toGeometry(geometryBuilder: GeometryBuilder) { + val dx = xSize / 2 + val dy = ySize / 2 + val dz = zSize / 2 + val node1 = Point3D(-dx, -dy, -dz) + val node2 = Point3D(dx, -dy, -dz) + val node3 = Point3D(dx, dy, -dz) + val node4 = Point3D(-dx, dy, -dz) + val node5 = Point3D(-dx, -dy, dz) + val node6 = Point3D(dx, -dy, dz) + val node7 = Point3D(dx, dy, dz) + val node8 = Point3D(-dx, dy, dz) + geometryBuilder.face4(node1, node4, node3, node2) + geometryBuilder.face4(node1, node2, node6, node5) + geometryBuilder.face4(node2, node3, node7, node6) + geometryBuilder.face4(node4, node8, node7, node3) + geometryBuilder.face4(node1, node5, node8, node4) + geometryBuilder.face4(node8, node5, node6, node7) + } +``` + +The `GeometryBuilder` instance is provided by the specific rendering engine, so the polygons are generated for target engine without intermediate steps. If the renderer provides its own implementation for a solid renderer, it takes precedence over generic `GeometrySolid` definition. + +An important basic solid is the `Composite`. It is a primitive, that allows combine two (maybe more in future) primitives via [composite solid geometry or CSG](https://en.wikipedia.org/wiki/Constructive_solid_geometry) transformations (union, difference and subtraction). At this moment, the actual transformation is done on the renderer side. + +### GDML bindings + +VisionForge supports extensible geometry primitive list, but we've started with primitives needed to render BM@N ([ref]) GDML ([ref]) geometry. GDML files are read with [gdml.kt](https://github.com/mipt-npm/gdml.kt) package designed specifically for this purpose. The package uses [https://github.com/pdvrieze/xmlutil](https://github.com/pdvrieze/xmlutil) serialization plugin to parse GDML structure into the convenient object structure and has language definitions for all GDML primitives. The `visionforge-gdml` module contains a converter that transforms Gdml.kt structures into `Solid`. + +The GDML file definition contains several sections: + +* **defines** - Dimensions and numbers for geometries. +* **materials** - Material definitions. +* **solids** - Primitive definitions and their composition. +* **structure** - Combinations of solids and groups used in geometry. +* **setup** - Metadata and geometry entry point. + +GDML materials are currently used only for Solid coloring. The data from material is stored in the `Vision` properties. Solids section and structures are transformed into top level group prototypes, which allows not only to create a compact representation, but also optimize rendering. The gdml structure is not always flexible. For example, it is not possible to add a solid directly into a group, but instead one needs to add a group with a single element. Problems like this could be automatically optimized by the convertor. + +Not all GDML solids are currently supported by the converter, they could be added later on-demand. Current support covers all solids used in BM@N geometry. + +### ThreeJs renderer + +VisionForge is not tied to any single renderer. Right now the primary target is the Browser rendering with [Three.js library](https://threejs.org/). The Three.js supports different renderers including WebGL with hardware support and virtual reality. + +The bindings for three-js was implemented in kotlin-js based on a [work by Lars Ivar Hatledal](https://github.com/markaren/three-kt-wrapper). The wrapper allows seamless integration with a lot of different library APIs incliding custom cameras and CSG. \ No newline at end of file diff --git a/docs/uml/prototypes.puml b/docs/uml/prototypes.puml new file mode 100644 index 00000000..784a8fc5 --- /dev/null +++ b/docs/uml/prototypes.puml @@ -0,0 +1,14 @@ +@startuml +package "VisionGroup" { + package "Prototypes"{ + [Prototype] + package "Prototype group"{ + [Prototype Ref] --> [Prototype] + } + } + + package "Child group"{ + [Ref] --> [Prototype Ref] + } +} +@enduml \ No newline at end of file diff --git a/playground/src/jvmMain/kotlin/plotlyVision.kt b/playground/src/jvmMain/kotlin/plotlyVision.kt index ea4be39b..9ce31eec 100644 --- a/playground/src/jvmMain/kotlin/plotlyVision.kt +++ b/playground/src/jvmMain/kotlin/plotlyVision.kt @@ -1,11 +1,13 @@ package hep.dataforge.vision.examples -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.VisionForge import hep.dataforge.vision.VisionManager import hep.dataforge.vision.html.fragment import hep.dataforge.vision.plotly.plotly import hep.dataforge.vision.plotly.withPlotly +import kotlinx.html.hr +import kotlinx.html.p import kscience.plotly.scatter @DFExperimental diff --git a/playground/src/jvmMain/kotlin/randomSpheres.kt b/playground/src/jvmMain/kotlin/randomSpheres.kt index 96431234..3e971e24 100644 --- a/playground/src/jvmMain/kotlin/randomSpheres.kt +++ b/playground/src/jvmMain/kotlin/randomSpheres.kt @@ -1,6 +1,6 @@ package hep.dataforge.vision.examples -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.VisionForge import hep.dataforge.vision.VisionManager import hep.dataforge.vision.html.ResourceLocation diff --git a/playground/src/jvmMain/kotlin/serverExtensions.kt b/playground/src/jvmMain/kotlin/serverExtensions.kt index 51aa23af..7e107f0e 100644 --- a/playground/src/jvmMain/kotlin/serverExtensions.kt +++ b/playground/src/jvmMain/kotlin/serverExtensions.kt @@ -1,7 +1,7 @@ package hep.dataforge.vision.examples import hep.dataforge.context.Context -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.html.HtmlVisionFragment import hep.dataforge.vision.html.ResourceLocation import hep.dataforge.vision.html.scriptHeader diff --git a/playground/src/jvmMain/kotlin/simpleCube.kt b/playground/src/jvmMain/kotlin/simpleCube.kt index fbcb66e1..9b43ff90 100644 --- a/playground/src/jvmMain/kotlin/simpleCube.kt +++ b/playground/src/jvmMain/kotlin/simpleCube.kt @@ -1,6 +1,6 @@ package hep.dataforge.vision.examples -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.VisionForge import hep.dataforge.vision.VisionManager import hep.dataforge.vision.html.ResourceLocation diff --git a/settings.gradle.kts b/settings.gradle.kts index 9da6e3f2..007af867 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,6 @@ pluginManagement { - val kotlinVersion = "1.4.30-RC" - val toolsVersion = "0.7.3-1.4.30-RC" + val kotlinVersion = "1.4.30" + val toolsVersion = "0.7.6" repositories { mavenLocal() @@ -44,9 +44,9 @@ include( ":visionforge-gdml", ":visionforge-server", ":visionforge-plotly", - ":demo:spatial-showcase", - ":demo:gdml", + ":demo:solid-showcase", +// ":demo:gdml", ":demo:muon-monitor", - ":demo:sat-demo", - ":playground" + ":demo:sat-demo" +// ":playground" ) diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleReference.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleReference.kt index ac8da104..045f7879 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleReference.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleReference.kt @@ -1,8 +1,8 @@ package hep.dataforge.vision -import hep.dataforge.meta.DFExperimental import hep.dataforge.meta.Meta import hep.dataforge.meta.MetaBuilder +import hep.dataforge.misc.DFExperimental import kotlin.properties.ReadOnlyProperty /** 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 5dd8bf37..f083e2c1 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionBase.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionBase.kt @@ -4,6 +4,7 @@ import hep.dataforge.meta.* import hep.dataforge.meta.descriptors.NodeDescriptor import hep.dataforge.meta.descriptors.defaultItem import hep.dataforge.meta.descriptors.get +import hep.dataforge.misc.DFExperimental import hep.dataforge.names.Name import hep.dataforge.names.asName import hep.dataforge.names.plus diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionChange.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionChange.kt index b94e7984..08d44311 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionChange.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/VisionChange.kt @@ -1,6 +1,7 @@ package hep.dataforge.vision import hep.dataforge.meta.* +import hep.dataforge.misc.DFExperimental import hep.dataforge.names.Name import hep.dataforge.names.plus import hep.dataforge.values.Null @@ -9,7 +10,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach -import kotlinx.serialization.* +import kotlinx.serialization.Serializable import kotlin.jvm.Synchronized import kotlin.time.Duration diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/html/HtmlVisionFragment.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/html/HtmlVisionFragment.kt index bdea12b4..debfe28e 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/html/HtmlVisionFragment.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/html/HtmlVisionFragment.kt @@ -1,6 +1,6 @@ package hep.dataforge.vision.html -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.VisionManager import kotlinx.html.FlowContent import kotlinx.html.TagConsumer diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/html/VisionTagConsumer.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/html/VisionTagConsumer.kt index 84d73269..0a536c90 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/html/VisionTagConsumer.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/html/VisionTagConsumer.kt @@ -1,11 +1,17 @@ package hep.dataforge.vision.html -import hep.dataforge.meta.* +import hep.dataforge.meta.Meta +import hep.dataforge.meta.MetaBuilder +import hep.dataforge.meta.MetaSerializer +import hep.dataforge.meta.isEmpty +import hep.dataforge.misc.DFExperimental import hep.dataforge.names.Name import hep.dataforge.names.toName import hep.dataforge.vision.Vision import hep.dataforge.vision.VisionManager import kotlinx.html.* +import kotlin.collections.set +import kotlin.collections.setOf /** diff --git a/visionforge-core/src/commonTest/kotlin/hep/dataforge/vision/html/HtmlTagTest.kt b/visionforge-core/src/commonTest/kotlin/hep/dataforge/vision/html/HtmlTagTest.kt index a5e08500..7d558b45 100644 --- a/visionforge-core/src/commonTest/kotlin/hep/dataforge/vision/html/HtmlTagTest.kt +++ b/visionforge-core/src/commonTest/kotlin/hep/dataforge/vision/html/HtmlTagTest.kt @@ -1,7 +1,7 @@ package hep.dataforge.vision.html -import hep.dataforge.meta.DFExperimental import hep.dataforge.meta.set +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.VisionBase import hep.dataforge.vision.configure import hep.dataforge.vision.meta diff --git a/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/html/headers.kt b/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/html/headers.kt index 4c458b58..45fde55a 100644 --- a/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/html/headers.kt +++ b/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/html/headers.kt @@ -1,6 +1,6 @@ package hep.dataforge.vision.html -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.VisionManager import kotlinx.html.link import kotlinx.html.script diff --git a/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/html/htmlExport.kt b/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/html/htmlExport.kt index 337ecefc..e18c65c3 100644 --- a/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/html/htmlExport.kt +++ b/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/html/htmlExport.kt @@ -1,7 +1,7 @@ package hep.dataforge.vision import hep.dataforge.context.Context -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.html.HtmlFragment import hep.dataforge.vision.html.HtmlVisionFragment import hep.dataforge.vision.html.Page diff --git a/visionforge-fx/build.gradle.kts b/visionforge-fx/build.gradle.kts index 4cc5286d..43a2d0ad 100644 --- a/visionforge-fx/build.gradle.kts +++ b/visionforge-fx/build.gradle.kts @@ -9,7 +9,6 @@ val fxVersion: String by rootProject.extra kscience{ useFx(ru.mipt.npm.gradle.FXModule.CONTROLS, version = fxVersion) - useSerialization() } dependencies { diff --git a/visionforge-gdml/build.gradle.kts b/visionforge-gdml/build.gradle.kts index d6456b16..59f0f524 100644 --- a/visionforge-gdml/build.gradle.kts +++ b/visionforge-gdml/build.gradle.kts @@ -7,7 +7,7 @@ kotlin { val commonMain by getting { dependencies { api(project(":visionforge-solid")) - api("kscience.gdml:gdml:0.2.0-dev-3") + api("kscience.gdml:gdml:0.2.0") } } } diff --git a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GDMLTransformer.kt b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GDMLTransformer.kt index a4008d2b..69a8dbbb 100644 --- a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GDMLTransformer.kt +++ b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GDMLTransformer.kt @@ -234,7 +234,14 @@ private class GDMLTransformer(val settings: GDMLTransformerSettings) { } } - else -> error("Renderer for $solid not supported yet") + is GDMLEllipsoid -> TODO("Renderer for $solid not supported yet") + is GDMLElTube -> TODO("Renderer for $solid not supported yet") + is GDMLElCone -> TODO("Renderer for $solid not supported yet") + is GDMLParaboloid -> TODO("Renderer for $solid not supported yet") + is GDMLParallelepiped -> TODO("Renderer for $solid not supported yet") + is GDMLTorus -> TODO("Renderer for $solid not supported yet") + is GDMLTrapezoid -> TODO("Renderer for $solid not supported yet") + is GDMLPolycone -> TODO("Renderer for $solid not supported yet") } } diff --git a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GdmlOptimizer.kt b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GdmlOptimizer.kt index 9670ea11..02915331 100644 --- a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GdmlOptimizer.kt +++ b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GdmlOptimizer.kt @@ -1,7 +1,7 @@ package hep.dataforge.vision.gdml -import hep.dataforge.meta.DFExperimental import hep.dataforge.meta.itemSequence +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.Vision import hep.dataforge.vision.meta import hep.dataforge.vision.solid.* diff --git a/visionforge-plotly/build.gradle.kts b/visionforge-plotly/build.gradle.kts index 66c1ca12..1eec1565 100644 --- a/visionforge-plotly/build.gradle.kts +++ b/visionforge-plotly/build.gradle.kts @@ -2,12 +2,12 @@ plugins { id("ru.mipt.npm.mpp") } -kscience { +val plotlyVersion = "0.3.1" + +kscience{ useSerialization() } -val plotlyVersion = "0.3.1-dev" - kotlin { js{ //binaries.library() diff --git a/visionforge-plotly/src/commonMain/kotlin/hep/dataforge/vision/plotly/VisionOfPlotly.kt b/visionforge-plotly/src/commonMain/kotlin/hep/dataforge/vision/plotly/VisionOfPlotly.kt index a295deb9..3fd82a3a 100644 --- a/visionforge-plotly/src/commonMain/kotlin/hep/dataforge/vision/plotly/VisionOfPlotly.kt +++ b/visionforge-plotly/src/commonMain/kotlin/hep/dataforge/vision/plotly/VisionOfPlotly.kt @@ -1,7 +1,7 @@ package hep.dataforge.vision.plotly import hep.dataforge.meta.Config -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.VisionBase import hep.dataforge.vision.html.VisionOutput import kotlinx.serialization.Serializable diff --git a/visionforge-plotly/src/jvmMain/kotlin/hep/dataforge/vision/plotly/plotlyHeaders.kt b/visionforge-plotly/src/jvmMain/kotlin/hep/dataforge/vision/plotly/plotlyHeaders.kt index ecf32a1a..65ad8a91 100644 --- a/visionforge-plotly/src/jvmMain/kotlin/hep/dataforge/vision/plotly/plotlyHeaders.kt +++ b/visionforge-plotly/src/jvmMain/kotlin/hep/dataforge/vision/plotly/plotlyHeaders.kt @@ -1,6 +1,6 @@ package hep.dataforge.vision.plotly -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.html.HtmlFragment import hep.dataforge.vision.html.ResourceLocation import hep.dataforge.vision.html.scriptHeader diff --git a/visionforge-server/src/main/kotlin/hep/dataforge/vision/three/server/VisionServer.kt b/visionforge-server/src/main/kotlin/hep/dataforge/vision/three/server/VisionServer.kt index 5baf2643..5672bd00 100644 --- a/visionforge-server/src/main/kotlin/hep/dataforge/vision/three/server/VisionServer.kt +++ b/visionforge-server/src/main/kotlin/hep/dataforge/vision/three/server/VisionServer.kt @@ -2,6 +2,7 @@ package hep.dataforge.vision.three.server import hep.dataforge.context.Context import hep.dataforge.meta.* +import hep.dataforge.misc.DFExperimental import hep.dataforge.names.Name import hep.dataforge.names.toName import hep.dataforge.vision.Vision diff --git a/visionforge-solid/build.gradle.kts b/visionforge-solid/build.gradle.kts index fde0d41d..843ae5dc 100644 --- a/visionforge-solid/build.gradle.kts +++ b/visionforge-solid/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("ru.mipt.npm.mpp") } -kscience { +kscience{ useSerialization() } diff --git a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/Box.kt b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/Box.kt index adedccda..c5a81fc6 100644 --- a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/Box.kt +++ b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/Box.kt @@ -3,7 +3,6 @@ package hep.dataforge.vision.solid import hep.dataforge.vision.VisionBuilder import hep.dataforge.vision.VisionContainerBuilder import hep.dataforge.vision.set -import hep.dataforge.vision.solid.Solid.Companion.solidEquals import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -36,25 +35,25 @@ public class Box( geometryBuilder.face4(node8, node5, node6, node7) } - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this::class != other::class) return false - - other as Box - - if (xSize != other.xSize) return false - if (ySize != other.ySize) return false - if (zSize != other.zSize) return false - - return solidEquals(this, other) - } - - override fun hashCode(): Int { - var result = xSize.hashCode() - result = 31 * result + ySize.hashCode() - result = 31 * result + zSize.hashCode() - return 31 * result + Solid.solidHashCode(this) - } +// override fun equals(other: Any?): Boolean { +// if (this === other) return true +// if (other == null || this::class != other::class) return false +// +// other as Box +// +// if (xSize != other.xSize) return false +// if (ySize != other.ySize) return false +// if (zSize != other.zSize) return false +// +// return solidEquals(this, other) +// } +// +// override fun hashCode(): Int { +// var result = xSize.hashCode() +// result = 31 * result + ySize.hashCode() +// result = 31 * result + zSize.hashCode() +// return 31 * result + Solid.solidHashCode(this) +// } public companion object { diff --git a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidGroup.kt b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidGroup.kt index 1a9db779..e7855cd5 100644 --- a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidGroup.kt +++ b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidGroup.kt @@ -33,7 +33,6 @@ public class SolidGroup( override val descriptor: NodeDescriptor get() = Solid.descriptor - /** * Ger a prototype redirecting the request to the parent if prototype is not found */ @@ -69,7 +68,7 @@ public class SolidGroup( } public companion object { -// val PROTOTYPES_KEY = NameToken("@prototypes") + //public val PROTOTYPES_TOKEN = NameToken("@prototypes") } } diff --git a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidManager.kt b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidManager.kt index db68b53c..442af1a5 100644 --- a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidManager.kt +++ b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidManager.kt @@ -3,8 +3,8 @@ package hep.dataforge.vision.solid import hep.dataforge.context.Context import hep.dataforge.context.PluginFactory import hep.dataforge.context.PluginTag -import hep.dataforge.meta.DFExperimental import hep.dataforge.meta.Meta +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.* import hep.dataforge.vision.html.VisionOutput import kotlinx.serialization.PolymorphicSerializer diff --git a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidReference.kt b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidReference.kt index a802b955..fd6ddbfa 100644 --- a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidReference.kt +++ b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/SolidReference.kt @@ -1,7 +1,9 @@ package hep.dataforge.vision.solid -import hep.dataforge.meta.* +import hep.dataforge.meta.MetaItem +import hep.dataforge.meta.asMetaItem import hep.dataforge.meta.descriptors.NodeDescriptor +import hep.dataforge.misc.DFExperimental import hep.dataforge.names.* import hep.dataforge.vision.* import kotlinx.coroutines.flow.Flow @@ -35,15 +37,15 @@ private fun SolidReference.getRefProperty( @Serializable @SerialName("solid.ref") public class SolidReferenceGroup( - public val templateName: Name, + public val refName: Name, ) : SolidBase(), SolidReference, VisionGroup { /** * Recursively search for defined template in the parent */ override val prototype: Solid - get() = (parent as? SolidGroup)?.getPrototype(templateName) - ?: error("Prototype with name $templateName not found in $parent") + get() = (parent as? SolidGroup)?.getPrototype(refName) + ?: error("Prototype with name $refName not found in $parent") override val children: Map get() = (prototype as? VisionGroup)?.children diff --git a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/transform/RemoveSingleChild.kt b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/transform/RemoveSingleChild.kt index 0b69d23b..72db9f97 100644 --- a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/transform/RemoveSingleChild.kt +++ b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/transform/RemoveSingleChild.kt @@ -1,6 +1,6 @@ package hep.dataforge.vision.solid.transform -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.names.asName import hep.dataforge.vision.* import hep.dataforge.vision.solid.* diff --git a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/transform/UnRef.kt b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/transform/UnRef.kt index 8bc81ff1..a9f22c1c 100644 --- a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/transform/UnRef.kt +++ b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/transform/UnRef.kt @@ -1,6 +1,6 @@ package hep.dataforge.vision.solid.transform -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.names.Name import hep.dataforge.names.asName import hep.dataforge.vision.MutableVisionGroup @@ -18,7 +18,7 @@ internal object UnRef : VisualTreeTransform() { reducer[key] = (reducer[key] ?: 0) + value } } else if (obj is SolidReferenceGroup) { - reducer[obj.templateName] = (reducer[obj.templateName] ?: 0) + 1 + reducer[obj.refName] = (reducer[obj.refName] ?: 0) + 1 } return reducer @@ -29,7 +29,7 @@ internal object UnRef : VisualTreeTransform() { (this as? SolidGroup)?.prototypes{ set(name, null) } - children.filter { (it.value as? SolidReferenceGroup)?.templateName == name }.forEach { (key, value) -> + children.filter { (it.value as? SolidReferenceGroup)?.refName == name }.forEach { (key, value) -> val reference = value as SolidReferenceGroup val newChild = mergeChild(reference, reference.prototype) newChild.parent = null 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 e2496d9a..20062686 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 @@ -1,7 +1,10 @@ package hep.dataforge.vision.solid -import hep.dataforge.meta.* - +import hep.dataforge.meta.MetaItemNode +import hep.dataforge.meta.getIndexed +import hep.dataforge.meta.node +import hep.dataforge.meta.toMetaItem +import hep.dataforge.misc.DFExperimental import kotlin.test.Test import kotlin.test.assertEquals diff --git a/visionforge-solid/src/commonTest/kotlin/hep/dataforge/vision/solid/SolidPluginTest.kt b/visionforge-solid/src/commonTest/kotlin/hep/dataforge/vision/solid/SolidPluginTest.kt index 1361a2c7..a18207c8 100644 --- a/visionforge-solid/src/commonTest/kotlin/hep/dataforge/vision/solid/SolidPluginTest.kt +++ b/visionforge-solid/src/commonTest/kotlin/hep/dataforge/vision/solid/SolidPluginTest.kt @@ -1,7 +1,7 @@ package hep.dataforge.vision.solid import hep.dataforge.context.Global -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.get import kotlin.test.Test import kotlin.test.assertEquals diff --git a/visionforge-threejs/build.gradle.kts b/visionforge-threejs/build.gradle.kts index c893e845..c2ce0570 100644 --- a/visionforge-threejs/build.gradle.kts +++ b/visionforge-threejs/build.gradle.kts @@ -2,10 +2,6 @@ plugins { id("ru.mipt.npm.js") } -kscience { - useSerialization() -} - kotlin{ js{ binaries.library() diff --git a/visionforge-threejs/visionforge-threejs-server/build.gradle.kts b/visionforge-threejs/visionforge-threejs-server/build.gradle.kts index 2531a5e2..ee0e74e9 100644 --- a/visionforge-threejs/visionforge-threejs-server/build.gradle.kts +++ b/visionforge-threejs/visionforge-threejs-server/build.gradle.kts @@ -2,13 +2,6 @@ plugins { id("ru.mipt.npm.mpp") } - -kscience{ - useSerialization{ - json() - } - } - val ktorVersion: String by rootProject.extra kotlin { diff --git a/visionforge-threejs/visionforge-threejs-server/src/jvmMain/kotlin/hep/dataforge/vision/three/server/serverExtensions.kt b/visionforge-threejs/visionforge-threejs-server/src/jvmMain/kotlin/hep/dataforge/vision/three/server/serverExtensions.kt index d44fa02e..589ed03a 100644 --- a/visionforge-threejs/visionforge-threejs-server/src/jvmMain/kotlin/hep/dataforge/vision/three/server/serverExtensions.kt +++ b/visionforge-threejs/visionforge-threejs-server/src/jvmMain/kotlin/hep/dataforge/vision/three/server/serverExtensions.kt @@ -1,7 +1,7 @@ package hep.dataforge.vision.three.server import hep.dataforge.context.Context -import hep.dataforge.meta.DFExperimental +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.html.HtmlVisionFragment import hep.dataforge.vision.html.ResourceLocation import hep.dataforge.vision.html.scriptHeader