Dev #24

Merged
altavir merged 12 commits from dev into master 2020-04-12 19:31:02 +03:00
7 changed files with 14 additions and 20 deletions
Showing only changes of commit 14de244c02 - Show all commits

View File

@ -33,6 +33,7 @@ kotlin {
dependencies {
api("hep.dataforge:dataforge-output-html:$dataforgeVersion")
//api(npm("bootstrap","4.4.1"))
implementation(npm("uri-js","4.2.2"))
implementation(npm("jsoneditor","8.6.1"))
implementation(npm("file-saver"))
}

View File

@ -1,7 +1,9 @@
package hep.dataforge.vis.spatial.gdml
import hep.dataforge.meta.scheme.setProperty
import hep.dataforge.meta.string
import hep.dataforge.names.toName
import hep.dataforge.values.asValue
import hep.dataforge.vis.spatial.Material3D
import hep.dataforge.vis.spatial.gdml.demo.cubes
import kotlin.test.Test
@ -12,7 +14,7 @@ class GDMLVisualTest {
fun testPrototypeProperty() {
val gdml = cubes()
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)
}
}

View File

@ -1,5 +1,7 @@
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.Visual3D
import hep.dataforge.vis.spatial.VisualGroup3D
@ -10,8 +12,6 @@ import scientifik.gdml.GDML
import java.io.File
import java.util.zip.GZIPInputStream
import java.util.zip.ZipInputStream
import hep.dataforge.meta.*
import hep.dataforge.values.*
fun Visual3D.Companion.readFile(file: File): VisualGroup3D = when {
file.extension == "gdml" || file.extension == "xml" -> {

View File

@ -7,19 +7,11 @@ plugins {
group = "ru.mipt.npm"
val ktor_version = "1.3.0-rc"
val ktor_version = "1.3.2"
kotlin {
js {
browser {
webpackTask {
sourceMaps = true
}
}
}
val installJS = tasks.getByName("jsBrowserWebpack")
val installJS = tasks.getByName("jsBrowserDistribution")
jvm {
withJava()

View File

@ -14,7 +14,7 @@ import io.ktor.http.content.static
import io.ktor.response.respond
import io.ktor.routing.Routing
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.engine.embeddedServer
import org.apache.commons.math3.random.JDKRandomGenerator
@ -35,7 +35,7 @@ fun Application.module() {
install(DefaultHeaders)
install(CallLogging)
install(ContentNegotiation) {
serialization(json = Visual3D.json)
json(json = Visual3D.json)
}
install(Routing) {
get("/event") {

View File

@ -4,11 +4,12 @@ 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.names.plus
import hep.dataforge.names.startsWith
import hep.dataforge.values.asValue
import hep.dataforge.vis.common.getProperty
import hep.dataforge.vis.common.set
import hep.dataforge.vis.common.setProperty
import hep.dataforge.vis.spatial.*
import hep.dataforge.vis.spatial.VisualObject3D.Companion.GEOMETRY_KEY
import hep.dataforge.vis.spatial.demo.VariableBoxThreeFactory.Z_SIZE_KEY
@ -25,13 +26,13 @@ import kotlin.reflect.KClass
internal var VisualObject3D.variableZSize: Number
get() = getProperty(Z_SIZE_KEY, false).number ?: 0f
set(value) {
setProperty(Z_SIZE_KEY, value)
setProperty(Z_SIZE_KEY, value.asValue())
}
internal var VisualObject3D.value: Int
get() = getProperty("value", false).int ?: 0
set(value) {
setProperty("value", value)
setProperty("value", value.asValue())
val size = value.toFloat() / 255f * 20f
scaleZ = size
z = -size / 2

View File

@ -13,7 +13,6 @@ pluginManagement {
resolutionStrategy {
eachPlugin {
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}")
"org.openjfx.javafxplugin" -> useModule("org.openjfx:javafx-plugin:${requested.version}")
}
@ -27,7 +26,6 @@ rootProject.name = "dataforge-vis"
include(
":dataforge-vis-common",
// ":wrappers",
":dataforge-vis-spatial",
":dataforge-vis-spatial-gdml",
":demo:spatial-showcase",