diff --git a/demo/gdml/build.gradle.kts b/demo/gdml/build.gradle.kts index f1593d84..8f8c0f9f 100644 --- a/demo/gdml/build.gradle.kts +++ b/demo/gdml/build.gradle.kts @@ -1,6 +1,5 @@ import scientifik.DependencyConfiguration import scientifik.FXModule -import scientifik.useFx plugins { id("scientifik.mpp") @@ -37,7 +36,7 @@ kotlin { } application { - mainClassName = "hep.dataforge.vis.spatial.gdml.demo.GDMLDemoAppKt" + mainClassName = "hep.dataforge.vision.gdml.demo.GDMLDemoAppKt" } val convertGdmlToJson by tasks.creating(JavaExec::class) { diff --git a/demo/gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/demo/cubes.kt b/demo/gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/demo/cubes.kt similarity index 97% rename from demo/gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/demo/cubes.kt rename to demo/gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/demo/cubes.kt index d682d25d..e0666f2a 100644 --- a/demo/gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/demo/cubes.kt +++ b/demo/gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/demo/cubes.kt @@ -1,4 +1,4 @@ -package hep.dataforge.vision.solid.gdml.demo +package hep.dataforge.vision.gdml.demo import scientifik.gdml.* diff --git a/demo/gdml/src/commonTest/kotlin/hep/dataforge/vision/solid/gdml/GDMLVisualTest.kt b/demo/gdml/src/commonTest/kotlin/hep/dataforge/vision/gdml/GDMLVisualTest.kt similarity index 87% rename from demo/gdml/src/commonTest/kotlin/hep/dataforge/vision/solid/gdml/GDMLVisualTest.kt rename to demo/gdml/src/commonTest/kotlin/hep/dataforge/vision/gdml/GDMLVisualTest.kt index 3b2679b3..ed3710e3 100644 --- a/demo/gdml/src/commonTest/kotlin/hep/dataforge/vision/solid/gdml/GDMLVisualTest.kt +++ b/demo/gdml/src/commonTest/kotlin/hep/dataforge/vision/gdml/GDMLVisualTest.kt @@ -1,11 +1,11 @@ -package hep.dataforge.vision.solid.gdml +package hep.dataforge.vision.gdml import hep.dataforge.meta.setItem import hep.dataforge.meta.string import hep.dataforge.names.toName import hep.dataforge.values.asValue +import hep.dataforge.vision.gdml.demo.cubes import hep.dataforge.vision.solid.SolidMaterial -import hep.dataforge.vision.solid.gdml.demo.cubes import kotlin.test.Test import kotlin.test.assertEquals diff --git a/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLAppComponent.kt b/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLAppComponent.kt similarity index 98% rename from demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLAppComponent.kt rename to demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLAppComponent.kt index 0fdb7e37..ee788190 100644 --- a/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLAppComponent.kt +++ b/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLAppComponent.kt @@ -1,4 +1,4 @@ -package hep.dataforge.vision.solid.gdml.demo +package hep.dataforge.vision.gdml.demo import hep.dataforge.context.Context import hep.dataforge.names.Name @@ -6,13 +6,13 @@ import hep.dataforge.names.isEmpty import hep.dataforge.vision.Vision import hep.dataforge.vision.VisionGroup import hep.dataforge.vision.bootstrap.* +import hep.dataforge.vision.gdml.toVision import hep.dataforge.vision.react.component import hep.dataforge.vision.react.configEditor import hep.dataforge.vision.react.flexColumn import hep.dataforge.vision.react.state import hep.dataforge.vision.solid.Solid import hep.dataforge.vision.solid.SolidGroup -import hep.dataforge.vision.solid.gdml.toVision import hep.dataforge.vision.solid.specifications.Camera import hep.dataforge.vision.solid.specifications.Canvas3DOptions import hep.dataforge.vision.solid.three.ThreeCanvas diff --git a/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLDemoApp.kt b/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLDemoApp.kt similarity index 92% rename from demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLDemoApp.kt rename to demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLDemoApp.kt index cd8d38f1..56b9fecd 100644 --- a/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLDemoApp.kt +++ b/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLDemoApp.kt @@ -1,12 +1,12 @@ -package hep.dataforge.vision.solid.gdml.demo +package hep.dataforge.vision.gdml.demo import hep.dataforge.context.Global import hep.dataforge.js.Application import hep.dataforge.js.startApplication +import hep.dataforge.vision.gdml.GDMLTransformer +import hep.dataforge.vision.gdml.LUnit +import hep.dataforge.vision.gdml.toVision import hep.dataforge.vision.solid.SolidMaterial.Companion.MATERIAL_OPACITY_KEY -import hep.dataforge.vision.solid.gdml.GDMLTransformer -import hep.dataforge.vision.solid.gdml.LUnit -import hep.dataforge.vision.solid.gdml.toVision import kotlinx.css.* import react.child import react.dom.render diff --git a/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/fileDrop.kt b/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/fileDrop.kt similarity index 93% rename from demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/fileDrop.kt rename to demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/fileDrop.kt index 0d4a7de9..4bf47c85 100644 --- a/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/solid/gdml/demo/fileDrop.kt +++ b/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/fileDrop.kt @@ -1,4 +1,4 @@ -package hep.dataforge.vision.solid.gdml.demo +package hep.dataforge.vision.gdml.demo import drop.FileDrop import kotlinx.css.* diff --git a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLDemoApp.kt b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLDemoApp.kt similarity index 96% rename from demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLDemoApp.kt rename to demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLDemoApp.kt index 831eae28..35b00615 100644 --- a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/GDMLDemoApp.kt +++ b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLDemoApp.kt @@ -1,13 +1,13 @@ -package hep.dataforge.vision.solid.gdml.demo +package hep.dataforge.vision.gdml.demo import hep.dataforge.context.Global import hep.dataforge.vision.editor.VisualObjectEditorFragment import hep.dataforge.vision.editor.VisualObjectTreeFragment +import hep.dataforge.vision.gdml.toVision import hep.dataforge.vision.solid.SolidManager import hep.dataforge.vision.solid.SolidMaterial import hep.dataforge.vision.solid.fx.FX3DPlugin import hep.dataforge.vision.solid.fx.FXCanvas3D -import hep.dataforge.vision.solid.gdml.toVision import javafx.geometry.Orientation import javafx.scene.Parent import javafx.stage.FileChooser diff --git a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/readFile.kt b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/readFile.kt similarity index 89% rename from demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/readFile.kt rename to demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/readFile.kt index 4fc2e535..c0fcd2ed 100644 --- a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/readFile.kt +++ b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/readFile.kt @@ -1,14 +1,14 @@ -package hep.dataforge.vision.solid.gdml.demo +package hep.dataforge.vision.gdml.demo import hep.dataforge.meta.DFExperimental import hep.dataforge.meta.setItem import hep.dataforge.values.asValue +import hep.dataforge.vision.gdml.LUnit +import hep.dataforge.vision.gdml.readFile +import hep.dataforge.vision.gdml.toVision import hep.dataforge.vision.solid.SolidGroup import hep.dataforge.vision.solid.SolidManager import hep.dataforge.vision.solid.SolidMaterial -import hep.dataforge.vision.solid.gdml.LUnit -import hep.dataforge.vision.solid.gdml.readFile -import hep.dataforge.vision.solid.gdml.toVision import scientifik.gdml.GDML import java.io.File import java.util.zip.GZIPInputStream diff --git a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/saveToJson.kt b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/saveToJson.kt similarity index 81% rename from demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/saveToJson.kt rename to demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/saveToJson.kt index 092cb00a..5c0c09c6 100644 --- a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/demo/saveToJson.kt +++ b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/demo/saveToJson.kt @@ -1,8 +1,8 @@ -package hep.dataforge.vision.solid.gdml.demo +package hep.dataforge.vision.gdml.demo -import hep.dataforge.vision.solid.gdml.LUnit -import hep.dataforge.vision.solid.gdml.readFile -import hep.dataforge.vision.solid.gdml.toVision +import hep.dataforge.vision.gdml.LUnit +import hep.dataforge.vision.gdml.readFile +import hep.dataforge.vision.gdml.toVision import hep.dataforge.vision.solid.stringify import scientifik.gdml.GDML import java.io.File 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 index a0c05d29..5b337ad9 100644 --- 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 @@ -1,6 +1,6 @@ package hep.dataforge.vision.solid.demo -import hep.dataforge.vision.solid.gdml.gdml +import hep.dataforge.vision.gdml.gdml import javafx.stage.Stage import tornadofx.* import java.nio.file.NoSuchFileException diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/AbstractVision.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/AbstractVision.kt index 0d25b35f..a025a87a 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/AbstractVision.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/AbstractVision.kt @@ -73,13 +73,13 @@ abstract class AbstractVision : Vision { return if (inherit) { sequence { yield(properties?.get(name)) - yield(getStyleItem(name)) + yieldAll(getStyleItems(name)) yield(parent?.getProperty(name, inherit)) }.merge() } else { sequence { yield(properties?.get(name)) - yield(getStyleItem(name)) + yieldAll(getStyleItems(name)) }.merge() } } 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 6fcc330d..4dfb28d1 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleSheet.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/StyleSheet.kt @@ -106,8 +106,15 @@ fun Vision.useStyle(name: String) { styles = styles + name } -fun Vision.getStyleItem(name: Name): MetaItem<*>? { - return styles.asSequence().map { resolveStyle(it) }.map { it[name] }.firstOrNull() +/** + * Resolve an item in all style layers + */ +fun Vision.getStyleItems(name: Name): Sequence> { + return styles.asSequence().map { + resolveStyle(it) + }.map { + it[name] + }.filterNotNull() } /** diff --git a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/GDMLTransformer.kt b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GDMLTransformer.kt similarity index 98% rename from visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/GDMLTransformer.kt rename to visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GDMLTransformer.kt index b576daf4..b7019f69 100644 --- a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/GDMLTransformer.kt +++ b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GDMLTransformer.kt @@ -1,4 +1,4 @@ -package hep.dataforge.vision.solid.gdml +package hep.dataforge.vision.gdml import hep.dataforge.meta.Meta import hep.dataforge.meta.MetaBuilder diff --git a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/GdmlVision.kt b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GdmlVision.kt similarity index 99% rename from visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/GdmlVision.kt rename to visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GdmlVision.kt index 105f545c..29efa338 100644 --- a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/GdmlVision.kt +++ b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/GdmlVision.kt @@ -1,4 +1,4 @@ -package hep.dataforge.vision.solid.gdml +package hep.dataforge.vision.gdml import hep.dataforge.names.Name diff --git a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/units.kt b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/units.kt similarity index 97% rename from visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/units.kt rename to visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/units.kt index a12aca34..3e5783ef 100644 --- a/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/solid/gdml/units.kt +++ b/visionforge-gdml/src/commonMain/kotlin/hep/dataforge/vision/gdml/units.kt @@ -1,4 +1,4 @@ -package hep.dataforge.vision.solid.gdml +package hep.dataforge.vision.gdml import scientifik.gdml.AUnit import scientifik.gdml.GDMLPosition diff --git a/visionforge-gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/visualGDMLJvm.kt b/visionforge-gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/visualGDMLJvm.kt similarity index 92% rename from visionforge-gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/visualGDMLJvm.kt rename to visionforge-gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/visualGDMLJvm.kt index 92fb50d4..0d47ea7a 100644 --- a/visionforge-gdml/src/jvmMain/kotlin/hep/dataforge/vision/solid/gdml/visualGDMLJvm.kt +++ b/visionforge-gdml/src/jvmMain/kotlin/hep/dataforge/vision/gdml/visualGDMLJvm.kt @@ -1,4 +1,4 @@ -package hep.dataforge.vision.solid.gdml +package hep.dataforge.vision.gdml import hep.dataforge.vision.solid.SolidGroup import nl.adaptivity.xmlutil.StAXReader diff --git a/visionforge-gdml/src/jvmTest/kotlin/hep/dataforge/vision/solid/gdml/TestConvertor.kt b/visionforge-gdml/src/jvmTest/kotlin/hep/dataforge/vision/gdml/TestConvertor.kt similarity index 96% rename from visionforge-gdml/src/jvmTest/kotlin/hep/dataforge/vision/solid/gdml/TestConvertor.kt rename to visionforge-gdml/src/jvmTest/kotlin/hep/dataforge/vision/gdml/TestConvertor.kt index 6fe347e3..d932ab0e 100644 --- a/visionforge-gdml/src/jvmTest/kotlin/hep/dataforge/vision/solid/gdml/TestConvertor.kt +++ b/visionforge-gdml/src/jvmTest/kotlin/hep/dataforge/vision/gdml/TestConvertor.kt @@ -1,4 +1,4 @@ -package hep.dataforge.vision.solid.gdml +package hep.dataforge.vision.gdml import hep.dataforge.vision.solid.stringify import nl.adaptivity.xmlutil.StAXReader diff --git a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/Proxy.kt b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/Proxy.kt index 8059e796..463434cc 100644 --- a/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/Proxy.kt +++ b/visionforge-solid/src/commonMain/kotlin/hep/dataforge/vision/solid/Proxy.kt @@ -48,14 +48,14 @@ class Proxy private constructor( return if (inherit) { sequence { yield(properties?.get(name)) - yield(getStyleItem(name)) + yieldAll(getStyleItems(name)) yield(prototype.getItem(name)) yield(parent?.getProperty(name, inherit)) }.merge() } else { sequence { yield(properties?.get(name)) - yield(getStyleItem(name)) + yieldAll(getStyleItems(name)) yield(prototype.getProperty(name, false)) }.merge() } @@ -126,14 +126,14 @@ class Proxy private constructor( return if (inherit) { sequence { yield(properties?.get(name)) - yield(getStyleItem(name)) + yieldAll(getStyleItems(name)) yield(prototype.getItem(name)) yield(parent?.getProperty(name, inherit)) }.merge() } else { sequence { yield(properties?.get(name)) - yield(getStyleItem(name)) + yieldAll(getStyleItems(name)) yield(prototype.getProperty(name, false)) }.merge() } diff --git a/visionforge-solid/src/jsMain/kotlin/hep/dataforge/vision/solid/three/ThreeMaterials.kt b/visionforge-solid/src/jsMain/kotlin/hep/dataforge/vision/solid/three/ThreeMaterials.kt index f8110d73..a2da8611 100644 --- a/visionforge-solid/src/jsMain/kotlin/hep/dataforge/vision/solid/three/ThreeMaterials.kt +++ b/visionforge-solid/src/jsMain/kotlin/hep/dataforge/vision/solid/three/ThreeMaterials.kt @@ -44,7 +44,7 @@ object ThreeMaterials { } fun getMaterial(vision3D: Vision): Material { - val meta = vision3D.getItem(SolidMaterial.MATERIAL_KEY).node ?: return ThreeMaterials.DEFAULT + val meta = vision3D.getItem(SolidMaterial.MATERIAL_KEY).node ?: return DEFAULT return if (meta[SolidMaterial.SPECULAR_COLOR_KEY] != null) { MeshPhongMaterial().apply { color = meta[SolidMaterial.COLOR_KEY]?.getColor() ?: DEFAULT_COLOR