forked from kscience/visionforge
Build fix
This commit is contained in:
parent
fb6a149b5e
commit
193ae96425
@ -13,7 +13,7 @@ buildscript {
|
||||
val dokkaVersion: String by rootProject.extra("0.9.17")
|
||||
val serializationVersion: String by rootProject.extra("0.10.0")
|
||||
|
||||
val dataforgeVersion: String by rootProject.extra("0.1.2-dev-3")
|
||||
val dataforgeVersion: String by rootProject.extra("0.1.2-dev-4")
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
@ -91,7 +91,6 @@ subprojects {
|
||||
|
||||
afterEvaluate {
|
||||
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
||||
apply(plugin = "com.moowork.node")
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
@ -120,38 +119,44 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
configure<NodeExtension>{
|
||||
nodeModulesDir = file("$buildDir/node_modules")
|
||||
}
|
||||
|
||||
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
||||
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
||||
val runJsTests by ext(false)
|
||||
|
||||
val populateNodeModules by tasks.registering(Copy::class) {
|
||||
dependsOn(compileKotlinJs)
|
||||
from(compileKotlinJs.destinationDir)
|
||||
|
||||
compilations["test"].runtimeDependencyFiles.forEach {
|
||||
if (it.exists() && !it.isDirectory) {
|
||||
from(zipTree(it.absolutePath).matching { include("*.js") })
|
||||
}
|
||||
if(runJsTests) {
|
||||
apply(plugin = "com.moowork.node")
|
||||
configure<NodeExtension> {
|
||||
nodeModulesDir = file("$buildDir/node_modules")
|
||||
}
|
||||
|
||||
into("$buildDir/node_modules")
|
||||
}
|
||||
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
||||
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
||||
|
||||
val installMocha by tasks.registering(NpmTask::class) {
|
||||
setWorkingDir(buildDir)
|
||||
setArgs(listOf("install", "mocha"))
|
||||
}
|
||||
val populateNodeModules by tasks.registering(Copy::class) {
|
||||
dependsOn(compileKotlinJs)
|
||||
from(compileKotlinJs.destinationDir)
|
||||
|
||||
val runMocha by tasks.registering(NodeTask::class) {
|
||||
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
|
||||
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
|
||||
setArgs(listOf(compileTestKotlinJs.outputFile))
|
||||
}
|
||||
compilations["test"].runtimeDependencyFiles.forEach {
|
||||
if (it.exists() && !it.isDirectory) {
|
||||
from(zipTree(it.absolutePath).matching { include("*.js") })
|
||||
}
|
||||
}
|
||||
|
||||
tasks["jsTest"].dependsOn(runMocha)
|
||||
into("$buildDir/node_modules")
|
||||
}
|
||||
|
||||
val installMocha by tasks.registering(NpmTask::class) {
|
||||
setWorkingDir(buildDir)
|
||||
setArgs(listOf("install", "mocha"))
|
||||
}
|
||||
|
||||
val runMocha by tasks.registering(NodeTask::class) {
|
||||
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
|
||||
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
|
||||
setArgs(listOf(compileTestKotlinJs.outputFile))
|
||||
}
|
||||
|
||||
tasks["jsTest"].dependsOn(runMocha)
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
@ -15,16 +15,16 @@ kotlin {
|
||||
//api("hep.dataforge:dataforge-output-metadata:$dataforgeVersion")
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
api("hep.dataforge:dataforge-output-jvm:$dataforgeVersion")
|
||||
//api("no.tornado:tornadofx:1.7.18")
|
||||
}
|
||||
}
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
api("hep.dataforge:dataforge-output-js:$dataforgeVersion")
|
||||
}
|
||||
}
|
||||
// val jvmMain by getting {
|
||||
// dependencies {
|
||||
// api("hep.dataforge:dataforge-output-jvm:$dataforgeVersion")
|
||||
// //api("no.tornado:tornadofx:1.7.18")
|
||||
// }
|
||||
// }
|
||||
// val jsMain by getting {
|
||||
// dependencies {
|
||||
// api("hep.dataforge:dataforge-output-js:$dataforgeVersion")
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package hep.dataforge.vis.spatial
|
||||
|
||||
import hep.dataforge.context.Context
|
||||
import hep.dataforge.io.Output
|
||||
import hep.dataforge.meta.Meta
|
||||
import hep.dataforge.output.Output
|
||||
import hep.dataforge.vis.*
|
||||
import javafx.scene.Group
|
||||
import javafx.scene.Node
|
||||
|
@ -8,16 +8,12 @@ plugins {
|
||||
id("org.jetbrains.kotlin.frontend")
|
||||
}
|
||||
|
||||
repositories{
|
||||
maven ("https://dl.bintray.com/orangy/maven" )
|
||||
}
|
||||
|
||||
val kotlinVersion: String by rootProject.extra
|
||||
|
||||
dependencies {
|
||||
implementation(project(":dataforge-vis-spatial"))
|
||||
api(project(":dataforge-vis-spatial"))
|
||||
implementation("info.laht.threekt:threejs-wrapper:0.88-npm-2")
|
||||
//implementation("org.jetbrains.kotlinx:kotlinx-files-js:0.1.0-dev-27")
|
||||
testCompile("org.jetbrains.kotlin:kotlin-test-js:$kotlinVersion")
|
||||
}
|
||||
|
||||
@ -27,9 +23,6 @@ configure<KotlinFrontendExtension> {
|
||||
configure<NpmExtension> {
|
||||
dependency("three-full")
|
||||
dependency("style-loader")
|
||||
// dependency("fs-remote")
|
||||
// dependency("path")
|
||||
// dependency("text-encoding")
|
||||
devDependency("karma")
|
||||
}
|
||||
|
||||
|
@ -15,3 +15,5 @@ external fun createTubeBuffer(shape: dynamic, limit: Int): BufferGeometry
|
||||
external fun createXtruBuffer(shape: dynamic, limit: Int): BufferGeometry
|
||||
|
||||
external fun build(obj: dynamic, opt: dynamic): Object3D
|
||||
|
||||
external fun buildFromJson(obj:dynamic, opt: dynamic): Object3D
|
||||
|
@ -24,7 +24,7 @@ object ThreeJSRootObjectFactory : ThreeFactory<JSRootObject> {
|
||||
override val type = JSRootObject::class
|
||||
|
||||
override fun invoke(obj: JSRootObject): Object3D {
|
||||
return build(obj.data, obj.options?.toDynamic())
|
||||
return buildFromJson(obj.data, obj.options?.toDynamic())
|
||||
}
|
||||
}
|
||||
|
||||
|
1931
dataforge-vis-spatial-js/src/main/resources/JSRoot.js
Normal file
1931
dataforge-vis-spatial-js/src/main/resources/JSRoot.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,9 +3,9 @@
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(['three-full', 'ThreeCSG'], factory);
|
||||
define(['three-full', 'ThreeCSG', 'JSRoot'], factory);
|
||||
} else if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||
factory(require("three-full"), require("./ThreeCSG.js"));
|
||||
factory(require("three-full"), require("./ThreeCSG.js"), require("./JSRoot.js"));
|
||||
} else {
|
||||
if (typeof THREE == 'undefined')
|
||||
throw new Error('THREE is not defined', 'JSRootGeoBase.js');
|
||||
@ -13,50 +13,16 @@
|
||||
if (typeof ThreeBSP == 'undefined')
|
||||
throw new Error('ThreeBSP is not defined', 'JSRootGeoBase.js');
|
||||
|
||||
factory(THREE, ThreeBSP);
|
||||
if (typeof JSROOT == 'undefined')
|
||||
throw new Error('JSROOT is not defined', 'JSRootGeoBase.js');
|
||||
|
||||
|
||||
factory(THREE, ThreeBSP, JSROOT);
|
||||
}
|
||||
}(function (THREE, ThreeBSP) {
|
||||
}(function (THREE, ThreeBSP, JSROOT) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var JSROOT = {};
|
||||
|
||||
/** Generate mask for given bit
|
||||
*
|
||||
* @param {number} n bit number
|
||||
* @returns {Number} produced make
|
||||
* @private */
|
||||
JSROOT.BIT = function (n) {
|
||||
return 1 << (n);
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Generic method to invoke callback function.
|
||||
*
|
||||
* @param {object|function} func either normal function or container like
|
||||
* { obj: object_pointer, func: name of method to call }
|
||||
* @param arg1 first optional argument of callback
|
||||
* @param arg2 second optional argument of callback
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
JSROOT.CallBack = function (func, arg1, arg2) {
|
||||
|
||||
if (typeof func == 'string') func = JSROOT.findFunction(func);
|
||||
|
||||
if (!func) return;
|
||||
|
||||
if (typeof func == 'function') return func(arg1, arg2);
|
||||
|
||||
if (typeof func != 'object') return;
|
||||
|
||||
if (('obj' in func) && ('func' in func) &&
|
||||
(typeof func.obj == 'object') && (typeof func.func == 'string') &&
|
||||
(typeof func.obj[func.func] == 'function')) {
|
||||
return func.obj[func.func](arg1, arg2);
|
||||
}
|
||||
};
|
||||
|
||||
/** @namespace GEO */
|
||||
/// Holder of all TGeo-related functions and classes
|
||||
var GEO = {
|
||||
@ -1650,7 +1616,7 @@
|
||||
} else if (('fMatrix' in node) && (node.fMatrix !== null))
|
||||
matrix = GEO.createMatrix(node.fMatrix);
|
||||
else if ((node._typename == "TGeoNodeOffset") && (node.fFinder !== null)) {
|
||||
var kPatternReflected = GEO.BITS.kVisBranch;
|
||||
let kPatternReflected = GEO.BITS.kVisBranch;
|
||||
if ((node.fFinder.fBits & kPatternReflected) !== 0)
|
||||
GEO.warn('Unsupported reflected pattern ' + node.fFinder._typename);
|
||||
|
||||
@ -2279,12 +2245,12 @@
|
||||
if (obj.fVolume.fNodes) chlds = obj.fVolume.fNodes.arr;
|
||||
}
|
||||
|
||||
var matrix = GEO.getNodeMatrix(kind, obj);
|
||||
const matrix = GEO.getNodeMatrix(kind, obj);
|
||||
if (matrix) {
|
||||
clone.matrix = matrix.elements; // take only matrix elements, matrix will be constructed in worker
|
||||
if (clone.matrix[0] === 1) {
|
||||
var issimple = true;
|
||||
for (var k = 1; (k < clone.matrix.length) && issimple; ++k)
|
||||
for (let k = 1; (k < clone.matrix.length) && issimple; ++k)
|
||||
issimple = (clone.matrix[k] === ((k === 5) || (k === 10) || (k === 15) ? 1 : 0));
|
||||
if (issimple) delete clone.matrix;
|
||||
}
|
||||
@ -3515,6 +3481,11 @@
|
||||
return toplevel;
|
||||
};
|
||||
|
||||
GEO.buildFromJson = function (obj, opt) {
|
||||
var unrefed = JSROOT.JSONR_unref(obj);
|
||||
return GEO.build(unrefed, opt)
|
||||
};
|
||||
|
||||
GEO.getBoundingBox = function (node, box3) {
|
||||
|
||||
// extract code of Box3.expandByObject
|
||||
|
@ -27,5 +27,9 @@ include(
|
||||
)
|
||||
|
||||
if(file("../dataforge-core").exists()) {
|
||||
includeBuild("../dataforge-core")
|
||||
includeBuild("../dataforge-core"){
|
||||
dependencySubstitution {
|
||||
substitute(module("hep.dataforge:dataforge-output")).with(project(":dataforge-output"))
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user