forked from kscience/visionforge
Fix compillation and tests
This commit is contained in:
parent
217f347c4b
commit
c7c1a8dd3c
@ -106,7 +106,7 @@ internal class Prototypes(
|
|||||||
|
|
||||||
override var styleSheet: StyleSheet?
|
override var styleSheet: StyleSheet?
|
||||||
get() = null
|
get() = null
|
||||||
set(value) {
|
set(_) {
|
||||||
error("Can't define stylesheet for prototypes block")
|
error("Can't define stylesheet for prototypes block")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ internal class Prototypes(
|
|||||||
|
|
||||||
override var properties: Config?
|
override var properties: Config?
|
||||||
get() = null
|
get() = null
|
||||||
set(value) {
|
set(_) {
|
||||||
error("Can't define properties for prototypes block")
|
error("Can't define properties for prototypes block")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ fun Visual3D.Companion.readFile(file: File): VisualGroup3D = when {
|
|||||||
file.name.endsWith("json.zip") -> {
|
file.name.endsWith("json.zip") -> {
|
||||||
file.inputStream().use {
|
file.inputStream().use {
|
||||||
val unzip = ZipInputStream(it, Charsets.UTF_8)
|
val unzip = ZipInputStream(it, Charsets.UTF_8)
|
||||||
val text = unzip.readAllBytes().decodeToString()
|
val text = unzip.readBytes().decodeToString()
|
||||||
VisualGroup3D.parseJson(text)
|
VisualGroup3D.parseJson(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file.name.endsWith("json.gz") -> {
|
file.name.endsWith("json.gz") -> {
|
||||||
file.inputStream().use {
|
file.inputStream().use {
|
||||||
val unzip = GZIPInputStream(it)
|
val unzip = GZIPInputStream(it)
|
||||||
val text = unzip.readAllBytes().decodeToString()
|
val text = unzip.readBytes().decodeToString()
|
||||||
VisualGroup3D.parseJson(text)
|
VisualGroup3D.parseJson(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import hep.dataforge.vis.spatial.VisualGroup3D
|
|||||||
import hep.dataforge.vis.spatial.gdml.LUnit
|
import hep.dataforge.vis.spatial.gdml.LUnit
|
||||||
import hep.dataforge.vis.spatial.gdml.readFile
|
import hep.dataforge.vis.spatial.gdml.readFile
|
||||||
import hep.dataforge.vis.spatial.gdml.toVisual
|
import hep.dataforge.vis.spatial.gdml.toVisual
|
||||||
|
import hep.dataforge.vis.spatial.stringify
|
||||||
import scientifik.gdml.GDML
|
import scientifik.gdml.GDML
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
@ -14,6 +15,6 @@ fun main() {
|
|||||||
val visual = gdml.toVisual {
|
val visual = gdml.toVisual {
|
||||||
lUnit = LUnit.CM
|
lUnit = LUnit.CM
|
||||||
}
|
}
|
||||||
val json = Visual3D.json.stringify(VisualGroup3D.serializer(), visual)
|
val json = visual.stringify()
|
||||||
File("D:\\Work\\Projects\\gdml.kt\\gdml-source\\cubes.json").writeText(json)
|
File("D:\\Work\\Projects\\gdml.kt\\gdml-source\\cubes.json").writeText(json)
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ class FileSerializationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
fun testFileRead(){
|
fun testFileRead(){
|
||||||
val text = this::class.java.getResourceAsStream("/cubes.json").readAllBytes().decodeToString()
|
val text = this::class.java.getResourceAsStream("/cubes.json").readBytes().decodeToString()
|
||||||
val visual = VisualGroup3D.parseJson(text)
|
val visual = VisualGroup3D.parseJson(text)
|
||||||
visual["composite_001".asName()]
|
visual["composite_001".asName()]
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ kotlin {
|
|||||||
|
|
||||||
jvm {
|
jvm {
|
||||||
withJava()
|
withJava()
|
||||||
compilations.findByName("main").apply {
|
compilations.findByName("jvmMain").apply {
|
||||||
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
||||||
dependsOn(installJS)
|
dependsOn(installJS)
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
|
@ -28,6 +28,7 @@ import kotlinx.coroutines.GlobalScope
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.html.js.button
|
import kotlinx.html.js.button
|
||||||
import kotlinx.html.js.onClickFunction
|
import kotlinx.html.js.onClickFunction
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import org.w3c.dom.HTMLElement
|
import org.w3c.dom.HTMLElement
|
||||||
import kotlin.browser.document
|
import kotlin.browser.document
|
||||||
import kotlin.dom.clear
|
import kotlin.dom.clear
|
||||||
@ -38,7 +39,7 @@ private class MMDemoApp : Application {
|
|||||||
|
|
||||||
private val connection = HttpClient {
|
private val connection = HttpClient {
|
||||||
install(JsonFeature) {
|
install(JsonFeature) {
|
||||||
serializer = KotlinxSerializer(Visual3D.json)
|
serializer = KotlinxSerializer(Json(context = Visual3D.serialModule))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package ru.mipt.npm.muon.monitor
|
package ru.mipt.npm.muon.monitor
|
||||||
|
|
||||||
actual fun readResource(path: String): String {
|
actual fun readResource(path: String): String {
|
||||||
return ClassLoader.getSystemClassLoader().getResourceAsStream(path)?.readAllBytes()?.decodeToString()
|
return ClassLoader.getSystemClassLoader().getResourceAsStream(path)?.readBytes()?.decodeToString()
|
||||||
?: error("Resource '$path' not found")
|
?: error("Resource '$path' not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ fun Application.module() {
|
|||||||
install(DefaultHeaders)
|
install(DefaultHeaders)
|
||||||
install(CallLogging)
|
install(CallLogging)
|
||||||
install(ContentNegotiation) {
|
install(ContentNegotiation) {
|
||||||
json(json = Visual3D.json)
|
json(module = Visual3D.serialModule)
|
||||||
}
|
}
|
||||||
install(Routing) {
|
install(Routing) {
|
||||||
get("/event") {
|
get("/event") {
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
3
gradlew.bat
vendored
3
gradlew.bat
vendored
@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
|||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user