Compare commits
165 Commits
master
...
kotlin/2.0
Author | SHA1 | Date | |
---|---|---|---|
fd5ff5e30c | |||
51bb46a45c | |||
d0220c98a4 | |||
5038829288 | |||
e5882d01f8 | |||
d305789aa8 | |||
ec238edbd1 | |||
6dc1b9f349 | |||
1145483a90 | |||
f0db286ce6 | |||
d90c1edc6c | |||
38d6a9c419 | |||
cbf3f4941a | |||
30ad680688 | |||
629923c03a | |||
c499c3fc47 | |||
1022b74d23 | |||
58d7bd9383 | |||
067ed4aa3d | |||
30f6d51745 | |||
15ac3545b5 | |||
da0f4c0ff0 | |||
7871987df1 | |||
b5a1296070 | |||
3f144a5dbd | |||
659b9c3525 | |||
72ead21ef0 | |||
49be579bd3 | |||
4fd5c634bb | |||
8deabbcb99 | |||
60b1b1997e | |||
2e2524450d | |||
6ce1e68b86 | |||
e36e4abb7f | |||
4f6f4b9268 | |||
0c9d849e97 | |||
9c2db6d321 | |||
f40bed7bb9 | |||
c5c3868786 | |||
c0cf852c62 | |||
05b87857f4 | |||
bce61c0fb0 | |||
9fc6f1e34c | |||
|
8e5503f0d8 | ||
595512959c | |||
fbb402de90 | |||
c877fcbce3 | |||
7561ddad36 | |||
5f4972a05e | |||
469655092e | |||
80284a99ef | |||
e6bdb67262 | |||
71f7f59cb3 | |||
ed71ba9ccb | |||
7b9fe54363 | |||
f0048a4d46 | |||
c7d4bdfa5f | |||
1ea5ef86e6 | |||
399be206be | |||
64c447a37b | |||
9c1246fb26 | |||
cf6d73305b | |||
6144410d22 | |||
2578fd6f77 | |||
001efa711a | |||
1ebeefe01c | |||
8fac827acb | |||
bdc2885c0d | |||
15b7dbd057 | |||
8749c0bda7 | |||
cf4743b600 | |||
52d346453c | |||
c7640a686a | |||
00213c089d | |||
9356e34328 | |||
d44f25ad4c | |||
af2539eed2 | |||
4b91e5d62b | |||
ae12084dee | |||
35ec4bac0e | |||
ba70af3a24 | |||
20fc81305c | |||
92bfb173d8 | |||
6a801f9999 | |||
|
cd28f377ab | ||
3529d0efc6 | |||
1e29c5dbaa | |||
f5fba4747e | |||
ed491bdae0 | |||
b3f68d879f | |||
a49a4f1a7f | |||
5783cf1430 | |||
c1f275ce45 | |||
8b25761dc6 | |||
086948492c | |||
25c3a19eed | |||
ea9d37b9a1 | |||
04b4a12946 | |||
8611327cc4 | |||
f2d7e20fd3 | |||
07b54fde51 | |||
4bce9ad34c | |||
20851baaf5 | |||
a695e5e7c9 | |||
2b70afdb86 | |||
8204eb63c3 | |||
442fcb6c5b | |||
38302eac4c | |||
140c59497e | |||
23cb8765b6 | |||
a872f10523 | |||
be52551564 | |||
c4b866f5b5 | |||
d32dc3fa08 | |||
18c39fc076 | |||
f6f74b54f6 | |||
33778801b6 | |||
c48e5aac25 | |||
c921d5541b | |||
4ec611eda3 | |||
35fc7a7042 | |||
2bdaea2e82 | |||
d28873e796 | |||
fef1df3ab4 | |||
fd8f693151 | |||
c8141c6338 | |||
20b20a621f | |||
d6c974fcbc | |||
4ceffef67a | |||
279b848039 | |||
b2624cb10b | |||
eae1316de5 | |||
3c51060e2e | |||
960d17855b | |||
81aa5d2fcc | |||
f0a6e12358 | |||
56d577453a | |||
25fc143363 | |||
75540a078f | |||
40b784f551 | |||
67afa4e45b | |||
cb25dca34c | |||
98bb935de5 | |||
e2f281debe | |||
ac651c4d50 | |||
846e87a44b | |||
34fbb23c60 | |||
eeec89f0e6 | |||
43362f51f5 | |||
c586a2ea14 | |||
ecf4a6a198 | |||
0ea1ee056a | |||
9221df785d | |||
47bde02488 | |||
c71042ae06 | |||
9b1ca8332b | |||
791d6d7a81 | |||
4b1149b99b | |||
86935ce52a | |||
ce02a18c09 | |||
212d729afb | |||
3198bad094 | |||
9648533ac8 | |||
7ee40679b9 | |||
f828f86e29 |
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@ -8,15 +8,15 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 40
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3.5.3
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2.5.0
|
||||
uses: actions/setup-java@v3.12.0
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: liberica
|
||||
- name: execute build
|
||||
uses: gradle/gradle-build-action@v2
|
||||
uses: gradle/gradle-build-action@v2.7.1
|
||||
with:
|
||||
arguments: build
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -3,7 +3,11 @@
|
||||
*.iws
|
||||
out/
|
||||
.gradle
|
||||
.kotlin
|
||||
build/
|
||||
data/
|
||||
.kotlin/
|
||||
|
||||
!gradle-wrapper.jar
|
||||
|
||||
/kotlin-js-store/yarn.lock
|
||||
|
@ -1,4 +0,0 @@
|
||||
job("Build") {
|
||||
gradlew("openjdk:11", "build")
|
||||
}
|
||||
|
68
CHANGELOG.md
68
CHANGELOG.md
@ -1,6 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
@ -13,8 +14,59 @@
|
||||
|
||||
### Security
|
||||
|
||||
## [0.2.0]
|
||||
## 0.4.1 - 2024-03-15
|
||||
|
||||
### Changed
|
||||
|
||||
- VisionProperties `flowChanges()` -> `changes`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug with ElementVisionRenderer having the same name
|
||||
- Plotly update problem
|
||||
|
||||
## 0.4.0 - 2024-02-16
|
||||
|
||||
### Added
|
||||
|
||||
- Added compose-mpp rendering.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Breaking API** Move vision cache to upper level for renderers to avoid re-creating visions for page reload.
|
||||
- **Breaking API** Forms refactor.
|
||||
- **Breaking API** Migrated from React to Compose-html.
|
||||
- **Breaking API** changed js package for `visionforge-core` to `space.kscience.visionforge.html` to avoid mixing html and generic parts.
|
||||
|
||||
## 0.3.0 - 2023-12-23
|
||||
|
||||
### Added
|
||||
|
||||
- Context receivers flag
|
||||
- MeshLine for thick lines
|
||||
- Custom client-side events and thier processing in VisionServer
|
||||
- Control/input visions
|
||||
|
||||
### Changed
|
||||
|
||||
- Color accessor property is now `colorProperty`. Color uses non-nullable `invoke` instead of `set`.
|
||||
- API update for server and pages
|
||||
- Edges moved to solids module for easier construction
|
||||
- Visions **must** be rooted in order to subscribe to updates.
|
||||
- Visions use flows instead of direct subscriptions.
|
||||
- Radical change of inner workings of vision children and properties.
|
||||
- Three package changed to `three`.
|
||||
- Naming of Canvas3D options.
|
||||
- Lights are added to the scene instead of 3D options.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Jupyter integration for IDEA and Jupyter lab.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Added
|
||||
|
||||
- Server module
|
||||
- Change collector
|
||||
- Customizable accessors for colors
|
||||
@ -25,8 +77,8 @@
|
||||
- Markdown module
|
||||
- Tables module
|
||||
|
||||
|
||||
### Changed
|
||||
|
||||
- Vision does not implement ItemProvider anymore. Property changes are done via `getProperty`/`setProperty` and `property` delegate.
|
||||
- Point3D and Point2D are made separate classes instead of expect/actual (to split up different engines.
|
||||
- JavaFX support moved to a separate module
|
||||
@ -41,16 +93,10 @@
|
||||
- Property listeners are not triggered if there are no changes.
|
||||
- Feedback websocket connection in the client.
|
||||
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
- Primary modules dependencies on UI
|
||||
|
||||
|
||||
### Fixed
|
||||
|
||||
- Version conflicts
|
||||
|
||||
|
||||
### Security
|
||||
|
||||
|
130
README.md
130
README.md
@ -61,157 +61,96 @@ To learn more about DataForge, please consult the following URLs:
|
||||
|
||||
## Modules contained in this repository
|
||||
|
||||
<hr/>
|
||||
|
||||
* ### [cern-root-loader](cern-root-loader)
|
||||
>
|
||||
### [cern-root-loader](cern-root-loader)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [demo](demo)
|
||||
>
|
||||
### [demo](demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [jupyter](jupyter)
|
||||
>
|
||||
### [visionforge-compose-html](visionforge-compose-html)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [ui](ui)
|
||||
>
|
||||
### [visionforge-compose-multiplatform](visionforge-compose-multiplatform)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-core](visionforge-core)
|
||||
>
|
||||
### [visionforge-core](visionforge-core)
|
||||
>
|
||||
> **Maturity**: DEVELOPMENT
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-fx](visionforge-fx)
|
||||
>
|
||||
>
|
||||
> **Maturity**: PROTOTYPE
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-gdml](visionforge-gdml)
|
||||
>
|
||||
### [visionforge-gdml](visionforge-gdml)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-markdown](visionforge-markdown)
|
||||
>
|
||||
### [visionforge-jupyter](visionforge-jupyter)
|
||||
> Common visionforge jupyter module
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-plotly](visionforge-plotly)
|
||||
>
|
||||
### [visionforge-markdown](visionforge-markdown)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-server](visionforge-server)
|
||||
>
|
||||
### [visionforge-plotly](visionforge-plotly)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-solid](visionforge-solid)
|
||||
>
|
||||
### [visionforge-server](visionforge-server)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [visionforge-solid](visionforge-solid)
|
||||
>
|
||||
> **Maturity**: DEVELOPMENT
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-tables](visionforge-tables)
|
||||
>
|
||||
### [visionforge-tables](visionforge-tables)
|
||||
>
|
||||
> **Maturity**: PROTOTYPE
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-threejs](visionforge-threejs)
|
||||
>
|
||||
### [visionforge-threejs](visionforge-threejs)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [gdml](demo/gdml)
|
||||
>
|
||||
### [demo/compose-desktop-demo](demo/compose-desktop-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [js-playground](demo/js-playground)
|
||||
>
|
||||
### [demo/gdml](demo/gdml)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [muon-monitor](demo/muon-monitor)
|
||||
>
|
||||
### [demo/js-playground](demo/js-playground)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [playground](demo/playground)
|
||||
>
|
||||
### [demo/muon-monitor](demo/muon-monitor)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [plotly-fx](demo/plotly-fx)
|
||||
>
|
||||
### [demo/playground](demo/playground)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [sat-demo](demo/sat-demo)
|
||||
>
|
||||
### [demo/sat-demo](demo/sat-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [solid-showcase](demo/solid-showcase)
|
||||
>
|
||||
### [demo/solid-showcase](demo/solid-showcase)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-jupyter-gdml](jupyter/visionforge-jupyter-gdml)
|
||||
>
|
||||
### [visionforge-jupyter/visionforge-jupyter-common](visionforge-jupyter/visionforge-jupyter-common)
|
||||
> Jupyter api artifact including all common modules
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [bootstrap](ui/bootstrap)
|
||||
>
|
||||
### [visionforge-threejs/visionforge-threejs-server](visionforge-threejs/visionforge-threejs-server)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [react](ui/react)
|
||||
>
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [ring](ui/ring)
|
||||
>
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
* ### [visionforge-threejs-server](visionforge-threejs/visionforge-threejs-server)
|
||||
>
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
<hr/>
|
||||
|
||||
|
||||
**Class diagram:**
|
||||
@ -283,6 +222,21 @@ Visualization example for geometry defined as GDML file.
|
||||
![](docs/images/gdml-demo.png)
|
||||
|
||||
|
||||
## Stability and documentation
|
||||
|
||||
VisionForge is a modular library. Different modules provide different features with different API stability guarantees. All core modules are released with the same version, but with different API change policy. The features are described in module definitions below. The module stability could have the following levels:
|
||||
|
||||
* **PROTOTYPE**. On this level there are no compatibility guarantees. All methods and classes form those modules could break any moment. You can still use it, but be sure to fix the specific version.
|
||||
* **EXPERIMENTAL**. The general API is decided, but some changes could be made. Volatile API is marked
|
||||
with `@DFExperimental` or other stability warning annotations.
|
||||
* **DEVELOPMENT**. API breaking generally follows semantic versioning ideology. There could be changes in minor
|
||||
versions, but not in patch versions. API is protected with [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) tool.
|
||||
* **STABLE**. The API stabilized. Breaking changes are allowed only in major releases.
|
||||
|
||||
Additionally, one should note that the VisionForge Json format impacts the reproducibility of stored vision fragments. There should not be any breaks of the format between major releases. All problems should be reported.
|
||||
|
||||
The documentation for the project is a work in progress. Please report any issues with missing, vague or wrong information. The contributions into documentation are quite welcome.
|
||||
|
||||
## Thanks and references
|
||||
The original three.js bindings were made by [Lars Ivar Hatledal](https://github.com/markaren), but the project is discontinued right now.
|
||||
|
||||
|
@ -1,29 +1,48 @@
|
||||
import space.kscience.gradle.useApache2Licence
|
||||
import space.kscience.gradle.useSPCTeam
|
||||
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.project")
|
||||
id("org.jetbrains.kotlinx.kover") version "0.5.0-RC"
|
||||
id("space.kscience.gradle.project")
|
||||
id("org.jetbrains.kotlinx.kover") version "0.5.0"
|
||||
}
|
||||
|
||||
val dataforgeVersion by extra("0.5.2")
|
||||
val fxVersion by extra("11")
|
||||
val dataforgeVersion by extra("0.8.0")
|
||||
|
||||
allprojects{
|
||||
allprojects {
|
||||
group = "space.kscience"
|
||||
version = "0.2.0"
|
||||
version = "0.4.2-dev-2"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
if (name.startsWith("visionforge")) apply<MavenPublishPlugin>()
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven("https://repo.kotlin.link")
|
||||
mavenCentral()
|
||||
maven("https://maven.jzy3d.org/releases")
|
||||
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-Xcontext-receivers")
|
||||
}
|
||||
}
|
||||
|
||||
// tasks.withType<KotlinJsCompile>{
|
||||
// kotlinOptions{
|
||||
// useEsClasses = true
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
ksciencePublish {
|
||||
github("visionforge")
|
||||
space()
|
||||
pom("https://github.com/SciProgCentre/visionforge") {
|
||||
useApache2Licence()
|
||||
useSPCTeam()
|
||||
}
|
||||
repository("spc","https://maven.sciprog.center/kscience")
|
||||
sonatype()
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,77 @@
|
||||
public final class ru/mipt/npm/root/BMN {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/BMN;
|
||||
public final fun getJson ()Lkotlinx/serialization/json/Json;
|
||||
public final fun readEventJson (Ljava/lang/String;)Lru/mipt/npm/root/BmnEventContainer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/BMNKt {
|
||||
public static final fun toVector (Lru/mipt/npm/root/FairTrackParam;)Lspace/kscience/visionforge/solid/Float32Vector3D;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/BmnEventContainer {
|
||||
public fun <init> (Ljava/util/List;Ljava/util/List;)V
|
||||
public final fun getBmnGlobalTracks ()Ljava/util/List;
|
||||
public final fun getCbmTracks ()Ljava/util/List;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/BmnGlobalTrack {
|
||||
public static final field Companion Lru/mipt/npm/root/BmnGlobalTrack$Companion;
|
||||
public fun <init> (Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;)V
|
||||
public final fun component1 ()Lru/mipt/npm/root/FairTrackParam;
|
||||
public final fun component2 ()Lru/mipt/npm/root/FairTrackParam;
|
||||
public final fun copy (Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;)Lru/mipt/npm/root/BmnGlobalTrack;
|
||||
public static synthetic fun copy$default (Lru/mipt/npm/root/BmnGlobalTrack;Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;ILjava/lang/Object;)Lru/mipt/npm/root/BmnGlobalTrack;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getFParamFirst ()Lru/mipt/npm/root/FairTrackParam;
|
||||
public final fun getFParamLast ()Lru/mipt/npm/root/FairTrackParam;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/BmnGlobalTrack$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/BmnGlobalTrack$$serializer;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/BmnGlobalTrack;
|
||||
public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/BmnGlobalTrack;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/BmnGlobalTrack$Companion {
|
||||
public final fun serializer ()Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/CbmStsTrack {
|
||||
public static final field Companion Lru/mipt/npm/root/CbmStsTrack$Companion;
|
||||
public fun <init> (Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;)V
|
||||
public final fun component1 ()Lru/mipt/npm/root/FairTrackParam;
|
||||
public final fun component2 ()Lru/mipt/npm/root/FairTrackParam;
|
||||
public final fun copy (Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;)Lru/mipt/npm/root/CbmStsTrack;
|
||||
public static synthetic fun copy$default (Lru/mipt/npm/root/CbmStsTrack;Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;ILjava/lang/Object;)Lru/mipt/npm/root/CbmStsTrack;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getFParamFirst ()Lru/mipt/npm/root/FairTrackParam;
|
||||
public final fun getFParamLast ()Lru/mipt/npm/root/FairTrackParam;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/CbmStsTrack$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/CbmStsTrack$$serializer;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/CbmStsTrack;
|
||||
public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/CbmStsTrack;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/CbmStsTrack$Companion {
|
||||
public final fun serializer ()Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoBoolNode : ru/mipt/npm/root/DObject {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public final fun getFLeft ()Lru/mipt/npm/root/DGeoShape;
|
||||
@ -6,6 +80,28 @@ public final class ru/mipt/npm/root/DGeoBoolNode : ru/mipt/npm/root/DObject {
|
||||
public final fun getFRightMat ()Lru/mipt/npm/root/DGeoMatrix;
|
||||
}
|
||||
|
||||
public class ru/mipt/npm/root/DGeoCombiTrans : ru/mipt/npm/root/DGeoMatrix {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public final fun getFRotation ()Lru/mipt/npm/root/DGeoRotation;
|
||||
public final fun getFTranslation ()[D
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoGenTrans : ru/mipt/npm/root/DGeoCombiTrans {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public final fun getFScale ()[D
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoHMatrix : ru/mipt/npm/root/DGeoMatrix {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public final fun getFRotation ()Lru/mipt/npm/root/DGeoRotation;
|
||||
public final fun getFScale ()[D
|
||||
public final fun getFTranslation ()[D
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoIdentity : ru/mipt/npm/root/DGeoMatrix {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoManager : ru/mipt/npm/root/DNamed {
|
||||
public static final field Companion Lru/mipt/npm/root/DGeoManager$Companion;
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
@ -23,8 +119,8 @@ public final class ru/mipt/npm/root/DGeoMaterial : ru/mipt/npm/root/DNamed {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
}
|
||||
|
||||
public class ru/mipt/npm/root/DGeoMatrix : ru/mipt/npm/root/DNamed {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public abstract class ru/mipt/npm/root/DGeoMatrix : ru/mipt/npm/root/DNamed {
|
||||
public synthetic fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoMedium : ru/mipt/npm/root/DNamed {
|
||||
@ -38,7 +134,12 @@ public final class ru/mipt/npm/root/DGeoNode : ru/mipt/npm/root/DNamed {
|
||||
public final fun getFVolume ()Lru/mipt/npm/root/DGeoVolume;
|
||||
}
|
||||
|
||||
public class ru/mipt/npm/root/DGeoScale : ru/mipt/npm/root/DGeoMatrix {
|
||||
public final class ru/mipt/npm/root/DGeoRotation : ru/mipt/npm/root/DGeoMatrix {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public final fun getFRotationMatrix ()[D
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoScale : ru/mipt/npm/root/DGeoMatrix {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public final fun getFScale ()[D
|
||||
public final fun getX ()D
|
||||
@ -53,6 +154,11 @@ public final class ru/mipt/npm/root/DGeoShape : ru/mipt/npm/root/DNamed {
|
||||
public final fun getFDZ ()D
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoTranslation : ru/mipt/npm/root/DGeoMatrix {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public final fun getFTranslation ()[D
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DGeoVolume : ru/mipt/npm/root/DNamed, space/kscience/dataforge/misc/Named {
|
||||
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
|
||||
public final fun getFFillColor ()Ljava/lang/Integer;
|
||||
@ -94,7 +200,45 @@ public final class ru/mipt/npm/root/DObjectKt {
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/DRootToSolidKt {
|
||||
public static final fun toSolid (Lru/mipt/npm/root/DGeoManager;)Lspace/kscience/visionforge/solid/SolidGroup;
|
||||
public static final fun rootGeo (Lspace/kscience/visionforge/MutableVisionContainer;Lru/mipt/npm/root/DGeoManager;Ljava/lang/String;IZ)Lspace/kscience/visionforge/solid/SolidGroup;
|
||||
public static synthetic fun rootGeo$default (Lspace/kscience/visionforge/MutableVisionContainer;Lru/mipt/npm/root/DGeoManager;Ljava/lang/String;IZILjava/lang/Object;)Lspace/kscience/visionforge/solid/SolidGroup;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/FairTrackParam {
|
||||
public static final field Companion Lru/mipt/npm/root/FairTrackParam$Companion;
|
||||
public fun <init> (DDDDDD)V
|
||||
public final fun component1 ()D
|
||||
public final fun component2 ()D
|
||||
public final fun component3 ()D
|
||||
public final fun component4 ()D
|
||||
public final fun component5 ()D
|
||||
public final fun component6 ()D
|
||||
public final fun copy (DDDDDD)Lru/mipt/npm/root/FairTrackParam;
|
||||
public static synthetic fun copy$default (Lru/mipt/npm/root/FairTrackParam;DDDDDDILjava/lang/Object;)Lru/mipt/npm/root/FairTrackParam;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getFQp ()D
|
||||
public final fun getFTx ()D
|
||||
public final fun getFTy ()D
|
||||
public final fun getFX ()D
|
||||
public final fun getFY ()D
|
||||
public final fun getFZ ()D
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/FairTrackParam$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/FairTrackParam$$serializer;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/FairTrackParam;
|
||||
public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/FairTrackParam;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/FairTrackParam$Companion {
|
||||
public final fun serializer ()Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/RootColors {
|
||||
@ -108,7 +252,7 @@ public final class ru/mipt/npm/root/serialization/JsonToRootKt {
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/RootToSolidKt {
|
||||
public static final fun toSolid (Lru/mipt/npm/root/serialization/TGeoManager;)Lspace/kscience/visionforge/solid/SolidGroup;
|
||||
public static final fun rootGeo (Lspace/kscience/visionforge/MutableVisionContainer;Lru/mipt/npm/root/serialization/TGeoManager;)Lspace/kscience/visionforge/solid/SolidGroup;
|
||||
}
|
||||
|
||||
public class ru/mipt/npm/root/serialization/TGeoBBox : ru/mipt/npm/root/serialization/TGeoShape {
|
||||
@ -119,12 +263,11 @@ public class ru/mipt/npm/root/serialization/TGeoBBox : ru/mipt/npm/root/serializ
|
||||
public final fun getFDY ()D
|
||||
public final fun getFDZ ()D
|
||||
public final fun getFOrigin ()[D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoBBox;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoBBox;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoBBox$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoBBox$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoBBox;
|
||||
@ -145,7 +288,7 @@ public abstract class ru/mipt/npm/root/serialization/TGeoBoolNode : ru/mipt/npm/
|
||||
public final fun getFLeftMat ()Lru/mipt/npm/root/serialization/TGeoMatrix;
|
||||
public abstract fun getFRight ()Lru/mipt/npm/root/serialization/TGeoShape;
|
||||
public final fun getFRightMat ()Lru/mipt/npm/root/serialization/TGeoMatrix;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoBoolNode;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoBoolNode;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoBoolNode$Companion {
|
||||
@ -154,17 +297,14 @@ public final class ru/mipt/npm/root/serialization/TGeoBoolNode$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoCombiTrans : ru/mipt/npm/root/serialization/TGeoMatrix {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoCombiTrans$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;[DLru/mipt/npm/root/serialization/TGeoRotation;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> ([DLru/mipt/npm/root/serialization/TGeoRotation;)V
|
||||
public synthetic fun <init> ([DLru/mipt/npm/root/serialization/TGeoRotation;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFRotation ()Lru/mipt/npm/root/serialization/TGeoRotation;
|
||||
public final fun getFTranslation ()[D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoCombiTrans;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoCombiTrans$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoCombiTrans$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoCombiTrans;
|
||||
@ -180,15 +320,12 @@ public final class ru/mipt/npm/root/serialization/TGeoCombiTrans$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoCompositeShape : ru/mipt/npm/root/serialization/TGeoBBox {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoCompositeShape$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DLru/mipt/npm/root/serialization/TGeoBoolNode;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Lru/mipt/npm/root/serialization/TGeoBoolNode;)V
|
||||
public final fun getFNode ()Lru/mipt/npm/root/serialization/TGeoBoolNode;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoCompositeShape;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoCompositeShape$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoCompositeShape$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoCompositeShape;
|
||||
@ -204,17 +341,14 @@ public final class ru/mipt/npm/root/serialization/TGeoCompositeShape$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoHMatrix : ru/mipt/npm/root/serialization/TGeoMatrix {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoHMatrix$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;[D[D[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> ([D[D[D)V
|
||||
public final fun getFRotationMatrix ()[D
|
||||
public final fun getFScale ()[D
|
||||
public final fun getFTranslation ()[D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoHMatrix;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoHMatrix$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoHMatrix$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoHMatrix;
|
||||
@ -231,13 +365,10 @@ public final class ru/mipt/npm/root/serialization/TGeoHMatrix$Companion {
|
||||
public final class ru/mipt/npm/root/serialization/TGeoIdentity : ru/mipt/npm/root/serialization/TGeoMatrix {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoIdentity$Companion;
|
||||
public fun <init> ()V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoIdentity;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoIdentity$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoIdentity$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoIdentity;
|
||||
@ -253,16 +384,13 @@ public final class ru/mipt/npm/root/serialization/TGeoIdentity$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoIntersection : ru/mipt/npm/root/serialization/TGeoBoolNode {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoIntersection$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;)V
|
||||
public fun getFLeft ()Lru/mipt/npm/root/serialization/TGeoShape;
|
||||
public fun getFRight ()Lru/mipt/npm/root/serialization/TGeoShape;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoIntersection;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoIntersection$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoIntersection$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoIntersection;
|
||||
@ -279,17 +407,14 @@ public final class ru/mipt/npm/root/serialization/TGeoIntersection$Companion {
|
||||
public final class ru/mipt/npm/root/serialization/TGeoManager : ru/mipt/npm/root/serialization/TNamed {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoManager$Companion;
|
||||
public fun <init> ()V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lru/mipt/npm/root/serialization/TObjArray;Lru/mipt/npm/root/serialization/TObjArray;Lru/mipt/npm/root/serialization/TObjArray;Lru/mipt/npm/root/serialization/TObjArray;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFMatrices ()Lru/mipt/npm/root/serialization/TObjArray;
|
||||
public final fun getFNodes ()Lru/mipt/npm/root/serialization/TObjArray;
|
||||
public final fun getFShapes ()Lru/mipt/npm/root/serialization/TObjArray;
|
||||
public final fun getFVolumes ()Lru/mipt/npm/root/serialization/TObjArray;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoManager;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoManager$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoManager$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoManager;
|
||||
@ -307,12 +432,11 @@ public class ru/mipt/npm/root/serialization/TGeoMaterial : ru/mipt/npm/root/seri
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoMaterial$Companion;
|
||||
public fun <init> ()V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoMaterial;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoMaterial;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoMaterial$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoMaterial$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoMaterial;
|
||||
@ -329,7 +453,7 @@ public final class ru/mipt/npm/root/serialization/TGeoMaterial$Companion {
|
||||
public abstract class ru/mipt/npm/root/serialization/TGeoMatrix : ru/mipt/npm/root/serialization/TNamed {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoMatrix$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoMatrix;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoMatrix;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoMatrix$Companion {
|
||||
@ -338,17 +462,14 @@ public final class ru/mipt/npm/root/serialization/TGeoMatrix$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoMedium : ru/mipt/npm/root/serialization/TNamed {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoMedium$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;ILru/mipt/npm/root/serialization/TGeoMaterial;[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (ILru/mipt/npm/root/serialization/TGeoMaterial;[D)V
|
||||
public final fun getFId ()I
|
||||
public final fun getFMaterial ()Lru/mipt/npm/root/serialization/TGeoMaterial;
|
||||
public final fun getFParams ()[D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoMedium;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoMedium$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoMedium$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoMedium;
|
||||
@ -365,13 +486,10 @@ public final class ru/mipt/npm/root/serialization/TGeoMedium$Companion {
|
||||
public final class ru/mipt/npm/root/serialization/TGeoMixture : ru/mipt/npm/root/serialization/TGeoMaterial {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoMixture$Companion;
|
||||
public fun <init> ()V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoMixture;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoMixture$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoMixture$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoMixture;
|
||||
@ -394,12 +512,11 @@ public class ru/mipt/npm/root/serialization/TGeoNode : ru/mipt/npm/root/serializ
|
||||
public final fun getFNumber ()I
|
||||
public final fun getFOverlaps ()[I
|
||||
public final fun getFVolume ()Lru/mipt/npm/root/serialization/TGeoVolume;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoNode;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoNode;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoNode$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoNode$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoNode;
|
||||
@ -416,14 +533,11 @@ public final class ru/mipt/npm/root/serialization/TGeoNode$Companion {
|
||||
public final class ru/mipt/npm/root/serialization/TGeoNodeMatrix : ru/mipt/npm/root/serialization/TGeoNode {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoNodeMatrix$Companion;
|
||||
public fun <init> ()V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoVolume;II[ILru/mipt/npm/root/serialization/TGeoMatrix;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFMatrix ()Lru/mipt/npm/root/serialization/TGeoMatrix;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoNodeMatrix;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoNodeMatrix$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoNodeMatrix$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoNodeMatrix;
|
||||
@ -440,14 +554,11 @@ public final class ru/mipt/npm/root/serialization/TGeoNodeMatrix$Companion {
|
||||
public final class ru/mipt/npm/root/serialization/TGeoNodeOffset : ru/mipt/npm/root/serialization/TGeoNode {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoNodeOffset$Companion;
|
||||
public fun <init> ()V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoVolume;II[IDLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFOffset ()D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoNodeOffset;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoNodeOffset$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoNodeOffset$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoNodeOffset;
|
||||
@ -471,12 +582,11 @@ public class ru/mipt/npm/root/serialization/TGeoPcon : ru/mipt/npm/root/serializ
|
||||
public final fun getFRmax ()[D
|
||||
public final fun getFRmin ()[D
|
||||
public final fun getFZ ()[D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoPcon;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoPcon;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoPcon$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoPcon$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoPcon;
|
||||
@ -495,12 +605,11 @@ public class ru/mipt/npm/root/serialization/TGeoPgon : ru/mipt/npm/root/serializ
|
||||
public fun <init> ()V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DIDD[D[D[DILkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFNedges ()I
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoPgon;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoPgon;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoPgon$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoPgon$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoPgon;
|
||||
@ -516,15 +625,12 @@ public final class ru/mipt/npm/root/serialization/TGeoPgon$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoRotation : ru/mipt/npm/root/serialization/TGeoMatrix {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoRotation$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> ([D)V
|
||||
public final fun getFRotationMatrix ()[D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoRotation;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoRotation$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoRotation$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoRotation;
|
||||
@ -543,7 +649,7 @@ public abstract class ru/mipt/npm/root/serialization/TGeoShape : ru/mipt/npm/roo
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;ILkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFShapeBits-pVg5ArA ()I
|
||||
public final fun getFShapeId ()I
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoShape$Companion {
|
||||
@ -552,17 +658,14 @@ public final class ru/mipt/npm/root/serialization/TGeoShape$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoShapeAssembly : ru/mipt/npm/root/serialization/TGeoBBox {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoShapeAssembly$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DLru/mipt/npm/root/serialization/TGeoVolumeAssembly;ZLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;Z)V
|
||||
public synthetic fun <init> (Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFBBoxOK ()Z
|
||||
public final fun getFVolume ()Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoShapeAssembly;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoShapeAssembly$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoShapeAssembly$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoShapeAssembly;
|
||||
@ -583,16 +686,13 @@ public final class ru/mipt/npm/root/serialization/TGeoShapeRef : ru/mipt/npm/roo
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoSubtraction : ru/mipt/npm/root/serialization/TGeoBoolNode {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoSubtraction$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;)V
|
||||
public fun getFLeft ()Lru/mipt/npm/root/serialization/TGeoShape;
|
||||
public fun getFRight ()Lru/mipt/npm/root/serialization/TGeoShape;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoSubtraction;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoSubtraction$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoSubtraction$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoSubtraction;
|
||||
@ -608,15 +708,12 @@ public final class ru/mipt/npm/root/serialization/TGeoSubtraction$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoTranslation : ru/mipt/npm/root/serialization/TGeoMatrix {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoTranslation$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> ([D)V
|
||||
public final fun getFTranslation ()[D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoTranslation;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoTranslation$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoTranslation$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoTranslation;
|
||||
@ -637,12 +734,11 @@ public class ru/mipt/npm/root/serialization/TGeoTube : ru/mipt/npm/root/serializ
|
||||
public final fun getFDz ()D
|
||||
public final fun getFRmax ()D
|
||||
public final fun getFRmin ()D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoTube;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoTube;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoTube$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoTube$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoTube;
|
||||
@ -659,7 +755,6 @@ public final class ru/mipt/npm/root/serialization/TGeoTube$Companion {
|
||||
public final class ru/mipt/npm/root/serialization/TGeoTubeSeg : ru/mipt/npm/root/serialization/TGeoTube {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoTubeSeg$Companion;
|
||||
public fun <init> (DDDDDDDDD)V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DDDDDDDDDDDDDLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFC1 ()D
|
||||
public final fun getFC2 ()D
|
||||
public final fun getFCdfi ()D
|
||||
@ -669,12 +764,10 @@ public final class ru/mipt/npm/root/serialization/TGeoTubeSeg : ru/mipt/npm/root
|
||||
public final fun getFS1 ()D
|
||||
public final fun getFS2 ()D
|
||||
public final fun getFSm ()D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoTubeSeg;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoTubeSeg$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoTubeSeg$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoTubeSeg;
|
||||
@ -690,16 +783,13 @@ public final class ru/mipt/npm/root/serialization/TGeoTubeSeg$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoUnion : ru/mipt/npm/root/serialization/TGeoBoolNode {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoUnion$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;)V
|
||||
public fun getFLeft ()Lru/mipt/npm/root/serialization/TGeoShape;
|
||||
public fun getFRight ()Lru/mipt/npm/root/serialization/TGeoShape;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoUnion;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoUnion$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoUnion$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoUnion;
|
||||
@ -729,12 +819,11 @@ public class ru/mipt/npm/root/serialization/TGeoVolume : ru/mipt/npm/root/serial
|
||||
public final fun getFNumber ()I
|
||||
public final fun getFRefCount ()I
|
||||
public final fun getFShape ()Lru/mipt/npm/root/serialization/TGeoShape;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoVolume;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoVolume;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoVolume$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoVolume$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoVolume;
|
||||
@ -752,12 +841,11 @@ public class ru/mipt/npm/root/serialization/TGeoVolumeAssembly : ru/mipt/npm/roo
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoVolumeAssembly$Companion;
|
||||
public fun <init> ()V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;ILjava/lang/Integer;Lkotlin/UInt;Ljava/lang/Integer;Ljava/lang/Integer;Lru/mipt/npm/root/serialization/TObjArray;Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoMedium;IIILkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoVolumeAssembly$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoVolumeAssembly$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;
|
||||
@ -784,7 +872,6 @@ public final class ru/mipt/npm/root/serialization/TGeoVolumeRef : ru/mipt/npm/ro
|
||||
public final class ru/mipt/npm/root/serialization/TGeoXtru : ru/mipt/npm/root/serialization/TGeoBBox {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TGeoXtru$Companion;
|
||||
public fun <init> (IID[D[D[D[D[D[D)V
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DIID[D[D[D[D[D[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFNvert ()I
|
||||
public final fun getFNz ()I
|
||||
public final fun getFScale ()[D
|
||||
@ -794,12 +881,10 @@ public final class ru/mipt/npm/root/serialization/TGeoXtru : ru/mipt/npm/root/se
|
||||
public final fun getFY0 ()[D
|
||||
public final fun getFZ ()[D
|
||||
public final fun getFZcurrent ()D
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoXtru;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TGeoXtru$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoXtru$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoXtru;
|
||||
@ -815,15 +900,12 @@ public final class ru/mipt/npm/root/serialization/TGeoXtru$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/THashList : ru/mipt/npm/root/serialization/TObject {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/THashList$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/util/List;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Ljava/util/List;)V
|
||||
public final fun getArr ()Ljava/util/List;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/THashList;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/THashList$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/THashList$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/THashList;
|
||||
@ -839,15 +921,12 @@ public final class ru/mipt/npm/root/serialization/THashList$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TList : ru/mipt/npm/root/serialization/TObject {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TList$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/util/List;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Ljava/util/List;)V
|
||||
public final fun getArr ()Ljava/util/List;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TList;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TList$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TList$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TList;
|
||||
@ -867,12 +946,11 @@ public class ru/mipt/npm/root/serialization/TNamed : ru/mipt/npm/root/serializat
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFName ()Ljava/lang/String;
|
||||
public final fun getFTitle ()Ljava/lang/String;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TNamed;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TNamed;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TNamed$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field INSTANCE Lru/mipt/npm/root/serialization/TNamed$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TNamed;
|
||||
@ -888,14 +966,11 @@ public final class ru/mipt/npm/root/serialization/TNamed$Companion {
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TObjArray : ru/mipt/npm/root/serialization/TObject {
|
||||
public static final field Companion Lru/mipt/npm/root/serialization/TObjArray$Companion;
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/util/List;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Ljava/util/List;)V
|
||||
public final fun getArr ()Ljava/util/List;
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TObjArray;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TObjArray$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun <init> (Lkotlinx/serialization/KSerializer;)V
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
@ -917,7 +992,7 @@ public abstract class ru/mipt/npm/root/serialization/TObject {
|
||||
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getFBits-pVg5ArA ()I
|
||||
public final fun getFUniqueID-pVg5ArA ()I
|
||||
public static final fun write$Self (Lru/mipt/npm/root/serialization/TObject;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TObject;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/serialization/TObject$Companion {
|
||||
|
@ -1,19 +1,14 @@
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.mpp")
|
||||
id("space.kscience.gradle.mpp")
|
||||
}
|
||||
|
||||
kscience{
|
||||
jvm()
|
||||
js()
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
}
|
||||
useSerialization {
|
||||
json()
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(project(":visionforge-solid"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package ru.mipt.npm.root
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonArray
|
||||
import space.kscience.visionforge.solid.Float32Vector3D
|
||||
|
||||
|
||||
@Serializable
|
||||
public data class FairTrackParam(
|
||||
val fX: Double,
|
||||
val fY: Double,
|
||||
val fZ: Double,
|
||||
val fTx: Double,
|
||||
val fTy: Double,
|
||||
val fQp: Double,
|
||||
)
|
||||
|
||||
public fun FairTrackParam.toVector(): Float32Vector3D = Float32Vector3D(fX,fY,fZ)
|
||||
|
||||
@Serializable
|
||||
public data class CbmStsTrack(
|
||||
val fParamFirst: FairTrackParam,
|
||||
val fParamLast: FairTrackParam,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class BmnGlobalTrack(
|
||||
val fParamFirst: FairTrackParam,
|
||||
val fParamLast: FairTrackParam,
|
||||
)
|
||||
|
||||
public class BmnEventContainer(
|
||||
public val cbmTracks: List<CbmStsTrack>,
|
||||
public val bmnGlobalTracks: List<BmnGlobalTrack>,
|
||||
)
|
||||
|
||||
public object BMN {
|
||||
public val json: Json = Json {
|
||||
ignoreUnknownKeys = true
|
||||
classDiscriminator = "_typename"
|
||||
}
|
||||
|
||||
public fun readEventJson(string: String): BmnEventContainer {
|
||||
val jsonArray = json.parseToJsonElement(string) as JsonArray
|
||||
val cbmTracks: List<CbmStsTrack> =
|
||||
json.decodeFromJsonElement(ListSerializer(CbmStsTrack.serializer()), jsonArray[0])
|
||||
val bmnGlobalTracks: List<BmnGlobalTrack> =
|
||||
json.decodeFromJsonElement(ListSerializer(BmnGlobalTrack.serializer()), jsonArray[1])
|
||||
return BmnEventContainer(cbmTracks, bmnGlobalTracks)
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ import space.kscience.dataforge.meta.*
|
||||
import space.kscience.dataforge.misc.Named
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.dataforge.values.doubleArray
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
|
||||
public fun MetaProvider.doubleArray(
|
||||
@ -43,7 +42,7 @@ public open class DObject(public val meta: Meta, public val refCache: DObjectCac
|
||||
}
|
||||
|
||||
internal fun <T : DObject> tObjectArray(
|
||||
builder: (Meta, DObjectCache) -> T
|
||||
builder: (Meta, DObjectCache) -> T,
|
||||
): ReadOnlyProperty<Any?, List<T>> = ReadOnlyProperty { _, property ->
|
||||
meta.getIndexed(Name.of(property.name, "arr")).values.mapNotNull {
|
||||
resolve(builder, it)
|
||||
@ -52,9 +51,9 @@ public open class DObject(public val meta: Meta, public val refCache: DObjectCac
|
||||
|
||||
internal fun <T : DObject> dObject(
|
||||
builder: (Meta, DObjectCache) -> T,
|
||||
key: Name? = null
|
||||
key: Name? = null,
|
||||
): ReadOnlyProperty<Any?, T?> = ReadOnlyProperty { _, property ->
|
||||
meta[key ?: property.name.asName()]?.let { resolve(builder, it) }
|
||||
meta[key ?: property.name.asName()]?.takeIf { it.value != Null }?.let { resolve(builder, it) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,8 +62,7 @@ public open class DNamed(meta: Meta, refCache: DObjectCache) : DObject(meta, ref
|
||||
public val fTitle: String by meta.string("")
|
||||
}
|
||||
|
||||
public class DGeoMaterial(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache) {
|
||||
}
|
||||
public class DGeoMaterial(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache)
|
||||
|
||||
public class DGeoMedium(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache) {
|
||||
public val fMaterial: DGeoMaterial? by dObject(::DGeoMaterial)
|
||||
@ -91,27 +89,69 @@ public class DGeoNode(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCach
|
||||
public val fVolume: DGeoVolume? by dObject(::DGeoVolume)
|
||||
}
|
||||
|
||||
public open class DGeoMatrix(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache)
|
||||
public sealed class DGeoMatrix(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache)
|
||||
|
||||
public open class DGeoScale(meta: Meta, refCache: DObjectCache) : DGeoMatrix(meta, refCache) {
|
||||
public class DGeoIdentity(meta: Meta, refCache: DObjectCache) : DGeoMatrix(meta, refCache)
|
||||
|
||||
public class DGeoScale(meta: Meta, refCache: DObjectCache) : DGeoMatrix(meta, refCache) {
|
||||
public val fScale: DoubleArray by meta.doubleArray(1.0, 1.0, 1.0)
|
||||
public val x: Double get() = fScale[0]
|
||||
public val y: Double get() = fScale[1]
|
||||
public val z: Double get() = fScale[2]
|
||||
}
|
||||
|
||||
public class DGeoRotation(meta: Meta, refCache: DObjectCache) : DGeoMatrix(meta, refCache) {
|
||||
public val fRotationMatrix: DoubleArray by meta.doubleArray()
|
||||
}
|
||||
|
||||
public class DGeoTranslation(meta: Meta, refCache: DObjectCache) : DGeoMatrix(meta, refCache) {
|
||||
public val fTranslation: DoubleArray by meta.doubleArray()
|
||||
}
|
||||
|
||||
public open class DGeoCombiTrans(meta: Meta, refCache: DObjectCache) : DGeoMatrix(meta, refCache) {
|
||||
public val fRotation: DGeoRotation? by dObject(::DGeoRotation)
|
||||
public val fTranslation: DoubleArray by meta.doubleArray()
|
||||
}
|
||||
|
||||
public class DGeoGenTrans(meta: Meta, refCache: DObjectCache) : DGeoCombiTrans(meta, refCache) {
|
||||
public val fScale: DoubleArray by meta.doubleArray()
|
||||
}
|
||||
|
||||
public class DGeoHMatrix(meta: Meta, refCache: DObjectCache) : DGeoMatrix(meta, refCache) {
|
||||
public val fRotation: DGeoRotation? by dObject(::DGeoRotation)
|
||||
public val fTranslation: DoubleArray by meta.doubleArray()
|
||||
public val fScale: DoubleArray by meta.doubleArray()
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a specialized version of [DGeoMatrix]
|
||||
*/
|
||||
internal fun dGeoMatrix(
|
||||
meta: Meta,
|
||||
refCache: DObjectCache,
|
||||
): DGeoMatrix = when (val typename = meta["_typename"].string) {
|
||||
null -> error("Type name is undefined")
|
||||
"TGeoIdentity" -> DGeoIdentity(meta, refCache)
|
||||
"TGeoScale" -> DGeoScale(meta, refCache)
|
||||
"TGeoRotation" -> DGeoRotation(meta, refCache)
|
||||
"TGeoTranslation" -> DGeoTranslation(meta, refCache)
|
||||
"TGeoCombiTrans" -> DGeoCombiTrans(meta, refCache)
|
||||
"TGeoGenTrans" -> DGeoGenTrans(meta, refCache)
|
||||
"TGeoHMatrix" -> DGeoHMatrix(meta, refCache)
|
||||
else -> error("$typename is not a member of TGeoMatrix")
|
||||
}
|
||||
|
||||
public class DGeoBoolNode(meta: Meta, refCache: DObjectCache) : DObject(meta, refCache) {
|
||||
public val fLeft: DGeoShape? by dObject(::DGeoShape)
|
||||
public val fLeftMat: DGeoMatrix? by dObject(::DGeoMatrix)
|
||||
public val fLeftMat: DGeoMatrix? by dObject(::dGeoMatrix)
|
||||
|
||||
public val fRight: DGeoShape? by dObject(::DGeoShape)
|
||||
public val fRightMat: DGeoMatrix? by dObject(::DGeoMatrix)
|
||||
public val fRightMat: DGeoMatrix? by dObject(::dGeoMatrix)
|
||||
}
|
||||
|
||||
|
||||
public class DGeoManager(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache) {
|
||||
public val fMatrices: List<DGeoMatrix> by tObjectArray(::DGeoMatrix)
|
||||
public val fMatrices: List<DGeoMatrix> by tObjectArray(::dGeoMatrix)
|
||||
|
||||
public val fShapes: List<DGeoShape> by tObjectArray(::DGeoShape)
|
||||
|
||||
|
@ -2,12 +2,19 @@ package ru.mipt.npm.root
|
||||
|
||||
import space.kscience.dataforge.meta.*
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.parseAsName
|
||||
import space.kscience.dataforge.names.plus
|
||||
import space.kscience.dataforge.values.doubleArray
|
||||
import space.kscience.dataforge.names.withIndex
|
||||
import space.kscience.kmath.complex.Quaternion
|
||||
import space.kscience.kmath.geometry.fromRotationMatrix
|
||||
import space.kscience.kmath.linear.VirtualMatrix
|
||||
import space.kscience.visionforge.MutableVisionContainer
|
||||
import space.kscience.visionforge.isEmpty
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.SolidMaterial.Companion.MATERIAL_COLOR_KEY
|
||||
import kotlin.math.*
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
private val volumesName = Name.EMPTY //"volumes".asName()
|
||||
|
||||
@ -20,51 +27,48 @@ private fun degToRad(d: Double) = d * PI / 180.0
|
||||
private data class RootToSolidContext(
|
||||
val prototypeHolder: PrototypeHolder,
|
||||
val currentLayer: Int = 0,
|
||||
val maxLayer: Int = 5
|
||||
val maxLayer: Int = 5,
|
||||
val ignoreRootColors: Boolean = false,
|
||||
val colorCache: MutableMap<Meta, String> = mutableMapOf(),
|
||||
)
|
||||
|
||||
// converting to XYZ to Tait–Bryan angles according to https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix
|
||||
// apply rotation from a matrix
|
||||
private fun Solid.rotate(rot: DoubleArray) {
|
||||
val xAngle = atan2(-rot[5], rot[8])
|
||||
val yAngle = atan2(rot[2], sqrt(1.0 - rot[2].pow(2)))
|
||||
val zAngle = atan2(-rot[1], rot[0])
|
||||
rotation = Point3D(xAngle, yAngle, zAngle)
|
||||
val matrix = VirtualMatrix(3, 3) { i, j -> rot[i * 3 + j] }
|
||||
quaternion = Quaternion.fromRotationMatrix(matrix)
|
||||
}
|
||||
|
||||
private fun Solid.translate(trans: DoubleArray) {
|
||||
val (x, y, z) = trans
|
||||
position = Point3D(x, y, z)
|
||||
position = Float32Vector3D(x, y, z)
|
||||
}
|
||||
|
||||
private fun Solid.useMatrix(matrix: DGeoMatrix?) {
|
||||
if (matrix == null) return
|
||||
when (matrix.typename) {
|
||||
"TGeoIdentity" -> {
|
||||
//do nothing
|
||||
}
|
||||
"TGeoTranslation" -> {
|
||||
val fTranslation by matrix.meta.doubleArray()
|
||||
translate(fTranslation)
|
||||
}
|
||||
"TGeoRotation" -> {
|
||||
val fRotationMatrix by matrix.meta.doubleArray()
|
||||
rotate(fRotationMatrix)
|
||||
}
|
||||
"TGeoCombiTrans" -> {
|
||||
val fTranslation by matrix.meta.doubleArray()
|
||||
private fun Solid.scale(s: DoubleArray) {
|
||||
scale = Float32Vector3D(s[0], s[1], s[2])
|
||||
}
|
||||
|
||||
translate(fTranslation)
|
||||
matrix.meta["fRotation.fRotationMatrix"]?.value?.let {
|
||||
rotate(it.doubleArray)
|
||||
}
|
||||
private fun Solid.useMatrix(matrix: DGeoMatrix?): Unit {
|
||||
when (matrix) {
|
||||
null -> {}
|
||||
is DGeoIdentity -> {}
|
||||
is DGeoTranslation -> translate(matrix.fTranslation)
|
||||
is DGeoRotation -> rotate(matrix.fRotationMatrix)
|
||||
is DGeoScale -> scale(matrix.fScale)
|
||||
is DGeoGenTrans -> {
|
||||
translate(matrix.fTranslation)
|
||||
matrix.fRotation?.fRotationMatrix?.let { rotate(it) }
|
||||
scale(matrix.fScale)
|
||||
}
|
||||
"TGeoHMatrix" -> {
|
||||
val fTranslation by matrix.meta.doubleArray()
|
||||
val fRotationMatrix by matrix.meta.doubleArray()
|
||||
val fScale by matrix.meta.doubleArray()
|
||||
translate(fTranslation)
|
||||
rotate(fRotationMatrix)
|
||||
scale = Point3D(fScale[0], fScale[1], fScale[2])
|
||||
|
||||
is DGeoCombiTrans -> {
|
||||
translate(matrix.fTranslation)
|
||||
matrix.fRotation?.fRotationMatrix?.let { rotate(it) }
|
||||
}
|
||||
|
||||
is DGeoHMatrix -> {
|
||||
translate(matrix.fTranslation)
|
||||
matrix.fRotation?.fRotationMatrix?.let { rotate(it) }
|
||||
scale(matrix.fScale)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,7 +77,7 @@ private fun SolidGroup.addShape(
|
||||
shape: DGeoShape,
|
||||
context: RootToSolidContext,
|
||||
name: String? = shape.fName.ifEmpty { null },
|
||||
block: Solid.() -> Unit = {}
|
||||
block: Solid.() -> Unit = {},
|
||||
) {
|
||||
when (shape.typename) {
|
||||
"TGeoCompositeShape" -> {
|
||||
@ -87,13 +91,14 @@ private fun SolidGroup.addShape(
|
||||
}
|
||||
smartComposite(compositeType, name = name) {
|
||||
addShape(node.fLeft!!, context, null) {
|
||||
this.useMatrix(node.fLeftMat)
|
||||
useMatrix(node.fLeftMat)
|
||||
}
|
||||
addShape(node.fRight!!, context, null) {
|
||||
this.useMatrix(node.fRightMat)
|
||||
useMatrix(node.fRightMat)
|
||||
}
|
||||
}.apply(block)
|
||||
}
|
||||
|
||||
"TGeoXtru" -> {
|
||||
val fNvert by shape.meta.int(0)
|
||||
val fX by shape.meta.doubleArray()
|
||||
@ -105,8 +110,8 @@ private fun SolidGroup.addShape(
|
||||
val fScale by shape.meta.doubleArray()
|
||||
|
||||
extruded(name = name) {
|
||||
(0 until fNvert).forEach { index ->
|
||||
shape {
|
||||
shape {
|
||||
(0 until fNvert).forEach { index ->
|
||||
point(fX[index], fY[index])
|
||||
}
|
||||
}
|
||||
@ -121,6 +126,7 @@ private fun SolidGroup.addShape(
|
||||
}
|
||||
}.apply(block)
|
||||
}
|
||||
|
||||
"TGeoTube" -> {
|
||||
val fRmax by shape.meta.double(0.0)
|
||||
val fDz by shape.meta.double(0.0)
|
||||
@ -134,6 +140,7 @@ private fun SolidGroup.addShape(
|
||||
block = block
|
||||
)
|
||||
}
|
||||
|
||||
"TGeoTubeSeg" -> {
|
||||
val fRmax by shape.meta.double(0.0)
|
||||
val fDz by shape.meta.double(0.0)
|
||||
@ -151,6 +158,7 @@ private fun SolidGroup.addShape(
|
||||
block = block
|
||||
)
|
||||
}
|
||||
|
||||
"TGeoPcon" -> {
|
||||
val fDphi by shape.meta.double(0.0)
|
||||
val fNz by shape.meta.int(2)
|
||||
@ -170,14 +178,14 @@ private fun SolidGroup.addShape(
|
||||
name = name,
|
||||
) {
|
||||
z = (fZ[1] + fZ[0]) / 2
|
||||
|
||||
}.apply(block)
|
||||
} else {
|
||||
TODO()
|
||||
TODO("Polycone is not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
"TGeoPgon" -> {
|
||||
//TODO add a inner polygone layer
|
||||
|
||||
val fDphi by shape.meta.double(0.0)
|
||||
val fNz by shape.meta.int(2)
|
||||
val fPhi1 by shape.meta.double(360.0)
|
||||
@ -190,31 +198,41 @@ private fun SolidGroup.addShape(
|
||||
val startphi = degToRad(fPhi1)
|
||||
val deltaphi = degToRad(fDphi)
|
||||
|
||||
extruded(name) {
|
||||
fun Shape2DBuilder.pGon(radius: Double){
|
||||
(0..<fNedges).forEach {
|
||||
val phi = deltaphi / fNedges * it + startphi
|
||||
point(radius * cos(phi), radius * sin(phi))
|
||||
}
|
||||
}
|
||||
|
||||
surface(name) {
|
||||
//getting the radius of first
|
||||
require(fNz > 1) { "The polyhedron geometry requires at least two planes" }
|
||||
val baseRadius = fRmax[0]
|
||||
shape {
|
||||
(0..fNedges).forEach {
|
||||
val phi = deltaphi * fNedges * it + startphi
|
||||
(baseRadius * cos(phi) to baseRadius * sin(phi))
|
||||
}
|
||||
}
|
||||
(0 until fNz).forEach { index ->
|
||||
//scaling all radii relative to first layer radius
|
||||
layer(fZ[index], scale = fRmax[index] / baseRadius)
|
||||
for (index in 0 until fNz){
|
||||
layer(
|
||||
fZ[index],
|
||||
innerBuilder = {
|
||||
pGon(fRmin[index])
|
||||
},
|
||||
outerBuilder = {
|
||||
pGon(fRmax[index])
|
||||
}
|
||||
)
|
||||
}
|
||||
}.apply(block)
|
||||
}
|
||||
|
||||
"TGeoShapeAssembly" -> {
|
||||
val fVolume by shape.dObject(::DGeoVolume)
|
||||
fVolume?.let { volume ->
|
||||
addRootVolume(volume, context, block = block)
|
||||
addRootVolume(volume, context, name = volume.fName.ifEmpty { null }, block = block)
|
||||
}
|
||||
}
|
||||
|
||||
"TGeoBBox" -> {
|
||||
box(shape.fDX * 2, shape.fDY * 2, shape.fDZ * 2, name = name, block = block)
|
||||
}
|
||||
|
||||
"TGeoTrap" -> {
|
||||
val fTheta by shape.meta.double(0.0)
|
||||
val fPhi by shape.meta.double(0.0)
|
||||
@ -232,27 +250,67 @@ private fun SolidGroup.addShape(
|
||||
|
||||
val fDz by shape.meta.double(0.0)
|
||||
//TODO check proper node order
|
||||
val node1 = Point3D(-fBl1, -fH1, -fDz)
|
||||
val node2 = Point3D(fBl1, -fH1, -fDz)
|
||||
val node3 = Point3D(fTl1, fH1, -fDz)
|
||||
val node4 = Point3D(-fTl1, fH1, -fDz)
|
||||
val node5 = Point3D(-fBl2, -fH2, fDz)
|
||||
val node6 = Point3D(fBl2, -fH2, fDz)
|
||||
val node7 = Point3D(fTl2, fH2, fDz)
|
||||
val node8 = Point3D(-fTl2, fH2, fDz)
|
||||
val node1 = Float32Vector3D(-fBl1, -fH1, -fDz)
|
||||
val node2 = Float32Vector3D(fBl1, -fH1, -fDz)
|
||||
val node3 = Float32Vector3D(fTl1, fH1, -fDz)
|
||||
val node4 = Float32Vector3D(-fTl1, fH1, -fDz)
|
||||
val node5 = Float32Vector3D(-fBl2, -fH2, fDz)
|
||||
val node6 = Float32Vector3D(fBl2, -fH2, fDz)
|
||||
val node7 = Float32Vector3D(fTl2, fH2, fDz)
|
||||
val node8 = Float32Vector3D(-fTl2, fH2, fDz)
|
||||
hexagon(node1, node2, node3, node4, node5, node6, node7, node8, name)
|
||||
}
|
||||
|
||||
"TGeoScaledShape" -> {
|
||||
val fShape by shape.dObject(::DGeoShape)
|
||||
val fScale by shape.dObject(::DGeoScale)
|
||||
fShape?.let { scaledShape ->
|
||||
group(name?.let { Name.parse(it) }) {
|
||||
scale = Point3D(fScale?.x ?: 1.0, fScale?.y ?: 1.0, fScale?.z ?: 1.0)
|
||||
solidGroup(name?.let { Name.parse(it) }) {
|
||||
scale = Float32Vector3D(fScale?.x ?: 1.0, fScale?.y ?: 1.0, fScale?.z ?: 1.0)
|
||||
addShape(scaledShape, context)
|
||||
apply(block)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"TGeoCone" -> {
|
||||
val fDz by shape.meta.double(0.0)
|
||||
val fRmin1 by shape.meta.double(0.0)
|
||||
val fRmax1 by shape.meta.double(0.0)
|
||||
val fRmin2 by shape.meta.double(0.0)
|
||||
val fRmax2 by shape.meta.double(0.0)
|
||||
|
||||
coneSurface(
|
||||
bottomOuterRadius = fRmax1,
|
||||
bottomInnerRadius = fRmin1,
|
||||
height = fDz * 2.0,
|
||||
topOuterRadius = fRmax2,
|
||||
topInnerRadius = fRmin2,
|
||||
name = name,
|
||||
)
|
||||
}
|
||||
|
||||
"TGeoCtub" -> {
|
||||
val fRmin by shape.meta.double(0.0)
|
||||
val fRmax by shape.meta.double(0.0)
|
||||
val fDz by shape.meta.double(0.0)
|
||||
val fPhi1 by shape.meta.double(0.0)
|
||||
val fPhi2 by shape.meta.double(PI2.toDouble())
|
||||
val fNlow by shape.meta.doubleArray()
|
||||
val fNhigh by shape.meta.doubleArray()
|
||||
|
||||
cutTube(
|
||||
outerRadius = fRmax,
|
||||
innerRadius = fRmin,
|
||||
height = fDz * 2.0,
|
||||
startAngle = degToRad(fPhi1),
|
||||
angle = degToRad(fPhi2 - fPhi1),
|
||||
topNormal = Float32Vector3D(fNhigh[0], fNhigh[1], fNhigh[2]),
|
||||
bottomNormal = Float32Vector3D(fNlow[0], fNlow[1], fNlow[2]),
|
||||
name = name,
|
||||
)
|
||||
}
|
||||
|
||||
else -> {
|
||||
TODO("A shape with type ${shape.typename} not implemented")
|
||||
}
|
||||
@ -264,9 +322,10 @@ private fun SolidGroup.addRootNode(obj: DGeoNode, context: RootToSolidContext) {
|
||||
addRootVolume(volume, context, obj.fName) {
|
||||
when (obj.typename) {
|
||||
"TGeoNodeMatrix" -> {
|
||||
val fMatrix by obj.dObject(::DGeoMatrix)
|
||||
val fMatrix by obj.dObject(::dGeoMatrix)
|
||||
this.useMatrix(fMatrix)
|
||||
}
|
||||
|
||||
"TGeoNodeOffset" -> {
|
||||
val fOffset by obj.meta.double(0.0)
|
||||
x = fOffset
|
||||
@ -276,12 +335,12 @@ private fun SolidGroup.addRootNode(obj: DGeoNode, context: RootToSolidContext) {
|
||||
}
|
||||
|
||||
private fun buildVolume(volume: DGeoVolume, context: RootToSolidContext): Solid? {
|
||||
val group = SolidGroup {
|
||||
val group = SolidGroup().apply {
|
||||
//set current layer
|
||||
layer = context.currentLayer
|
||||
val nodes = volume.fNodes
|
||||
|
||||
if (nodes.isEmpty() || context.currentLayer >= context.maxLayer) {
|
||||
if (volume.typename != "TGeoVolumeAssembly" && (nodes.isEmpty() || context.currentLayer >= context.maxLayer)) {
|
||||
//TODO add smart filter
|
||||
volume.fShape?.let { shape ->
|
||||
addShape(shape, context)
|
||||
@ -301,12 +360,22 @@ private fun buildVolume(volume: DGeoVolume, context: RootToSolidContext): Solid?
|
||||
}
|
||||
}
|
||||
}
|
||||
return if (group.isEmpty()) {
|
||||
return if (group.children.isEmpty()) {
|
||||
null
|
||||
} else if (group.children.size == 1 && group.meta.isEmpty()) {
|
||||
(group.children.values.first() as Solid).apply { parent = null }
|
||||
} else if (group.items.size == 1 && group.properties.own.isEmpty()) {
|
||||
group.items.values.first().apply { parent = null }
|
||||
} else {
|
||||
group
|
||||
}.apply {
|
||||
volume.fMedium?.let { medium ->
|
||||
color(context.colorCache.getOrPut(medium.meta) { RootColors[11 + context.colorCache.size] })
|
||||
}
|
||||
|
||||
if (!context.ignoreRootColors) {
|
||||
volume.fFillColor?.let {
|
||||
properties[MATERIAL_COLOR_KEY] = RootColors[it]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,46 +386,42 @@ private fun SolidGroup.addRootVolume(
|
||||
context: RootToSolidContext,
|
||||
name: String? = null,
|
||||
cache: Boolean = true,
|
||||
block: Solid.() -> Unit = {}
|
||||
block: Solid.() -> Unit = {},
|
||||
) {
|
||||
val combinedName = if (volume.fName.isEmpty()) {
|
||||
name
|
||||
} else if (name == null) {
|
||||
volume.fName
|
||||
} else {
|
||||
"${name}_${volume.fName}"
|
||||
val combinedName = name?.parseAsName()?.let {
|
||||
// this fix is required to work around malformed root files with duplicated node names
|
||||
if (get(it) != null) {
|
||||
it.withIndex(volume.hashCode().toString(16))
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
|
||||
if (!cache) {
|
||||
val group = buildVolume(volume, context)?.apply {
|
||||
volume.fFillColor?.let {
|
||||
meta[MATERIAL_COLOR_KEY] = RootColors[it]
|
||||
}
|
||||
block()
|
||||
}
|
||||
set(combinedName?.let { Name.parse(it) }, group)
|
||||
val group = buildVolume(volume, context)?.apply(block) ?: return
|
||||
setChild(combinedName, group)
|
||||
} else {
|
||||
val templateName = volumesName + volume.name
|
||||
val existing = getPrototype(templateName)
|
||||
val existing = context.prototypeHolder.getPrototype(templateName)
|
||||
if (existing == null) {
|
||||
context.prototypeHolder.prototypes {
|
||||
val group = buildVolume(volume, context)
|
||||
set(templateName, group)
|
||||
val group = buildVolume(volume, context) ?: return@prototypes
|
||||
setChild(templateName, group)
|
||||
}
|
||||
}
|
||||
|
||||
ref(templateName, name).apply {
|
||||
volume.fFillColor?.let {
|
||||
meta[MATERIAL_COLOR_KEY] = RootColors[it]
|
||||
}
|
||||
block()
|
||||
}
|
||||
ref(templateName, combinedName).apply(block)
|
||||
}
|
||||
}
|
||||
|
||||
public fun DGeoManager.toSolid(): SolidGroup = SolidGroup {
|
||||
val context = RootToSolidContext(this)
|
||||
fNodes.forEach { node ->
|
||||
public fun MutableVisionContainer<Solid>.rootGeo(
|
||||
dGeoManager: DGeoManager,
|
||||
name: String? = null,
|
||||
maxLayer: Int = 5,
|
||||
ignoreRootColors: Boolean = false,
|
||||
): SolidGroup = solidGroup(name = name?.parseAsName()) {
|
||||
val context = RootToSolidContext(this, maxLayer = maxLayer, ignoreRootColors = ignoreRootColors)
|
||||
dGeoManager.fNodes.forEach { node ->
|
||||
addRootNode(node, context)
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package ru.mipt.npm.root
|
||||
|
||||
public object RootColors {
|
||||
private val colorMap = Array<String>(924) { "white" }
|
||||
private val colorMap = MutableList(924) { "white" }
|
||||
|
||||
//colorMap[110] = "white"
|
||||
|
||||
|
@ -12,9 +12,10 @@ import kotlinx.serialization.modules.polymorphic
|
||||
import kotlinx.serialization.modules.subclass
|
||||
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
private fun <T> jsonRootDeserializer(
|
||||
tSerializer: KSerializer<T>,
|
||||
builder: (JsonElement) -> T
|
||||
builder: (JsonElement) -> T,
|
||||
): DeserializationStrategy<T> = object :
|
||||
DeserializationStrategy<T> {
|
||||
private val jsonElementSerializer = JsonElement.serializer()
|
||||
@ -46,6 +47,7 @@ private object RootDecoder {
|
||||
private val refCache: List<RefEntry>,
|
||||
) : KSerializer<T> by tSerializer {
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun deserialize(decoder: Decoder): T {
|
||||
val input = decoder as JsonDecoder
|
||||
@ -82,7 +84,7 @@ private object RootDecoder {
|
||||
|
||||
return ref.getOrPutValue {
|
||||
// println("Decoding $it")
|
||||
val actualTypeName = it.jsonObject["_typename"]?.jsonPrimitive?.content
|
||||
// val actualTypeName = it.jsonObject["_typename"]?.jsonPrimitive?.content
|
||||
input.json.decodeFromJsonElement(tSerializer, it)
|
||||
}
|
||||
}
|
||||
@ -90,9 +92,8 @@ private object RootDecoder {
|
||||
|
||||
private fun <T> KSerializer<T>.unref(refCache: List<RefEntry>): KSerializer<T> = RootUnrefSerializer(this, refCache)
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
fun unrefSerializersModule(
|
||||
refCache: List<RefEntry>
|
||||
refCache: List<RefEntry>,
|
||||
): SerializersModule = SerializersModule {
|
||||
|
||||
contextual(TObjArray::class) {
|
||||
@ -118,7 +119,7 @@ private object RootDecoder {
|
||||
subclass(TGeoCompositeShape.serializer().unref(refCache))
|
||||
subclass(TGeoShapeAssembly.serializer().unref(refCache))
|
||||
|
||||
default {
|
||||
defaultDeserializer {
|
||||
if (it == null) {
|
||||
TGeoShape.serializer().unref(refCache)
|
||||
} else {
|
||||
@ -136,7 +137,7 @@ private object RootDecoder {
|
||||
|
||||
|
||||
val unrefed = TGeoMatrix.serializer().unref(refCache)
|
||||
default {
|
||||
defaultDeserializer {
|
||||
if (it == null) {
|
||||
unrefed
|
||||
} else {
|
||||
@ -149,7 +150,7 @@ private object RootDecoder {
|
||||
subclass(TGeoVolumeAssembly.serializer().unref(refCache))
|
||||
|
||||
val unrefed = TGeoVolume.serializer().unref(refCache)
|
||||
default {
|
||||
defaultDeserializer {
|
||||
if (it == null) {
|
||||
unrefed
|
||||
} else {
|
||||
@ -163,7 +164,7 @@ private object RootDecoder {
|
||||
subclass(TGeoNodeOffset.serializer().unref(refCache))
|
||||
|
||||
val unrefed = TGeoNode.serializer().unref(refCache)
|
||||
default {
|
||||
defaultDeserializer {
|
||||
if (it == null) {
|
||||
unrefed
|
||||
} else {
|
||||
@ -197,11 +198,13 @@ private object RootDecoder {
|
||||
fillCache(it)
|
||||
}
|
||||
}
|
||||
|
||||
is JsonArray -> {
|
||||
element.forEach {
|
||||
fillCache(it)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
//ignore primitives
|
||||
}
|
||||
@ -216,6 +219,7 @@ private object RootDecoder {
|
||||
|
||||
var value: Any? = null
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <T> getOrPutValue(builder: (JsonElement) -> T): T {
|
||||
if (value == null) {
|
||||
value = builder(element)
|
||||
|
@ -3,6 +3,7 @@ package ru.mipt.npm.root.serialization
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.dataforge.names.plus
|
||||
import space.kscience.visionforge.MutableVisionContainer
|
||||
import space.kscience.visionforge.solid.*
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.atan2
|
||||
@ -24,12 +25,12 @@ private fun Solid.rotate(rot: DoubleArray) {
|
||||
val xAngle = atan2(-rot[5], rot[8])
|
||||
val yAngle = atan2(rot[2], sqrt(1.0 - rot[2].pow(2)))
|
||||
val zAngle = atan2(-rot[1], rot[0])
|
||||
rotation = Point3D(xAngle, yAngle, zAngle)
|
||||
rotation = Float32Vector3D(xAngle, yAngle, zAngle)
|
||||
}
|
||||
|
||||
private fun Solid.translate(trans: DoubleArray) {
|
||||
val (x, y, z) = trans
|
||||
position = Point3D(x, y, z)
|
||||
position = Float32Vector3D(x, y, z)
|
||||
}
|
||||
|
||||
private fun Solid.useMatrix(matrix: TGeoMatrix?) {
|
||||
@ -51,7 +52,7 @@ private fun Solid.useMatrix(matrix: TGeoMatrix?) {
|
||||
translate(matrix.fTranslation)
|
||||
rotate(matrix.fRotationMatrix)
|
||||
val (xScale, yScale, zScale) = matrix.fScale
|
||||
scale = Point3D(xScale, yScale, zScale)
|
||||
scale = Float32Vector3D(xScale, yScale, zScale)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,7 +133,7 @@ private fun buildGroup(volume: TGeoVolume): SolidGroup {
|
||||
return if (volume is TGeoVolumeAssemblyRef) {
|
||||
buildGroup(volume.value)
|
||||
} else {
|
||||
SolidGroup {
|
||||
SolidGroup().apply {
|
||||
volume.fShape?.let { addShape(it) }
|
||||
volume.fNodes?.let {
|
||||
it.arr.forEach { obj ->
|
||||
@ -160,7 +161,7 @@ private fun SolidGroup.volume(volume: TGeoVolume, name: String? = null, cache: B
|
||||
name = combinedName,
|
||||
obj = group,
|
||||
prototypeHolder = rootPrototypes,
|
||||
templateName = volumesName + Name.parse(combinedName ?: "volume[${group.hashCode()}]")
|
||||
prototypeName = volumesName + Name.parse(combinedName ?: "volume[${group.hashCode()}]")
|
||||
)
|
||||
}
|
||||
|
||||
@ -180,8 +181,8 @@ private fun SolidGroup.volume(volume: TGeoVolume, name: String? = null, cache: B
|
||||
// }
|
||||
|
||||
|
||||
public fun TGeoManager.toSolid(): SolidGroup = SolidGroup {
|
||||
fNodes.arr.forEach {
|
||||
public fun MutableVisionContainer<Solid>.rootGeo(tGeoManager: TGeoManager): SolidGroup = solidGroup {
|
||||
tGeoManager.fNodes.arr.forEach {
|
||||
node(it)
|
||||
}
|
||||
}
|
11
demo/build.gradle.kts
Normal file
11
demo/build.gradle.kts
Normal file
@ -0,0 +1,11 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
|
||||
|
||||
subprojects {
|
||||
plugins.withType<KotlinPluginWrapper> {
|
||||
configure<KotlinProjectExtension> {
|
||||
explicitApi = ExplicitApiMode.Disabled
|
||||
}
|
||||
}
|
||||
}
|
4
demo/compose-desktop-demo/README.md
Normal file
4
demo/compose-desktop-demo/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Module compose-desktop-demo
|
||||
|
||||
|
||||
|
17
demo/compose-desktop-demo/api/compose-desktop-demo.api
Normal file
17
demo/compose-desktop-demo/api/compose-desktop-demo.api
Normal file
@ -0,0 +1,17 @@
|
||||
public final class ComposableSingletons$MainKt {
|
||||
public static final field INSTANCE LComposableSingletons$MainKt;
|
||||
public static field lambda-1 Lkotlin/jvm/functions/Function2;
|
||||
public static field lambda-2 Lkotlin/jvm/functions/Function3;
|
||||
public static field lambda-3 Lkotlin/jvm/functions/Function3;
|
||||
public fun <init> ()V
|
||||
public final fun getLambda-1$compose_desktop_demo ()Lkotlin/jvm/functions/Function2;
|
||||
public final fun getLambda-2$compose_desktop_demo ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getLambda-3$compose_desktop_demo ()Lkotlin/jvm/functions/Function3;
|
||||
}
|
||||
|
||||
public final class MainKt {
|
||||
public static final fun App (Landroidx/compose/runtime/Composer;I)V
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
40
demo/compose-desktop-demo/build.gradle.kts
Normal file
40
demo/compose-desktop-demo/build.gradle.kts
Normal file
@ -0,0 +1,40 @@
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
alias(spclibs.plugins.compose)
|
||||
}
|
||||
|
||||
kscience {
|
||||
jvm()
|
||||
useCoroutines()
|
||||
|
||||
commonMain{
|
||||
implementation(projects.visionforgeSolid)
|
||||
}
|
||||
|
||||
jvmMain {
|
||||
implementation(projects.visionforgeComposeMultiplatform)
|
||||
}
|
||||
}
|
||||
|
||||
kotlin{
|
||||
explicitApi = null
|
||||
sourceSets{
|
||||
commonMain{
|
||||
dependencies {
|
||||
implementation(compose.desktop.currentOs)
|
||||
api(compose.preview)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
compose{
|
||||
desktop{
|
||||
desktop {
|
||||
application {
|
||||
mainClass = "MainKt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
demo/compose-desktop-demo/src/jvmMain/kotlin/main.kt
Normal file
33
demo/compose-desktop-demo/src/jvmMain/kotlin/main.kt
Normal file
@ -0,0 +1,33 @@
|
||||
import androidx.compose.desktop.ui.tooling.preview.Preview
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.window.Window
|
||||
import androidx.compose.ui.window.application
|
||||
import space.kscience.dataforge.meta.set
|
||||
import space.kscience.visionforge.compose.PropertyEditor
|
||||
import space.kscience.visionforge.solid.specifications.Canvas3DOptions
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun App(){
|
||||
val options = remember {
|
||||
Canvas3DOptions{
|
||||
meta["custom.field"] = 32
|
||||
}
|
||||
}
|
||||
PropertyEditor(
|
||||
properties = options.meta,
|
||||
descriptor = Canvas3DOptions.descriptor,
|
||||
expanded = true
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun main() = application {
|
||||
Window(onCloseRequest = ::exitApplication) {
|
||||
MaterialTheme {
|
||||
App()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +1,3 @@
|
||||
public final class space/kscience/visionforge/gdml/demo/GDMLDemoApp : tornadofx/App {
|
||||
public fun <init> ()V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/gdml/demo/GDMLView : tornadofx/View {
|
||||
public static final field Companion Lspace/kscience/visionforge/gdml/demo/GDMLView$Companion;
|
||||
public fun <init> ()V
|
||||
public fun getRoot ()Ljavafx/scene/Parent;
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/gdml/demo/GDMLView$Companion {
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/gdml/demo/GdmlFxDemoAppKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/gdml/demo/ReadFileKt {
|
||||
public static final fun readFile (Lspace/kscience/visionforge/VisionManager;Ljava/io/File;)Lspace/kscience/visionforge/Vision;
|
||||
public static final fun readFile (Lspace/kscience/visionforge/VisionManager;Ljava/lang/String;)Lspace/kscience/visionforge/Vision;
|
||||
|
@ -1,60 +1,46 @@
|
||||
import ru.mipt.npm.gradle.DependencyConfiguration
|
||||
import ru.mipt.npm.gradle.FXModule
|
||||
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.mpp")
|
||||
application
|
||||
id("space.kscience.gradle.mpp")
|
||||
alias(spclibs.plugins.compose)
|
||||
}
|
||||
|
||||
group = "demo"
|
||||
|
||||
kscience {
|
||||
val fxVersion: String by rootProject.extra
|
||||
useFx(FXModule.CONTROLS, version = fxVersion, configuration = DependencyConfiguration.IMPLEMENTATION)
|
||||
application()
|
||||
// jvm()
|
||||
js {
|
||||
browser {
|
||||
binaries.executable()
|
||||
commonWebpackConfig{
|
||||
cssSupport{
|
||||
enabled = true
|
||||
}
|
||||
scssSupport{
|
||||
enabled = true
|
||||
}
|
||||
sourceMaps = true
|
||||
}
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation(projects.visionforgeSolid)
|
||||
implementation(projects.visionforgeGdml)
|
||||
}
|
||||
// jvmMain {
|
||||
//// implementation(project(":visionforge-fx"))
|
||||
// implementation(spclibs.logback.classic)
|
||||
// }
|
||||
jsMain {
|
||||
implementation(projects.visionforgeThreejs)
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
|
||||
js {
|
||||
useCommonJs()
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
cssSupport.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-solid"))
|
||||
implementation(project(":visionforge-gdml"))
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-fx"))
|
||||
implementation("ch.qos.logback:logback-classic:1.2.5")
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(project(":ui:ring"))
|
||||
implementation(project(":visionforge-threejs"))
|
||||
implementation(npm("react-file-drop", "3.0.6"))
|
||||
}
|
||||
}
|
||||
}
|
||||
explicitApi = null
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("space.kscience.visionforge.gdml.demo.GdmlFxDemoAppKt")
|
||||
}
|
||||
|
||||
val convertGdmlToJson by tasks.creating(JavaExec::class) {
|
||||
group = "application"
|
||||
classpath = sourceSets["main"].runtimeClasspath
|
||||
mainClass.set("space.kscience.dataforge.vis.spatial.gdml.demo.SaveToJsonKt")
|
||||
}
|
||||
//val convertGdmlToJson by tasks.creating(JavaExec::class) {
|
||||
// group = "application"
|
||||
// classpath = sourceSets["main"].runtimeClasspath
|
||||
// mainClass.set("space.kscience.dataforge.vis.spatial.gdml.demo.SaveToJsonKt")
|
||||
//}
|
@ -1,13 +1,11 @@
|
||||
package space.kscience.visionforge.gdml
|
||||
|
||||
import space.kscience.dataforge.meta.asValue
|
||||
import space.kscience.dataforge.meta.string
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.values.asValue
|
||||
import space.kscience.dataforge.values.string
|
||||
import space.kscience.gdml.GdmlShowCase
|
||||
import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.computeProperties
|
||||
import space.kscience.visionforge.get
|
||||
import space.kscience.visionforge.setProperty
|
||||
import space.kscience.visionforge.getChild
|
||||
import space.kscience.visionforge.solid.Solid
|
||||
import space.kscience.visionforge.solid.SolidMaterial
|
||||
import space.kscience.visionforge.solid.material
|
||||
@ -20,8 +18,8 @@ class GDMLVisionTest {
|
||||
|
||||
@Test
|
||||
fun testCubesStyles(){
|
||||
val segment = cubes["composite-000.segment-0"] as Solid
|
||||
println(segment.computeProperties().getValue(Vision.STYLE_KEY))
|
||||
val segment = cubes.children.getChild("composite-000.segment-0") as Solid
|
||||
println(segment.properties.getValue(Vision.STYLE_KEY))
|
||||
// println(segment.computePropertyNode(SolidMaterial.MATERIAL_KEY))
|
||||
// println(segment.computeProperty(SolidMaterial.MATERIAL_COLOR_KEY))
|
||||
|
||||
@ -35,7 +33,7 @@ class GDMLVisionTest {
|
||||
fun testPrototypeProperty() {
|
||||
val child = cubes[Name.of("composite-000","segment-0")]
|
||||
assertNotNull(child)
|
||||
child.setProperty(SolidMaterial.MATERIAL_COLOR_KEY, "red".asValue())
|
||||
assertEquals("red", child.getPropertyValue(SolidMaterial.MATERIAL_COLOR_KEY)?.string)
|
||||
child.properties.setValue(SolidMaterial.MATERIAL_COLOR_KEY, "red".asValue())
|
||||
assertEquals("red", child.properties[SolidMaterial.MATERIAL_COLOR_KEY].string)
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
@file:JsModule("react-file-drop")
|
||||
@file:JsNonModule
|
||||
|
||||
package drop
|
||||
|
||||
import org.w3c.dom.DragEvent
|
||||
import org.w3c.files.FileList
|
||||
import react.Component
|
||||
import react.Props
|
||||
import react.State
|
||||
|
||||
external enum class DropEffects {
|
||||
copy,
|
||||
move,
|
||||
link,
|
||||
none
|
||||
}
|
||||
|
||||
external interface FileDropProps: Props {
|
||||
var className: String?
|
||||
var targetClassName: String?
|
||||
var draggingOverFrameClassName: String?
|
||||
var draggingOverTargetClassName: String?
|
||||
|
||||
// var frame?: Exclude<HTMLElementTagNameMap[keyof HTMLElementTagNameMap], HTMLElement> | HTMLDocument;
|
||||
var onFrameDragEnter: ((event: DragEvent) -> Unit)?
|
||||
var onFrameDragLeave: ((event: DragEvent) -> Unit)?
|
||||
var onFrameDrop: ((event: DragEvent) -> Unit)?
|
||||
// var onDragOver: ReactDragEventHandler<HTMLDivElement>?
|
||||
// var onDragLeave: ReactDragEventHandler<HTMLDivElement>?
|
||||
var onDrop: ((files: FileList?, event: dynamic) -> Unit)?//event:DragEvent<HTMLDivElement>)
|
||||
var dropEffect: DropEffects?
|
||||
}
|
||||
|
||||
external interface FileDropState: State {
|
||||
var draggingOverFrame: Boolean
|
||||
var draggingOverTarget: Boolean
|
||||
}
|
||||
|
||||
external class FileDrop : Component<FileDropProps, FileDropState> {
|
||||
override fun render(): dynamic
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
@file:OptIn(ExperimentalComposeWebApi::class)
|
||||
|
||||
package space.kscience.visionforge.gdml.demo
|
||||
|
||||
import androidx.compose.runtime.*
|
||||
import bootstrap.Container
|
||||
import bootstrap.Icon
|
||||
import org.jetbrains.compose.web.ExperimentalComposeWebApi
|
||||
import org.jetbrains.compose.web.attributes.InputType
|
||||
import org.jetbrains.compose.web.attributes.name
|
||||
import org.jetbrains.compose.web.css.*
|
||||
import org.jetbrains.compose.web.dom.Input
|
||||
import org.jetbrains.compose.web.dom.Text
|
||||
import org.w3c.files.FileList
|
||||
|
||||
|
||||
//https://codepen.io/zahedkamal87/pen/PobNNwE
|
||||
@Composable
|
||||
fun FileDrop(
|
||||
title: String = "Drop files or Click here to select files to upload.",
|
||||
onFileDrop: (FileList) -> Unit,
|
||||
) {
|
||||
var dragOver by remember { mutableStateOf(false) }
|
||||
|
||||
Container(attrs = {
|
||||
id("dropzone")
|
||||
style {
|
||||
border(
|
||||
width = 0.2.cssRem,
|
||||
style = LineStyle.Dashed,
|
||||
color = Color("#6583fe")
|
||||
)
|
||||
padding(2.cssRem)
|
||||
borderRadius(0.25.cssRem)
|
||||
backgroundColor(Color("#fff"))
|
||||
textAlign("center")
|
||||
fontSize(1.5.cssRem)
|
||||
transitions {
|
||||
all {
|
||||
delay(0.25.s)
|
||||
timingFunction(AnimationTimingFunction.EaseInOut)
|
||||
properties("background-color")
|
||||
}
|
||||
}
|
||||
cursor("pointer")
|
||||
}
|
||||
listOf("drag", "dragstart", "dragend", "dragenter").forEach {
|
||||
addEventListener(it) { event ->
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
}
|
||||
}
|
||||
onDragOver { event ->
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
dragOver = true
|
||||
}
|
||||
onDragLeave { event ->
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
dragOver = false
|
||||
}
|
||||
onDrop { event ->
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
dragOver = false
|
||||
event.dataTransfer?.files?.let {
|
||||
onFileDrop(it)
|
||||
}
|
||||
}
|
||||
}) {
|
||||
Icon("cloud-upload"){ classes("dropzone-icon") }
|
||||
Text(title)
|
||||
Input(type = InputType.File, attrs = {
|
||||
style {
|
||||
display(DisplayStyle.None)
|
||||
}
|
||||
classes("dropzone-input")
|
||||
name("files")
|
||||
})
|
||||
}
|
||||
}
|
||||
//
|
||||
//dropzone.addEventListener("click", function(e) {
|
||||
// dropzone_input.click();
|
||||
//});
|
@ -1,47 +1,35 @@
|
||||
package space.kscience.visionforge.gdml.demo
|
||||
|
||||
import androidx.compose.runtime.*
|
||||
import kotlinx.browser.window
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.css.*
|
||||
import org.jetbrains.compose.web.css.*
|
||||
import org.jetbrains.compose.web.dom.Div
|
||||
import org.jetbrains.compose.web.dom.P
|
||||
import org.jetbrains.compose.web.dom.Text
|
||||
import org.w3c.files.File
|
||||
import org.w3c.files.FileReader
|
||||
import org.w3c.files.get
|
||||
import react.Props
|
||||
import react.dom.h2
|
||||
import react.fc
|
||||
import react.useMemo
|
||||
import react.useState
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.gdml.Gdml
|
||||
import space.kscience.gdml.decodeFromString
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.gdml.markLayers
|
||||
import space.kscience.visionforge.gdml.toVision
|
||||
import space.kscience.visionforge.ring.ThreeCanvasWithControls
|
||||
import space.kscience.visionforge.ring.tab
|
||||
import space.kscience.visionforge.setAsRoot
|
||||
import space.kscience.visionforge.solid.Solid
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
import styled.css
|
||||
import styled.styledDiv
|
||||
import space.kscience.visionforge.solid.ambientLight
|
||||
import space.kscience.visionforge.solid.invoke
|
||||
import space.kscience.visionforge.solid.three.compose.ThreeView
|
||||
import space.kscience.visionforge.visionManager
|
||||
|
||||
external interface GDMLAppProps : Props {
|
||||
var context: Context
|
||||
var vision: Solid?
|
||||
var selected: Name?
|
||||
}
|
||||
|
||||
@JsExport
|
||||
val GDMLApp = fc<GDMLAppProps>("GDMLApp") { props ->
|
||||
val visionManager = useMemo(props.context) { props.context.fetch(Solids).visionManager }
|
||||
var deferredVision: Deferred<Solid?> by useState {
|
||||
CompletableDeferred(props.vision)
|
||||
}
|
||||
@Composable
|
||||
fun GDMLApp(context: Context, initialVision: Solid?, selected: Name? = null) {
|
||||
var vision: Solid? by remember { mutableStateOf(initialVision) }
|
||||
|
||||
fun readFileAsync(file: File): Deferred<Solid?> {
|
||||
val deferred = CompletableDeferred<Solid?>()
|
||||
fun readFileAsync(file: File) {
|
||||
val visionManager = context.visionManager
|
||||
FileReader().apply {
|
||||
onload = {
|
||||
val data = result as String
|
||||
@ -53,45 +41,43 @@ val GDMLApp = fc<GDMLAppProps>("GDMLApp") { props ->
|
||||
setAsRoot(visionManager)
|
||||
console.info("Marking layers for file $name")
|
||||
markLayers()
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
name.endsWith(".json") -> visionManager.decodeFromString(data)
|
||||
else -> {
|
||||
window.alert("File extension is not recognized: $name")
|
||||
error("File extension is not recognized: $name")
|
||||
}
|
||||
}
|
||||
deferred.complete(parsedVision as? Solid ?: error("Parsed vision is not a solid"))
|
||||
vision = parsedVision as? Solid ?: error("Parsed vision is not a solid")
|
||||
Unit
|
||||
}
|
||||
readAsText(file)
|
||||
}
|
||||
|
||||
return deferred
|
||||
}
|
||||
|
||||
styledDiv {
|
||||
css {
|
||||
height = 100.vh - 12.pt
|
||||
width = 100.vw
|
||||
Div({
|
||||
style {
|
||||
height(100.vh - 12.pt)
|
||||
width(100.vw)
|
||||
}
|
||||
child(ThreeCanvasWithControls) {
|
||||
attrs {
|
||||
this.context = props.context
|
||||
this.builderOfSolid = deferredVision
|
||||
this.selected = props.selected
|
||||
tab("Load") {
|
||||
h2 {
|
||||
+"Drag and drop .gdml or .json VisionForge files here"
|
||||
}
|
||||
fileDrop("(drag file here)") { files ->
|
||||
val file = files?.get(0)
|
||||
if (file != null) {
|
||||
deferredVision = readFileAsync(file)
|
||||
}
|
||||
}) {
|
||||
ThreeView(context, vision, selected) {
|
||||
Tab("Load") {
|
||||
P {
|
||||
Text("Drag and drop .gdml or .json VisionForge files here")
|
||||
}
|
||||
FileDrop("(drag file here)") { files ->
|
||||
val file = files[0]
|
||||
if (file != null) {
|
||||
readFileAsync(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,53 +1,57 @@
|
||||
package space.kscience.visionforge.gdml.demo
|
||||
|
||||
import kotlinx.browser.document
|
||||
import kotlinx.css.*
|
||||
import react.dom.render
|
||||
import org.jetbrains.compose.web.css.*
|
||||
import org.jetbrains.compose.web.dom.Style
|
||||
import org.jetbrains.compose.web.renderComposable
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.gdml.GdmlShowCase
|
||||
import space.kscience.visionforge.Application
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.gdml.toVision
|
||||
import space.kscience.visionforge.html.Application
|
||||
import space.kscience.visionforge.html.VisionForgeStyles
|
||||
import space.kscience.visionforge.html.startApplication
|
||||
import space.kscience.visionforge.solid.ambientLight
|
||||
import space.kscience.visionforge.solid.invoke
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
import space.kscience.visionforge.startApplication
|
||||
import styled.injectGlobal
|
||||
|
||||
|
||||
private class GDMLDemoApp : Application {
|
||||
|
||||
override fun start(state: Map<String, Any>) {
|
||||
val context = Context("gdml-demo"){
|
||||
plugin(ThreePlugin)
|
||||
}
|
||||
val context = Context("gdml-demo") {
|
||||
plugin(ThreePlugin)
|
||||
}
|
||||
|
||||
injectGlobal {
|
||||
html{
|
||||
height = 100.pct
|
||||
}
|
||||
|
||||
body{
|
||||
height = 100.pct
|
||||
display = Display.flex
|
||||
alignItems = Align.stretch
|
||||
}
|
||||
|
||||
"#application"{
|
||||
width = 100.pct
|
||||
display = Display.flex
|
||||
alignItems = Align.stretch
|
||||
}
|
||||
}
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
|
||||
val element = document.getElementById("application") ?: error("Element with id 'application' not found on page")
|
||||
|
||||
render(element) {
|
||||
child(GDMLApp) {
|
||||
val vision = GdmlShowCase.cubes().toVision()
|
||||
//println(context.plugins.fetch(VisionManager).encodeToString(vision))
|
||||
attrs {
|
||||
this.context = context
|
||||
this.vision = vision
|
||||
val vision = GdmlShowCase.cubes().toVision().apply {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
}
|
||||
|
||||
renderComposable(element) {
|
||||
Style(VisionForgeStyles)
|
||||
Style {
|
||||
"html" {
|
||||
height(100.percent)
|
||||
}
|
||||
|
||||
"body" {
|
||||
height(100.percent)
|
||||
display(DisplayStyle.Flex)
|
||||
alignItems(AlignItems.Stretch)
|
||||
}
|
||||
|
||||
"#application" {
|
||||
width(100.percent)
|
||||
display(DisplayStyle.Flex)
|
||||
alignItems(AlignItems.Stretch)
|
||||
}
|
||||
}
|
||||
GDMLApp(context, vision)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
package space.kscience.visionforge.gdml.demo
|
||||
|
||||
import drop.FileDrop
|
||||
import kotlinx.css.*
|
||||
import kotlinx.css.properties.border
|
||||
import org.w3c.files.FileList
|
||||
import react.RBuilder
|
||||
import styled.css
|
||||
import styled.styledDiv
|
||||
|
||||
//TODO move styles to inline
|
||||
|
||||
fun RBuilder.fileDrop(title: String, action: (files: FileList?) -> Unit) {
|
||||
styledDiv {
|
||||
css {
|
||||
border(style = BorderStyle.dashed, width = 1.px, color = Color.orange)
|
||||
flexGrow = 0.0
|
||||
alignContent = Align.center
|
||||
}
|
||||
|
||||
child(FileDrop::class) {
|
||||
attrs {
|
||||
onDrop = { files, _ ->
|
||||
console.info("loaded $files")
|
||||
action(files)
|
||||
}
|
||||
}
|
||||
+title
|
||||
}
|
||||
}
|
||||
}
|
@ -1,83 +1,83 @@
|
||||
package space.kscience.visionforge.gdml.demo
|
||||
|
||||
import javafx.geometry.Orientation
|
||||
import javafx.scene.Parent
|
||||
import javafx.stage.FileChooser
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.gdml.GdmlShowCase
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.editor.VisionEditorFragment
|
||||
import space.kscience.visionforge.editor.VisionTreeFragment
|
||||
import space.kscience.visionforge.gdml.toVision
|
||||
import space.kscience.visionforge.solid.FX3DPlugin
|
||||
import space.kscience.visionforge.solid.FXCanvas3D
|
||||
import space.kscience.visionforge.solid.Solid
|
||||
import space.kscience.visionforge.solid.SolidMaterial
|
||||
import tornadofx.*
|
||||
|
||||
class GDMLDemoApp : App(GDMLView::class)
|
||||
|
||||
class GDMLView : View() {
|
||||
private val context = Context {
|
||||
plugin(FX3DPlugin)
|
||||
}
|
||||
|
||||
private val fx3d = context.fetch(FX3DPlugin)
|
||||
private val visionManager = context.fetch(VisionManager)
|
||||
private val canvas = FXCanvas3D(fx3d)
|
||||
|
||||
private val treeFragment = VisionTreeFragment().apply {
|
||||
this.itemProperty.bind(canvas.rootObjectProperty)
|
||||
}
|
||||
|
||||
private val propertyEditor = VisionEditorFragment().apply {
|
||||
descriptorProperty.set(SolidMaterial.descriptor)
|
||||
visionProperty.bind(treeFragment.selectedProperty)
|
||||
}
|
||||
|
||||
override val root: Parent = borderpane {
|
||||
top {
|
||||
buttonbar {
|
||||
button("Load GDML/json") {
|
||||
action {
|
||||
val file = chooseFile("Select a GDML/json file", filters = fileNameFilter).firstOrNull()
|
||||
if (file != null) {
|
||||
runAsync {
|
||||
visionManager.readFile(file) as Solid
|
||||
} ui {
|
||||
canvas.render(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
center {
|
||||
splitpane(Orientation.HORIZONTAL, treeFragment.root, canvas.root, propertyEditor.root) {
|
||||
setDividerPositions(0.2, 0.6, 0.2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
runAsync {
|
||||
GdmlShowCase.cubes().toVision()
|
||||
} ui {
|
||||
canvas.render(it)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val fileNameFilter = arrayOf(
|
||||
FileChooser.ExtensionFilter("GDML", "*.gdml", "*.xml"),
|
||||
FileChooser.ExtensionFilter("JSON", "*.json"),
|
||||
FileChooser.ExtensionFilter("JSON.ZIP", "*.json.zip"),
|
||||
FileChooser.ExtensionFilter("JSON.GZ", "*.json.gz")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
launch<GDMLDemoApp>()
|
||||
}
|
||||
//package space.kscience.visionforge.gdml.demo
|
||||
//
|
||||
//import javafx.geometry.Orientation
|
||||
//import javafx.scene.Parent
|
||||
//import javafx.stage.FileChooser
|
||||
//import space.kscience.dataforge.context.Context
|
||||
//import space.kscience.dataforge.context.fetch
|
||||
//import space.kscience.gdml.GdmlShowCase
|
||||
//import space.kscience.visionforge.VisionManager
|
||||
//import space.kscience.visionforge.editor.VisionEditorFragment
|
||||
//import space.kscience.visionforge.editor.VisionTreeFragment
|
||||
//import space.kscience.visionforge.gdml.toVision
|
||||
//import space.kscience.visionforge.solid.FX3DPlugin
|
||||
//import space.kscience.visionforge.solid.FXCanvas3D
|
||||
//import space.kscience.visionforge.solid.Solid
|
||||
//import space.kscience.visionforge.solid.SolidMaterial
|
||||
//import tornadofx.*
|
||||
//
|
||||
//class GDMLDemoApp : App(GDMLView::class)
|
||||
//
|
||||
//class GDMLView : View() {
|
||||
// private val context = Context {
|
||||
// plugin(FX3DPlugin)
|
||||
// }
|
||||
//
|
||||
// private val fx3d = context.fetch(FX3DPlugin)
|
||||
// private val visionManager = context.fetch(VisionManager)
|
||||
// private val canvas = FXCanvas3D(fx3d)
|
||||
//
|
||||
// private val treeFragment = VisionTreeFragment().apply {
|
||||
// this.itemProperty.bind(canvas.rootObjectProperty)
|
||||
// }
|
||||
//
|
||||
// private val propertyEditor = VisionEditorFragment().apply {
|
||||
// descriptorProperty.set(SolidMaterial.descriptor)
|
||||
// visionProperty.bind(treeFragment.selectedProperty)
|
||||
// }
|
||||
//
|
||||
// override val root: Parent = borderpane {
|
||||
// top {
|
||||
// buttonbar {
|
||||
// button("Load GDML/json") {
|
||||
// action {
|
||||
// val file = chooseFile("Select a GDML/json file", filters = fileNameFilter).firstOrNull()
|
||||
// if (file != null) {
|
||||
// runAsync {
|
||||
// visionManager.readFile(file) as Solid
|
||||
// } ui {
|
||||
// canvas.render(it)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// center {
|
||||
// splitpane(Orientation.HORIZONTAL, treeFragment.root, canvas.root, propertyEditor.root) {
|
||||
// setDividerPositions(0.2, 0.6, 0.2)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// init {
|
||||
// runAsync {
|
||||
// GdmlShowCase.cubes().toVision()
|
||||
// } ui {
|
||||
// canvas.render(it)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// companion object {
|
||||
// private val fileNameFilter = arrayOf(
|
||||
// FileChooser.ExtensionFilter("GDML", "*.gdml", "*.xml"),
|
||||
// FileChooser.ExtensionFilter("JSON", "*.json"),
|
||||
// FileChooser.ExtensionFilter("JSON.ZIP", "*.json.zip"),
|
||||
// FileChooser.ExtensionFilter("JSON.GZ", "*.json.gz")
|
||||
// )
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//fun main() {
|
||||
// launch<GDMLDemoApp>()
|
||||
//}
|
3
demo/gdml/webpack.config.d/01.ring.js
vendored
3
demo/gdml/webpack.config.d/01.ring.js
vendored
@ -1,3 +0,0 @@
|
||||
const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
|
||||
|
||||
config.module.rules.push(...ringConfig.module.rules)
|
@ -1,28 +1,35 @@
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.js")
|
||||
id("space.kscience.gradle.mpp")
|
||||
alias(spclibs.plugins.compose)
|
||||
}
|
||||
|
||||
kscience{
|
||||
kscience {
|
||||
useCoroutines()
|
||||
application()
|
||||
}
|
||||
|
||||
kotlin{
|
||||
js(IR){
|
||||
useCommonJs()
|
||||
kotlin {
|
||||
explicitApi = null
|
||||
js {
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
cssSupport.enabled = false
|
||||
binaries.executable()
|
||||
commonWebpackConfig{
|
||||
cssSupport{
|
||||
enabled = true
|
||||
}
|
||||
scssSupport{
|
||||
enabled = true
|
||||
}
|
||||
sourceMaps = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies{
|
||||
implementation(projects.visionforge.visionforgeGdml)
|
||||
implementation(projects.visionforge.visionforgePlotly)
|
||||
implementation(projects.visionforge.visionforgeMarkdown)
|
||||
implementation(projects.visionforge.visionforgeThreejs)
|
||||
implementation(projects.ui.ring)
|
||||
kscience {
|
||||
dependencies {
|
||||
implementation(projects.visionforge.visionforgeGdml)
|
||||
implementation(projects.visionforge.visionforgePlotly)
|
||||
implementation(projects.visionforge.visionforgeMarkdown)
|
||||
implementation(projects.visionforge.visionforgeThreejs)
|
||||
}
|
||||
}
|
106
demo/js-playground/src/jsMain/kotlin/JsPlaygroundApp.kt
Normal file
106
demo/js-playground/src/jsMain/kotlin/JsPlaygroundApp.kt
Normal file
@ -0,0 +1,106 @@
|
||||
import org.jetbrains.compose.web.css.*
|
||||
import org.jetbrains.compose.web.dom.Div
|
||||
import org.jetbrains.compose.web.renderComposable
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.plotly.scatter
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.html.Application
|
||||
import space.kscience.visionforge.html.Tabs
|
||||
import space.kscience.visionforge.html.VisionForgeStyles
|
||||
import space.kscience.visionforge.html.startApplication
|
||||
import space.kscience.visionforge.markup.MarkupPlugin
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
import space.kscience.visionforge.solid.three.compose.ThreeView
|
||||
import kotlin.random.Random
|
||||
|
||||
fun Trace.appendXYLatest(x: Number, y: Number, history: Int = 400, xErr: Number? = null, yErr: Number? = null) {
|
||||
this.x.numbers = (this.x.numbers + x).takeLast(history)
|
||||
this.y.numbers = (this.y.numbers + y).takeLast(history)
|
||||
xErr?.let { error_x.array = (error_x.array + xErr).takeLast(history) }
|
||||
yErr?.let { error_y.array = (error_y.array + yErr).takeLast(history) }
|
||||
}
|
||||
|
||||
private class JsPlaygroundApp : Application {
|
||||
|
||||
val playgroundContext = Context {
|
||||
plugin(ThreePlugin)
|
||||
plugin(PlotlyPlugin)
|
||||
plugin(MarkupPlugin)
|
||||
}
|
||||
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
|
||||
// val solids = playgroundContext.request(Solids)
|
||||
// val client = playgroundContext.request(JsVisionClient)
|
||||
|
||||
val element = document.getElementById("playground") ?: error("Element with id 'playground' not found on page")
|
||||
|
||||
renderComposable(element) {
|
||||
Style(VisionForgeStyles)
|
||||
Div({
|
||||
style {
|
||||
padding(0.pt)
|
||||
margin(0.pt)
|
||||
height(100.vh)
|
||||
width(100.vw)
|
||||
}
|
||||
}) {
|
||||
Tabs("gravity") {
|
||||
Tab("gravity") {
|
||||
GravityDemo(playgroundContext)
|
||||
}
|
||||
|
||||
// Tab("D0") {
|
||||
// child(ThreeCanvasWithControls) {
|
||||
// attrs {
|
||||
// context = playgroundContext
|
||||
// solid = GdmlShowCase.babyIaxo().toVision()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Tab("spheres") {
|
||||
Div({
|
||||
style {
|
||||
height(100.vh - 50.pt)
|
||||
}
|
||||
}) {
|
||||
ThreeView(playgroundContext, SolidGroup {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
repeat(100) {
|
||||
sphere(5, name = "sphere[$it]") {
|
||||
x = Random.nextDouble(-300.0, 300.0)
|
||||
y = Random.nextDouble(-300.0, 300.0)
|
||||
z = Random.nextDouble(-300.0, 300.0)
|
||||
material {
|
||||
color(Random.nextInt())
|
||||
}
|
||||
detail = 16
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Tab("plotly") {
|
||||
Plot(playgroundContext) {
|
||||
scatter {
|
||||
x(1, 2, 3)
|
||||
y(5, 8, 7)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public fun main() {
|
||||
startApplication(::JsPlaygroundApp)
|
||||
}
|
164
demo/js-playground/src/jsMain/kotlin/gravityDemo.kt
Normal file
164
demo/js-playground/src/jsMain/kotlin/gravityDemo.kt
Normal file
@ -0,0 +1,164 @@
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.remember
|
||||
import bootstrap.Column
|
||||
import bootstrap.Row
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import org.jetbrains.compose.web.css.*
|
||||
import org.jetbrains.compose.web.dom.AttrBuilderContext
|
||||
import org.jetbrains.compose.web.dom.Div
|
||||
import org.w3c.dom.HTMLDivElement
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.plotly.Plot
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.html.Vision
|
||||
import space.kscience.visionforge.html.zIndex
|
||||
import space.kscience.visionforge.markup.VisionOfMarkup
|
||||
import space.kscience.visionforge.plotly.asVision
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.three.compose.ThreeView
|
||||
import kotlin.math.sqrt
|
||||
|
||||
@Composable
|
||||
fun Plot(
|
||||
context: Context,
|
||||
meta: Meta = Meta.EMPTY,
|
||||
attrs: AttrBuilderContext<HTMLDivElement>? = null,
|
||||
block: Plot.() -> Unit,
|
||||
) = Vision(
|
||||
context = context,
|
||||
attrs = attrs,
|
||||
meta = meta,
|
||||
vision = Plot().apply(block).asVision()
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun Markup(
|
||||
context: Context,
|
||||
markup: VisionOfMarkup,
|
||||
meta: Meta = Meta.EMPTY,
|
||||
attrs: AttrBuilderContext<HTMLDivElement>? = null,
|
||||
) = Vision(
|
||||
context = context,
|
||||
attrs = attrs,
|
||||
meta = meta,
|
||||
vision = markup
|
||||
)
|
||||
|
||||
|
||||
private val h = 100.0
|
||||
|
||||
@Composable
|
||||
fun GravityDemo(context: Context) {
|
||||
val velocityTrace = remember {
|
||||
Trace {
|
||||
name = "velocity"
|
||||
}
|
||||
}
|
||||
|
||||
val energyTrace = remember {
|
||||
Trace {
|
||||
name = "energy"
|
||||
}
|
||||
}
|
||||
|
||||
val markup = remember { VisionOfMarkup() }
|
||||
|
||||
val solid = remember {
|
||||
SolidGroup {
|
||||
pointLight(200, 200, 200, name = "light") {
|
||||
color(Colors.white)
|
||||
}
|
||||
ambientLight()
|
||||
|
||||
sphere(5.0, "ball") {
|
||||
detail = 16
|
||||
color("red")
|
||||
y = h
|
||||
|
||||
|
||||
box(200, 5, 200, name = "floor") {
|
||||
y = -2.5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(solid) {
|
||||
val ball = solid["ball"]!!
|
||||
val g = 10.0
|
||||
val dt = 0.1
|
||||
var time = 0.0
|
||||
var velocity = 0.0
|
||||
while (isActive) {
|
||||
delay(20)
|
||||
time += dt
|
||||
velocity -= g * dt
|
||||
val energy = g * ball.y.toDouble() + velocity * velocity / 2
|
||||
ball.y = ball.y.toDouble() + velocity * dt
|
||||
|
||||
velocityTrace.appendXYLatest(time, ball.y)
|
||||
energyTrace.appendXYLatest(time, energy)
|
||||
|
||||
if (ball.y.toDouble() <= 2.5) {
|
||||
//conservation of energy
|
||||
velocity = sqrt(2 * g * h)
|
||||
}
|
||||
|
||||
markup.content = """
|
||||
## Bouncing sphere parameters
|
||||
|
||||
**velocity** = $velocity
|
||||
|
||||
**energy** = $energy
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
Div({
|
||||
style {
|
||||
height(100.vh - 50.pt)
|
||||
}
|
||||
}) {
|
||||
Div({
|
||||
style {
|
||||
height(50.vh)
|
||||
}
|
||||
}) {
|
||||
ThreeView(context, solid)
|
||||
}
|
||||
Row(attrs = {
|
||||
style {
|
||||
alignContent(AlignContent.Stretch)
|
||||
alignItems(AlignItems.Stretch)
|
||||
height(50.vh - 50.pt)
|
||||
}
|
||||
}) {
|
||||
Column {
|
||||
Plot(context) {
|
||||
traces(velocityTrace, energyTrace)
|
||||
layout {
|
||||
xaxis.title = "time"
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
Markup(context, markup, attrs = {
|
||||
style {
|
||||
width(100.percent)
|
||||
height(100.percent)
|
||||
border(2.pt, LineStyle.Solid, Color.blue)
|
||||
paddingLeft(8.pt)
|
||||
backgroundColor(Color.white)
|
||||
flex(1)
|
||||
zIndex(10000)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
import kotlinx.browser.document
|
||||
import kotlinx.css.*
|
||||
import react.child
|
||||
import react.dom.render
|
||||
import ringui.SmartTabs
|
||||
import ringui.Tab
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.plotly.scatter
|
||||
import space.kscience.visionforge.Application
|
||||
import space.kscience.visionforge.VisionClient
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.ring.ThreeCanvasWithControls
|
||||
import space.kscience.visionforge.ring.ThreeWithControlsPlugin
|
||||
import space.kscience.visionforge.ring.solid
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.startApplication
|
||||
import styled.css
|
||||
import styled.styledDiv
|
||||
import kotlin.random.Random
|
||||
|
||||
fun Trace.appendXYLatest(x: Number, y: Number, history: Int = 400, xErr: Number? = null, yErr: Number? = null) {
|
||||
this.x.numbers = (this.x.numbers + x).takeLast(history)
|
||||
this.y.numbers = (this.y.numbers + y).takeLast(history)
|
||||
xErr?.let { error_x.array = (error_x.array + xErr).takeLast(history) }
|
||||
yErr?.let { error_y.array = (error_y.array + yErr).takeLast(history) }
|
||||
}
|
||||
|
||||
private class JsPlaygroundApp : Application {
|
||||
|
||||
override fun start(state: Map<String, Any>) {
|
||||
|
||||
val playgroundContext = Context {
|
||||
plugin(ThreeWithControlsPlugin)
|
||||
plugin(VisionClient)
|
||||
plugin(PlotlyPlugin)
|
||||
}
|
||||
|
||||
val element = document.getElementById("playground") ?: error("Element with id 'playground' not found on page")
|
||||
|
||||
render(element) {
|
||||
styledDiv {
|
||||
css {
|
||||
padding(0.pt)
|
||||
margin(0.pt)
|
||||
height = 100.vh
|
||||
width = 100.vw
|
||||
}
|
||||
SmartTabs("gravity") {
|
||||
Tab("gravity") {
|
||||
GravityDemo{
|
||||
attrs {
|
||||
this.context = playgroundContext
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tab("D0") {
|
||||
// child(ThreeCanvasWithControls) {
|
||||
// attrs {
|
||||
// context = playgroundContext
|
||||
// solid = GdmlShowCase.babyIaxo().toVision()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Tab("spheres") {
|
||||
styledDiv {
|
||||
css {
|
||||
height = 100.vh - 50.pt
|
||||
}
|
||||
child(ThreeCanvasWithControls) {
|
||||
val random = Random(112233)
|
||||
attrs {
|
||||
context = playgroundContext
|
||||
solid {
|
||||
repeat(100) {
|
||||
sphere(5, name = "sphere[$it]") {
|
||||
x = random.nextDouble(-300.0, 300.0)
|
||||
y = random.nextDouble(-300.0, 300.0)
|
||||
z = random.nextDouble(-300.0, 300.0)
|
||||
material {
|
||||
color(random.nextInt())
|
||||
}
|
||||
detail = 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Tab("plotly") {
|
||||
Plotly {
|
||||
attrs {
|
||||
plot = space.kscience.plotly.Plotly.plot {
|
||||
scatter {
|
||||
x(1, 2, 3)
|
||||
y(5, 8, 7)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun main() {
|
||||
startApplication(::JsPlaygroundApp)
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.css.*
|
||||
import react.Props
|
||||
import react.fc
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.visionforge.markup.VisionOfMarkup
|
||||
import space.kscience.visionforge.react.flexRow
|
||||
import space.kscience.visionforge.ring.ThreeCanvasWithControls
|
||||
import space.kscience.visionforge.ring.solid
|
||||
import space.kscience.visionforge.solid.*
|
||||
import styled.css
|
||||
import styled.styledDiv
|
||||
import kotlin.math.sqrt
|
||||
|
||||
external interface DemoProps : Props {
|
||||
var context: Context
|
||||
}
|
||||
|
||||
val GravityDemo = fc<DemoProps> { props ->
|
||||
val velocityTrace = Trace{
|
||||
name = "velocity"
|
||||
}
|
||||
val energyTrace = Trace{
|
||||
name = "energy"
|
||||
}
|
||||
val markup = VisionOfMarkup()
|
||||
|
||||
styledDiv {
|
||||
css {
|
||||
height = 100.vh - 50.pt
|
||||
}
|
||||
styledDiv {
|
||||
css {
|
||||
height = 50.vh
|
||||
}
|
||||
child(ThreeCanvasWithControls) {
|
||||
attrs {
|
||||
context = props.context
|
||||
solid {
|
||||
sphere(5.0, "ball") {
|
||||
detail = 16
|
||||
color("red")
|
||||
val h = 100.0
|
||||
y = h
|
||||
context.launch {
|
||||
val g = 10.0
|
||||
val dt = 0.1
|
||||
var time = 0.0
|
||||
var velocity = 0.0
|
||||
while (isActive) {
|
||||
delay(20)
|
||||
time += dt
|
||||
velocity -= g * dt
|
||||
val energy = g * y.toDouble() + velocity * velocity / 2
|
||||
y = y.toDouble() + velocity * dt
|
||||
|
||||
velocityTrace.appendXYLatest(time, y)
|
||||
energyTrace.appendXYLatest(time, energy)
|
||||
|
||||
if (y.toDouble() <= 2.5) {
|
||||
//conservation of energy
|
||||
velocity = sqrt(2 * g * h)
|
||||
}
|
||||
|
||||
markup.content = """
|
||||
## Bouncing sphere parameters
|
||||
|
||||
**velocity** = $velocity
|
||||
|
||||
**energy** = $energy
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
box(200, 5, 200, name = "floor") {
|
||||
y = -2.5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
flexRow {
|
||||
css {
|
||||
alignContent = Align.stretch
|
||||
alignItems = Align.stretch
|
||||
height = 50.vh - 50.pt
|
||||
}
|
||||
plotly {
|
||||
traces(velocityTrace,energyTrace)
|
||||
layout {
|
||||
xaxis.title = "time"
|
||||
}
|
||||
}
|
||||
Markup {
|
||||
attrs {
|
||||
this.markup = markup
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
import kotlinx.css.*
|
||||
import kotlinx.css.properties.border
|
||||
import kotlinx.dom.clear
|
||||
import kotlinx.html.dom.append
|
||||
import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor
|
||||
import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.HTMLElement
|
||||
import react.Props
|
||||
import react.fc
|
||||
import react.useEffect
|
||||
import react.useRef
|
||||
import space.kscience.visionforge.markup.VisionOfMarkup
|
||||
import space.kscience.visionforge.markup.markdown
|
||||
import space.kscience.visionforge.useProperty
|
||||
import styled.css
|
||||
import styled.styledDiv
|
||||
|
||||
external interface MarkupProps : Props {
|
||||
var markup: VisionOfMarkup?
|
||||
}
|
||||
|
||||
val Markup = fc<MarkupProps>("Markup") { props ->
|
||||
val elementRef = useRef<Element>(null)
|
||||
|
||||
useEffect(props.markup, elementRef) {
|
||||
val element = elementRef.current as? HTMLElement ?: error("Markup element not found")
|
||||
props.markup?.let { vision ->
|
||||
val flavour = when (vision.format) {
|
||||
VisionOfMarkup.COMMONMARK_FORMAT -> CommonMarkFlavourDescriptor()
|
||||
VisionOfMarkup.GFM_FORMAT -> GFMFlavourDescriptor()
|
||||
//TODO add new formats via plugins
|
||||
else -> error("Format ${vision.format} not recognized")
|
||||
}
|
||||
vision.useProperty(VisionOfMarkup::content) { content: String? ->
|
||||
element.clear()
|
||||
element.append {
|
||||
markdown(flavour) { content ?: "" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
styledDiv {
|
||||
css {
|
||||
width = 100.pct
|
||||
height = 100.pct
|
||||
border(2.pt, BorderStyle.solid, Color.blue)
|
||||
padding(left = 8.pt)
|
||||
backgroundColor = Color.white
|
||||
flex(1.0)
|
||||
zIndex = 10000
|
||||
}
|
||||
ref = elementRef
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
import kotlinx.css.*
|
||||
import kotlinx.css.properties.border
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.HTMLElement
|
||||
import react.*
|
||||
import space.kscience.plotly.Plot
|
||||
import space.kscience.plotly.PlotlyConfig
|
||||
import space.kscience.plotly.plot
|
||||
import styled.css
|
||||
import styled.styledDiv
|
||||
|
||||
external interface PlotlyProps : Props {
|
||||
var plot: Plot?
|
||||
}
|
||||
|
||||
|
||||
val Plotly = fc<PlotlyProps>("Plotly") { props ->
|
||||
val elementRef = useRef<Element>(null)
|
||||
|
||||
useEffect(props.plot, elementRef) {
|
||||
val element = elementRef.current as? HTMLElement ?: error("Plotly element not found")
|
||||
props.plot?.let {
|
||||
element.plot(it, PlotlyConfig {
|
||||
responsive = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
styledDiv {
|
||||
css {
|
||||
width = 100.pct
|
||||
height = 100.pct
|
||||
border(2.pt, BorderStyle.solid, Color.blue)
|
||||
flex(1.0)
|
||||
}
|
||||
ref = elementRef
|
||||
}
|
||||
}
|
||||
|
||||
fun RBuilder.plotly(plotbuilder: Plot.() -> Unit) = Plotly {
|
||||
attrs {
|
||||
this.plot = Plot().apply(plotbuilder)
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
|
||||
|
||||
config.module.rules.push(...ringConfig.module.rules)
|
@ -1,6 +1,6 @@
|
||||
public final class ru/mipt/npm/muon/monitor/Event {
|
||||
public static final field $stable I
|
||||
public static final field Companion Lru/mipt/npm/muon/monitor/Event$Companion;
|
||||
public synthetic fun <init> (IILjava/util/List;Ljava/util/Collection;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
|
||||
public fun <init> (ILjava/util/List;Ljava/util/Collection;)V
|
||||
public final fun component1 ()I
|
||||
public final fun component2 ()Ljava/util/List;
|
||||
@ -13,12 +13,11 @@ public final class ru/mipt/npm/muon/monitor/Event {
|
||||
public final fun getTrack ()Ljava/util/List;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
public static final fun write$Self (Lru/mipt/npm/muon/monitor/Event;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/Event$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
|
||||
public static final field $stable I
|
||||
public static final field INSTANCE Lru/mipt/npm/muon/monitor/Event$$serializer;
|
||||
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/muon/monitor/Event;
|
||||
@ -33,6 +32,7 @@ public final class ru/mipt/npm/muon/monitor/Event$Companion {
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/Model {
|
||||
public static final field $stable I
|
||||
public fun <init> (Lspace/kscience/visionforge/VisionManager;)V
|
||||
public final fun displayEvent (Lru/mipt/npm/muon/monitor/Event;)V
|
||||
public final fun encodeToString ()Ljava/lang/String;
|
||||
@ -40,10 +40,10 @@ public final class ru/mipt/npm/muon/monitor/Model {
|
||||
public final fun getRoot ()Lspace/kscience/visionforge/solid/SolidGroup;
|
||||
public final fun getTracks ()Lspace/kscience/visionforge/solid/SolidGroup;
|
||||
public final fun reset ()V
|
||||
public final fun setTracks (Lspace/kscience/visionforge/solid/SolidGroup;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/Monitor {
|
||||
public static final field $stable I
|
||||
public static final field CENTRAL_LAYER_Z F
|
||||
public static final field GEOMETRY_TOLERANCE D
|
||||
public static final field INSTANCE Lru/mipt/npm/muon/monitor/Monitor;
|
||||
@ -61,9 +61,10 @@ public final class ru/mipt/npm/muon/monitor/ReadResourceKt {
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/SC1 {
|
||||
public fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Point3D;FFF)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Point3D;FFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getCenter ()Lspace/kscience/visionforge/solid/Point3D;
|
||||
public static final field $stable I
|
||||
public fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;FFF)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;FFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getCenter ()Lspace/kscience/visionforge/solid/Float32Vector3D;
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public final fun getXSize ()F
|
||||
public final fun getYSize ()F
|
||||
@ -71,8 +72,9 @@ public final class ru/mipt/npm/muon/monitor/SC1 {
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/SC16 {
|
||||
public fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Point3D;)V
|
||||
public final fun getCenter ()Lspace/kscience/visionforge/solid/Point3D;
|
||||
public static final field $stable I
|
||||
public fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;)V
|
||||
public final fun getCenter ()Lspace/kscience/visionforge/solid/Float32Vector3D;
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public final fun getPixels ()Ljava/util/Collection;
|
||||
}
|
||||
@ -80,11 +82,12 @@ public final class ru/mipt/npm/muon/monitor/SC16 {
|
||||
public final class ru/mipt/npm/muon/monitor/server/MMServerKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
public static final fun module (Lio/ktor/application/Application;Lspace/kscience/dataforge/context/Context;)V
|
||||
public static synthetic fun module$default (Lio/ktor/application/Application;Lspace/kscience/dataforge/context/Context;ILjava/lang/Object;)V
|
||||
public static final fun module (Lio/ktor/server/application/Application;Lspace/kscience/dataforge/context/Context;)V
|
||||
public static synthetic fun module$default (Lio/ktor/server/application/Application;Lspace/kscience/dataforge/context/Context;ILjava/lang/Object;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/sim/Cos2TrackGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
|
||||
public static final field $stable I
|
||||
public fun <init> (Lorg/apache/commons/math3/random/RandomGenerator;DFF)V
|
||||
public synthetic fun <init> (Lorg/apache/commons/math3/random/RandomGenerator;DFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun generate ()Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
|
||||
@ -95,6 +98,7 @@ public final class ru/mipt/npm/muon/monitor/sim/Cos2TrackGenerator : ru/mipt/npm
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/sim/FixedAngleGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
|
||||
public static final field $stable I
|
||||
public fun <init> (Lorg/apache/commons/math3/random/RandomGenerator;DDFF)V
|
||||
public synthetic fun <init> (Lorg/apache/commons/math3/random/RandomGenerator;DDFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun generate ()Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
|
||||
@ -112,8 +116,8 @@ public final class ru/mipt/npm/muon/monitor/sim/LineKt {
|
||||
public static final fun getY (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)D
|
||||
public static final fun makeTrack (DDDD)Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
|
||||
public static final fun makeTrack (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
|
||||
public static final fun toPoint (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lspace/kscience/visionforge/solid/Point3D;
|
||||
public static final fun toPoints (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)Ljava/util/List;
|
||||
public static final fun toKMathVector (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lspace/kscience/visionforge/solid/Float32Vector3D;
|
||||
public static final fun toKMathVectors (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)Ljava/util/List;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/sim/MonitorKt {
|
||||
@ -138,6 +142,7 @@ public abstract interface class ru/mipt/npm/muon/monitor/sim/TrackGenerator {
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/sim/UniformTrackGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
|
||||
public static final field $stable I
|
||||
public fun <init> (Lorg/apache/commons/math3/random/RandomGenerator;FF)V
|
||||
public synthetic fun <init> (Lorg/apache/commons/math3/random/RandomGenerator;FFILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun generate ()Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
|
||||
|
@ -1,75 +1,54 @@
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.mpp")
|
||||
id("space.kscience.gradle.mpp")
|
||||
alias(spclibs.plugins.compose)
|
||||
// alias(spclibs.plugins.ktor)
|
||||
application
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
|
||||
val ktorVersion: String = npmlibs.versions.ktor.get()
|
||||
|
||||
kscience {
|
||||
fullStack(
|
||||
"muon-monitor.js",
|
||||
jvmConfig = {withJava()},
|
||||
browserConfig = {
|
||||
commonWebpackConfig {
|
||||
cssSupport {
|
||||
enabled = true
|
||||
}
|
||||
scssSupport {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
useCoroutines()
|
||||
useSerialization()
|
||||
application()
|
||||
}
|
||||
useKtor()
|
||||
|
||||
commonMain {
|
||||
implementation(projects.visionforgeSolid)
|
||||
implementation(projects.visionforgeComposeHtml)
|
||||
}
|
||||
jvmMain {
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("io.ktor:ktor-server-cio")
|
||||
implementation("io.ktor:ktor-server-content-negotiation")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json")
|
||||
implementation(spclibs.logback.classic)
|
||||
}
|
||||
jsMain {
|
||||
implementation(projects.visionforgeThreejs)
|
||||
//implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
|
||||
}
|
||||
}
|
||||
kotlin {
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
js {
|
||||
useCommonJs()
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
cssSupport.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
val jsBrowserDistribution by tasks.getting
|
||||
|
||||
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
||||
dependsOn(jsBrowserDistribution)
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(jsBrowserDistribution)
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-solid"))
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation(npmlibs.ktor.server.cio)
|
||||
implementation(npmlibs.ktor.serialization)
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(project(":ui:ring"))
|
||||
implementation(project(":visionforge-threejs"))
|
||||
//implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
|
||||
}
|
||||
}
|
||||
}
|
||||
explicitApi = null
|
||||
}
|
||||
|
||||
|
||||
application {
|
||||
mainClass.set("ru.mipt.npm.muon.monitor.server.MMServerKt")
|
||||
}
|
||||
|
||||
//distributions {
|
||||
// main {
|
||||
// contents {
|
||||
// from("$buildDir/libs") {
|
||||
// rename("${rootProject.name}-jvm", rootProject.name)
|
||||
// into("lib")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
mainClass.set("ru.mipt.npm.muon.monitor.MMServerKt")
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package ru.mipt.npm.muon.monitor
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import space.kscience.visionforge.solid.Point3D
|
||||
import space.kscience.visionforge.solid.Float32Vector3D
|
||||
|
||||
typealias Track = List<Point3D>
|
||||
typealias Track = List<Float32Vector3D>
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -3,20 +3,21 @@ package ru.mipt.npm.muon.monitor
|
||||
import ru.mipt.npm.muon.monitor.Monitor.CENTRAL_LAYER_Z
|
||||
import ru.mipt.npm.muon.monitor.Monitor.LOWER_LAYER_Z
|
||||
import ru.mipt.npm.muon.monitor.Monitor.UPPER_LAYER_Z
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.visionforge.MutableVisionContainer
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.removeAll
|
||||
import space.kscience.visionforge.setAsRoot
|
||||
import space.kscience.visionforge.setProperty
|
||||
import space.kscience.visionforge.solid.*
|
||||
import kotlin.collections.set
|
||||
import kotlin.math.PI
|
||||
|
||||
class Model(val manager: VisionManager) {
|
||||
private val map = HashMap<String, SolidGroup>()
|
||||
private val events = HashSet<Event>()
|
||||
|
||||
private fun SolidGroup.pixel(pixel: SC1) {
|
||||
val group = group(pixel.name) {
|
||||
position = Point3D(pixel.center.x, pixel.center.y, pixel.center.z)
|
||||
private fun MutableVisionContainer<Solid>.pixel(pixel: SC1) {
|
||||
val group = solidGroup(pixel.name) {
|
||||
position = Float32Vector3D(pixel.center.x, pixel.center.y, pixel.center.z)
|
||||
box(pixel.xSize, pixel.ySize, pixel.zSize)
|
||||
label(pixel.name) {
|
||||
z = -Monitor.PIXEL_Z_SIZE / 2 - 5
|
||||
@ -27,52 +28,52 @@ class Model(val manager: VisionManager) {
|
||||
}
|
||||
|
||||
private fun SolidGroup.detector(detector: SC16) {
|
||||
group(detector.name) {
|
||||
solidGroup(detector.name) {
|
||||
detector.pixels.forEach {
|
||||
pixel(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var tracks: SolidGroup
|
||||
val tracks: SolidGroup = SolidGroup()
|
||||
|
||||
val root: SolidGroup = SolidGroup().apply {
|
||||
setAsRoot(this@Model.manager)
|
||||
material {
|
||||
wireframe
|
||||
color("darkgreen")
|
||||
}
|
||||
rotationX = PI / 2
|
||||
group("bottom") {
|
||||
solidGroup("bottom") {
|
||||
Monitor.detectors.filter { it.center.z == LOWER_LAYER_Z }.forEach {
|
||||
detector(it)
|
||||
}
|
||||
}
|
||||
|
||||
group("middle") {
|
||||
solidGroup("middle") {
|
||||
Monitor.detectors.filter { it.center.z == CENTRAL_LAYER_Z }.forEach {
|
||||
detector(it)
|
||||
}
|
||||
}
|
||||
|
||||
group("top") {
|
||||
solidGroup("top") {
|
||||
Monitor.detectors.filter { it.center.z == UPPER_LAYER_Z }.forEach {
|
||||
detector(it)
|
||||
}
|
||||
}
|
||||
tracks = group("tracks")
|
||||
|
||||
setChild("tracks".asName(), tracks)
|
||||
}
|
||||
|
||||
private fun highlight(pixel: String) {
|
||||
println("highlight $pixel")
|
||||
map[pixel]?.color?.invoke("blue")
|
||||
map[pixel]?.color("blue")
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
map.values.forEach {
|
||||
it.setProperty(SolidMaterial.MATERIAL_COLOR_KEY, null)
|
||||
it.properties[SolidMaterial.MATERIAL_COLOR_KEY] = null
|
||||
}
|
||||
tracks.removeAll()
|
||||
tracks.children.clear()
|
||||
}
|
||||
|
||||
fun displayEvent(event: Event) {
|
||||
@ -83,7 +84,6 @@ class Model(val manager: VisionManager) {
|
||||
}
|
||||
event.track?.let {
|
||||
tracks.polyline(*it.toTypedArray(), name = "track[${event.id}]") {
|
||||
thickness = 4
|
||||
color("red")
|
||||
}
|
||||
}
|
||||
|
@ -2,21 +2,21 @@ package ru.mipt.npm.muon.monitor
|
||||
|
||||
import ru.mipt.npm.muon.monitor.Monitor.PIXEL_XY_SIZE
|
||||
import ru.mipt.npm.muon.monitor.Monitor.PIXEL_Z_SIZE
|
||||
import space.kscience.visionforge.solid.Point3D
|
||||
import space.kscience.visionforge.solid.plus
|
||||
import space.kscience.visionforge.solid.Float32Euclidean3DSpace
|
||||
import space.kscience.visionforge.solid.Float32Vector3D
|
||||
|
||||
/**
|
||||
* A single pixel
|
||||
*/
|
||||
class SC1(
|
||||
val name: String,
|
||||
val center: Point3D,
|
||||
val xSize: Float = PIXEL_XY_SIZE, val ySize: Float = PIXEL_XY_SIZE, val zSize: Float = PIXEL_Z_SIZE
|
||||
val center: Float32Vector3D,
|
||||
val xSize: Float = PIXEL_XY_SIZE, val ySize: Float = PIXEL_XY_SIZE, val zSize: Float = PIXEL_Z_SIZE,
|
||||
)
|
||||
|
||||
class SC16(
|
||||
val name: String,
|
||||
val center: Point3D
|
||||
val center: Float32Vector3D,
|
||||
) {
|
||||
|
||||
/**
|
||||
@ -28,77 +28,90 @@ class SC16(
|
||||
val y: Double
|
||||
when (index) {
|
||||
7 -> {
|
||||
x = 1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = 1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = 1.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = 1.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
4 -> {
|
||||
x = 0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = 1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = 0.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = 1.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
6 -> {
|
||||
x = 1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = 0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = 1.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = 0.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
5 -> {
|
||||
x = 0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = 0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = 0.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = 0.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
3 -> {
|
||||
x = -1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = 1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = -1.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = 1.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
0 -> {
|
||||
x = -0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = 1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = -0.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = 1.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
2 -> {
|
||||
x = -1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = 0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = -1.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = 0.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
1 -> {
|
||||
x = -0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = 0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = -0.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = 0.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
11 -> {
|
||||
x = -1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = -1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = -1.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = -1.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
8 -> {
|
||||
x = -0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = -1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = -0.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = -1.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
10 -> {
|
||||
x = -1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = -0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = -1.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = -0.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
9 -> {
|
||||
x = -0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = -0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = -0.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = -0.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
15 -> {
|
||||
x = 1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = -1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = 1.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = -1.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
12 -> {
|
||||
x = 0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = -1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = 0.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = -1.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
14 -> {
|
||||
x = 1.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = -0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = 1.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = -0.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
|
||||
13 -> {
|
||||
x = 0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
y = -0.5 * Monitor.PIXEL_XY_SPACING;
|
||||
x = 0.5 * Monitor.PIXEL_XY_SPACING
|
||||
y = -0.5 * Monitor.PIXEL_XY_SPACING
|
||||
}
|
||||
else -> throw Error();
|
||||
|
||||
else -> throw Error()
|
||||
}
|
||||
val offset = Point3D(-y, x, 0)//rotateDetector(Point3D(x, y, 0.0));
|
||||
val offset = Float32Vector3D(-y, x, 0)//rotateDetector(Point3D(x, y, 0.0));
|
||||
val pixelName = "${name}_${index}"
|
||||
SC1(pixelName, offset + center)
|
||||
SC1(pixelName, with(Float32Euclidean3DSpace) { offset + center })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -137,11 +150,11 @@ object Monitor {
|
||||
.mapNotNull { line ->
|
||||
if (line.startsWith(" ")) {
|
||||
val split = line.trim().split("\\s+".toRegex())
|
||||
val detectorName = split[1];
|
||||
val detectorName = split[1]
|
||||
val x = split[4].toDouble() - 500
|
||||
val y = split[5].toDouble() - 500
|
||||
val z = 180 - split[6].toDouble()
|
||||
SC16(detectorName, Point3D(x, y, z))
|
||||
SC16(detectorName, Float32Vector3D(x, y, z))
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
@ -1,48 +1,38 @@
|
||||
package ru.mipt.npm.muon.monitor
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.remember
|
||||
import bootstrap.Button
|
||||
import bootstrap.ButtonGroup
|
||||
import bootstrap.Layout.Width.Full
|
||||
import kotlinx.browser.window
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.await
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.css.*
|
||||
import kotlinx.html.js.onClickFunction
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.jetbrains.compose.web.css.*
|
||||
import org.jetbrains.compose.web.dom.Div
|
||||
import org.jetbrains.compose.web.dom.P
|
||||
import org.jetbrains.compose.web.dom.Span
|
||||
import org.jetbrains.compose.web.dom.Text
|
||||
import org.w3c.fetch.RequestInit
|
||||
import react.Props
|
||||
import react.dom.attrs
|
||||
import react.dom.button
|
||||
import react.dom.p
|
||||
import react.fc
|
||||
import react.useMemo
|
||||
import react.useState
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.meta.invoke
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.react.flexColumn
|
||||
import space.kscience.visionforge.react.flexRow
|
||||
import space.kscience.visionforge.ring.ThreeCanvasWithControls
|
||||
import space.kscience.visionforge.ring.tab
|
||||
import space.kscience.visionforge.solid.specifications.Camera
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.solid.ambientLight
|
||||
import space.kscience.visionforge.solid.edges
|
||||
import space.kscience.visionforge.solid.invoke
|
||||
import space.kscience.visionforge.solid.specifications.Canvas3DOptions
|
||||
import space.kscience.visionforge.solid.three.edges
|
||||
import styled.css
|
||||
import styled.styledDiv
|
||||
import styled.styledSpan
|
||||
import space.kscience.visionforge.solid.three.compose.ThreeView
|
||||
import kotlin.math.PI
|
||||
|
||||
external interface MMAppProps : Props {
|
||||
var model: Model
|
||||
var context: Context
|
||||
var selected: Name?
|
||||
}
|
||||
@Composable
|
||||
fun MMApp(context: Context, model: Model, selected: Name? = null) {
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
@JsExport
|
||||
val MMApp = fc<MMAppProps>("Muon monitor") { props ->
|
||||
|
||||
val mmOptions = useMemo {
|
||||
val mmOptions = remember {
|
||||
Canvas3DOptions {
|
||||
camera = Camera {
|
||||
camera {
|
||||
distance = 2100.0
|
||||
latitude = PI / 6
|
||||
azimuth = PI + PI / 6
|
||||
@ -50,225 +40,74 @@ val MMApp = fc<MMAppProps>("Muon monitor") { props ->
|
||||
}
|
||||
}
|
||||
|
||||
val root = useMemo(props.model) {
|
||||
props.model.root.apply {
|
||||
val root = remember(model) {
|
||||
model.root.apply {
|
||||
edges()
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var events: Set<Event> by useState(emptySet())
|
||||
val events = remember { mutableStateListOf<Event>() }
|
||||
|
||||
styledDiv {
|
||||
css {
|
||||
height = 100.vh - 12.pt
|
||||
Div(
|
||||
attrs = {
|
||||
classes("container-fluid")
|
||||
style {
|
||||
height(100.vh - 12.pt)
|
||||
}
|
||||
}
|
||||
child(ThreeCanvasWithControls) {
|
||||
attrs {
|
||||
this.context = props.context
|
||||
this.builderOfSolid = CompletableDeferred(root)
|
||||
this.selected = props.selected
|
||||
this.options = mmOptions
|
||||
tab("Events") {
|
||||
flexColumn {
|
||||
flexRow {
|
||||
button {
|
||||
+"Next"
|
||||
attrs {
|
||||
onClickFunction = {
|
||||
context.launch {
|
||||
val event = window.fetch(
|
||||
"http://localhost:8080/event",
|
||||
RequestInit("GET")
|
||||
).then { response ->
|
||||
if (response.ok) {
|
||||
response.text()
|
||||
} else {
|
||||
error("Failed to get event")
|
||||
}
|
||||
}.then { body ->
|
||||
Json.decodeFromString(Event.serializer(), body)
|
||||
}.await()
|
||||
events = events + event
|
||||
props.model.displayEvent(event)
|
||||
}
|
||||
) {
|
||||
ThreeView(
|
||||
context,
|
||||
solid = root,
|
||||
initialSelected = selected,
|
||||
options = mmOptions,
|
||||
sidebarTabs = {
|
||||
Tab("Events") {
|
||||
ButtonGroup({ Layout.width = Full }) {
|
||||
Button("Next") {
|
||||
context.launch {
|
||||
val event = window.fetch(
|
||||
"http://localhost:8080/event",
|
||||
RequestInit("GET")
|
||||
).then { response ->
|
||||
if (response.ok) {
|
||||
response.text()
|
||||
} else {
|
||||
error("Failed to get event")
|
||||
}
|
||||
}
|
||||
}
|
||||
button {
|
||||
+"Clear"
|
||||
attrs {
|
||||
onClickFunction = {
|
||||
events = emptySet()
|
||||
props.model.reset()
|
||||
}
|
||||
}
|
||||
}.then { body ->
|
||||
Json.decodeFromString(Event.serializer(), body)
|
||||
}.await()
|
||||
events.add(event)
|
||||
model.displayEvent(event)
|
||||
}
|
||||
}
|
||||
Button("Clear", color = bootstrap.Color.Secondary) {
|
||||
events.clear()
|
||||
model.reset()
|
||||
}
|
||||
}
|
||||
|
||||
events.forEach { event ->
|
||||
p {
|
||||
styledSpan {
|
||||
+event.id.toString()
|
||||
P {
|
||||
Span {
|
||||
Text(event.id.toString())
|
||||
}
|
||||
+" : "
|
||||
styledSpan {
|
||||
css {
|
||||
color = Color.blue
|
||||
Text(" : ")
|
||||
Span({
|
||||
style {
|
||||
color(Color.blue)
|
||||
}
|
||||
+event.hits.toString()
|
||||
}) {
|
||||
Text(event.hits.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// var selected by useState { props.selected }
|
||||
//
|
||||
// val onSelect: (Name?) -> Unit = {
|
||||
// selected = it
|
||||
// }
|
||||
//
|
||||
|
||||
//
|
||||
// gridRow {
|
||||
// flexColumn {
|
||||
// css {
|
||||
// +"col-lg-3"
|
||||
// +"order-lg-1"
|
||||
// +"order-2"
|
||||
// padding(0.px)
|
||||
// overflowY = Overflow.auto
|
||||
// height = 100.vh
|
||||
// }
|
||||
// //tree
|
||||
// card("Object tree") {
|
||||
// css {
|
||||
// flex(1.0, 1.0, FlexBasis.auto)
|
||||
// }
|
||||
// visionTree(root, selected, onSelect)
|
||||
// }
|
||||
// }
|
||||
// flexColumn {
|
||||
// css {
|
||||
// +"col-lg-6"
|
||||
// +"order-lg-2"
|
||||
// +"order-1"
|
||||
// height = 100.vh
|
||||
// }
|
||||
// h1("mx-auto page-header") {
|
||||
// +"Muon monitor demo"
|
||||
// }
|
||||
// //canvas
|
||||
//
|
||||
// child(ThreeCanvasComponent) {
|
||||
// attrs {
|
||||
// this.context = props.context
|
||||
// this.solid = root
|
||||
// this.selected = selected
|
||||
// this.options = mmOptions
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// flexColumn {
|
||||
// css {
|
||||
// +"col-lg-3"
|
||||
// +"order-3"
|
||||
// padding(0.px)
|
||||
// height = 100.vh
|
||||
// }
|
||||
// styledDiv {
|
||||
// css {
|
||||
// flex(0.0, 1.0, FlexBasis.zero)
|
||||
// }
|
||||
// //settings
|
||||
// card("Canvas configuration") {
|
||||
// canvasControls(mmOptions, root)
|
||||
// }
|
||||
//
|
||||
// card("Events") {
|
||||
// button {
|
||||
// +"Next"
|
||||
// attrs {
|
||||
// onClickFunction = {
|
||||
// GlobalScope.launch {
|
||||
// val event = props.connection.get<Event>("http://localhost:8080/event")
|
||||
// props.model.displayEvent(event)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// button {
|
||||
// +"Clear"
|
||||
// attrs {
|
||||
// onClickFunction = {
|
||||
// props.model.reset()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// styledDiv {
|
||||
// css {
|
||||
// padding(0.px)
|
||||
// }
|
||||
// nav {
|
||||
// attrs {
|
||||
// attributes["aria-label"] = "breadcrumb"
|
||||
// }
|
||||
// ol("breadcrumb") {
|
||||
// li("breadcrumb-item") {
|
||||
// button(classes = "btn btn-link p-0") {
|
||||
// +"World"
|
||||
// attrs {
|
||||
// onClickFunction = {
|
||||
// selected = Name.EMPTY
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (selected != null) {
|
||||
// val tokens = ArrayList<NameToken>(selected?.length ?: 1)
|
||||
// selected?.tokens?.forEach { token ->
|
||||
// tokens.add(token)
|
||||
// val fullName = Name(tokens.toList())
|
||||
// li("breadcrumb-item") {
|
||||
// button(classes = "btn btn-link p-0") {
|
||||
// +token.toString()
|
||||
// attrs {
|
||||
// onClickFunction = {
|
||||
// console.log("Selected = $fullName")
|
||||
// selected = fullName
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// styledDiv {
|
||||
// css {
|
||||
// overflowY = Overflow.auto
|
||||
// }
|
||||
// //properties
|
||||
// card("Properties") {
|
||||
// selected.let { selected ->
|
||||
// val selectedObject: Vision? = when {
|
||||
// selected == null -> null
|
||||
// selected.isEmpty() -> root
|
||||
// else -> root[selected]
|
||||
// }
|
||||
// if (selectedObject != null) {
|
||||
// visionPropertyEditor(selectedObject, key = selected)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
@ -1,33 +1,31 @@
|
||||
package ru.mipt.npm.muon.monitor
|
||||
|
||||
import kotlinx.browser.document
|
||||
import react.dom.render
|
||||
import org.jetbrains.compose.web.css.Style
|
||||
import org.jetbrains.compose.web.renderComposable
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.visionforge.Application
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.html.Application
|
||||
import space.kscience.visionforge.html.VisionForgeStyles
|
||||
import space.kscience.visionforge.html.startApplication
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
import space.kscience.visionforge.startApplication
|
||||
|
||||
private class MMDemoApp : Application {
|
||||
|
||||
override fun start(state: Map<String, Any>) {
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
|
||||
val context = Context("MM-demo") {
|
||||
plugin(ThreePlugin)
|
||||
}
|
||||
val visionManager = context.fetch(VisionManager)
|
||||
|
||||
val visionManager = context.request(VisionManager)
|
||||
|
||||
val model = Model(visionManager)
|
||||
|
||||
val element = document.getElementById("app") ?: error("Element with id 'app' not found on page")
|
||||
render(element) {
|
||||
child(MMApp) {
|
||||
attrs {
|
||||
this.model = model
|
||||
this.context = context
|
||||
}
|
||||
}
|
||||
renderComposable("app") {
|
||||
Style(VisionForgeStyles)
|
||||
MMApp(context, model)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">-->
|
||||
<title>Three js demo for particle physics</title>
|
||||
<script type="text/javascript" src="muon-monitor.js"></script>
|
||||
<link rel="stylesheet" href="css/custom-bootstrap.css">
|
||||
</head>
|
||||
<body class="application">
|
||||
<div class="container-fluid max-vh-100" id = "app"> </div>
|
||||
|
@ -1,31 +1,27 @@
|
||||
package ru.mipt.npm.muon.monitor.server
|
||||
package ru.mipt.npm.muon.monitor
|
||||
|
||||
|
||||
import io.ktor.application.Application
|
||||
import io.ktor.application.call
|
||||
import io.ktor.application.install
|
||||
import io.ktor.application.log
|
||||
import io.ktor.features.CallLogging
|
||||
import io.ktor.features.ContentNegotiation
|
||||
import io.ktor.features.DefaultHeaders
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.http.content.resources
|
||||
import io.ktor.http.content.static
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Routing
|
||||
import io.ktor.routing.get
|
||||
import io.ktor.serialization.json
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import io.ktor.server.application.Application
|
||||
import io.ktor.server.application.call
|
||||
import io.ktor.server.application.install
|
||||
import io.ktor.server.application.log
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.http.content.staticResources
|
||||
import io.ktor.server.plugins.contentnegotiation.ContentNegotiation
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.server.response.respondText
|
||||
import io.ktor.server.routing.Routing
|
||||
import io.ktor.server.routing.get
|
||||
import org.apache.commons.math3.random.JDKRandomGenerator
|
||||
import ru.mipt.npm.muon.monitor.Model
|
||||
import ru.mipt.npm.muon.monitor.sim.Cos2TrackGenerator
|
||||
import ru.mipt.npm.muon.monitor.sim.simulateOne
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
import java.awt.Desktop
|
||||
@ -38,10 +34,8 @@ private val generator = Cos2TrackGenerator(JDKRandomGenerator(223))
|
||||
fun Application.module(context: Context = Global) {
|
||||
val currentDir = File(".").absoluteFile
|
||||
environment.log.info("Current directory: $currentDir")
|
||||
val solidManager = context.fetch(Solids)
|
||||
val solidManager = context.request(Solids)
|
||||
|
||||
install(DefaultHeaders)
|
||||
install(CallLogging)
|
||||
install(ContentNegotiation) {
|
||||
json()
|
||||
}
|
||||
@ -57,9 +51,7 @@ fun Application.module(context: Context = Global) {
|
||||
status = HttpStatusCode.OK
|
||||
)
|
||||
}
|
||||
static("/") {
|
||||
resources()
|
||||
}
|
||||
staticResources("/", null)
|
||||
}
|
||||
try {
|
||||
Desktop.getDesktop().browse(URI("http://localhost:8080/index.html"))
|
||||
|
@ -5,7 +5,7 @@ import org.apache.commons.math3.geometry.euclidean.threed.Plane
|
||||
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D
|
||||
import ru.mipt.npm.muon.monitor.Monitor.CENTRAL_LAYER_Z
|
||||
import ru.mipt.npm.muon.monitor.Monitor.GEOMETRY_TOLERANCE
|
||||
import space.kscience.visionforge.solid.Point3D
|
||||
import space.kscience.visionforge.solid.Float32Vector3D
|
||||
|
||||
/**
|
||||
* Created by darksnake on 11-May-16.
|
||||
@ -50,12 +50,12 @@ fun makeTrack(x: Double, y: Double, theta: Double, phi: Double): Line {
|
||||
)
|
||||
}
|
||||
|
||||
fun Vector3D.toPoint() = Point3D(x, y, z)
|
||||
fun Vector3D.toKMathVector() = Float32Vector3D(x, y, z)
|
||||
|
||||
fun Line.toPoints(): List<Point3D> {
|
||||
fun Line.toKMathVectors(): List<Float32Vector3D> {
|
||||
val basePoint = basePlane.intersection(this)
|
||||
val bottom = basePoint.subtract(2000.0, direction)
|
||||
val top = basePoint.add(2000.0, direction)
|
||||
return listOf(bottom.toPoint(), top.toPoint())
|
||||
return listOf(bottom.toKMathVector(), top.toKMathVector())
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ fun readEffs(): Map<String, Double> {
|
||||
|
||||
|
||||
fun buildEventByTrack(index: Int, track: Line, hitResolver: (Line) -> Collection<SC1> = defaultHitResolver): Event {
|
||||
return Event(index, track.toPoints(), hitResolver(track).map { it.name })
|
||||
return Event(index, track.toKMathVectors(), hitResolver(track).map { it.name })
|
||||
}
|
||||
|
||||
val defaultHitResolver: (Line) -> Collection<SC1> = { track: Line ->
|
||||
|
@ -1,3 +0,0 @@
|
||||
const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
|
||||
|
||||
config.module.rules.push(...ringConfig.module.rules)
|
@ -3,6 +3,36 @@ public final class space/kscience/visionforge/examples/AllThingsDemoKt {
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/AntennaKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/AxesKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/BmnDemoKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/ControlVisionKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/DynamicPlotlyVisionKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/ExtrudedKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/FormServerKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
@ -28,6 +58,11 @@ public final class space/kscience/visionforge/examples/GenerateSchemaKt {
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/MarkdownVisionKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/PlotlyVisionKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
@ -38,17 +73,24 @@ public final class space/kscience/visionforge/examples/RandomSpheresKt {
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/RootParserKt {
|
||||
public final class space/kscience/visionforge/examples/ServerExtensionsKt {
|
||||
public static final fun makeVisionFile (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLspace/kscience/visionforge/html/HtmlVisionFragment;)V
|
||||
public static synthetic fun makeVisionFile$default (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLspace/kscience/visionforge/html/HtmlVisionFragment;ILjava/lang/Object;)V
|
||||
public static final fun serve (Ljava/lang/String;ZLspace/kscience/visionforge/html/HtmlVisionFragment;)V
|
||||
public static synthetic fun serve$default (Ljava/lang/String;ZLspace/kscience/visionforge/html/HtmlVisionFragment;ILjava/lang/Object;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/ShapesKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/ServerExtensionsKt {
|
||||
public static final fun makeVisionFile (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLkotlin/jvm/functions/Function1;)V
|
||||
public static synthetic fun makeVisionFile$default (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
|
||||
public final class space/kscience/visionforge/examples/SimpleCubeKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/SimpleCubeKt {
|
||||
public final class space/kscience/visionforge/examples/SurfaceKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ plugins {
|
||||
kotlin("multiplatform")
|
||||
kotlin("jupyter.api")
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
// application
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -11,29 +12,27 @@ repositories {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
||||
jvmToolchain(11)
|
||||
js(IR) {
|
||||
useCommonJs()
|
||||
browser {
|
||||
webpackTask {
|
||||
this.outputFileName = "js/visionforge-playground.js"
|
||||
}
|
||||
commonWebpackConfig {
|
||||
sourceMaps = true
|
||||
cssSupport.enabled = false
|
||||
cssSupport{
|
||||
enabled = true
|
||||
}
|
||||
scssSupport{
|
||||
enabled = true
|
||||
}
|
||||
mainOutputFileName.set("js/visionforge-playground.js")
|
||||
}
|
||||
}
|
||||
binaries.executable()
|
||||
}
|
||||
|
||||
jvm {
|
||||
withJava()
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
freeCompilerArgs =
|
||||
freeCompilerArgs + "-Xjvm-default=all" + "-Xopt-in=kotlin.RequiresOptIn" + "-Xlambdas=indy"
|
||||
}
|
||||
// withJava()
|
||||
compilerOptions {
|
||||
freeCompilerArgs.addAll("-Xjvm-default=all", "-Xopt-in=kotlin.RequiresOptIn", "-Xlambdas=indy", "-Xcontext-receivers")
|
||||
|
||||
}
|
||||
testRuns["test"].executionTask.configure {
|
||||
useJUnitPlatform()
|
||||
@ -44,18 +43,16 @@ kotlin {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
implementation(projects.visionforgeSolid)
|
||||
implementation(projects.visionforgeGdml)
|
||||
implementation(projects.visionforgePlotly)
|
||||
implementation(projects.visionforgeMarkdown)
|
||||
implementation(projects.visionforgeTables)
|
||||
implementation(projects.cernRootLoader)
|
||||
implementation(projects.jupyter)
|
||||
api(projects.visionforgeJupyter.visionforgeJupyterCommon)
|
||||
}
|
||||
}
|
||||
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
implementation(projects.ui.ring)
|
||||
implementation(projects.visionforgeThreejs)
|
||||
compileOnly(npm("webpack-bundle-analyzer","4.5.0"))
|
||||
}
|
||||
@ -63,8 +60,10 @@ kotlin {
|
||||
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
implementation("io.ktor:ktor-server-cio:${spclibs.versions.ktor.get()}")
|
||||
implementation(projects.visionforgeGdml)
|
||||
implementation(projects.visionforgeServer)
|
||||
implementation("ch.qos.logback:logback-classic:1.2.3")
|
||||
implementation(spclibs.logback.classic)
|
||||
implementation("com.github.Ricky12Awesome:json-schema-serialization:0.6.6")
|
||||
}
|
||||
}
|
||||
@ -87,4 +86,8 @@ val processJupyterApiResources by tasks.getting(org.jetbrains.kotlinx.jupyter.ap
|
||||
libraryProducers = listOf("space.kscience.visionforge.examples.VisionForgePlayGroundForJupyter")
|
||||
}
|
||||
|
||||
tasks.findByName("shadowJar")?.dependsOn(processJupyterApiResources)
|
||||
tasks.findByName("shadowJar")?.dependsOn(processJupyterApiResources)
|
||||
|
||||
//application{
|
||||
// mainClass.set("space.kscience.visionforge.examples.ShapesKt")
|
||||
//}
|
98
demo/playground/notebooks/common-demo.ipynb
Normal file
98
demo/playground/notebooks/common-demo.ipynb
Normal file
@ -0,0 +1,98 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"@file:Repository(\"*mavenLocal\")\n",
|
||||
"@file:Repository(\"https://repo.kotlin.link\")\n",
|
||||
"@file:Repository(\"https://maven.pkg.jetbrains.space/spc/p/sci/dev\")\n",
|
||||
"@file:DependsOn(\"space.kscience:visionforge-jupyter-common-jvm:0.3.0-dev-12\")\n",
|
||||
"//import space.kscience.visionforge.jupyter.JupyterCommonIntegration\n",
|
||||
"//\n",
|
||||
"//val integration = JupyterCommonIntegration()\n",
|
||||
"//USE(integration.getDefinitions(notebook).first())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vf.fragment {\n",
|
||||
" h1 { +\"AAA\" }\n",
|
||||
" vision {\n",
|
||||
" solid {\n",
|
||||
" ambientLight()\n",
|
||||
" box(100, 100, 200)\n",
|
||||
"\n",
|
||||
" sphere(100) {\n",
|
||||
" x = 300\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" vision {\n",
|
||||
" plotly {\n",
|
||||
" scatter {\n",
|
||||
" x(1, 2, 3, 1)\n",
|
||||
" y(1, 2, 3, 4)\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"Plotly.plot { \n",
|
||||
" scatter{\n",
|
||||
" x(1,2,3)\n",
|
||||
" y(1,2,3)\n",
|
||||
" }\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Kotlin",
|
||||
"language": "kotlin",
|
||||
"name": "kotlin"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": "text/x-kotlin",
|
||||
"file_extension": ".kt",
|
||||
"mimetype": "text/x-kotlin",
|
||||
"name": "kotlin",
|
||||
"nbconvert_exporter": "",
|
||||
"pygments_lexer": "kotlin",
|
||||
"version": "1.8.20"
|
||||
},
|
||||
"ktnbPluginMetadata": {
|
||||
"projectLibraries": []
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
45
demo/playground/notebooks/controls.ipynb
Normal file
45
demo/playground/notebooks/controls.ipynb
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"USE(JupyterCommonIntegration())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Kotlin",
|
||||
"language": "kotlin",
|
||||
"name": "kotlin"
|
||||
},
|
||||
"language_info": {
|
||||
"name": "kotlin",
|
||||
"version": "1.9.0",
|
||||
"mimetype": "text/x-kotlin",
|
||||
"file_extension": ".kt",
|
||||
"pygments_lexer": "kotlin",
|
||||
"codemirror_mode": "text/x-kotlin",
|
||||
"nbconvert_exporter": ""
|
||||
},
|
||||
"ktnbPluginMetadata": {
|
||||
"projectDependencies": true
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
89
demo/playground/notebooks/dynamic-demo.ipynb
Normal file
89
demo/playground/notebooks/dynamic-demo.ipynb
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"tags": [],
|
||||
"pycharm": {
|
||||
"is_executing": true
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vf.startServer()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import kotlinx.coroutines.*\n",
|
||||
"import kotlin.random.Random\n",
|
||||
"\n",
|
||||
"Plotly.plot{\n",
|
||||
" scatter{\n",
|
||||
" x(1,2,3)\n",
|
||||
" y(1,2,3)\n",
|
||||
" if(vf.isServerRunning()){\n",
|
||||
" vf.launch{\n",
|
||||
" while(isActive){\n",
|
||||
" delay(500)\n",
|
||||
" y(Random.nextDouble(), Random.nextDouble(), Random.nextDouble())\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vf.stopServer()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Kotlin",
|
||||
"language": "kotlin",
|
||||
"name": "kotlin"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": "text/x-kotlin",
|
||||
"file_extension": ".kt",
|
||||
"mimetype": "text/x-kotlin",
|
||||
"name": "kotlin",
|
||||
"nbconvert_exporter": "",
|
||||
"pygments_lexer": "kotlin",
|
||||
"version": "1.8.0-dev-3517"
|
||||
},
|
||||
"ktnbPluginMetadata": {
|
||||
"projectLibraries": []
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -1,14 +1,16 @@
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.visionforge.html.runVisionClient
|
||||
import space.kscience.visionforge.jupyter.VFNotebookClient
|
||||
import space.kscience.visionforge.markup.MarkupPlugin
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.ring.ThreeWithControlsPlugin
|
||||
import space.kscience.visionforge.runVisionClient
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
import space.kscience.visionforge.tables.TableVisionJsPlugin
|
||||
|
||||
@DFExperimental
|
||||
fun main() = runVisionClient {
|
||||
plugin(ThreeWithControlsPlugin)
|
||||
plugin(ThreePlugin)
|
||||
plugin(PlotlyPlugin)
|
||||
plugin(MarkupPlugin)
|
||||
plugin(TableVisionJsPlugin)
|
||||
plugin(VFNotebookClient)
|
||||
}
|
83
demo/playground/src/jvmMain/kotlin/BmnDemo.kt
Normal file
83
demo/playground/src/jvmMain/kotlin/BmnDemo.kt
Normal file
@ -0,0 +1,83 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import ru.mipt.npm.root.BMN
|
||||
import ru.mipt.npm.root.DGeoManager
|
||||
import ru.mipt.npm.root.rootGeo
|
||||
import ru.mipt.npm.root.serialization.TGeoManager
|
||||
import ru.mipt.npm.root.toVector
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.get
|
||||
import space.kscience.dataforge.meta.isLeaf
|
||||
import space.kscience.dataforge.meta.string
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.solid.*
|
||||
import java.util.zip.ZipInputStream
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.createDirectories
|
||||
import kotlin.io.path.writeText
|
||||
|
||||
|
||||
private fun Meta.countTypes(): Sequence<String> = sequence {
|
||||
if (!isLeaf) {
|
||||
get("_typename")?.value?.let { yield(it.string) }
|
||||
items.forEach { yieldAll(it.value.countTypes()) }
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
Path("data").createDirectories()
|
||||
|
||||
val string = ZipInputStream(TGeoManager::class.java.getResourceAsStream("/root/geometry_run_7-2076.zip")!!).use {
|
||||
it.nextEntry
|
||||
it.readAllBytes().decodeToString()
|
||||
}
|
||||
|
||||
val geo = DGeoManager.parse(string)
|
||||
|
||||
|
||||
val sizes = geo.meta.countTypes().groupBy { it }.mapValues { it.value.size }
|
||||
sizes.forEach {
|
||||
println(it)
|
||||
}
|
||||
|
||||
val events = BMN.readEventJson(TGeoManager::class.java.getResourceAsStream("/root/event_0.json")!!.bufferedReader().readText())
|
||||
|
||||
makeVisionFile(path = Path("data/output.html"), resourceLocation = ResourceLocation.EMBED) {
|
||||
vision("canvas") {
|
||||
requirePlugin(Solids)
|
||||
solid {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
rootGeo(geo,"BM@N", ignoreRootColors = true).also {
|
||||
Path("data/BM@N.vf.json").writeText(Solids.encodeToString(it))
|
||||
}
|
||||
|
||||
solidGroup("cbmStsTracks") {
|
||||
events.cbmTracks.forEach { track ->
|
||||
polyline(
|
||||
track.fParamFirst.toVector(),
|
||||
track.fParamLast.toVector()
|
||||
) {
|
||||
thickness = 2.0
|
||||
color(Colors.blue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
solidGroup("bmnGlobalTracks") {
|
||||
events.bmnGlobalTracks.forEach { track ->
|
||||
polyline(
|
||||
track.fParamFirst.toVector(),
|
||||
track.fParamLast.toVector()
|
||||
) {
|
||||
thickness = 2.0
|
||||
color(Colors.red)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import org.jetbrains.kotlinx.jupyter.api.libraries.resources
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.gdml.Gdml
|
||||
import space.kscience.plotly.Plot
|
||||
import space.kscience.visionforge.gdml.toVision
|
||||
import space.kscience.visionforge.jupyter.JupyterPluginBase
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.plotly.asVision
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
|
||||
@DFExperimental
|
||||
internal class VisionForgePlayGroundForJupyter : JupyterPluginBase(
|
||||
Context("VisionForge") {
|
||||
plugin(Solids)
|
||||
plugin(PlotlyPlugin)
|
||||
}
|
||||
) {
|
||||
|
||||
override fun Builder.afterLoaded() {
|
||||
resources {
|
||||
js("VisionForge") {
|
||||
classPath("js/visionforge-playground.js")
|
||||
}
|
||||
}
|
||||
|
||||
import(
|
||||
"space.kscience.gdml.*",
|
||||
"space.kscience.plotly.*",
|
||||
"space.kscience.plotly.models.*",
|
||||
"space.kscience.visionforge.solid.*",
|
||||
)
|
||||
|
||||
|
||||
render<Gdml> { gdmlModel ->
|
||||
handler.produceHtml {
|
||||
vision { gdmlModel.toVision() }
|
||||
}
|
||||
}
|
||||
|
||||
render<Plot> { plot ->
|
||||
handler.produceHtml {
|
||||
vision { plot.asVision() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import kotlinx.html.h2
|
||||
import space.kscience.dataforge.values.ValueType
|
||||
import space.kscience.dataforge.meta.ValueType
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.ScatterMode
|
||||
import space.kscience.plotly.models.TextPosition
|
||||
@ -10,15 +10,16 @@ import space.kscience.tables.ColumnHeader
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.markup.markdown
|
||||
import space.kscience.visionforge.plotly.plotly
|
||||
import space.kscience.visionforge.solid.axes
|
||||
import space.kscience.visionforge.solid.box
|
||||
import space.kscience.visionforge.solid.solid
|
||||
import space.kscience.visionforge.solid.z
|
||||
import space.kscience.visionforge.tables.columnTable
|
||||
import java.nio.file.Paths
|
||||
import kotlin.io.path.Path
|
||||
|
||||
|
||||
fun main() = makeVisionFile(
|
||||
Paths.get("VisionForgeDemo.html"),
|
||||
Path("VisionForgeDemo.html"),
|
||||
resourceLocation = ResourceLocation.EMBED
|
||||
) {
|
||||
markdown {
|
||||
@ -33,7 +34,8 @@ fun main() = makeVisionFile(
|
||||
h2 { +"3D visualization with Three-js" }
|
||||
vision("3D") {
|
||||
solid {
|
||||
box(100, 100, 100, name = "aBox"){
|
||||
axes(200)
|
||||
box(100, 100, 100, name = "aBox") {
|
||||
z = 50.0
|
||||
}
|
||||
}
|
||||
|
102
demo/playground/src/jvmMain/kotlin/antenna.kt
Normal file
102
demo/playground/src/jvmMain/kotlin/antenna.kt
Normal file
@ -0,0 +1,102 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import space.kscience.dataforge.meta.configure
|
||||
import space.kscience.kmath.complex.Quaternion
|
||||
import space.kscience.kmath.complex.QuaternionField
|
||||
import space.kscience.kmath.complex.conjugate
|
||||
import space.kscience.kmath.geometry.*
|
||||
import space.kscience.visionforge.solid.*
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() = serve {
|
||||
|
||||
// val azimuth = 60.degrees
|
||||
// val inclination = 15.degrees
|
||||
|
||||
// val direction = with(QuaternionField) {
|
||||
// Quaternion.fromRotation(-azimuth, Euclidean3DSpace.zAxis) *
|
||||
// Quaternion.fromRotation(Angle.piDiv2 - inclination, Euclidean3DSpace.yAxis)
|
||||
// }
|
||||
|
||||
//val direction2 = Quaternion.fromEuler(Angle.zero, Angle.piDiv2 - inclination, -azimuth, RotationOrder.ZYX)
|
||||
|
||||
val target = Quaternion.fromEuler((-45).degrees, 45.degrees, Angle.zero, RotationOrder.XYZ)
|
||||
|
||||
|
||||
vision("canvas") {
|
||||
requirePlugin(Solids)
|
||||
|
||||
solid(options = {
|
||||
configure { "controls.enabled" put false }
|
||||
}) {
|
||||
rotationX = -PI / 2
|
||||
rotationZ = PI
|
||||
//axes(200)
|
||||
ambientLight()
|
||||
val platform = solidGroup("platform") {
|
||||
cylinder(50, 5, name = "base")
|
||||
solidGroup("frame") {
|
||||
z = 60
|
||||
|
||||
solidGroup("antenna") {
|
||||
axes(200)
|
||||
tube(40, 10, 30)
|
||||
sphereLayer(100, 95, theta = PI / 6) {
|
||||
z = 100
|
||||
rotationX = -PI / 2
|
||||
}
|
||||
cylinder(5, 30) {
|
||||
z = 15
|
||||
}
|
||||
|
||||
sphereLayer(101, 94, phi = PI / 32, theta = PI / 6) {
|
||||
z = 100
|
||||
rotationX = -PI / 2
|
||||
color("red")
|
||||
}
|
||||
|
||||
quaternion = target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val frame = platform["frame"] as SolidGroup
|
||||
|
||||
val antenna = frame["antenna"] as SolidGroup
|
||||
|
||||
val xPeriod = 5000 //ms
|
||||
val yPeriod = 7000 //ms
|
||||
|
||||
val incRot = Quaternion.fromRotation(30.degrees, Euclidean3DSpace.zAxis)
|
||||
|
||||
|
||||
context.launch {
|
||||
var time: Long = 0L
|
||||
while (isActive) {
|
||||
with(QuaternionField) {
|
||||
delay(200)
|
||||
platform.quaternion = Quaternion.fromRotation(
|
||||
15.degrees * sin(time.toDouble() * 2 * PI / xPeriod),
|
||||
Euclidean3DSpace.xAxis
|
||||
) * Quaternion.fromRotation(
|
||||
15.degrees * cos(time * 2 * PI / yPeriod),
|
||||
Euclidean3DSpace.yAxis
|
||||
)
|
||||
|
||||
val qi = platform.quaternion * incRot
|
||||
|
||||
antenna.quaternion = qi.conjugate * incRot.conjugate * target
|
||||
|
||||
time += 200
|
||||
//antenna.quaternion = Quaternion.fromRotation(5.degrees, Euclidean3DSpace.zAxis) * antenna.quaternion
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
demo/playground/src/jvmMain/kotlin/axes.kt
Normal file
22
demo/playground/src/jvmMain/kotlin/axes.kt
Normal file
@ -0,0 +1,22 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.kmath.geometry.Euclidean3DSpace
|
||||
import space.kscience.kmath.geometry.radians
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.solid.*
|
||||
import kotlin.math.PI
|
||||
|
||||
fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
vision("canvas") {
|
||||
requirePlugin(Solids)
|
||||
solid {
|
||||
axes(100, "root-axes")
|
||||
solidGroup("group") {
|
||||
z = 100
|
||||
rotate((PI / 4).radians, Euclidean3DSpace.vector(1, 1, 1))
|
||||
axes(100, "local-axes")
|
||||
box(50, 50, 50, "box")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
71
demo/playground/src/jvmMain/kotlin/controlVision.kt
Normal file
71
demo/playground/src/jvmMain/kotlin/controlVision.kt
Normal file
@ -0,0 +1,71 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.html.h2
|
||||
import kotlinx.html.p
|
||||
import space.kscience.visionforge.VisionControlEvent
|
||||
import space.kscience.visionforge.html.*
|
||||
import space.kscience.visionforge.onSubmit
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
|
||||
fun main() = serve {
|
||||
|
||||
val events = ArrayDeque<VisionControlEvent>(10)
|
||||
|
||||
val html = VisionOfPlainHtml()
|
||||
|
||||
fun pushEvent(event: VisionControlEvent) {
|
||||
events.addFirst(event)
|
||||
if (events.size >= 10) {
|
||||
events.removeLast()
|
||||
}
|
||||
html.content {
|
||||
events.forEach { event ->
|
||||
p {
|
||||
text(event.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
h2 { +"Control elements" }
|
||||
|
||||
vision {
|
||||
htmlCheckBox {
|
||||
checked = true
|
||||
onValueChange(context) {
|
||||
pushEvent(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vision {
|
||||
htmlRangeField(1, 10) {
|
||||
numberValue = 4
|
||||
onValueChange(context) {
|
||||
pushEvent(this)
|
||||
}
|
||||
context.launch {
|
||||
while (isActive) {
|
||||
delay(1.seconds)
|
||||
numberValue = ((numberValue?.toInt() ?: 0) + 1) % 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vision {
|
||||
button("Click me") {
|
||||
onSubmit(context) {
|
||||
pushEvent(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
vision(html)
|
||||
}
|
112
demo/playground/src/jvmMain/kotlin/dynamicPlotlyVision.kt
Normal file
112
demo/playground/src/jvmMain/kotlin/dynamicPlotlyVision.kt
Normal file
@ -0,0 +1,112 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.http.content.staticResources
|
||||
import io.ktor.server.routing.routing
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.html.a
|
||||
import kotlinx.html.h1
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.plotly.models.invoke
|
||||
import space.kscience.visionforge.html.VisionPage
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.plotly.plotly
|
||||
import space.kscience.visionforge.server.close
|
||||
import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.visionPage
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
val plotlyPlugin = Global.request(PlotlyPlugin)
|
||||
val visionManager = plotlyPlugin.visionManager
|
||||
|
||||
val server = embeddedServer(CIO) {
|
||||
|
||||
routing {
|
||||
staticResources("/", null)
|
||||
}
|
||||
|
||||
|
||||
val freq = 1.0 / 1000
|
||||
val oscillationFreq = 1.0 / 10000
|
||||
|
||||
val x = (0..100).map { it.toDouble() / 100.0 }
|
||||
val sinY = x.map { sin(2.0 * PI * it) }
|
||||
val cosY = x.map { cos(2.0 * PI * it) }
|
||||
|
||||
val sinTrace = Trace(x, sinY) { name = "sin" }
|
||||
val cosTrace = Trace(x, cosY) { name = "cos" }
|
||||
|
||||
visionPage(
|
||||
visionManager,
|
||||
VisionPage.scriptHeader("js/visionforge-playground.js"),
|
||||
) {
|
||||
|
||||
h1 { +"This is the plot page" }
|
||||
a("/other") { +"The other page" }
|
||||
vision {
|
||||
|
||||
|
||||
plotly {
|
||||
traces(sinTrace, cosTrace)
|
||||
layout {
|
||||
title = "Other dynamic plot"
|
||||
xaxis.title = "x axis name"
|
||||
yaxis.title = "y axis name"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visionPage(
|
||||
visionManager,
|
||||
VisionPage.scriptHeader("js/visionforge-playground.js"),
|
||||
route = "other"
|
||||
) {
|
||||
h1 { +"This is the other plot page" }
|
||||
a("/") { +"Back to the main page" }
|
||||
vision {
|
||||
plotly {
|
||||
traces(sinTrace)
|
||||
layout {
|
||||
title = "Dynamic plot"
|
||||
xaxis.title = "x axis name"
|
||||
yaxis.title = "y axis name"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Start pushing updates
|
||||
launch {
|
||||
var time: Long = 0
|
||||
|
||||
while (isActive) {
|
||||
delay(10)
|
||||
time += 10
|
||||
sinTrace.y.numbers = x.map { sin(2.0 * PI * (it + time.toDouble() * freq)) }
|
||||
val cosAmp = cos(2.0 * PI * oscillationFreq * time)
|
||||
cosTrace.y.numbers = x.map { cos(2.0 * PI * (it + time.toDouble() * freq)) * cosAmp }
|
||||
}
|
||||
}
|
||||
|
||||
}.start(false)
|
||||
|
||||
|
||||
server.openInBrowser()
|
||||
|
||||
while (readlnOrNull() != "exit") {
|
||||
|
||||
}
|
||||
|
||||
server.close()
|
||||
}
|
22
demo/playground/src/jvmMain/kotlin/extruded.kt
Normal file
22
demo/playground/src/jvmMain/kotlin/extruded.kt
Normal file
@ -0,0 +1,22 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.visionforge.solid.ambientLight
|
||||
import space.kscience.visionforge.solid.extruded
|
||||
import space.kscience.visionforge.solid.polygon
|
||||
import space.kscience.visionforge.solid.solid
|
||||
|
||||
fun main() = makeVisionFile {
|
||||
vision("canvas") {
|
||||
solid {
|
||||
ambientLight()
|
||||
extruded("extruded") {
|
||||
shape{
|
||||
polygon(8, 100)
|
||||
}
|
||||
layer(-30)
|
||||
layer(0, x = 10, y = 10)
|
||||
layer(30)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +1,42 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.http.content.staticResources
|
||||
import io.ktor.server.routing.routing
|
||||
import kotlinx.html.*
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.html.Page
|
||||
import space.kscience.visionforge.html.formFragment
|
||||
import space.kscience.visionforge.html.VisionOfHtmlForm
|
||||
import space.kscience.visionforge.html.VisionPage
|
||||
import space.kscience.visionforge.html.visionOfForm
|
||||
import space.kscience.visionforge.onPropertyChange
|
||||
import space.kscience.visionforge.server.close
|
||||
import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.serve
|
||||
import space.kscience.visionforge.server.visionPage
|
||||
|
||||
@Suppress("ExtractKtorModule")
|
||||
fun main() {
|
||||
val visionManager = Global.fetch(VisionManager)
|
||||
val visionManager = Global.request(VisionManager)
|
||||
|
||||
val server = visionManager.serve {
|
||||
page(header = Page.scriptHeader("js/visionforge-playground.js")) {
|
||||
val form = formFragment("form") {
|
||||
val server = embeddedServer(CIO) {
|
||||
|
||||
routing {
|
||||
staticResources("/", null)
|
||||
}
|
||||
|
||||
val form = VisionOfHtmlForm("form").apply {
|
||||
onPropertyChange(visionManager.context) {
|
||||
println(values)
|
||||
}
|
||||
}
|
||||
|
||||
visionPage(
|
||||
visionManager,
|
||||
VisionPage.scriptHeader("js/visionforge-playground.js"),
|
||||
) {
|
||||
visionOfForm(form) {
|
||||
label {
|
||||
htmlFor = "fname"
|
||||
+"First name:"
|
||||
@ -47,17 +67,15 @@ fun main() {
|
||||
value = "Submit"
|
||||
}
|
||||
}
|
||||
|
||||
vision("form") { form }
|
||||
form.onPropertyChange {
|
||||
println(this)
|
||||
}
|
||||
vision(form)
|
||||
println(form.values)
|
||||
}
|
||||
}
|
||||
|
||||
}.start(false)
|
||||
|
||||
server.openInBrowser()
|
||||
|
||||
while (readln() != "exit") {
|
||||
while (readlnOrNull() != "exit") {
|
||||
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import space.kscience.visionforge.gdml.toVision
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
|
||||
fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM){
|
||||
fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
vision("canvas") {
|
||||
requirePlugin(Solids)
|
||||
GdmlShowCase.cubes().toVision()
|
||||
|
@ -223,7 +223,7 @@ fun main() = makeVisionFile(Path.of("curves.html"), resourceLocation = ResourceL
|
||||
}
|
||||
}
|
||||
}.toVision {
|
||||
configure { _, solid, _ ->
|
||||
solids { _, solid, _ ->
|
||||
//disable visibility for the world box
|
||||
if(solid.name == "world"){
|
||||
visible = false
|
||||
|
@ -1,12 +1,15 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.gdml.GdmlShowCase
|
||||
import space.kscience.visionforge.gdml.toVision
|
||||
import space.kscience.visionforge.gdml.gdml
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
import space.kscience.visionforge.solid.solid
|
||||
|
||||
fun main() = makeVisionFile {
|
||||
vision("canvas") {
|
||||
requirePlugin(Solids)
|
||||
GdmlShowCase.babyIaxo().toVision()
|
||||
solid {
|
||||
gdml(GdmlShowCase.babyIaxo(), "D0")
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import kotlinx.serialization.json.Json
|
||||
import space.kscience.visionforge.solid.SolidGroup
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
private val json = Json {
|
||||
serializersModule = Solids.serializersModuleForSolids
|
||||
prettyPrintIndent = " "
|
||||
|
19
demo/playground/src/jvmMain/kotlin/markdownVision.kt
Normal file
19
demo/playground/src/jvmMain/kotlin/markdownVision.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.markup.markdown
|
||||
|
||||
fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
vision {
|
||||
markdown{
|
||||
content = """
|
||||
# h1 Heading 8-)
|
||||
## h2 Heading
|
||||
### h3 Heading
|
||||
#### h4 Heading
|
||||
##### h5 Heading
|
||||
###### h6 Heading
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,92 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.plotly.scatter
|
||||
import space.kscience.dataforge.meta.Value
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.*
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.plotly.plotly
|
||||
|
||||
fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
vision {
|
||||
val trace1 = Violin {
|
||||
text("sample length: 32")
|
||||
marker {
|
||||
line {
|
||||
width = 2
|
||||
color("#bebada")
|
||||
}
|
||||
symbol = Symbol.valueOf("line-ns")
|
||||
}
|
||||
orientation = Orientation.h
|
||||
hoveron = ViolinHoveron.`points+kde`
|
||||
meanline {
|
||||
visible = true
|
||||
}
|
||||
legendgroup = "F"
|
||||
scalegroup = "F"
|
||||
points = ViolinPoints.all
|
||||
pointpos = 1.2
|
||||
jitter = 0
|
||||
box {
|
||||
visible = true
|
||||
}
|
||||
scalemode = ViolinScaleMode.count
|
||||
showlegend = false
|
||||
side = ViolinSide.positive
|
||||
y0 = Value.of(0)
|
||||
line {
|
||||
color("#bebada")
|
||||
}
|
||||
name = "F"
|
||||
|
||||
x(10.07, 34.83, 10.65, 12.43, 24.08, 13.42, 12.48, 29.8, 14.52, 11.38,
|
||||
20.27, 11.17, 12.26, 18.26, 8.51, 10.33, 14.15, 13.16, 17.47, 27.05, 16.43,
|
||||
8.35, 18.64, 11.87, 19.81, 43.11, 13.0, 12.74, 13.0, 16.4, 16.47, 18.78)
|
||||
}
|
||||
|
||||
val trace2 = Violin {
|
||||
text("sample length: 32")
|
||||
marker {
|
||||
line {
|
||||
width = 2
|
||||
color("#8dd3c7")
|
||||
}
|
||||
symbol = Symbol.valueOf("line-ns")
|
||||
}
|
||||
orientation = Orientation.h
|
||||
hoveron = ViolinHoveron.`points+kde`
|
||||
meanline {
|
||||
visible = true
|
||||
}
|
||||
legendgroup = "M"
|
||||
scalegroup = "M"
|
||||
points = ViolinPoints.all
|
||||
pointpos = -1.2
|
||||
jitter = 0
|
||||
box {
|
||||
visible = true
|
||||
}
|
||||
scalemode = ViolinScaleMode.count
|
||||
showlegend = false
|
||||
side = ViolinSide.negative
|
||||
y0 = Value.of(0)
|
||||
|
||||
line {
|
||||
color("#8dd3c7")
|
||||
}
|
||||
name = "M"
|
||||
|
||||
x(27.2, 22.76, 17.29, 19.44, 16.66, 32.68, 15.98, 13.03, 18.28, 24.71,
|
||||
21.16, 11.69, 14.26, 15.95, 8.52, 22.82, 19.08, 16.0, 34.3, 41.19, 9.78,
|
||||
7.51, 28.44, 15.48, 16.58, 7.56, 10.34, 13.51, 18.71, 20.53)
|
||||
}
|
||||
|
||||
plotly {
|
||||
scatter {
|
||||
x(1, 2, 3)
|
||||
y(5, 8, 7)
|
||||
traces(trace1, trace2)
|
||||
layout {
|
||||
width = 800
|
||||
height = 800
|
||||
title = "Advanced Violin Plot"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package space.kscience.visionforge.examples
|
||||
|
||||
import kotlinx.html.div
|
||||
import kotlinx.html.h1
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.solid.*
|
||||
import java.nio.file.Paths
|
||||
@ -17,6 +18,9 @@ fun main() = makeVisionFile(
|
||||
div {
|
||||
vision {
|
||||
solid {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
repeat(100) {
|
||||
sphere(5, name = "sphere[$it]") {
|
||||
x = random.nextDouble(-300.0, 300.0)
|
||||
|
@ -1,106 +0,0 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import ru.mipt.npm.root.DGeoManager
|
||||
import ru.mipt.npm.root.serialization.TGeoManager
|
||||
import ru.mipt.npm.root.toSolid
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.get
|
||||
import space.kscience.dataforge.meta.isLeaf
|
||||
import space.kscience.dataforge.values.string
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
import java.nio.file.Paths
|
||||
import java.util.zip.ZipInputStream
|
||||
import kotlin.io.path.writeText
|
||||
|
||||
|
||||
private fun Meta.countTypes(): Sequence<String> = sequence {
|
||||
if (!isLeaf) {
|
||||
get("_typename")?.value?.let { yield(it.string) }
|
||||
items.forEach { yieldAll(it.value.countTypes()) }
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val string = ZipInputStream(TGeoManager::class.java.getResourceAsStream("/root/BM@N_geometry.zip")!!).use {
|
||||
it.nextEntry
|
||||
it.readAllBytes().decodeToString()
|
||||
}
|
||||
|
||||
val geo = DGeoManager.parse(string)
|
||||
|
||||
|
||||
val sizes = geo.meta.countTypes().groupBy { it }.mapValues { it.value.size }
|
||||
sizes.forEach {
|
||||
println(it)
|
||||
}
|
||||
|
||||
val solid = geo.toSolid()
|
||||
|
||||
Paths.get("BM@N.vf.json").writeText(Solids.encodeToString(solid))
|
||||
//println(Solids.encodeToString(solid))
|
||||
|
||||
makeVisionFile {
|
||||
vision("canvas") {
|
||||
requirePlugin(Solids)
|
||||
solid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* SolidGroup {
|
||||
set(
|
||||
"Coil",
|
||||
solid.getPrototype("Coil".asName())!!.apply {
|
||||
parent = null
|
||||
}
|
||||
)
|
||||
*//* group("Shade") {
|
||||
y = 200
|
||||
color("red")
|
||||
coneSurface(
|
||||
bottomOuterRadius = 135,
|
||||
bottomInnerRadius = 25,
|
||||
height = 50,
|
||||
topOuterRadius = 135,
|
||||
topInnerRadius = 25,
|
||||
angle = 1.5707964
|
||||
) {
|
||||
position = Point3D(79.6, 0, -122.1)
|
||||
rotation = Point3D(-1.5707964, 0, 0)
|
||||
}
|
||||
coneSurface(
|
||||
bottomOuterRadius = 135,
|
||||
bottomInnerRadius = 25,
|
||||
height = 50,
|
||||
topOuterRadius = 135,
|
||||
topInnerRadius = 25,
|
||||
angle = 1.5707964
|
||||
) {
|
||||
position = Point3D(-79.6, 0, -122.1)
|
||||
rotation = Point3D(1.5707964, 0, -3.1415927)
|
||||
}
|
||||
coneSurface(
|
||||
bottomOuterRadius = 135,
|
||||
bottomInnerRadius = 25,
|
||||
height = 50,
|
||||
topOuterRadius = 135,
|
||||
topInnerRadius = 25,
|
||||
angle = 1.5707964
|
||||
) {
|
||||
position = Point3D(79.6, 0, 122.1)
|
||||
rotation = Point3D(1.5707964, 0, 0)
|
||||
}
|
||||
coneSurface(
|
||||
bottomOuterRadius = 135,
|
||||
bottomInnerRadius = 25,
|
||||
height = 50,
|
||||
topOuterRadius = 135,
|
||||
topInnerRadius = 25,
|
||||
angle = 1.5707964
|
||||
) {
|
||||
position = Point3D(-79.6, 0, 122.1)
|
||||
rotation = Point3D(-1.5707964, 0, -3.1415927)
|
||||
}
|
||||
}*//*
|
||||
}*/
|
@ -1,14 +1,24 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.http.content.staticResources
|
||||
import io.ktor.server.routing.routing
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.visionforge.html.HtmlVisionFragment
|
||||
import space.kscience.visionforge.html.Page
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.html.importScriptHeader
|
||||
import space.kscience.visionforge.makeFile
|
||||
import space.kscience.visionforge.html.*
|
||||
import space.kscience.visionforge.markup.MarkupPlugin
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.server.close
|
||||
import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.visionPage
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
import space.kscience.visionforge.tables.TableVisionPlugin
|
||||
import space.kscience.visionforge.visionManager
|
||||
import java.awt.Desktop
|
||||
import java.nio.file.Path
|
||||
|
||||
|
||||
public fun makeVisionFile(
|
||||
path: Path? = null,
|
||||
title: String = "VisionForge page",
|
||||
@ -16,15 +26,58 @@ public fun makeVisionFile(
|
||||
show: Boolean = true,
|
||||
content: HtmlVisionFragment,
|
||||
): Unit {
|
||||
val actualPath = Page(Global, content = content).makeFile(path) { actualPath ->
|
||||
val actualPath = VisionPage(Global.visionManager, content = content).makeFile(path) { actualPath ->
|
||||
mapOf(
|
||||
"title" to Page.title(title),
|
||||
"playground" to Page.importScriptHeader("js/visionforge-playground.js", resourceLocation, actualPath),
|
||||
"title" to VisionPage.title(title),
|
||||
"playground" to VisionPage.importScriptHeader(
|
||||
"js/visionforge-playground.js",
|
||||
resourceLocation,
|
||||
actualPath
|
||||
),
|
||||
)
|
||||
}
|
||||
if (show) Desktop.getDesktop().browse(actualPath.toFile().toURI())
|
||||
}
|
||||
|
||||
public fun serve(
|
||||
title: String = "VisionForge page",
|
||||
show: Boolean = true,
|
||||
content: HtmlVisionFragment,
|
||||
) {
|
||||
val context = Context("playground") {
|
||||
plugin(Solids)
|
||||
plugin(PlotlyPlugin)
|
||||
plugin(MarkupPlugin)
|
||||
plugin(TableVisionPlugin)
|
||||
}
|
||||
|
||||
val server = embeddedServer(CIO, port = 7779) {
|
||||
routing {
|
||||
staticResources("", null, null)
|
||||
}
|
||||
|
||||
visionPage(
|
||||
context.visionManager,
|
||||
VisionPage.scriptHeader("js/visionforge-playground.js") {
|
||||
defer = true
|
||||
},
|
||||
VisionPage.title(title),
|
||||
visionFragment = content
|
||||
)
|
||||
}.start(false)
|
||||
|
||||
if (show) {
|
||||
server.openInBrowser()
|
||||
}
|
||||
|
||||
println("Enter 'exit' to close server")
|
||||
while (readlnOrNull() != "exit") {
|
||||
//
|
||||
}
|
||||
|
||||
server.close()
|
||||
}
|
||||
|
||||
//@DFExperimental
|
||||
//public fun Context.makeVisionFile(
|
||||
// vision: Vision,
|
||||
|
40
demo/playground/src/jvmMain/kotlin/shapes.kt
Normal file
40
demo/playground/src/jvmMain/kotlin/shapes.kt
Normal file
@ -0,0 +1,40 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.solid.*
|
||||
import kotlin.math.PI
|
||||
|
||||
fun main() = makeVisionFile {
|
||||
vision("canvas") {
|
||||
solid {
|
||||
ambientLight()
|
||||
box(100.0, 100.0, 100.0) {
|
||||
z = -110.0
|
||||
color("teal")
|
||||
}
|
||||
sphere(50.0) {
|
||||
x = 110
|
||||
detail = 16
|
||||
color("red")
|
||||
}
|
||||
tube(50, height = 10, innerRadius = 25, angle = PI) {
|
||||
y = 110
|
||||
detail = 16
|
||||
rotationX = PI / 4
|
||||
color("blue")
|
||||
}
|
||||
sphereLayer(50, 40, theta = PI / 2) {
|
||||
rotationX = -PI * 3 / 4
|
||||
z = 110
|
||||
color(Colors.pink)
|
||||
}
|
||||
|
||||
|
||||
cylinder(30,20, name = "cylinder"){
|
||||
detail = 31
|
||||
y = -220
|
||||
z = 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
demo/playground/src/jvmMain/kotlin/surface.kt
Normal file
19
demo/playground/src/jvmMain/kotlin/surface.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.visionforge.solid.ambientLight
|
||||
import space.kscience.visionforge.solid.polygon
|
||||
import space.kscience.visionforge.solid.solid
|
||||
import space.kscience.visionforge.solid.surface
|
||||
|
||||
fun main() = makeVisionFile {
|
||||
vision("canvas") {
|
||||
solid {
|
||||
ambientLight()
|
||||
surface("surface") {
|
||||
layer(0, { polygon(8, 10) }, { polygon(8, 20) })
|
||||
layer(10, { polygon(8, 20) }, { polygon(8, 30) })
|
||||
layer(20, { polygon(8, 10) }, { polygon(8, 20) })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.dataforge.values.ValueType
|
||||
import space.kscience.dataforge.meta.ValueType
|
||||
import space.kscience.tables.ColumnHeader
|
||||
import space.kscience.tables.valueRow
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
|
Binary file not shown.
7912
demo/playground/src/jvmMain/resources/root/event_0.json
Normal file
7912
demo/playground/src/jvmMain/resources/root/event_0.json
Normal file
File diff suppressed because it is too large
Load Diff
215
demo/playground/src/jvmMain/resources/root/event_1.json
Normal file
215
demo/playground/src/jvmMain/resources/root/event_1.json
Normal file
@ -0,0 +1,215 @@
|
||||
[
|
||||
[{
|
||||
"_typename" : "CbmStsTrack",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"ststrk" : 2112745000,
|
||||
"fStsHits" : [216, 221, 5, 50, 63, 82, 133],
|
||||
"fMvdHits" : [],
|
||||
"fPidHypo" : 211,
|
||||
"fParamFirst" : {
|
||||
"_typename" : "FairTrackParam",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fX" : -4.79052305221558,
|
||||
"fY" : 8.83165168762207,
|
||||
"fZ" : 36.5065002441406,
|
||||
"fTx" : -0.11185921728611,
|
||||
"fTy" : 0.228091076016426,
|
||||
"fQp" : 0.893607378005981,
|
||||
"fCovMatrix" : [1.68777798535302e-4, -9.69577522482723e-4, -1.07744517663377e-5, 1.2614247680176e-5, 2.87587154161884e-5, 0.0403835587203503, 5.90448107686825e-5, -5.16064348630607e-4, -2.05383723368868e-4, 2.20405854634009e-6, -8.30146461794357e-7, -5.49759215573431e-6, 1.16227884063846e-5, 3.6013934732182e-6, 1.46196922287345e-4]
|
||||
},
|
||||
"fParamLast" : {
|
||||
"_typename" : "FairTrackParam",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fX" : 4.67626953125,
|
||||
"fY" : 43.7959594726562,
|
||||
"fZ" : 190.759826660156,
|
||||
"fTx" : 0.240885242819786,
|
||||
"fTy" : 0.230351597070694,
|
||||
"fQp" : 0.896391570568085,
|
||||
"fCovMatrix" : [0.00152156152762473, 0.00325645040720701, 4.73157851956785e-5, 4.51812447863631e-5, 1.32256536744535e-4, 0.0311740729957819, 1.29416745039634e-4, 3.94528120523319e-4, 3.28425812767819e-4, 3.75195077140233e-6, 1.75166894678114e-6, 9.62230569712119e-6, 9.89728778222343e-6, 4.38717188444571e-6, 1.46559861605056e-4]
|
||||
},
|
||||
"fFlag" : 0,
|
||||
"fChi2" : 3.59655165672302,
|
||||
"fNDF" : 9,
|
||||
"fB" : 0,
|
||||
"fnEv" : 0,
|
||||
"fHitsArr" : {
|
||||
"_typename" : "TClonesArray",
|
||||
"name" : "CbmStsHits",
|
||||
"arr" : []
|
||||
}
|
||||
}, {
|
||||
"_typename" : "CbmStsTrack",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"ststrk" : 0,
|
||||
"fStsHits" : [79, 108, 136, 160],
|
||||
"fMvdHits" : [],
|
||||
"fPidHypo" : 211,
|
||||
"fParamFirst" : {
|
||||
"_typename" : "FairTrackParam",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fX" : 7.56474113464355,
|
||||
"fY" : -6.31765508651733,
|
||||
"fZ" : 123.474571228027,
|
||||
"fTx" : 0.198165953159332,
|
||||
"fTy" : -0.0599287338554859,
|
||||
"fQp" : 0.826108694076538,
|
||||
"fCovMatrix" : [0.00192060391418636, -0.00543995574116707, -7.47249359847046e-5, 9.40304598771036e-5, 4.32362634455785e-4, 0.0452092550694942, 2.69763870164752e-4, -7.19496863894165e-4, -0.00178805936593562, 5.47440777154407e-6, -4.97666542287334e-6, -3.32396593876183e-5, 1.67156704264926e-5, 3.69572808267549e-5, 3.62657097866759e-4]
|
||||
},
|
||||
"fParamLast" : {
|
||||
"_typename" : "FairTrackParam",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fX" : 38.4175720214844,
|
||||
"fY" : -12.5351896286011,
|
||||
"fZ" : 222.266052246094,
|
||||
"fTx" : 0.428264498710632,
|
||||
"fTy" : -0.0652719661593437,
|
||||
"fQp" : 0.827384233474731,
|
||||
"fCovMatrix" : [0.00191446917597204, 0.00539331184700131, 7.50113686081022e-5, 9.10265880520456e-5, 4.29905543569475e-4, 0.0449054278433323, 2.68147414317355e-4, 7.0479983696714e-4, 0.00177141127642244, 5.60895068701939e-6, 4.76898094348144e-6, 3.39166836056393e-5, 1.61108710017288e-5, 3.51894050254487e-5, 3.57192009687424e-4]
|
||||
},
|
||||
"fFlag" : 0,
|
||||
"fChi2" : 0.0889237225055695,
|
||||
"fNDF" : 3,
|
||||
"fB" : 0,
|
||||
"fnEv" : 0,
|
||||
"fHitsArr" : {
|
||||
"_typename" : "TClonesArray",
|
||||
"name" : "CbmStsHits",
|
||||
"arr" : []
|
||||
}
|
||||
}]
|
||||
,
|
||||
[{
|
||||
"_typename" : "BmnGlobalTrack",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fHits" : [],
|
||||
"fParamFirst" : {
|
||||
"_typename" : "FairTrackParam",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fX" : 0.514997541904449,
|
||||
"fY" : 0.614071667194366,
|
||||
"fZ" : 0.716018855571747,
|
||||
"fTx" : -0.182437181472778,
|
||||
"fTy" : 0.231170654296875,
|
||||
"fQp" : 0.890645802021027,
|
||||
"fCovMatrix" : [0.00640107085928321, -0.00549036636948586, -2.40077963098884e-4, 5.9050194977317e-5, 4.4034980237484e-4, 0.0939982086420059, 1.37060953420587e-4, -0.0010447750100866, -3.45796346664429e-4, 1.4494138667942e-5, -1.88720639471285e-6, -1.71545361808967e-5, 2.24065261136275e-5, 4.27886925535859e-6, 1.46344274980947e-4]
|
||||
},
|
||||
"fParamLast" : {
|
||||
"_typename" : "FairTrackParam",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fX" : 4.67626953125,
|
||||
"fY" : 43.7959594726562,
|
||||
"fZ" : 190.759826660156,
|
||||
"fTx" : 0.240885242819786,
|
||||
"fTy" : 0.230351597070694,
|
||||
"fQp" : 0.896391570568085,
|
||||
"fCovMatrix" : [0.00152156152762473, 0.00325645040720701, 4.73157851956785e-5, 4.51812447863631e-5, 1.32256536744535e-4, 0.0311740729957819, 1.29416745039634e-4, 3.94528120523319e-4, 3.28425812767819e-4, 3.75195077140233e-6, 1.75166894678114e-6, 9.62230569712119e-6, 9.89728778222343e-6, 4.38717188444571e-6, 1.46559861605056e-4]
|
||||
},
|
||||
"fFlag" : -1,
|
||||
"fChi2" : 3.596552,
|
||||
"fNDF" : 9,
|
||||
"fB" : 0,
|
||||
"fLength" : 196.4224,
|
||||
"fNhits" : 7,
|
||||
"fUsing" : false,
|
||||
"fGemTrack" : 0,
|
||||
"fSsdTrack" : -1,
|
||||
"fSilTrack" : -1,
|
||||
"fTof1Hit" : -1,
|
||||
"fTof2Hit" : -1,
|
||||
"fDch1Track" : -1,
|
||||
"fDch2Track" : -1,
|
||||
"fDchTrack" : -1,
|
||||
"fMwpc1Track" : -1,
|
||||
"fMwpc2Track" : -1,
|
||||
"fUpstreamTrack" : -1,
|
||||
"fScWallCellId" : -1,
|
||||
"fCscHit" : [-1, -1, -1, -1],
|
||||
"fScWallSignal" : -1000,
|
||||
"fBeta400" : -1000,
|
||||
"fBeta700" : -1000,
|
||||
"fdQdNUpper" : 0,
|
||||
"fdQdNLower" : 0,
|
||||
"fA" : -1,
|
||||
"fZ" : 0,
|
||||
"fPDG" : 0,
|
||||
"fChi2InVertex" : 2.34478793822074e-310,
|
||||
"fDCAInVertex" : 0.169359803199768,
|
||||
"fPidTof400" : [],
|
||||
"fPidTof700" : [],
|
||||
"fIsPrimary" : true,
|
||||
"fRefIndex" : 0
|
||||
}, {
|
||||
"_typename" : "BmnGlobalTrack",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fHits" : [],
|
||||
"fParamFirst" : {
|
||||
"_typename" : "FairTrackParam",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fX" : -1.30332088470459,
|
||||
"fY" : 0.709633886814117,
|
||||
"fZ" : 0.716018855571747,
|
||||
"fTx" : -0.0394387505948544,
|
||||
"fTy" : -0.0554707236588001,
|
||||
"fQp" : 0.794627845287323,
|
||||
"fCovMatrix" : [1.0362377166748, -0.242409482598305, -0.0120293609797955, 0.00132000644225627, 0.0113498065620661, 1.10034370422363, 0.0026963478885591, -0.0100266374647617, -0.00638964772224426, 1.71858730027452e-4, -1.46718830364989e-5, -1.39145020511933e-4, 1.31993641844019e-4, 3.72123940906022e-5, 3.64089268259704e-4]
|
||||
},
|
||||
"fParamLast" : {
|
||||
"_typename" : "FairTrackParam",
|
||||
"fUniqueID" : 0,
|
||||
"fBits" : 0,
|
||||
"fX" : 153.443832397461,
|
||||
"fY" : -27.7408638000488,
|
||||
"fZ" : 422.371002197266,
|
||||
"fTx" : 0.623147189617157,
|
||||
"fTy" : -0.0757252722978592,
|
||||
"fQp" : 0.879441320896149,
|
||||
"fCovMatrix" : [0.210621446371078, 0.00677151698619127, 0.00126052019186318, -1.89192069228739e-5, 0.00233594398014247, 0.117487587034702, 1.90632126759738e-5, 5.61361608561128e-4, 3.66047053830698e-4, 5.4321233619703e-5, -1.38209452416049e-6, 1.40239317261148e-5, 3.86252722819336e-5, -2.07852266953523e-7, 1.6525064711459e-4]
|
||||
},
|
||||
"fFlag" : -1,
|
||||
"fChi2" : 28.54445,
|
||||
"fNDF" : 3,
|
||||
"fB" : 0,
|
||||
"fLength" : 456.7299,
|
||||
"fNhits" : 5,
|
||||
"fUsing" : false,
|
||||
"fGemTrack" : 1,
|
||||
"fSsdTrack" : -1,
|
||||
"fSilTrack" : -1,
|
||||
"fTof1Hit" : 0,
|
||||
"fTof2Hit" : -1,
|
||||
"fDch1Track" : -1,
|
||||
"fDch2Track" : -1,
|
||||
"fDchTrack" : -1,
|
||||
"fMwpc1Track" : -1,
|
||||
"fMwpc2Track" : -1,
|
||||
"fUpstreamTrack" : -1,
|
||||
"fScWallCellId" : -1,
|
||||
"fCscHit" : [-1, -1, -1, -1],
|
||||
"fScWallSignal" : -1000,
|
||||
"fBeta400" : 0.813491527513362,
|
||||
"fBeta700" : -1000,
|
||||
"fdQdNUpper" : 0,
|
||||
"fdQdNLower" : 0,
|
||||
"fA" : -1,
|
||||
"fZ" : 0,
|
||||
"fPDG" : 0,
|
||||
"fChi2InVertex" : 2.34478793822074e-310,
|
||||
"fDCAInVertex" : 1.82100653648376,
|
||||
"fPidTof400" : [0.698706510566553, 0.0456706934329348, 0.070160747316434, 0.044178479600919, 0.0321317585690916, 0.0203602877603981, 0.0563498151154308, 0.0324417076382387],
|
||||
"fPidTof700" : [],
|
||||
"fIsPrimary" : true,
|
||||
"fRefIndex" : 0
|
||||
}]
|
||||
]
|
5150
demo/playground/src/jvmMain/resources/root/event_2.json
Normal file
5150
demo/playground/src/jvmMain/resources/root/event_2.json
Normal file
File diff suppressed because it is too large
Load Diff
1370
demo/playground/src/jvmMain/resources/root/event_3.json
Normal file
1370
demo/playground/src/jvmMain/resources/root/event_3.json
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
23
demo/playground/webpack.config.d/01.ring.js
vendored
23
demo/playground/webpack.config.d/01.ring.js
vendored
@ -1,23 +0,0 @@
|
||||
const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
|
||||
const path = require('path');
|
||||
|
||||
config.module.rules.push(...ringConfig.module.rules)
|
||||
|
||||
config.module.rules.push(
|
||||
{
|
||||
test: /\.css$/,
|
||||
exclude: [
|
||||
path.resolve(__dirname, "../../node_modules/@jetbrains/ring-ui")
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'style-loader',
|
||||
options: {}
|
||||
},
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {}
|
||||
}
|
||||
]
|
||||
}
|
||||
)
|
@ -3,3 +3,8 @@ public final class ru/mipt/npm/sat/SatServerKt {
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/sat/StaticKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
|
||||
|
||||
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.jvm")
|
||||
id("space.kscience.gradle.mpp")
|
||||
alias(spclibs.plugins.ktor)
|
||||
application
|
||||
}
|
||||
|
||||
@ -8,15 +12,19 @@ kscience {
|
||||
// useSerialization {
|
||||
// json()
|
||||
// }
|
||||
application()
|
||||
jvm{
|
||||
withJava()
|
||||
}
|
||||
jvmMain{
|
||||
implementation("io.ktor:ktor-server-cio")
|
||||
implementation(projects.visionforgeThreejs.visionforgeThreejsServer)
|
||||
implementation(spclibs.logback.classic)
|
||||
}
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
group = "center.sciprog"
|
||||
|
||||
dependencies{
|
||||
implementation(project(":visionforge-threejs:visionforge-threejs-server"))
|
||||
implementation("ch.qos.logback:logback-classic:1.2.3")
|
||||
}
|
||||
kotlin.explicitApi = ExplicitApiMode.Disabled
|
||||
|
||||
application {
|
||||
mainClass.set("ru.mipt.npm.sat.SatServerKt")
|
||||
|
@ -6,7 +6,7 @@ import space.kscience.visionforge.style
|
||||
import space.kscience.visionforge.useStyle
|
||||
import kotlin.math.PI
|
||||
|
||||
internal fun visionOfSatellite(
|
||||
internal fun Solids.visionOfSatellite(
|
||||
layers: Int = 10,
|
||||
layerHeight: Number = 10,
|
||||
xSegments: Int = 3,
|
||||
@ -14,7 +14,7 @@ internal fun visionOfSatellite(
|
||||
xSegmentSize: Number = 30,
|
||||
ySegmentSize: Number = xSegmentSize,
|
||||
fiberDiameter: Number = 1.0,
|
||||
): SolidGroup = SolidGroup {
|
||||
): SolidGroup = solidGroup {
|
||||
color("darkgreen")
|
||||
val transparent by style {
|
||||
this[SolidMaterial.MATERIAL_OPACITY_KEY] = 0.3
|
||||
@ -31,7 +31,7 @@ internal fun visionOfSatellite(
|
||||
val totalXSize = xSegments * xSegmentSize.toDouble()
|
||||
val totalYSize = ySegments * ySegmentSize.toDouble()
|
||||
for (layer in 1..layers) {
|
||||
group("layer[$layer]") {
|
||||
solidGroup("layer[$layer]") {
|
||||
for (i in 1..xSegments) {
|
||||
for (j in 1..ySegments) {
|
||||
box(xSegmentSize, ySegmentSize, layerHeight, name = "segment[$i,$j]") {
|
||||
@ -42,7 +42,7 @@ internal fun visionOfSatellite(
|
||||
}
|
||||
}
|
||||
}
|
||||
group("fibers") {
|
||||
solidGroup("fibers") {
|
||||
for (i in 1..xSegments) {
|
||||
cylinder(fiberDiameter, totalYSize) {
|
||||
useStyle(red)
|
@ -0,0 +1,88 @@
|
||||
package ru.mipt.npm.sat
|
||||
|
||||
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.http.content.staticResources
|
||||
import io.ktor.server.routing.routing
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.html.div
|
||||
import kotlinx.html.h1
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.meta.Null
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.html.VisionPage
|
||||
import space.kscience.visionforge.html.meta
|
||||
import space.kscience.visionforge.server.close
|
||||
import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.visionPage
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.specifications.Canvas3DOptions
|
||||
import space.kscience.visionforge.three.threeJsHeader
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
@Suppress("ExtractKtorModule")
|
||||
fun main() {
|
||||
val satContext = Context("sat") {
|
||||
plugin(Solids)
|
||||
}
|
||||
|
||||
val solids = satContext.request(Solids)
|
||||
|
||||
//Create a geometry
|
||||
val sat = solids.visionOfSatellite(ySegments = 3).apply {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
}
|
||||
val server = embeddedServer(CIO, port = 7777) {
|
||||
routing {
|
||||
staticResources("", null, null)
|
||||
}
|
||||
|
||||
visionPage(
|
||||
solids.visionManager, VisionPage.threeJsHeader,
|
||||
VisionPage.styleSheetHeader("css/styles.css")
|
||||
) {
|
||||
div("flex-column") {
|
||||
h1 { +"Satellite detector demo" }
|
||||
vision {
|
||||
meta(Canvas3DOptions {
|
||||
controls.enabled = false
|
||||
})
|
||||
sat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}.start(false)
|
||||
|
||||
server.openInBrowser()
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
GlobalScope.launch {
|
||||
while (isActive) {
|
||||
val randomLayer = Random.nextInt(1, 11)
|
||||
val randomI = Random.nextInt(1, 4)
|
||||
val randomJ = Random.nextInt(1, 4)
|
||||
val target = Name.parse("layer[$randomLayer].segment[$randomI,$randomJ]")
|
||||
val targetVision = sat[target] as Solid
|
||||
targetVision.color("red")
|
||||
delay(1000)
|
||||
//use to ensure that color is cleared
|
||||
targetVision.color.value = Null
|
||||
delay(500)
|
||||
}
|
||||
}
|
||||
|
||||
println("Enter 'exit' to close server")
|
||||
while (readLine() != "exit") {
|
||||
//
|
||||
}
|
||||
|
||||
server.close()
|
||||
|
||||
}
|
21
demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/static.kt
Normal file
21
demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/static.kt
Normal file
@ -0,0 +1,21 @@
|
||||
package ru.mipt.npm.sat
|
||||
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.solid.box
|
||||
import space.kscience.visionforge.solid.invoke
|
||||
import space.kscience.visionforge.solid.material
|
||||
import space.kscience.visionforge.solid.solid
|
||||
import space.kscience.visionforge.three.makeThreeJsFile
|
||||
|
||||
@OptIn(DFExperimental::class)
|
||||
fun main() = makeThreeJsFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
vision ("canvas") {
|
||||
solid {
|
||||
box(100, 100, 100)
|
||||
material {
|
||||
emissiveColor("red")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package ru.mipt.npm.sat
|
||||
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.html.div
|
||||
import kotlinx.html.h1
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.html.Page
|
||||
import space.kscience.visionforge.html.plus
|
||||
import space.kscience.visionforge.server.close
|
||||
import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.serve
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.three.threeJsHeader
|
||||
import space.kscience.visionforge.visionManager
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
fun main() {
|
||||
val satContext = Context("sat") {
|
||||
plugin(Solids)
|
||||
}
|
||||
|
||||
//Create a geometry
|
||||
val sat = visionOfSatellite(ySegments = 3)
|
||||
|
||||
val server = satContext.visionManager.serve {
|
||||
page(header = Page.threeJsHeader + Page.styleSheetHeader("css/styles.css")) {
|
||||
div("flex-column") {
|
||||
h1 { +"Satellite detector demo" }
|
||||
vision { sat }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server.openInBrowser()
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
GlobalScope.launch {
|
||||
while (isActive) {
|
||||
val randomLayer = Random.nextInt(1, 11)
|
||||
val randomI = Random.nextInt(1, 4)
|
||||
val randomJ = Random.nextInt(1, 4)
|
||||
val target = Name.parse("layer[$randomLayer].segment[$randomI,$randomJ]")
|
||||
val targetVision = sat[target] as Solid
|
||||
targetVision.color("red")
|
||||
delay(1000)
|
||||
targetVision.color.clear()
|
||||
delay(500)
|
||||
}
|
||||
}
|
||||
|
||||
println("Enter 'exit' to close server")
|
||||
while (readLine() != "exit") {
|
||||
//
|
||||
}
|
||||
|
||||
server.close()
|
||||
|
||||
}
|
@ -1,20 +1,3 @@
|
||||
public final class space/kscience/visionforge/demo/MetaEditorDemo : tornadofx/View {
|
||||
public fun <init> ()V
|
||||
public final fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
|
||||
public final fun getMeta ()Lspace/kscience/dataforge/meta/ObservableMutableMeta;
|
||||
public synthetic fun getRoot ()Ljavafx/scene/Parent;
|
||||
public fun getRoot ()Ljavafx/scene/control/SplitPane;
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/demo/MetaEditorDemoApp : tornadofx/App {
|
||||
public fun <init> ()V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/demo/MetaEditorDemoKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/solid/demo/DemoKt {
|
||||
public static final fun demo (Lspace/kscience/visionforge/solid/demo/VisionLayout;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
|
||||
public static synthetic fun demo$default (Lspace/kscience/visionforge/solid/demo/VisionLayout;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
|
||||
@ -23,25 +6,8 @@ public final class space/kscience/visionforge/solid/demo/DemoKt {
|
||||
public static final fun showcaseCSG (Lspace/kscience/visionforge/solid/demo/VisionLayout;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/solid/demo/FXDemoApp : tornadofx/App {
|
||||
public fun <init> ()V
|
||||
public final fun getView ()Lspace/kscience/visionforge/solid/demo/FXDemoGrid;
|
||||
public fun start (Ljavafx/stage/Stage;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/solid/demo/FXDemoAppKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/solid/demo/FXDemoGrid : tornadofx/View, space/kscience/visionforge/solid/demo/VisionLayout {
|
||||
public fun <init> ()V
|
||||
public fun getRoot ()Ljavafx/scene/Parent;
|
||||
public synthetic fun render (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;)V
|
||||
public fun render (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/solid/Solid;Lspace/kscience/dataforge/meta/Meta;)V
|
||||
}
|
||||
|
||||
public abstract interface class space/kscience/visionforge/solid/demo/VisionLayout {
|
||||
public abstract fun getSolids ()Lspace/kscience/visionforge/solid/Solids;
|
||||
public abstract fun render (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;)V
|
||||
public static synthetic fun render$default (Lspace/kscience/visionforge/solid/demo/VisionLayout;Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;ILjava/lang/Object;)V
|
||||
}
|
||||
|
@ -1,44 +1,36 @@
|
||||
import ru.mipt.npm.gradle.DependencyConfiguration
|
||||
import ru.mipt.npm.gradle.FXModule
|
||||
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.mpp")
|
||||
application
|
||||
id("space.kscience.gradle.mpp")
|
||||
// application
|
||||
}
|
||||
|
||||
kscience {
|
||||
useCoroutines()
|
||||
val fxVersion: String by rootProject.extra
|
||||
useFx(FXModule.CONTROLS, version = fxVersion, configuration = DependencyConfiguration.IMPLEMENTATION)
|
||||
application()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-solid"))
|
||||
// implementation(project(":visionforge-gdml"))
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-fx"))
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(project(":visionforge-threejs"))
|
||||
jvm()
|
||||
js{
|
||||
binaries.executable()
|
||||
browser{
|
||||
commonWebpackConfig{
|
||||
cssSupport{
|
||||
enabled = true
|
||||
}
|
||||
scssSupport{
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation(projects.visionforgeSolid)
|
||||
implementation(projects.visionforgeGdml)
|
||||
}
|
||||
|
||||
jsMain {
|
||||
implementation(projects.visionforgeThreejs)
|
||||
}
|
||||
}
|
||||
|
||||
application {
|
||||
mainClassName = "space.kscience.visionforge.solid.demo.FXDemoAppKt"
|
||||
}
|
||||
kotlin.explicitApi = null
|
||||
|
||||
//application {
|
||||
// mainClass.set("space.kscience.visionforge.solid.demo.FXDemoAppKt")
|
||||
//}
|
@ -3,7 +3,10 @@ package space.kscience.visionforge.solid.demo
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
|
||||
public interface VisionLayout<in V: Vision> {
|
||||
public fun render(name: Name, vision: V, meta: Meta = Meta.EMPTY)
|
||||
interface VisionLayout<in V: Vision> {
|
||||
val solids: Solids
|
||||
|
||||
fun render(name: Name, vision: V, meta: Meta = Meta.EMPTY)
|
||||
}
|
@ -4,6 +4,8 @@ import kotlinx.coroutines.*
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.invoke
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.kmath.geometry.Euclidean3DSpace
|
||||
import space.kscience.kmath.geometry.radians
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.specifications.Canvas3DOptions
|
||||
@ -18,7 +20,17 @@ fun VisionLayout<Solid>.demo(name: String, title: String = name, block: SolidGro
|
||||
val meta = Meta {
|
||||
"title" put title
|
||||
}
|
||||
val vision = SolidGroup(block)
|
||||
val vision = solids.solidGroup {
|
||||
block()
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
intensity = 0.5
|
||||
}
|
||||
pointLight(0, 0, 1000) {
|
||||
color(Colors.white)
|
||||
intensity = 10.0
|
||||
}
|
||||
}
|
||||
render(Name.parse(name), vision, meta)
|
||||
}
|
||||
|
||||
@ -26,10 +38,6 @@ val canvasOptions = Canvas3DOptions {
|
||||
size {
|
||||
minSize = 400
|
||||
}
|
||||
axes {
|
||||
size = 500.0
|
||||
visible = true
|
||||
}
|
||||
camera {
|
||||
distance = 600.0
|
||||
latitude = PI / 6
|
||||
@ -39,6 +47,9 @@ val canvasOptions = Canvas3DOptions {
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
fun VisionLayout<Solid>.showcase() {
|
||||
demo("shapes", "Basic shapes") {
|
||||
ambientLight()
|
||||
axes(size = 500.0)
|
||||
|
||||
box(100.0, 100.0, 100.0) {
|
||||
z = -110.0
|
||||
color("teal")
|
||||
@ -62,7 +73,7 @@ fun VisionLayout<Solid>.showcase() {
|
||||
}
|
||||
|
||||
demo("dynamic", "Dynamic properties") {
|
||||
val group = group {
|
||||
val group = solidGroup {
|
||||
box(100, 100, 100) {
|
||||
z = 110.0
|
||||
opacity = 0.5
|
||||
@ -94,11 +105,18 @@ fun VisionLayout<Solid>.showcase() {
|
||||
|
||||
demo("rotation", "Rotations") {
|
||||
box(100, 100, 100)
|
||||
group {
|
||||
solidGroup {
|
||||
x = 200
|
||||
rotationY = PI / 4
|
||||
axes(200)
|
||||
box(100, 100, 100) {
|
||||
rotationZ = PI / 4
|
||||
rotate((PI / 4).radians, Euclidean3DSpace.zAxis)
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
while (isActive) {
|
||||
delay(100)
|
||||
rotate((PI / 20).radians, Euclidean3DSpace.yAxis)
|
||||
}
|
||||
}
|
||||
color(Colors.red)
|
||||
}
|
||||
}
|
||||
@ -107,13 +125,16 @@ fun VisionLayout<Solid>.showcase() {
|
||||
demo("extrude", "extruded shape") {
|
||||
extruded {
|
||||
shape {
|
||||
polygon(8, 50)
|
||||
polygon(32, 50)
|
||||
}
|
||||
for (i in 0..100) {
|
||||
layer(i * 5, 20 * sin(2 * PI / 100 * i), 20 * cos(2 * PI / 100 * i))
|
||||
}
|
||||
color(Colors.teal)
|
||||
rotationX = -PI / 2
|
||||
rotationY = -PI / 2
|
||||
material {
|
||||
type = "lambert"
|
||||
color(Colors.teal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +145,10 @@ fun VisionLayout<Solid>.showcase() {
|
||||
color(Colors.blue)
|
||||
}
|
||||
repeat(20) {
|
||||
polyline(Point3D(100, 100, 100), Point3D(-100, -100, -100)) {
|
||||
polyline(
|
||||
Float32Vector3D(100, 100, 100),
|
||||
Float32Vector3D(-100, -100, -100)
|
||||
) {
|
||||
thickness = 3.0
|
||||
rotationX = it * PI2 / 20
|
||||
color(Colors.green)
|
||||
@ -141,6 +165,18 @@ fun VisionLayout<Solid>.showcase() {
|
||||
z = 26
|
||||
}
|
||||
}
|
||||
|
||||
demo("STL", "STL loaded from URL") {
|
||||
stl("Menger_sponge_sample.stl") {
|
||||
scale(100f)
|
||||
material {
|
||||
type = "phong"
|
||||
color("red")
|
||||
specularColor("blue")
|
||||
}
|
||||
}
|
||||
//stl("https://ozeki.hu/attachments/116/Menger_sponge_sample.stl")
|
||||
}
|
||||
}
|
||||
|
||||
fun VisionLayout<Solid>.showcaseCSG() {
|
||||
|
@ -1,18 +1,18 @@
|
||||
package space.kscience.visionforge.solid.demo
|
||||
|
||||
import kotlinx.browser.document
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import space.kscience.visionforge.Application
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.visionforge.html.Application
|
||||
import space.kscience.visionforge.html.startApplication
|
||||
import space.kscience.visionforge.solid.x
|
||||
import space.kscience.visionforge.solid.y
|
||||
import space.kscience.visionforge.startApplication
|
||||
import kotlin.random.Random
|
||||
|
||||
private class ThreeDemoApp : Application {
|
||||
|
||||
override fun start(state: Map<String, Any>) {
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
|
||||
val element = document.getElementById("demo") ?: error("Element with id 'demo' not found on page")
|
||||
|
||||
|
@ -10,12 +10,13 @@ import org.w3c.dom.Element
|
||||
import org.w3c.dom.HTMLDivElement
|
||||
import org.w3c.dom.HTMLElement
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.fetch
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.get
|
||||
import space.kscience.dataforge.meta.string
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.visionforge.solid.Solid
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
import space.kscience.visionforge.solid.three.ThreeCanvas
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
|
||||
@ -25,7 +26,9 @@ class ThreeDemoGrid(element: Element) : VisionLayout<Solid> {
|
||||
|
||||
private val outputs: MutableMap<Name, ThreeCanvas> = HashMap()
|
||||
|
||||
private val three = Global.fetch(ThreePlugin)
|
||||
private val three = Global.request(ThreePlugin)
|
||||
|
||||
override val solids: Solids get() = three.solids
|
||||
|
||||
init {
|
||||
element.clear()
|
||||
@ -69,7 +72,7 @@ class ThreeDemoGrid(element: Element) : VisionLayout<Solid> {
|
||||
}
|
||||
}
|
||||
val element = document.getElementById("output-$name") ?: error("Element not found")
|
||||
three.getOrCreateCanvas(element, canvasOptions)
|
||||
ThreeCanvas(three, element, canvasOptions)
|
||||
}.render(vision)
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,19 @@
|
||||
package space.kscience.visionforge.solid.demo
|
||||
|
||||
import info.laht.threekt.core.Object3D
|
||||
import info.laht.threekt.geometries.BoxGeometry
|
||||
import info.laht.threekt.objects.Mesh
|
||||
import space.kscience.dataforge.meta.get
|
||||
import space.kscience.dataforge.meta.asValue
|
||||
import space.kscience.dataforge.meta.int
|
||||
import space.kscience.dataforge.meta.number
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.dataforge.names.startsWith
|
||||
import space.kscience.dataforge.values.asValue
|
||||
import space.kscience.visionforge.onPropertyChange
|
||||
import space.kscience.visionforge.set
|
||||
import space.kscience.visionforge.setProperty
|
||||
import space.kscience.visionforge.setChild
|
||||
import space.kscience.visionforge.solid.SolidGroup
|
||||
import space.kscience.visionforge.solid.SolidMaterial.Companion.EDGES_KEY
|
||||
import space.kscience.visionforge.solid.layer
|
||||
import space.kscience.visionforge.solid.three.*
|
||||
import three.core.Object3D
|
||||
import three.geometries.BoxGeometry
|
||||
import three.objects.Mesh
|
||||
import kotlin.math.max
|
||||
|
||||
internal fun SolidGroup.varBox(
|
||||
@ -22,11 +21,11 @@ internal fun SolidGroup.varBox(
|
||||
ySize: Number,
|
||||
name: String = "",
|
||||
action: VariableBox.() -> Unit = {},
|
||||
): VariableBox = VariableBox(xSize, ySize).apply(action).also { set(name, it) }
|
||||
): VariableBox = VariableBox(xSize, ySize).apply(action).also { setChild(name, it) }
|
||||
|
||||
internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision() {
|
||||
|
||||
override fun render(three: ThreePlugin): Object3D {
|
||||
override suspend fun render(three: ThreePlugin): Object3D {
|
||||
val geometry = BoxGeometry(xSize, ySize, 1)
|
||||
|
||||
val material = ThreeMaterials.DEFAULT.clone()
|
||||
@ -44,13 +43,13 @@ internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision
|
||||
it.layers.enable(this@VariableBox.layer)
|
||||
}
|
||||
}
|
||||
mesh.scale.z = meta[VALUE].number?.toDouble() ?: 1.0
|
||||
mesh.scale.z = properties.getValue(VALUE)?.number?.toDouble() ?: 1.0
|
||||
|
||||
//add listener to object properties
|
||||
onPropertyChange { name ->
|
||||
onPropertyChange(three.context) { name ->
|
||||
when {
|
||||
name == VALUE -> {
|
||||
val value = meta.get(VALUE).int ?: 0
|
||||
val value = properties.getValue(VALUE)?.int ?: 0
|
||||
val size = value.toFloat() / 255f * 20f
|
||||
mesh.scale.z = size.toDouble()
|
||||
mesh.position.z = size.toDouble() / 2
|
||||
@ -61,7 +60,8 @@ internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision
|
||||
material.color.setRGB(r.toFloat() / 256, g.toFloat() / 256, b.toFloat() / 256)
|
||||
mesh.updateMatrix()
|
||||
}
|
||||
name.startsWith(MeshThreeFactory.EDGES_KEY) -> mesh.applyEdges(this@VariableBox)
|
||||
|
||||
name.startsWith(EDGES_KEY) -> mesh.applyEdges(this@VariableBox)
|
||||
else -> mesh.updateProperty(this@VariableBox, name)
|
||||
}
|
||||
}
|
||||
@ -70,9 +70,9 @@ internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision
|
||||
}
|
||||
|
||||
var value: Int
|
||||
get() = meta[VALUE].int ?: 0
|
||||
get() = properties.getValue(VALUE)?.int ?: 0
|
||||
set(value) {
|
||||
setProperty(VALUE, value.asValue())
|
||||
properties.setValue(VALUE, value.asValue())
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user