forked from kscience/visionforge
Fix style merge
This commit is contained in:
parent
2f570f2791
commit
5e3e3908ea
@ -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) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package hep.dataforge.vision.solid.gdml.demo
|
||||
package hep.dataforge.vision.gdml.demo
|
||||
|
||||
import scientifik.gdml.*
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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
|
@ -1,4 +1,4 @@
|
||||
package hep.dataforge.vision.solid.gdml.demo
|
||||
package hep.dataforge.vision.gdml.demo
|
||||
|
||||
import drop.FileDrop
|
||||
import kotlinx.css.*
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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<MetaItem<*>> {
|
||||
return styles.asSequence().map {
|
||||
resolveStyle(it)
|
||||
}.map {
|
||||
it[name]
|
||||
}.filterNotNull()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
@ -1,4 +1,4 @@
|
||||
package hep.dataforge.vision.solid.gdml
|
||||
package hep.dataforge.vision.gdml
|
||||
|
||||
|
||||
import hep.dataforge.names.Name
|
@ -1,4 +1,4 @@
|
||||
package hep.dataforge.vision.solid.gdml
|
||||
package hep.dataforge.vision.gdml
|
||||
|
||||
import scientifik.gdml.AUnit
|
||||
import scientifik.gdml.GDMLPosition
|
@ -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
|
@ -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
|
@ -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()
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user