fixed dataforge compatibility

This commit is contained in:
Alexander Nozik 2019-05-28 18:56:07 +03:00
parent 4af79e078d
commit 7aaca8c34f
6 changed files with 30 additions and 18 deletions

View File

@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.openjfx.gradle.JavaFXOptions
plugins {
@ -13,4 +14,10 @@ dependencies {
configure<JavaFXOptions> {
modules("javafx.controls")
}
tasks.withType<KotlinCompile> {
kotlinOptions{
jvmTarget = "1.8"
}
}

View File

@ -1,7 +1,7 @@
package hep.dataforge.vis.spatial
import hep.dataforge.context.Context
import hep.dataforge.context.members
import hep.dataforge.context.content
import hep.dataforge.meta.*
import hep.dataforge.output.Output
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>? {
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) {

View File

@ -3,6 +3,7 @@ package hep.dataforge.vis.spatial
import hep.dataforge.context.AbstractPlugin
import hep.dataforge.context.PluginFactory
import hep.dataforge.context.PluginTag
import hep.dataforge.meta.Meta
import hep.dataforge.names.Name
import hep.dataforge.names.toName
@ -16,10 +17,12 @@ class ThreePlugin : AbstractPlugin() {
factories["convex".toName()] = ThreeConvexFactory
}
override fun listTop(target: String): Sequence<Name> {
override fun listNames(target: String): Sequence<Name> {
return when (target) {
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> {
override val tag = PluginTag("vis.three", "hep.dataforge")
override val type = ThreePlugin::class
override fun invoke() = ThreePlugin()
override fun invoke(meta: Meta) = ThreePlugin()
}
}

View File

@ -4,7 +4,7 @@ import hep.dataforge.meta.*
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
sealed class GDMLNode(override val config: Config) : Specification {
sealed class GDMLNode(override val config: Config) : Specific {
var pName by string()
}
@ -16,7 +16,7 @@ class GDMLPosition(config: Config) : GDMLDefine(config) {
var z by number(0f).float
var unit by string("cm")
companion object : SpecificationCompanion<GDMLPosition> {
companion object : Specification<GDMLPosition> {
override fun wrap(config: Config) = GDMLPosition(config)
}
}
@ -27,7 +27,7 @@ class GDMLRotation(config: Config) : GDMLDefine(config) {
var z by number(0f).float
var unit by string("deg")
companion object : SpecificationCompanion<GDMLRotation> {
companion object : Specification<GDMLRotation> {
override fun wrap(config: Config) = GDMLRotation(config)
}
}
@ -43,7 +43,7 @@ class GDMLBox(config: Config) : GDMLSolid(config) {
var pDy by number().double
var pDz by number().double
companion object : SpecificationCompanion<GDMLBox> {
companion object : Specification<GDMLBox> {
override fun wrap(config: Config): GDMLBox = GDMLBox(config)
}
}
@ -57,7 +57,7 @@ class GDMLTube(config: Config) : GDMLSolid(config) {
var pSPhi by number().double
var pDPhi by number().double
companion object : SpecificationCompanion<GDMLTube> {
companion object : Specification<GDMLTube> {
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 Section(override val config: Config) : Specification {
class Section(override val config: Config) : Specific {
var zOrder by number().int
var zPosition by number().double
var xOffsset by number(0.0).double
var yOffset by number(0.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)
}
}
@ -96,7 +96,7 @@ class GDMLXtru(config: Config) : GDMLSolid(config) {
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)
}
}
@ -160,7 +160,7 @@ sealed class GDMLBoolSolid(config: Config, var root: GDML? = null) : GDMLSolid(c
class GDMLUnion(config: Config) : GDMLBoolSolid(config) {
override val type: String = "union"
companion object : SpecificationCompanion<GDMLUnion> {
companion object : Specification<GDMLUnion> {
override fun wrap(config: Config): GDMLUnion = GDMLUnion(config)
}
}
@ -168,7 +168,7 @@ class GDMLUnion(config: Config) : GDMLBoolSolid(config) {
class GDMLSubtraction(config: Config) : GDMLBoolSolid(config) {
override val type: String = "subtraction"
companion object : SpecificationCompanion<GDMLUnion> {
companion object : Specification<GDMLUnion> {
override fun wrap(config: Config) = GDMLUnion(config)
}
}
@ -176,7 +176,7 @@ class GDMLSubtraction(config: Config) : GDMLBoolSolid(config) {
class GDMLIntersection(config: Config) : GDMLBoolSolid(config) {
override val type: String = "intersection"
companion object : SpecificationCompanion<GDMLIntersection> {
companion object : Specification<GDMLIntersection> {
override fun wrap(config: Config) = GDMLIntersection(config)
}
}

View File

@ -4,6 +4,7 @@ import hep.dataforge.context.AbstractPlugin
import hep.dataforge.context.Context
import hep.dataforge.context.PluginFactory
import hep.dataforge.context.PluginTag
import hep.dataforge.meta.Meta
import hep.dataforge.names.toName
import hep.dataforge.vis.spatial.ThreePlugin
@ -30,6 +31,6 @@ class GDMLPlugin : AbstractPlugin() {
companion object : PluginFactory<GDMLPlugin> {
override val tag = PluginTag("vis.gdml", "hep.dataforge")
override val type = GDMLPlugin::class
override fun invoke() = GDMLPlugin()
override fun invoke(meta: Meta) = GDMLPlugin()
}
}

View File

@ -4,6 +4,7 @@ import hep.dataforge.context.AbstractPlugin
import hep.dataforge.context.Context
import hep.dataforge.context.PluginFactory
import hep.dataforge.context.PluginTag
import hep.dataforge.meta.Meta
import hep.dataforge.names.toName
import hep.dataforge.vis.spatial.ThreePlugin
@ -31,6 +32,6 @@ class JSRootPlugin : AbstractPlugin() {
companion object: PluginFactory<JSRootPlugin> {
override val tag = PluginTag("vis.jsroot", "hep.dataforge")
override val type = JSRootPlugin::class
override fun invoke() = JSRootPlugin()
override fun invoke(meta: Meta) = JSRootPlugin()
}
}