DF to 0.1.7

This commit is contained in:
Alexander Nozik 2020-04-10 19:25:52 +03:00
parent a8f6fa9dc6
commit 54c42a6a56
25 changed files with 66 additions and 86 deletions

View File

@ -1,10 +1,10 @@
import scientifik.fx
import scientifik.serialization
val dataforgeVersion by extra("0.1.6-dev")
val dataforgeVersion by extra("0.1.7")
plugins {
val toolsVersion = "0.4.0"
val toolsVersion = "0.4.2"
id("scientifik.mpp") version toolsVersion apply false
id("scientifik.jvm") version toolsVersion apply false
id("scientifik.js") version toolsVersion apply false
@ -24,7 +24,7 @@ allprojects {
}
group = "hep.dataforge"
version = "0.1.2-dev"
version = "0.1.3-dev"
}
val githubProject by extra("dataforge-vis")

View File

@ -1,7 +1,6 @@
package hep.dataforge.vis
import hep.dataforge.meta.*
import hep.dataforge.meta.scheme.setProperty
import hep.dataforge.names.Name
import hep.dataforge.names.asName
import hep.dataforge.values.Value

View File

@ -1,15 +1,13 @@
package hep.dataforge.vis
import hep.dataforge.meta.Configurable
import hep.dataforge.meta.Laminate
import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaItem
import hep.dataforge.meta.descriptors.NodeDescriptor
import hep.dataforge.meta.scheme.Configurable
import hep.dataforge.names.Name
import hep.dataforge.names.asName
import hep.dataforge.names.toName
import hep.dataforge.provider.Type
import hep.dataforge.values.ValueType
import hep.dataforge.vis.VisualObject.Companion.TYPE
import kotlinx.serialization.Transient

View File

@ -1,19 +1,14 @@
package hep.dataforge.vis
import hep.dataforge.meta.EmptyMeta
import hep.dataforge.meta.Meta
import hep.dataforge.meta.*
import hep.dataforge.meta.descriptors.ValueDescriptor
import hep.dataforge.meta.node
import hep.dataforge.meta.scheme.getProperty
import hep.dataforge.meta.scheme.setProperty
import hep.dataforge.meta.string
import hep.dataforge.values.asValue
/**
* Extension property to access the "widget" key of [ValueDescriptor]
*/
var ValueDescriptor.widget: Meta
get() = getProperty("widget").node ?: EmptyMeta
get() = getProperty("widget").node ?: Meta.EMPTY
set(value) {
setProperty("widget", value)
}

View File

@ -1,7 +1,6 @@
package hep.dataforge.vis
import hep.dataforge.context.*
import hep.dataforge.meta.EmptyMeta
import hep.dataforge.meta.Meta
import hep.dataforge.meta.boolean
import javafx.application.Application
@ -20,7 +19,7 @@ import kotlin.reflect.KClass
/**
* Plugin holding JavaFX application instance and its root stage
*/
class FXPlugin(meta: Meta = EmptyMeta) : AbstractPlugin(meta) {
class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) {
override val tag: PluginTag get() = Companion.tag
private val stages: ObservableSet<Stage> = FXCollections.observableSet()

View File

@ -174,10 +174,10 @@ private fun <M : MutableMeta<M>> M.createEmptyNode(token: NameToken, append: Boo
val name = token.asName()
val index = (getIndexed(name).keys.mapNotNull { it.toIntOrNull() }.max() ?: -1) + 1
val newName = name.withIndex(index.toString())
set(newName, EmptyMeta)
set(newName, Meta.EMPTY)
get(newName).node!!
} else {
this.setNode(token.asName(), EmptyMeta)
this.setNode(token.asName(), Meta.EMPTY)
//FIXME possible concurrency bug
get(token).node!!
}
@ -211,9 +211,9 @@ fun <M : MutableMeta<M>> FXMetaNode<M>.addValue(key: String) {
fun <M : MutableMeta<M>> FXMetaNode<M>.addNode(key: String) {
val parent = getOrCreateNode()
if (descriptor?.multiple == true) {
parent.append(key, EmptyMeta)
parent.append(key, Meta.EMPTY)
} else {
parent[key] = EmptyMeta
parent[key] = Meta.EMPTY
}
}

View File

@ -7,7 +7,6 @@ package hep.dataforge.vis.editor
import hep.dataforge.context.Context
import hep.dataforge.context.Named
import hep.dataforge.meta.EmptyMeta
import hep.dataforge.meta.Meta
import hep.dataforge.meta.descriptors.ValueDescriptor
import hep.dataforge.names.toName
@ -66,7 +65,7 @@ interface ValueChooser {
@Type("hep.dataforge.vis.fx.valueChooserFactory")
interface Factory : Named {
operator fun invoke(meta: Meta = EmptyMeta): ValueChooser
operator fun invoke(meta: Meta = Meta.EMPTY): ValueChooser
}
companion object {

View File

@ -1,7 +1,7 @@
package hep.dataforge.vis.spatial.gdml
import nl.adaptivity.xmlutil.StAXReader
import org.junit.Test
import org.junit.jupiter.api.Test
import scientifik.gdml.GDML
import java.io.File
import java.net.URL

View File

@ -1,6 +1,5 @@
package hep.dataforge.vis.spatial
import hep.dataforge.meta.EmptyMeta
import hep.dataforge.meta.Meta
/**
@ -14,7 +13,7 @@ interface GeometryBuilder<T : Any> {
* @param normal optional external normal to the face
* @param meta optional additional platform-specific parameters like color or texture index
*/
fun face(vertex1: Point3D, vertex2: Point3D, vertex3: Point3D, normal: Point3D? = null, meta: Meta = EmptyMeta)
fun face(vertex1: Point3D, vertex2: Point3D, vertex3: Point3D, normal: Point3D? = null, meta: Meta = Meta.EMPTY)
fun build(): T
}
@ -25,7 +24,7 @@ fun GeometryBuilder<*>.face4(
vertex3: Point3D,
vertex4: Point3D,
normal: Point3D? = null,
meta: Meta = EmptyMeta
meta: Meta = Meta.EMPTY
) {
face(vertex1, vertex2, vertex3, normal, meta)
face(vertex1, vertex3, vertex4, normal, meta)

View File

@ -1,11 +1,7 @@
package hep.dataforge.vis.spatial
import hep.dataforge.meta.*
import hep.dataforge.meta.descriptors.NodeDescriptor
import hep.dataforge.meta.double
import hep.dataforge.meta.get
import hep.dataforge.meta.node
import hep.dataforge.meta.scheme.*
import hep.dataforge.meta.set
import hep.dataforge.names.asName
import hep.dataforge.names.plus
import hep.dataforge.values.ValueType
@ -48,7 +44,9 @@ class Material3D : Scheme() {
internal val WIREFRAME_KEY = "wireframe".asName()
val MATERIAL_WIREFRAME_KEY = MATERIAL_KEY + WIREFRAME_KEY
val descriptor = NodeDescriptor {
val descriptor by lazy {
//must be lazy to avoid initialization bug
NodeDescriptor {
defineValue(VisualObject3D.VISIBLE_KEY) {
type(ValueType.BOOLEAN)
default(true)
@ -69,6 +67,7 @@ class Material3D : Scheme() {
}
}
}
}
}
/**

View File

@ -3,7 +3,7 @@
package hep.dataforge.vis.spatial
import hep.dataforge.meta.Config
import hep.dataforge.meta.scheme.number
import hep.dataforge.meta.number
import hep.dataforge.names.asName
import hep.dataforge.names.plus
import hep.dataforge.vis.AbstractVisualObject

View File

@ -4,11 +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.meta.float
import hep.dataforge.meta.get
import hep.dataforge.meta.node
import hep.dataforge.meta.scheme.configure
import hep.dataforge.meta.*
import hep.dataforge.names.Name
import hep.dataforge.names.toName
import hep.dataforge.vis.Visual

View File

@ -4,8 +4,6 @@ package hep.dataforge.vis.spatial
import hep.dataforge.meta.*
import hep.dataforge.meta.descriptors.NodeDescriptor
import hep.dataforge.meta.scheme.node
import hep.dataforge.meta.scheme.setProperty
import hep.dataforge.names.asName
import hep.dataforge.names.plus
import hep.dataforge.output.Renderer
@ -61,13 +59,14 @@ interface VisualObject3D : VisualObject {
val yScale = scale + y
val zScale = scale + z
val descriptor = NodeDescriptor {
val descriptor by lazy {
NodeDescriptor {
defineValue(VISIBLE_KEY) {
type(ValueType.BOOLEAN)
default(true)
}
defineItem(Material3D.MATERIAL_KEY, Material3D.descriptor)
defineItem(Material3D.MATERIAL_KEY.toString(), Material3D.descriptor)
// Material3D.MATERIAL_COLOR_KEY put "#ffffff"
// Material3D.MATERIAL_OPACITY_KEY put 1.0
@ -75,6 +74,7 @@ interface VisualObject3D : VisualObject {
}
}
}
}
/**
@ -86,7 +86,7 @@ var VisualObject3D.layer: Int
setProperty(LAYER_KEY, value.asValue())
}
fun Renderer<VisualObject3D>.render(meta: Meta = EmptyMeta, action: VisualGroup3D.() -> Unit) =
fun Renderer<VisualObject3D>.render(meta: Meta = Meta.EMPTY, action: VisualGroup3D.() -> Unit) =
render(VisualGroup3D().apply(action), meta)
// Common properties

View File

@ -1,10 +1,6 @@
package hep.dataforge.vis.spatial.specifications
import hep.dataforge.meta.isEmpty
import hep.dataforge.meta.scheme.Scheme
import hep.dataforge.meta.scheme.SchemeSpec
import hep.dataforge.meta.scheme.boolean
import hep.dataforge.meta.scheme.double
import hep.dataforge.meta.*
class Axes : Scheme() {
var visible by boolean(!config.isEmpty())

View File

@ -1,9 +1,9 @@
package hep.dataforge.vis.spatial.specifications
import hep.dataforge.meta.scheme.Scheme
import hep.dataforge.meta.scheme.SchemeSpec
import hep.dataforge.meta.scheme.double
import hep.dataforge.meta.scheme.int
import hep.dataforge.meta.Scheme
import hep.dataforge.meta.SchemeSpec
import hep.dataforge.meta.double
import hep.dataforge.meta.int
import kotlin.math.PI
class Camera : Scheme() {

View File

@ -1,9 +1,9 @@
package hep.dataforge.vis.spatial.specifications
import hep.dataforge.meta.scheme.Scheme
import hep.dataforge.meta.scheme.SchemeSpec
import hep.dataforge.meta.scheme.int
import hep.dataforge.meta.scheme.spec
import hep.dataforge.meta.Scheme
import hep.dataforge.meta.SchemeSpec
import hep.dataforge.meta.int
import hep.dataforge.meta.spec
class Canvas : Scheme() {
var axes by spec(Axes, Axes.empty())

View File

@ -1,7 +1,7 @@
package hep.dataforge.vis.spatial.specifications
import hep.dataforge.meta.scheme.Scheme
import hep.dataforge.meta.scheme.SchemeSpec
import hep.dataforge.meta.Scheme
import hep.dataforge.meta.SchemeSpec
class Controls : Scheme() {

View File

@ -2,7 +2,7 @@ package hep.dataforge.vis.spatial.three
import hep.dataforge.context.Context
import hep.dataforge.meta.Meta
import hep.dataforge.meta.scheme.getProperty
import hep.dataforge.meta.getProperty
import hep.dataforge.meta.string
import hep.dataforge.names.Name
import hep.dataforge.names.plus

View File

@ -1,6 +1,6 @@
package hep.dataforge.vis.spatial.gdml
import hep.dataforge.meta.scheme.setProperty
import hep.dataforge.meta.setProperty
import hep.dataforge.meta.string
import hep.dataforge.names.toName
import hep.dataforge.values.asValue

View File

@ -1,6 +1,6 @@
package hep.dataforge.vis.spatial.gdml.demo
import hep.dataforge.meta.scheme.setProperty
import hep.dataforge.meta.setProperty
import hep.dataforge.values.asValue
import hep.dataforge.vis.spatial.Material3D
import hep.dataforge.vis.spatial.Visual3D

View File

@ -1,7 +1,7 @@
package hep.dataforge.vis.spatial
import hep.dataforge.names.asName
import org.junit.Test
import org.junit.jupiter.api.Test
import kotlin.test.Ignore
class FileSerializationTest {

View File

@ -46,6 +46,7 @@ kotlin {
implementation(npm("abort-controller"))
implementation(npm("bufferutil"))
implementation(npm("utf-8-validate"))
implementation(npm("fs"))
// implementation(npm("jquery"))
// implementation(npm("popper.js"))
// implementation(npm("react-is"))

View File

@ -1,7 +1,6 @@
package ru.mipt.npm.muon.monitor
import org.junit.Test
import kotlin.test.assertTrue
import kotlin.test.*
class GeometryTest {

View File

@ -1,7 +1,7 @@
package hep.dataforge.vis.spatial.demo
import hep.dataforge.meta.Meta
import hep.dataforge.meta.scheme.invoke
import hep.dataforge.meta.invoke
import hep.dataforge.names.toName
import hep.dataforge.output.OutputManager
import hep.dataforge.vis.Colors

View File

@ -4,7 +4,7 @@ package hep.dataforge.vis.spatial.demo
import hep.dataforge.meta.int
import hep.dataforge.meta.number
import hep.dataforge.meta.scheme.setProperty
import hep.dataforge.meta.setProperty
import hep.dataforge.names.plus
import hep.dataforge.names.startsWith
import hep.dataforge.values.asValue