forked from kscience/visionforge
Move to new kotlin and plugin
This commit is contained in:
parent
75a988b546
commit
14de244c02
@ -33,6 +33,7 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api("hep.dataforge:dataforge-output-html:$dataforgeVersion")
|
api("hep.dataforge:dataforge-output-html:$dataforgeVersion")
|
||||||
//api(npm("bootstrap","4.4.1"))
|
//api(npm("bootstrap","4.4.1"))
|
||||||
|
implementation(npm("uri-js","4.2.2"))
|
||||||
implementation(npm("jsoneditor","8.6.1"))
|
implementation(npm("jsoneditor","8.6.1"))
|
||||||
implementation(npm("file-saver"))
|
implementation(npm("file-saver"))
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package hep.dataforge.vis.spatial.gdml
|
package hep.dataforge.vis.spatial.gdml
|
||||||
|
|
||||||
|
import hep.dataforge.meta.scheme.setProperty
|
||||||
import hep.dataforge.meta.string
|
import hep.dataforge.meta.string
|
||||||
import hep.dataforge.names.toName
|
import hep.dataforge.names.toName
|
||||||
|
import hep.dataforge.values.asValue
|
||||||
import hep.dataforge.vis.spatial.Material3D
|
import hep.dataforge.vis.spatial.Material3D
|
||||||
import hep.dataforge.vis.spatial.gdml.demo.cubes
|
import hep.dataforge.vis.spatial.gdml.demo.cubes
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
@ -12,7 +14,7 @@ class GDMLVisualTest {
|
|||||||
fun testPrototypeProperty() {
|
fun testPrototypeProperty() {
|
||||||
val gdml = cubes()
|
val gdml = cubes()
|
||||||
val visual = gdml.toVisual()
|
val visual = gdml.toVisual()
|
||||||
visual["composite000.segment0".toName()]?.setProperty(Material3D.MATERIAL_COLOR_KEY, "red")
|
visual["composite000.segment0".toName()]?.setProperty(Material3D.MATERIAL_COLOR_KEY, "red".asValue())
|
||||||
assertEquals("red", visual["composite000.segment0".toName()]?.getProperty(Material3D.MATERIAL_COLOR_KEY).string)
|
assertEquals("red", visual["composite000.segment0".toName()]?.getProperty(Material3D.MATERIAL_COLOR_KEY).string)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package hep.dataforge.vis.spatial.gdml.demo
|
package hep.dataforge.vis.spatial.gdml.demo
|
||||||
|
|
||||||
|
import hep.dataforge.meta.scheme.setProperty
|
||||||
|
import hep.dataforge.values.asValue
|
||||||
import hep.dataforge.vis.spatial.Material3D
|
import hep.dataforge.vis.spatial.Material3D
|
||||||
import hep.dataforge.vis.spatial.Visual3D
|
import hep.dataforge.vis.spatial.Visual3D
|
||||||
import hep.dataforge.vis.spatial.VisualGroup3D
|
import hep.dataforge.vis.spatial.VisualGroup3D
|
||||||
@ -10,8 +12,6 @@ import scientifik.gdml.GDML
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.zip.GZIPInputStream
|
import java.util.zip.GZIPInputStream
|
||||||
import java.util.zip.ZipInputStream
|
import java.util.zip.ZipInputStream
|
||||||
import hep.dataforge.meta.*
|
|
||||||
import hep.dataforge.values.*
|
|
||||||
|
|
||||||
fun Visual3D.Companion.readFile(file: File): VisualGroup3D = when {
|
fun Visual3D.Companion.readFile(file: File): VisualGroup3D = when {
|
||||||
file.extension == "gdml" || file.extension == "xml" -> {
|
file.extension == "gdml" || file.extension == "xml" -> {
|
||||||
|
@ -7,19 +7,11 @@ plugins {
|
|||||||
|
|
||||||
group = "ru.mipt.npm"
|
group = "ru.mipt.npm"
|
||||||
|
|
||||||
val ktor_version = "1.3.0-rc"
|
val ktor_version = "1.3.2"
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
|
||||||
js {
|
val installJS = tasks.getByName("jsBrowserDistribution")
|
||||||
browser {
|
|
||||||
webpackTask {
|
|
||||||
sourceMaps = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val installJS = tasks.getByName("jsBrowserWebpack")
|
|
||||||
|
|
||||||
jvm {
|
jvm {
|
||||||
withJava()
|
withJava()
|
||||||
|
@ -14,7 +14,7 @@ import io.ktor.http.content.static
|
|||||||
import io.ktor.response.respond
|
import io.ktor.response.respond
|
||||||
import io.ktor.routing.Routing
|
import io.ktor.routing.Routing
|
||||||
import io.ktor.routing.get
|
import io.ktor.routing.get
|
||||||
import io.ktor.serialization.serialization
|
import io.ktor.serialization.json
|
||||||
import io.ktor.server.cio.CIO
|
import io.ktor.server.cio.CIO
|
||||||
import io.ktor.server.engine.embeddedServer
|
import io.ktor.server.engine.embeddedServer
|
||||||
import org.apache.commons.math3.random.JDKRandomGenerator
|
import org.apache.commons.math3.random.JDKRandomGenerator
|
||||||
@ -35,7 +35,7 @@ fun Application.module() {
|
|||||||
install(DefaultHeaders)
|
install(DefaultHeaders)
|
||||||
install(CallLogging)
|
install(CallLogging)
|
||||||
install(ContentNegotiation) {
|
install(ContentNegotiation) {
|
||||||
serialization(json = Visual3D.json)
|
json(json = Visual3D.json)
|
||||||
}
|
}
|
||||||
install(Routing) {
|
install(Routing) {
|
||||||
get("/event") {
|
get("/event") {
|
||||||
|
@ -4,11 +4,12 @@ package hep.dataforge.vis.spatial.demo
|
|||||||
|
|
||||||
import hep.dataforge.meta.int
|
import hep.dataforge.meta.int
|
||||||
import hep.dataforge.meta.number
|
import hep.dataforge.meta.number
|
||||||
|
import hep.dataforge.meta.scheme.setProperty
|
||||||
import hep.dataforge.names.plus
|
import hep.dataforge.names.plus
|
||||||
import hep.dataforge.names.startsWith
|
import hep.dataforge.names.startsWith
|
||||||
|
import hep.dataforge.values.asValue
|
||||||
import hep.dataforge.vis.common.getProperty
|
import hep.dataforge.vis.common.getProperty
|
||||||
import hep.dataforge.vis.common.set
|
import hep.dataforge.vis.common.set
|
||||||
import hep.dataforge.vis.common.setProperty
|
|
||||||
import hep.dataforge.vis.spatial.*
|
import hep.dataforge.vis.spatial.*
|
||||||
import hep.dataforge.vis.spatial.VisualObject3D.Companion.GEOMETRY_KEY
|
import hep.dataforge.vis.spatial.VisualObject3D.Companion.GEOMETRY_KEY
|
||||||
import hep.dataforge.vis.spatial.demo.VariableBoxThreeFactory.Z_SIZE_KEY
|
import hep.dataforge.vis.spatial.demo.VariableBoxThreeFactory.Z_SIZE_KEY
|
||||||
@ -25,13 +26,13 @@ import kotlin.reflect.KClass
|
|||||||
internal var VisualObject3D.variableZSize: Number
|
internal var VisualObject3D.variableZSize: Number
|
||||||
get() = getProperty(Z_SIZE_KEY, false).number ?: 0f
|
get() = getProperty(Z_SIZE_KEY, false).number ?: 0f
|
||||||
set(value) {
|
set(value) {
|
||||||
setProperty(Z_SIZE_KEY, value)
|
setProperty(Z_SIZE_KEY, value.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var VisualObject3D.value: Int
|
internal var VisualObject3D.value: Int
|
||||||
get() = getProperty("value", false).int ?: 0
|
get() = getProperty("value", false).int ?: 0
|
||||||
set(value) {
|
set(value) {
|
||||||
setProperty("value", value)
|
setProperty("value", value.asValue())
|
||||||
val size = value.toFloat() / 255f * 20f
|
val size = value.toFloat() / 255f * 20f
|
||||||
scaleZ = size
|
scaleZ = size
|
||||||
z = -size / 2
|
z = -size / 2
|
||||||
|
@ -13,7 +13,6 @@ pluginManagement {
|
|||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
eachPlugin {
|
eachPlugin {
|
||||||
when (requested.id.id) {
|
when (requested.id.id) {
|
||||||
"kotlin-dce-js" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
|
|
||||||
"scientifik.mpp", "scientifik.publish", "scientifik.jvm", "scientifik.js" -> useModule("scientifik:gradle-tools:${requested.version}")
|
"scientifik.mpp", "scientifik.publish", "scientifik.jvm", "scientifik.js" -> useModule("scientifik:gradle-tools:${requested.version}")
|
||||||
"org.openjfx.javafxplugin" -> useModule("org.openjfx:javafx-plugin:${requested.version}")
|
"org.openjfx.javafxplugin" -> useModule("org.openjfx:javafx-plugin:${requested.version}")
|
||||||
}
|
}
|
||||||
@ -27,7 +26,6 @@ rootProject.name = "dataforge-vis"
|
|||||||
|
|
||||||
include(
|
include(
|
||||||
":dataforge-vis-common",
|
":dataforge-vis-common",
|
||||||
// ":wrappers",
|
|
||||||
":dataforge-vis-spatial",
|
":dataforge-vis-spatial",
|
||||||
":dataforge-vis-spatial-gdml",
|
":dataforge-vis-spatial-gdml",
|
||||||
":demo:spatial-showcase",
|
":demo:spatial-showcase",
|
||||||
|
Loading…
Reference in New Issue
Block a user