Fix gdml demo file loader

This commit is contained in:
Alexander Nozik 2020-02-28 16:36:09 +03:00
parent 9b4105b300
commit ef42327cc5

View File

@ -135,12 +135,13 @@ private class GDMLDemoApp : Application {
val action: (name: String, data: String) -> Unit = { name, data -> val action: (name: String, data: String) -> Unit = { name, data ->
canvasElement.clear() canvasElement.clear()
spinner(true) spinner(true)
message("Loading GDML")
val gdml = GDML.format.parse(GDML.serializer(), data)
message("Converting GDML into DF-VIS format")
val visual: VisualObject3D = when { val visual: VisualObject3D = when {
name.endsWith(".gdml") || name.endsWith(".xml") -> gdml.toVisual(gdmlConfiguration) name.endsWith(".gdml") || name.endsWith(".xml") -> {
message("Loading GDML")
val gdml = GDML.format.parse(GDML.serializer(), data)
message("Converting GDML into DF-VIS format")
gdml.toVisual(gdmlConfiguration)
}
name.endsWith(".json") -> VisualGroup3D.fromJson(data) name.endsWith(".json") -> VisualGroup3D.fromJson(data)
else -> { else -> {
window.alert("File extension is not recognized: $name") window.alert("File extension is not recognized: $name")