forked from kscience/visionforge
fixed dataforge compatibility
This commit is contained in:
parent
4af79e078d
commit
7aaca8c34f
@ -1,3 +1,4 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
import org.openjfx.gradle.JavaFXOptions
|
import org.openjfx.gradle.JavaFXOptions
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@ -14,3 +15,9 @@ dependencies {
|
|||||||
configure<JavaFXOptions> {
|
configure<JavaFXOptions> {
|
||||||
modules("javafx.controls")
|
modules("javafx.controls")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinCompile> {
|
||||||
|
kotlinOptions{
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package hep.dataforge.vis.spatial
|
package hep.dataforge.vis.spatial
|
||||||
|
|
||||||
import hep.dataforge.context.Context
|
import hep.dataforge.context.Context
|
||||||
import hep.dataforge.context.members
|
import hep.dataforge.context.content
|
||||||
import hep.dataforge.meta.*
|
import hep.dataforge.meta.*
|
||||||
import hep.dataforge.output.Output
|
import hep.dataforge.output.Output
|
||||||
import hep.dataforge.vis.DisplayGroup
|
import hep.dataforge.vis.DisplayGroup
|
||||||
@ -75,7 +75,7 @@ class ThreeOutput(override val context: Context, val meta: Meta = EmptyMeta) : O
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun <T : DisplayObject> findFactory(type: KClass<out T>): ThreeFactory<T>? {
|
private fun <T : DisplayObject> findFactory(type: KClass<out T>): ThreeFactory<T>? {
|
||||||
return context.members<ThreeFactory<*>>(ThreeFactory.TYPE).find { it.type == type } as? ThreeFactory<T>?
|
return context.content<ThreeFactory<*>>(ThreeFactory.TYPE).values.find { it.type == type } as? ThreeFactory<T>?
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(obj: DisplayObject, meta: Meta) {
|
override fun render(obj: DisplayObject, meta: Meta) {
|
||||||
|
@ -3,6 +3,7 @@ package hep.dataforge.vis.spatial
|
|||||||
import hep.dataforge.context.AbstractPlugin
|
import hep.dataforge.context.AbstractPlugin
|
||||||
import hep.dataforge.context.PluginFactory
|
import hep.dataforge.context.PluginFactory
|
||||||
import hep.dataforge.context.PluginTag
|
import hep.dataforge.context.PluginTag
|
||||||
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.names.Name
|
import hep.dataforge.names.Name
|
||||||
import hep.dataforge.names.toName
|
import hep.dataforge.names.toName
|
||||||
|
|
||||||
@ -16,10 +17,12 @@ class ThreePlugin : AbstractPlugin() {
|
|||||||
factories["convex".toName()] = ThreeConvexFactory
|
factories["convex".toName()] = ThreeConvexFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun listTop(target: String): Sequence<Name> {
|
|
||||||
|
|
||||||
|
override fun listNames(target: String): Sequence<Name> {
|
||||||
return when (target) {
|
return when (target) {
|
||||||
ThreeFactory.TYPE -> factories.keys.asSequence()
|
ThreeFactory.TYPE -> factories.keys.asSequence()
|
||||||
else -> return super.listTop(target)
|
else -> return super.listNames(target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +36,6 @@ class ThreePlugin : AbstractPlugin() {
|
|||||||
companion object : PluginFactory<ThreePlugin> {
|
companion object : PluginFactory<ThreePlugin> {
|
||||||
override val tag = PluginTag("vis.three", "hep.dataforge")
|
override val tag = PluginTag("vis.three", "hep.dataforge")
|
||||||
override val type = ThreePlugin::class
|
override val type = ThreePlugin::class
|
||||||
override fun invoke() = ThreePlugin()
|
override fun invoke(meta: Meta) = ThreePlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ import hep.dataforge.meta.*
|
|||||||
import kotlin.properties.ReadWriteProperty
|
import kotlin.properties.ReadWriteProperty
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
sealed class GDMLNode(override val config: Config) : Specification {
|
sealed class GDMLNode(override val config: Config) : Specific {
|
||||||
var pName by string()
|
var pName by string()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ class GDMLPosition(config: Config) : GDMLDefine(config) {
|
|||||||
var z by number(0f).float
|
var z by number(0f).float
|
||||||
var unit by string("cm")
|
var unit by string("cm")
|
||||||
|
|
||||||
companion object : SpecificationCompanion<GDMLPosition> {
|
companion object : Specification<GDMLPosition> {
|
||||||
override fun wrap(config: Config) = GDMLPosition(config)
|
override fun wrap(config: Config) = GDMLPosition(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ class GDMLRotation(config: Config) : GDMLDefine(config) {
|
|||||||
var z by number(0f).float
|
var z by number(0f).float
|
||||||
var unit by string("deg")
|
var unit by string("deg")
|
||||||
|
|
||||||
companion object : SpecificationCompanion<GDMLRotation> {
|
companion object : Specification<GDMLRotation> {
|
||||||
override fun wrap(config: Config) = GDMLRotation(config)
|
override fun wrap(config: Config) = GDMLRotation(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ class GDMLBox(config: Config) : GDMLSolid(config) {
|
|||||||
var pDy by number().double
|
var pDy by number().double
|
||||||
var pDz by number().double
|
var pDz by number().double
|
||||||
|
|
||||||
companion object : SpecificationCompanion<GDMLBox> {
|
companion object : Specification<GDMLBox> {
|
||||||
override fun wrap(config: Config): GDMLBox = GDMLBox(config)
|
override fun wrap(config: Config): GDMLBox = GDMLBox(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ class GDMLTube(config: Config) : GDMLSolid(config) {
|
|||||||
var pSPhi by number().double
|
var pSPhi by number().double
|
||||||
var pDPhi by number().double
|
var pDPhi by number().double
|
||||||
|
|
||||||
companion object : SpecificationCompanion<GDMLTube> {
|
companion object : Specification<GDMLTube> {
|
||||||
override fun wrap(config: Config): GDMLTube = GDMLTube(config)
|
override fun wrap(config: Config): GDMLTube = GDMLTube(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,14 +67,14 @@ class GDMLXtru(config: Config) : GDMLSolid(config) {
|
|||||||
|
|
||||||
class TwoDimVertex(val x: Double, val y: Double)
|
class TwoDimVertex(val x: Double, val y: Double)
|
||||||
|
|
||||||
class Section(override val config: Config) : Specification {
|
class Section(override val config: Config) : Specific {
|
||||||
var zOrder by number().int
|
var zOrder by number().int
|
||||||
var zPosition by number().double
|
var zPosition by number().double
|
||||||
var xOffsset by number(0.0).double
|
var xOffsset by number(0.0).double
|
||||||
var yOffset by number(0.0).double
|
var yOffset by number(0.0).double
|
||||||
var scalingFactor by number(1.0).double
|
var scalingFactor by number(1.0).double
|
||||||
|
|
||||||
companion object : SpecificationCompanion<Section> {
|
companion object : Specification<Section> {
|
||||||
override fun wrap(config: Config): Section = Section(config)
|
override fun wrap(config: Config): Section = Section(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ class GDMLXtru(config: Config) : GDMLSolid(config) {
|
|||||||
config["section[$index]"] = Section.build(block).apply { zOrder = index; zPosition = z }
|
config["section[$index]"] = Section.build(block).apply { zOrder = index; zPosition = z }
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : SpecificationCompanion<GDMLXtru> {
|
companion object : Specification<GDMLXtru> {
|
||||||
override fun wrap(config: Config): GDMLXtru = GDMLXtru(config)
|
override fun wrap(config: Config): GDMLXtru = GDMLXtru(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ sealed class GDMLBoolSolid(config: Config, var root: GDML? = null) : GDMLSolid(c
|
|||||||
class GDMLUnion(config: Config) : GDMLBoolSolid(config) {
|
class GDMLUnion(config: Config) : GDMLBoolSolid(config) {
|
||||||
override val type: String = "union"
|
override val type: String = "union"
|
||||||
|
|
||||||
companion object : SpecificationCompanion<GDMLUnion> {
|
companion object : Specification<GDMLUnion> {
|
||||||
override fun wrap(config: Config): GDMLUnion = GDMLUnion(config)
|
override fun wrap(config: Config): GDMLUnion = GDMLUnion(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ class GDMLUnion(config: Config) : GDMLBoolSolid(config) {
|
|||||||
class GDMLSubtraction(config: Config) : GDMLBoolSolid(config) {
|
class GDMLSubtraction(config: Config) : GDMLBoolSolid(config) {
|
||||||
override val type: String = "subtraction"
|
override val type: String = "subtraction"
|
||||||
|
|
||||||
companion object : SpecificationCompanion<GDMLUnion> {
|
companion object : Specification<GDMLUnion> {
|
||||||
override fun wrap(config: Config) = GDMLUnion(config)
|
override fun wrap(config: Config) = GDMLUnion(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ class GDMLSubtraction(config: Config) : GDMLBoolSolid(config) {
|
|||||||
class GDMLIntersection(config: Config) : GDMLBoolSolid(config) {
|
class GDMLIntersection(config: Config) : GDMLBoolSolid(config) {
|
||||||
override val type: String = "intersection"
|
override val type: String = "intersection"
|
||||||
|
|
||||||
companion object : SpecificationCompanion<GDMLIntersection> {
|
companion object : Specification<GDMLIntersection> {
|
||||||
override fun wrap(config: Config) = GDMLIntersection(config)
|
override fun wrap(config: Config) = GDMLIntersection(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import hep.dataforge.context.AbstractPlugin
|
|||||||
import hep.dataforge.context.Context
|
import hep.dataforge.context.Context
|
||||||
import hep.dataforge.context.PluginFactory
|
import hep.dataforge.context.PluginFactory
|
||||||
import hep.dataforge.context.PluginTag
|
import hep.dataforge.context.PluginTag
|
||||||
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.names.toName
|
import hep.dataforge.names.toName
|
||||||
import hep.dataforge.vis.spatial.ThreePlugin
|
import hep.dataforge.vis.spatial.ThreePlugin
|
||||||
|
|
||||||
@ -30,6 +31,6 @@ class GDMLPlugin : AbstractPlugin() {
|
|||||||
companion object : PluginFactory<GDMLPlugin> {
|
companion object : PluginFactory<GDMLPlugin> {
|
||||||
override val tag = PluginTag("vis.gdml", "hep.dataforge")
|
override val tag = PluginTag("vis.gdml", "hep.dataforge")
|
||||||
override val type = GDMLPlugin::class
|
override val type = GDMLPlugin::class
|
||||||
override fun invoke() = GDMLPlugin()
|
override fun invoke(meta: Meta) = GDMLPlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import hep.dataforge.context.AbstractPlugin
|
|||||||
import hep.dataforge.context.Context
|
import hep.dataforge.context.Context
|
||||||
import hep.dataforge.context.PluginFactory
|
import hep.dataforge.context.PluginFactory
|
||||||
import hep.dataforge.context.PluginTag
|
import hep.dataforge.context.PluginTag
|
||||||
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.names.toName
|
import hep.dataforge.names.toName
|
||||||
import hep.dataforge.vis.spatial.ThreePlugin
|
import hep.dataforge.vis.spatial.ThreePlugin
|
||||||
|
|
||||||
@ -31,6 +32,6 @@ class JSRootPlugin : AbstractPlugin() {
|
|||||||
companion object: PluginFactory<JSRootPlugin> {
|
companion object: PluginFactory<JSRootPlugin> {
|
||||||
override val tag = PluginTag("vis.jsroot", "hep.dataforge")
|
override val tag = PluginTag("vis.jsroot", "hep.dataforge")
|
||||||
override val type = JSRootPlugin::class
|
override val type = JSRootPlugin::class
|
||||||
override fun invoke() = JSRootPlugin()
|
override fun invoke(meta: Meta) = JSRootPlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user