0.2.0 #71

Merged
altavir merged 139 commits from dev into master 2022-01-24 09:44:18 +03:00
290 changed files with 22740 additions and 4065 deletions

22
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Gradle build
on:
push:
branches: [ dev, master ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2.5.0
with:
java-version: 11
distribution: liberica
- name: execute build
uses: gradle/gradle-build-action@v2
with:
arguments: build

View File

@ -1,19 +0,0 @@
name: Gradle build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build

25
.github/workflows/pages.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Dokka publication
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2.5.0
with:
java-version: 11
distribution: liberica
- name: execute build
uses: gradle/gradle-build-action@v2
with:
arguments: dokkaHtmlMultiModule
- uses: JamesIves/github-pages-deploy-action@4.1.0
with:
branch: gh-pages
folder: build/dokka/htmlMultiModule

27
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Gradle publish
on:
workflow_dispatch:
release:
types: [ created ]
jobs:
publish:
environment:
name: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2.5.0
with:
java-version: 11
distribution: liberica
- name: execute build
uses: gradle/gradle-build-action@v2
- name: Publish
shell: bash
run: >
./gradlew release --no-daemon --build-cache -Ppublishing.enabled=true
-Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
-Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}

1
.gitignore vendored
View File

@ -4,5 +4,6 @@
out/ out/
.gradle .gradle
build/ build/
data/
!gradle-wrapper.jar !gradle-wrapper.jar

4
.space.kts Normal file
View File

@ -0,0 +1,4 @@
job("Build") {
gradlew("openjdk:11", "build")
}

View File

@ -2,6 +2,19 @@
## [Unreleased] ## [Unreleased]
### Added ### Added
### Changed
### Deprecated
### Removed
### Fixed
### Security
## [0.2.0]
### Added
- Server module - Server module
- Change collector - Change collector
- Customizable accessors for colors - Customizable accessors for colors
@ -9,6 +22,9 @@
- Hexagon interface and GenericHexagon implementation (Box inherits Hexagon) - Hexagon interface and GenericHexagon implementation (Box inherits Hexagon)
- Increased the default detail level for spheres and cones to 32 - Increased the default detail level for spheres and cones to 32
- Simple clipping for Solids in ThreeJs - Simple clipping for Solids in ThreeJs
- Markdown module
- Tables module
### Changed ### Changed
- Vision does not implement ItemProvider anymore. Property changes are done via `getProperty`/`setProperty` and `property` delegate. - Vision does not implement ItemProvider anymore. Property changes are done via `getProperty`/`setProperty` and `property` delegate.
@ -25,12 +41,16 @@
- Property listeners are not triggered if there are no changes. - Property listeners are not triggered if there are no changes.
- Feedback websocket connection in the client. - Feedback websocket connection in the client.
### Deprecated ### Deprecated
### Removed ### Removed
- Primary modules dependencies on UI - Primary modules dependencies on UI
### Fixed ### Fixed
- Version conflicts - Version conflicts
### Security ### Security

164
README.md
View File

@ -14,9 +14,6 @@
* [Features](#features) * [Features](#features)
* [About DataForge](#about-dataforge) * [About DataForge](#about-dataforge)
* [Modules contained in this repository](#modules-contained-in-this-repository) * [Modules contained in this repository](#modules-contained-in-this-repository)
* [visionforge-core](#visionforge-core)
* [visionforge-solid](#visionforge-solid)
* [visionforge-gdml](#visionforge-gdml)
* [Visualization for External Systems](#visualization-for-external-systems) * [Visualization for External Systems](#visualization-for-external-systems)
* [Demonstrations](#demonstrations) * [Demonstrations](#demonstrations)
* [Simple Example - Solid Showcase](#simple-example---solid-showcase) * [Simple Example - Solid Showcase](#simple-example---solid-showcase)
@ -64,21 +61,158 @@ To learn more about DataForge, please consult the following URLs:
## Modules contained in this repository ## Modules contained in this repository
### visionforge-core <hr/>
Contains a general hierarchy of classes and interfaces useful for visualization. * ### [cern-root-loader](cern-root-loader)
This module is not specific to 3D-visualization. >
>
> **Maturity**: EXPERIMENTAL
<hr/>
The `visionforge-core` module also includes configuration editors for JS (in `jsMain`) and JVM (in `jvmMain`). * ### [demo](demo)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
**Class diagram:** * ### [jupyter](jupyter)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
![](docs/images/class-diag-core.png) * ### [ui](ui)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [visionforge-core](visionforge-core)
>
>
> **Maturity**: DEVELOPMENT
<hr/>
### visionforge-solid * ### [visionforge-fx](visionforge-fx)
>
>
> **Maturity**: PROTOTYPE
<hr/>
* ### [visionforge-gdml](visionforge-gdml)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [visionforge-markdown](visionforge-markdown)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [visionforge-plotly](visionforge-plotly)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [visionforge-server](visionforge-server)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [visionforge-solid](visionforge-solid)
>
>
> **Maturity**: DEVELOPMENT
<hr/>
* ### [visionforge-tables](visionforge-tables)
>
>
> **Maturity**: PROTOTYPE
<hr/>
* ### [visionforge-threejs](visionforge-threejs)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [gdml](demo/gdml)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [js-playground](demo/js-playground)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [muon-monitor](demo/muon-monitor)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [playground](demo/playground)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [plotly-fx](demo/plotly-fx)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [sat-demo](demo/sat-demo)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [solid-showcase](demo/solid-showcase)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [visionforge-jupyter-gdml](jupyter/visionforge-jupyter-gdml)
>
>
> **Maturity**: EXPERIMENTAL
<hr/>
* ### [bootstrap](ui/bootstrap)
>
>
> **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/>
Includes common classes and serializers for 3D visualization, as well as Three.js and JavaFX implementations.
**Class diagram:** **Class diagram:**
@ -95,14 +229,10 @@ The `prototypes` property tree is defined in `SolidGroup` class via `PrototypeHo
##### Styles ##### Styles
`SolidGroup` has a `styleSheet` property that can optionally define styles at the Group's `VisionGroup` has a `styleSheet` property that can optionally define styles at the Group's
level. Styles are applied to child (descendant) objects using `Vision.styles: List<String>` property. level. Styles are applied to child (descendant) objects using `Vision.styles: List<String>` property.
### visionforge-threejs
### visionforge-gdml
GDML bindings for 3D visualization (to be moved to gdml project).
## Visualization for External Systems ## Visualization for External Systems

View File

@ -1,31 +1,23 @@
plugins { plugins {
id("ru.mipt.npm.gradle.project") id("ru.mipt.npm.gradle.project")
id("org.jetbrains.kotlinx.kover") version "0.5.0-RC"
//Override kotlin version
// val kotlinVersion = "1.5.20-RC"
// kotlin("multiplatform") version(kotlinVersion) apply false
// kotlin("jvm") version(kotlinVersion) apply false
// kotlin("js") version(kotlinVersion) apply false
} }
val dataforgeVersion by extra("0.4.3") val dataforgeVersion by extra("0.5.2")
val fxVersion by extra("11") val fxVersion by extra("11")
allprojects{ allprojects{
repositories {
mavenCentral()
jcenter()
maven("https://repo.kotlin.link")
maven("https://maven.jzy3d.org/releases")
}
group = "space.kscience" group = "space.kscience"
version = "0.2.0-dev-22" version = "0.2.0"
} }
subprojects { subprojects {
if (name.startsWith("visionforge")) { if (name.startsWith("visionforge")) apply<MavenPublishPlugin>()
plugins.apply("maven-publish")
repositories {
maven("https://repo.kotlin.link")
mavenCentral()
maven("https://maven.jzy3d.org/releases")
} }
} }
@ -36,6 +28,7 @@ ksciencePublish{
} }
apiValidation { apiValidation {
validationDisabled = true
ignoredPackages.add("info.laht.threekt") ignoredPackages.add("info.laht.threekt")
} }
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")

View File

@ -0,0 +1,4 @@
# Module cern-root-loader

View File

@ -0,0 +1,926 @@
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;
public final fun getFLeftMat ()Lru/mipt/npm/root/DGeoMatrix;
public final fun getFRight ()Lru/mipt/npm/root/DGeoShape;
public final fun getFRightMat ()Lru/mipt/npm/root/DGeoMatrix;
}
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
public final fun getFMatrices ()Ljava/util/List;
public final fun getFNodes ()Ljava/util/List;
public final fun getFShapes ()Ljava/util/List;
public final fun getFVolumes ()Ljava/util/List;
}
public final class ru/mipt/npm/root/DGeoManager$Companion {
public final fun parse (Ljava/lang/String;)Lru/mipt/npm/root/DGeoManager;
}
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 final class ru/mipt/npm/root/DGeoMedium : ru/mipt/npm/root/DNamed {
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
public final fun getFMaterial ()Lru/mipt/npm/root/DGeoMaterial;
public final fun getFParams ()[D
}
public final class ru/mipt/npm/root/DGeoNode : ru/mipt/npm/root/DNamed {
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
public final fun getFVolume ()Lru/mipt/npm/root/DGeoVolume;
}
public 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
public final fun getY ()D
public final fun getZ ()D
}
public final class ru/mipt/npm/root/DGeoShape : ru/mipt/npm/root/DNamed {
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
public final fun getFDX ()D
public final fun getFDY ()D
public final fun getFDZ ()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;
public final fun getFMedium ()Lru/mipt/npm/root/DGeoMedium;
public final fun getFNodes ()Ljava/util/List;
public final fun getFShape ()Lru/mipt/npm/root/DGeoShape;
public fun getName ()Lspace/kscience/dataforge/names/Name;
}
public class ru/mipt/npm/root/DNamed : ru/mipt/npm/root/DObject {
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
public final fun getFName ()Ljava/lang/String;
public final fun getFTitle ()Ljava/lang/String;
}
public class ru/mipt/npm/root/DObject {
public fun <init> (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
public final fun getMeta ()Lspace/kscience/dataforge/meta/Meta;
public final fun getRefCache ()Lru/mipt/npm/root/DObjectCache;
public final fun getTypename ()Ljava/lang/String;
}
public final class ru/mipt/npm/root/DObjectCache {
public static final field Companion Lru/mipt/npm/root/DObjectCache$Companion;
public fun <init> (Ljava/util/List;Ljava/util/List;)V
public synthetic fun <init> (Ljava/util/List;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun get (I)Lspace/kscience/dataforge/meta/Meta;
public final fun getRefStack ()Ljava/util/List;
public final fun stack (I)Lru/mipt/npm/root/DObjectCache;
}
public final class ru/mipt/npm/root/DObjectCache$Companion {
public final fun getEmpty ()Lru/mipt/npm/root/DObjectCache;
}
public final class ru/mipt/npm/root/DObjectKt {
public static final fun doubleArray (Lspace/kscience/dataforge/meta/MetaProvider;[DLspace/kscience/dataforge/names/Name;)Lkotlin/properties/ReadOnlyProperty;
public static synthetic fun doubleArray$default (Lspace/kscience/dataforge/meta/MetaProvider;[DLspace/kscience/dataforge/names/Name;ILjava/lang/Object;)Lkotlin/properties/ReadOnlyProperty;
}
public final class ru/mipt/npm/root/DRootToSolidKt {
public static final fun toSolid (Lru/mipt/npm/root/DGeoManager;)Lspace/kscience/visionforge/solid/SolidGroup;
}
public final class ru/mipt/npm/root/RootColors {
public static final field INSTANCE Lru/mipt/npm/root/RootColors;
public final fun get (I)Ljava/lang/String;
}
public final class ru/mipt/npm/root/serialization/JsonToRootKt {
public static final fun decodeFromJson (Lru/mipt/npm/root/serialization/TObject;Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/json/JsonElement;)Lru/mipt/npm/root/serialization/TObject;
public static final fun decodeFromString (Lru/mipt/npm/root/serialization/TObject;Lkotlinx/serialization/KSerializer;Ljava/lang/String;)Lru/mipt/npm/root/serialization/TObject;
}
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 class ru/mipt/npm/root/serialization/TGeoBBox : ru/mipt/npm/root/serialization/TGeoShape {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoBBox$Companion;
public fun <init> ()V
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFDX ()D
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 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;
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/serialization/TGeoBBox;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoBBox$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public abstract class ru/mipt/npm/root/serialization/TGeoBoolNode : ru/mipt/npm/root/serialization/TObject {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoBoolNode$Companion;
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoMatrix;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public abstract fun getFLeft ()Lru/mipt/npm/root/serialization/TGeoShape;
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 final class ru/mipt/npm/root/serialization/TGeoBoolNode$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoCombiTrans;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoCombiTrans$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoCompositeShape;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoCompositeShape$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoHMatrix;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoHMatrix$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoIdentity;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoIdentity$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoIntersection;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoIntersection$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoManager;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoManager$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public class ru/mipt/npm/root/serialization/TGeoMaterial : ru/mipt/npm/root/serialization/TNamed {
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 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;
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/serialization/TGeoMaterial;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoMaterial$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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 final class ru/mipt/npm/root/serialization/TGeoMatrix$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoMedium;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoMedium$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoMixture;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoMixture$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public class ru/mipt/npm/root/serialization/TGeoNode : ru/mipt/npm/root/serialization/TNamed {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoNode$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[ILkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFGeoAtt-pVg5ArA ()I
public final fun getFNovlp ()I
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 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;
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/serialization/TGeoNode;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoNode$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoNodeMatrix;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoNodeMatrix$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoNodeOffset;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoNodeOffset$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public class ru/mipt/npm/root/serialization/TGeoPcon : ru/mipt/npm/root/serialization/TGeoBBox {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoPcon$Companion;
public fun <init> ()V
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DIDD[D[D[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFDphi ()D
public final fun getFNz ()I
public final fun getFPhi1 ()D
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 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;
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/serialization/TGeoPcon;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoPcon$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public class ru/mipt/npm/root/serialization/TGeoPgon : ru/mipt/npm/root/serialization/TGeoPcon {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoPgon$Companion;
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 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;
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/serialization/TGeoPgon;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoPgon$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoRotation;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoRotation$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public abstract class ru/mipt/npm/root/serialization/TGeoShape : ru/mipt/npm/root/serialization/TNamed {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoShape$Companion;
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 final class ru/mipt/npm/root/serialization/TGeoShape$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoShapeAssembly;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoShapeAssembly$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoShapeRef : ru/mipt/npm/root/serialization/TGeoShape {
public fun <init> (Lkotlin/jvm/functions/Function0;)V
public final fun getValue ()Lru/mipt/npm/root/serialization/TGeoShape;
}
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;
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/serialization/TGeoSubtraction;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoSubtraction$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoTranslation;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoTranslation$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public class ru/mipt/npm/root/serialization/TGeoTube : ru/mipt/npm/root/serialization/TGeoBBox {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoTube$Companion;
public fun <init> ()V
public synthetic fun <init> (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DDDDLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
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 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;
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/serialization/TGeoTube;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoTube$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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
public final fun getFCm ()D
public final fun getFPhi1 ()D
public final fun getFPhi2 ()D
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;
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/serialization/TGeoTubeSeg;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoTubeSeg$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TGeoUnion;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoUnion$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public class ru/mipt/npm/root/serialization/TGeoVolume : ru/mipt/npm/root/serialization/TNamed {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoVolume$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 final fun getFFillColor ()Ljava/lang/Integer;
public final fun getFFillStyle ()Ljava/lang/Integer;
public final fun getFGeoAtt-pVg5ArA ()I
public final fun getFLineColor ()I
public final fun getFLineStyle ()Ljava/lang/Integer;
public final fun getFLineWidth-pVg5ArA ()I
public final fun getFMedium ()Lru/mipt/npm/root/serialization/TGeoMedium;
public final fun getFNodes ()Lru/mipt/npm/root/serialization/TObjArray;
public final fun getFNtotal ()I
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 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;
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/serialization/TGeoVolume;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoVolume$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public class ru/mipt/npm/root/serialization/TGeoVolumeAssembly : ru/mipt/npm/root/serialization/TGeoVolume {
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 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;
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/serialization/TGeoVolumeAssembly;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoVolumeAssembly$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoVolumeAssemblyRef : ru/mipt/npm/root/serialization/TGeoVolumeAssembly {
public fun <init> (Lkotlin/jvm/functions/Function0;)V
public final fun getValue ()Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;
}
public final class ru/mipt/npm/root/serialization/TGeoVolumeRef : ru/mipt/npm/root/serialization/TGeoVolume {
public fun <init> (Lkotlin/jvm/functions/Function0;)V
public final fun getValue ()Lru/mipt/npm/root/serialization/TGeoVolume;
}
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
public final fun getFX ()[D
public final fun getFX0 ()[D
public final fun getFY ()[D
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;
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/serialization/TGeoXtru;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TGeoXtru$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/THashList;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/THashList$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
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/serialization/TList;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TList$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public class ru/mipt/npm/root/serialization/TNamed : ru/mipt/npm/root/serialization/TObject {
public static final field Companion Lru/mipt/npm/root/serialization/TNamed$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 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 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;
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/serialization/TNamed;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TNamed$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
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;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TObjArray;
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/serialization/TObjArray;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/serialization/TObjArray$Companion {
public final fun getEmpty ()Lru/mipt/npm/root/serialization/TObjArray;
public final fun serializer (Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer;
}
public abstract class ru/mipt/npm/root/serialization/TObject {
public static final field Companion Lru/mipt/npm/root/serialization/TObject$Companion;
public fun <init> ()V
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 final class ru/mipt/npm/root/serialization/TObject$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}

View File

@ -0,0 +1,19 @@
plugins {
id("ru.mipt.npm.gradle.mpp")
}
kscience{
useSerialization {
json()
}
}
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
api(project(":visionforge-solid"))
}
}
}
}

View File

@ -0,0 +1,145 @@
package ru.mipt.npm.root
import kotlinx.serialization.json.Json
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(
vararg default: Double,
key: Name? = null,
): ReadOnlyProperty<Any?, DoubleArray> = value(key) {
it?.doubleArray ?: doubleArrayOf(*default)
}
public class DObjectCache(private val cache: List<Meta>, public val refStack: List<Int> = emptyList()) {
public operator fun get(index: Int): Meta = cache[index]
public fun stack(ref: Int): DObjectCache = DObjectCache(cache, refStack + ref)
public companion object {
public val empty: DObjectCache = DObjectCache(emptyList(), emptyList())
}
}
public open class DObject(public val meta: Meta, public val refCache: DObjectCache) {
public val typename: String by meta.string(key = "_typename".asName()) {
error("Type is not defined")
}
private fun <T : DObject> resolve(builder: (Meta, DObjectCache) -> T, meta: Meta): T? {
meta["\$ref"]?.int?.let { refId ->
if (refCache.refStack.contains(refId)) {
println("Circular reference $refId in stack ${refCache.refStack}")
return null
}
return builder(refCache[refId], refCache.stack(refId))
}
return builder(meta, refCache)
}
internal fun <T : DObject> tObjectArray(
builder: (Meta, DObjectCache) -> T
): ReadOnlyProperty<Any?, List<T>> = ReadOnlyProperty { _, property ->
meta.getIndexed(Name.of(property.name, "arr")).values.mapNotNull {
resolve(builder, it)
}
}
internal fun <T : DObject> dObject(
builder: (Meta, DObjectCache) -> T,
key: Name? = null
): ReadOnlyProperty<Any?, T?> = ReadOnlyProperty { _, property ->
meta[key ?: property.name.asName()]?.let { resolve(builder, it) }
}
}
public open class DNamed(meta: Meta, refCache: DObjectCache) : DObject(meta, refCache) {
public val fName: String by meta.string("")
public val fTitle: String by meta.string("")
}
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)
public val fParams: DoubleArray by meta.doubleArray()
}
public class DGeoShape(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache) {
public val fDX: Double by meta.double(0.0)
public val fDY: Double by meta.double(0.0)
public val fDZ: Double by meta.double(0.0)
}
public class DGeoVolume(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache), Named {
public val fNodes: List<DGeoNode> by tObjectArray(::DGeoNode)
public val fShape: DGeoShape? by dObject(::DGeoShape)
public val fMedium: DGeoMedium? by dObject(::DGeoMedium)
public val fFillColor: Int? by meta.int()
override val name: Name by lazy { Name.parse(fName.ifEmpty { "volume[${meta.hashCode().toUInt()}]" }) }
}
public class DGeoNode(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache) {
public val fVolume: DGeoVolume? by dObject(::DGeoVolume)
}
public open class DGeoMatrix(meta: Meta, refCache: DObjectCache) : DNamed(meta, refCache)
public open 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 DGeoBoolNode(meta: Meta, refCache: DObjectCache) : DObject(meta, refCache) {
public val fLeft: DGeoShape? by dObject(::DGeoShape)
public val fLeftMat: DGeoMatrix? by dObject(::DGeoMatrix)
public val fRight: DGeoShape? by dObject(::DGeoShape)
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 fShapes: List<DGeoShape> by tObjectArray(::DGeoShape)
public val fVolumes: List<DGeoVolume> by tObjectArray(::DGeoVolume)
public val fNodes: List<DGeoNode> by tObjectArray(::DGeoNode)
public companion object {
public fun parse(string: String): DGeoManager {
val meta = Json.decodeFromString(MetaSerializer, string)
val res = ArrayList<Meta>(4096)
fun fillCache(element: Meta) {
if (element["\$ref"] == null) {
res.add(element)
element.items.values.forEach {
if (!it.isLeaf) {
fillCache(it)
}
}
}
}
fillCache(meta)
val refCache = DObjectCache(res)
return DGeoManager(meta, refCache)
}
}
}

View File

@ -0,0 +1,362 @@
package ru.mipt.npm.root
import space.kscience.dataforge.meta.*
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.plus
import space.kscience.dataforge.values.doubleArray
import space.kscience.visionforge.isEmpty
import space.kscience.visionforge.solid.*
import space.kscience.visionforge.solid.SolidMaterial.Companion.MATERIAL_COLOR_KEY
import kotlin.math.*
private val volumesName = Name.EMPTY //"volumes".asName()
private operator fun Number.times(d: Double) = toDouble() * d
private operator fun Number.times(f: Float) = toFloat() * f
private fun degToRad(d: Double) = d * PI / 180.0
private data class RootToSolidContext(
val prototypeHolder: PrototypeHolder,
val currentLayer: Int = 0,
val maxLayer: Int = 5
)
// converting to XYZ to TaitBryan angles according to https://en.wikipedia.org/wiki/Euler_angles#Rotation_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)
}
private fun Solid.translate(trans: DoubleArray) {
val (x, y, z) = trans
position = Point3D(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()
translate(fTranslation)
matrix.meta["fRotation.fRotationMatrix"]?.value?.let {
rotate(it.doubleArray)
}
}
"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])
}
}
}
private fun SolidGroup.addShape(
shape: DGeoShape,
context: RootToSolidContext,
name: String? = shape.fName.ifEmpty { null },
block: Solid.() -> Unit = {}
) {
when (shape.typename) {
"TGeoCompositeShape" -> {
val fNode: DGeoBoolNode? by shape.dObject(::DGeoBoolNode)
val node = fNode ?: error("Composite shape node not resolved")
val compositeType = when (node.typename) {
"TGeoIntersection" -> CompositeType.INTERSECT
"TGeoSubtraction" -> CompositeType.SUBTRACT
"TGeoUnion" -> CompositeType.GROUP
else -> error("Unknown bool node type ${node.typename}")
}
smartComposite(compositeType, name = name) {
addShape(node.fLeft!!, context, null) {
this.useMatrix(node.fLeftMat)
}
addShape(node.fRight!!, context, null) {
this.useMatrix(node.fRightMat)
}
}.apply(block)
}
"TGeoXtru" -> {
val fNvert by shape.meta.int(0)
val fX by shape.meta.doubleArray()
val fY by shape.meta.doubleArray()
val fNz by shape.meta.int(0)
val fZ by shape.meta.doubleArray()
val fX0 by shape.meta.doubleArray()
val fY0 by shape.meta.doubleArray()
val fScale by shape.meta.doubleArray()
extruded(name = name) {
(0 until fNvert).forEach { index ->
shape {
point(fX[index], fY[index])
}
}
(0 until fNz).forEach { index ->
layer(
fZ[index],
fX0[index],
fY0[index],
fScale[index]
)
}
}.apply(block)
}
"TGeoTube" -> {
val fRmax by shape.meta.double(0.0)
val fDz by shape.meta.double(0.0)
val fRmin by shape.meta.double(0.0)
tube(
radius = fRmax,
height = fDz * 2,
innerRadius = fRmin,
name = name,
block = block
)
}
"TGeoTubeSeg" -> {
val fRmax by shape.meta.double(0.0)
val fDz by shape.meta.double(0.0)
val fRmin by shape.meta.double(0.0)
val fPhi1 by shape.meta.double(0.0)
val fPhi2 by shape.meta.double(0.0)
tube(
radius = fRmax,
height = fDz * 2,
innerRadius = fRmin,
startAngle = degToRad(fPhi1),
angle = degToRad(fPhi2 - fPhi1),
name = name,
block = block
)
}
"TGeoPcon" -> {
val fDphi by shape.meta.double(0.0)
val fNz by shape.meta.int(2)
val fPhi1 by shape.meta.double(360.0)
val fRmax by shape.meta.doubleArray()
val fRmin by shape.meta.doubleArray()
val fZ by shape.meta.doubleArray()
if (fNz == 2) {
coneSurface(
bottomOuterRadius = fRmax[0],
bottomInnerRadius = fRmin[0],
height = fZ[1] - fZ[0],
topOuterRadius = fRmax[1],
topInnerRadius = fRmin[1],
startAngle = degToRad(fPhi1),
angle = degToRad(fDphi),
name = name,
) {
z = (fZ[1] + fZ[0]) / 2
}.apply(block)
} else {
TODO()
}
}
"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)
val fRmax by shape.meta.doubleArray()
val fRmin by shape.meta.doubleArray()
val fZ by shape.meta.doubleArray()
val fNedges by shape.meta.int(1)
val startphi = degToRad(fPhi1)
val deltaphi = degToRad(fDphi)
extruded(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)
}
}.apply(block)
}
"TGeoShapeAssembly" -> {
val fVolume by shape.dObject(::DGeoVolume)
fVolume?.let { volume ->
addRootVolume(volume, context, 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)
val fAlpha1 by shape.meta.double(0.0)
val fAlpha2 by shape.meta.double(0.0)
if (fAlpha1 != 0.0 || fAlpha2 != 0.0 || fTheta != 0.0 || fPhi != 0.0) {
TODO("Angled trapezoid not implemented")
}
val fH1 by shape.meta.double(0.0)
val fBl1 by shape.meta.double(0.0)
val fTl1 by shape.meta.double(0.0)
val fH2 by shape.meta.double(0.0)
val fBl2 by shape.meta.double(0.0)
val fTl2 by shape.meta.double(0.0)
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)
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)
addShape(scaledShape, context)
apply(block)
}
}
}
else -> {
TODO("A shape with type ${shape.typename} not implemented")
}
}
}
private fun SolidGroup.addRootNode(obj: DGeoNode, context: RootToSolidContext) {
val volume = obj.fVolume ?: return
addRootVolume(volume, context, obj.fName) {
when (obj.typename) {
"TGeoNodeMatrix" -> {
val fMatrix by obj.dObject(::DGeoMatrix)
this.useMatrix(fMatrix)
}
"TGeoNodeOffset" -> {
val fOffset by obj.meta.double(0.0)
x = fOffset
}
}
}
}
private fun buildVolume(volume: DGeoVolume, context: RootToSolidContext): Solid? {
val group = SolidGroup {
//set current layer
layer = context.currentLayer
val nodes = volume.fNodes
if (nodes.isEmpty() || context.currentLayer >= context.maxLayer) {
//TODO add smart filter
volume.fShape?.let { shape ->
addShape(shape, context)
}
} else {
val newLayer = if (nodes.size <= 2) {
context.currentLayer
} else if (nodes.size > 10) {
context.currentLayer + 2
} else {
context.currentLayer + 1
}
val newContext = context.copy(currentLayer = newLayer)
nodes.forEach { node ->
//add children to the next layer
addRootNode(node, newContext)
}
}
}
return if (group.isEmpty()) {
null
} else if (group.children.size == 1 && group.meta.isEmpty()) {
(group.children.values.first() as Solid).apply { parent = null }
} else {
group
}
}
//private val SolidGroup.rootPrototypes: SolidGroup get() = (parent as? SolidGroup)?.rootPrototypes ?: this
private fun SolidGroup.addRootVolume(
volume: DGeoVolume,
context: RootToSolidContext,
name: String? = null,
cache: Boolean = true,
block: Solid.() -> Unit = {}
) {
val combinedName = if (volume.fName.isEmpty()) {
name
} else if (name == null) {
volume.fName
} else {
"${name}_${volume.fName}"
}
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)
} else {
val templateName = volumesName + volume.name
val existing = getPrototype(templateName)
if (existing == null) {
context.prototypeHolder.prototypes {
val group = buildVolume(volume, context)
set(templateName, group)
}
}
ref(templateName, name).apply {
volume.fFillColor?.let {
meta[MATERIAL_COLOR_KEY] = RootColors[it]
}
block()
}
}
}
public fun DGeoManager.toSolid(): SolidGroup = SolidGroup {
val context = RootToSolidContext(this)
fNodes.forEach { node ->
addRootNode(node, context)
}
}

View File

@ -0,0 +1,42 @@
package ru.mipt.npm.root
public object RootColors {
private val colorMap = Array<String>(924) { "white" }
//colorMap[110] = "white"
private val moreCol = listOf(
11 to "c1b7ad4d4d4d6666668080809a9a9ab3b3b3cdcdcde6e6e6f3f3f3cdc8accdc8acc3c0a9bbb6a4b3a697b8a49cae9a8d9c8f83886657b1cfc885c3a48aa9a1839f8daebdc87b8f9a768a926983976e7b857d9ad280809caca6c0d4cf88dfbb88bd9f83c89a7dc08378cf5f61ac8f94a6787b946971d45a549300ff7b00ff6300ff4b00ff3300ff1b00ff0300ff0014ff002cff0044ff005cff0074ff008cff00a4ff00bcff00d4ff00ecff00fffd00ffe500ffcd00ffb500ff9d00ff8500ff6d00ff5500ff3d00ff2600ff0e0aff0022ff003aff0052ff006aff0082ff009aff00b1ff00c9ff00e1ff00f9ff00ffef00ffd700ffbf00ffa700ff8f00ff7700ff6000ff4800ff3000ff1800ff0000",
201 to "5c5c5c7b7b7bb8b8b8d7d7d78a0f0fb81414ec4848f176760f8a0f14b81448ec4876f1760f0f8a1414b84848ec7676f18a8a0fb8b814ecec48f1f1768a0f8ab814b8ec48ecf176f10f8a8a14b8b848ecec76f1f1",
390 to "ffffcdffff9acdcd9affff66cdcd669a9a66ffff33cdcd339a9a33666633ffff00cdcd009a9a00666600333300",
406 to "cdffcd9aff9a9acd9a66ff6666cd66669a6633ff3333cd33339a3333663300ff0000cd00009a00006600003300",
422 to "cdffff9affff9acdcd66ffff66cdcd669a9a33ffff33cdcd339a9a33666600ffff00cdcd009a9a006666003333",
590 to "cdcdff9a9aff9a9acd6666ff6666cd66669a3333ff3333cd33339a3333660000ff0000cd00009a000066000033",
606 to "ffcdffff9affcd9acdff66ffcd66cd9a669aff33ffcd33cd9a339a663366ff00ffcd00cd9a009a660066330033",
622 to "ffcdcdff9a9acd9a9aff6666cd66669a6666ff3333cd33339a3333663333ff0000cd00009a0000660000330000",
791 to "ffcd9acd9a669a66339a6600cd9a33ffcd66ff9a00ffcd33cd9a00ffcd00ff9a33cd66006633009a3300cd6633ff9a66ff6600ff6633cd3300ff33009aff3366cd00336600339a0066cd339aff6666ff0066ff3333cd0033ff00cdff9a9acd66669a33669a009acd33cdff669aff00cdff339acd00cdff009affcd66cd9a339a66009a6633cd9a66ffcd00ff6633ffcd00cd9a00ffcd33ff9a00cd66006633009a3333cd6666ff9a00ff9a33ff6600cd3300ff339acdff669acd33669a00339a3366cd669aff0066ff3366ff0033cd0033ff339aff0066cd00336600669a339acd66cdff009aff33cdff009acd00cdffcd9aff9a66cd66339a66009a9a33cdcd66ff9a00ffcd33ff9a00cdcd00ff9a33ff6600cd33006633009a6633cd9a66ff6600ff6633ff3300cd3300ffff339acd00666600339a0033cd3366ff669aff0066ff3366cd0033ff0033ff9acdcd669a9a33669a0066cd339aff66cdff009acd009aff33cdff009a",
920 to "cdcdcd9a9a9a666666333333"
)
init {
colorMap[0] = "white"
colorMap[1] = "black"
colorMap[2] = "red"
colorMap[3] = "green"
colorMap[4] = "blue"
colorMap[5] = "yellow"
colorMap[6] = "magenta"
colorMap[7] = "cyan"
colorMap[8] = "rgb(89,212,84)"
colorMap[9] = "rgb(89,84,217)"
colorMap[10] = "white"
moreCol.forEach { (n, s) ->
for (i in 0 until (s.length / 6)) {
colorMap[n + i] = "#" + s.substring(i * 6, (i + 1) * 6)
}
}
}
public operator fun get(index: Int): String = colorMap[index]
}

View File

@ -0,0 +1,17 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@SerialName("TGeoManager")
public class TGeoManager : TNamed() {
public val fMatrices: TObjArray<TGeoMatrix> = TObjArray.getEmpty()
public val fShapes: TObjArray<TGeoShape> = TObjArray.getEmpty()
public val fVolumes: TObjArray<TGeoVolume> = TObjArray.getEmpty()
public val fNodes: TObjArray<TGeoNode> = TObjArray.getEmpty()
}

View File

@ -0,0 +1,12 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@SerialName("TGeoMaterial")
public open class TGeoMaterial: TNamed()
@Serializable
@SerialName("TGeoMixture")
public class TGeoMixture: TGeoMaterial()

View File

@ -0,0 +1,42 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.Contextual
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@SerialName("TGeoMatrix")
public sealed class TGeoMatrix : TNamed()
@Serializable
@SerialName("TGeoIdentity")
public class TGeoIdentity : TGeoMatrix()
@Serializable
@SerialName("TGeoHMatrix")
public class TGeoHMatrix(
public val fTranslation: DoubleArray,
public val fRotationMatrix: DoubleArray,
public val fScale: DoubleArray
) : TGeoMatrix()
@Serializable
@SerialName("TGeoTranslation")
public class TGeoTranslation(
public val fTranslation: DoubleArray
) : TGeoMatrix()
@Serializable
@SerialName("TGeoRotation")
public class TGeoRotation(
public val fRotationMatrix: DoubleArray
) : TGeoMatrix()
@Serializable
@SerialName("TGeoCombiTrans")
public class TGeoCombiTrans(
public val fTranslation: DoubleArray,
@Contextual
public val fRotation: TGeoRotation? = null,
) : TGeoMatrix()

View File

@ -0,0 +1,14 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.Contextual
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@SerialName("TGeoMedium")
public class TGeoMedium(
public val fId: Int,
@Contextual
public val fMaterial: TGeoMaterial,
public val fParams: DoubleArray
) : TNamed()

View File

@ -0,0 +1,34 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.Contextual
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@SerialName("TGeoNode")
public open class TGeoNode : TNamed() {
public val fGeoAtt: UInt = 0u
@Contextual
public val fVolume: TGeoVolume? = null
// @Contextual
// public val fMother: TGeoVolume? = null
public val fNumber: Int = 0
public val fNovlp: Int = 0
public val fOverlaps: IntArray = intArrayOf()
}
@Serializable
@SerialName("TGeoNodeMatrix")
public class TGeoNodeMatrix : TGeoNode() {
@Contextual
public val fMatrix: TGeoMatrix? = null
}
@Serializable
@SerialName("TGeoNodeOffset")
public class TGeoNodeOffset : TGeoNode() {
public val fOffset: Double = 0.0
}

View File

@ -0,0 +1,136 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.Contextual
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.math.PI
@Serializable
@SerialName("TGeoShape")
public sealed class TGeoShape : TNamed() {
public val fShapeBits: UInt = 0u
public val fShapeId: Int = 0
}
@Serializable
@SerialName("TGeoBBox")
public open class TGeoBBox : TGeoShape() {
public val fDX: Double = 0.0
public val fDY: Double = 0.0
public val fDZ: Double = 0.0
public val fOrigin: DoubleArray = doubleArrayOf(0.0, 0.0, 0.0)
}
@Serializable
@SerialName("TGeoBoolNode")
public sealed class TGeoBoolNode : TObject() {
@Contextual
public abstract val fLeft: TGeoShape
@Contextual
public val fLeftMat: TGeoMatrix? = null
@Contextual
public abstract val fRight: TGeoShape
@Contextual
public val fRightMat: TGeoMatrix? = null
}
@Serializable
@SerialName("TGeoUnion")
public class TGeoUnion(
@Contextual
override val fLeft: TGeoShape,
@Contextual
override val fRight: TGeoShape,
) : TGeoBoolNode()
@Serializable
@SerialName("TGeoSubtraction")
public class TGeoSubtraction(
@Contextual
override val fLeft: TGeoShape,
@Contextual
override val fRight: TGeoShape,
) : TGeoBoolNode()
@Serializable
@SerialName("TGeoIntersection")
public class TGeoIntersection(
@Contextual
override val fLeft: TGeoShape,
@Contextual
override val fRight: TGeoShape,
) : TGeoBoolNode()
@Serializable
@SerialName("TGeoCompositeShape")
public class TGeoCompositeShape(public val fNode: TGeoBoolNode) : TGeoBBox()
@Serializable
@SerialName("TGeoXtru")
public class TGeoXtru(
public val fNvert: Int,
public val fNz: Int,
public val fZcurrent: Double,
public val fX: DoubleArray,
public val fY: DoubleArray,
public val fZ: DoubleArray,
public val fScale: DoubleArray,
public val fX0: DoubleArray,
public val fY0: DoubleArray
) : TGeoBBox()
@Serializable
@SerialName("TGeoTube")
public open class TGeoTube : TGeoBBox() {
public val fRmin: Double = 0.0
public val fRmax: Double = 0.0
public val fDz: Double = 0.0
}
@Serializable
@SerialName("TGeoTubeSeg")
public class TGeoTubeSeg(
public val fPhi1: Double,
public val fPhi2: Double,
public val fS1: Double,
public val fC1: Double,
public val fS2: Double,
public val fC2: Double,
public val fSm: Double,
public val fCm: Double,
public val fCdfi: Double,
) : TGeoTube()
@Serializable
@SerialName("TGeoPcon")
public open class TGeoPcon : TGeoBBox() {
public val fNz: Int = 0 // number of z planes (at least two)
public val fPhi1: Double = 0.0 // lower phi limit (converted to [0,2*pi)
public val fDphi: Double = PI * 2 // phi range
public val fRmin: DoubleArray = doubleArrayOf() //[fNz] pointer to array of inner radii
public val fRmax: DoubleArray = doubleArrayOf() //[fNz] pointer to array of outer radii
public val fZ: DoubleArray = doubleArrayOf() //[fNz] pointer to array of Z planes positions
}
@Serializable
@SerialName("TGeoPgon")
public open class TGeoPgon : TGeoPcon() {
public val fNedges: Int = 0
}
@Serializable
@SerialName("TGeoShapeAssembly")
public class TGeoShapeAssembly(
@Contextual
public val fVolume: TGeoVolumeAssembly,
public val fBBoxOK: Boolean = true
) : TGeoBBox()
public class TGeoShapeRef(provider: () -> TGeoShape) : TGeoShape() {
public val value: TGeoShape by lazy(provider)
}

View File

@ -0,0 +1,41 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.Contextual
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@SerialName("TGeoVolume")
public open class TGeoVolume : TNamed() {
public val fGeoAtt: UInt = 0u
public val fLineColor: Int = 2
public val fLineStyle: Int? = null
public val fLineWidth: UInt = 1u
public val fFillColor: Int? = null
public val fFillStyle: Int? = null
@Contextual
public val fNodes: TObjArray<@Contextual TGeoNode>? = null
@Contextual
public val fShape: TGeoShape? = null
@Contextual
public val fMedium: TGeoMedium? = null
public val fNumber: Int = 1
public val fNtotal: Int = 1
public val fRefCount: Int = 1
}
public class TGeoVolumeRef(provider: () -> TGeoVolume) : TGeoVolume() {
public val value: TGeoVolume by lazy(provider)
}
@Serializable
@SerialName("TGeoVolumeAssembly")
public open class TGeoVolumeAssembly : TGeoVolume()
public class TGeoVolumeAssemblyRef(provider: () -> TGeoVolumeAssembly) : TGeoVolumeAssembly() {
public val value: TGeoVolumeAssembly by lazy(provider)
}

View File

@ -0,0 +1,34 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.Contextual
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
public abstract class TObject {
public val fUniqueID: UInt = 0u
public val fBits: UInt = 0u
}
@Serializable
public open class TNamed : TObject() {
public val fName: String = ""
public val fTitle: String = ""
}
@Serializable
@SerialName("TObjArray")
public class TObjArray<T: TObject>(public val arr: List<@Contextual T>): TObject() {
public companion object{
public fun <T: TObject> getEmpty(): TObjArray<T> = TObjArray(emptyList())
}
}
@Serializable
@SerialName("TList")
public class TList(public val arr: List<@Contextual TObject>): TObject()
@Serializable
@SerialName("THashList")
public class THashList(public val arr: List<@Contextual TObject>): TObject()

View File

@ -0,0 +1,236 @@
package ru.mipt.npm.root.serialization
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.json.*
import kotlinx.serialization.modules.SerializersModule
import kotlinx.serialization.modules.contextual
import kotlinx.serialization.modules.polymorphic
import kotlinx.serialization.modules.subclass
private fun <T> jsonRootDeserializer(
tSerializer: KSerializer<T>,
builder: (JsonElement) -> T
): DeserializationStrategy<T> = object :
DeserializationStrategy<T> {
private val jsonElementSerializer = JsonElement.serializer()
override val descriptor: SerialDescriptor
get() = jsonElementSerializer.descriptor
override fun deserialize(decoder: Decoder): T {
val json = decoder.decodeSerializableValue(jsonElementSerializer)
return builder(json)
}
}
/**
* Load Json encoded TObject
*/
public fun <T : TObject> TObject.decodeFromJson(serializer: KSerializer<T>, jsonElement: JsonElement): T =
RootDecoder.decode(serializer, jsonElement)
public fun <T : TObject> TObject.decodeFromString(serializer: KSerializer<T>, string: String): T {
val json = Json.parseToJsonElement(string)
return RootDecoder.decode(serializer, json)
}
private object RootDecoder {
private class RootUnrefSerializer<T>(
private val tSerializer: KSerializer<T>,
private val refCache: List<RefEntry>,
) : KSerializer<T> by tSerializer {
@Suppress("UNCHECKED_CAST")
override fun deserialize(decoder: Decoder): T {
val input = decoder as JsonDecoder
val element = input.decodeJsonElement()
val refId = (element as? JsonObject)?.get("\$ref")?.jsonPrimitive?.int
val ref = if (refId != null) {
println("Substituting ${tSerializer.descriptor.serialName} ref $refId")
//Forward ref for shapes
when (tSerializer.descriptor.serialName) {
"TGeoShape" -> return TGeoShapeRef {
refCache[refId].getOrPutValue {
input.json.decodeFromJsonElement(tSerializer, it) as TGeoShape
}
} as T
"TGeoVolumeAssembly" -> return TGeoVolumeAssemblyRef {
refCache[refId].getOrPutValue {
input.json.decodeFromJsonElement(tSerializer, it) as TGeoVolumeAssembly
}
} as T
"TGeoVolume" -> return TGeoVolumeRef {
refCache[refId].getOrPutValue {
input.json.decodeFromJsonElement(tSerializer, it) as TGeoVolume
}
} as T
//Do unref
else -> refCache[refId]
}
} else {
refCache.find { it.element == element } ?: error("Element '$element' not found in the cache")
}
return ref.getOrPutValue {
// println("Decoding $it")
val actualTypeName = it.jsonObject["_typename"]?.jsonPrimitive?.content
input.json.decodeFromJsonElement(tSerializer, it)
}
}
}
private fun <T> KSerializer<T>.unref(refCache: List<RefEntry>): KSerializer<T> = RootUnrefSerializer(this, refCache)
@OptIn(ExperimentalSerializationApi::class)
fun unrefSerializersModule(
refCache: List<RefEntry>
): SerializersModule = SerializersModule {
contextual(TObjArray::class) {
TObjArray.serializer(it[0]).unref(refCache)
}
contextual(TGeoMedium.serializer().unref(refCache))
polymorphic(TGeoBoolNode::class) {
subclass(TGeoIntersection.serializer().unref(refCache))
subclass(TGeoUnion.serializer().unref(refCache))
subclass(TGeoSubtraction.serializer().unref(refCache))
}
polymorphic(TGeoShape::class) {
subclass(TGeoBBox.serializer())
subclass(TGeoXtru.serializer())
subclass(TGeoTube.serializer())
subclass(TGeoTubeSeg.serializer())
subclass(TGeoPcon.serializer())
subclass(TGeoPgon.serializer())
subclass(TGeoCompositeShape.serializer().unref(refCache))
subclass(TGeoShapeAssembly.serializer().unref(refCache))
default {
if (it == null) {
TGeoShape.serializer().unref(refCache)
} else {
error("Unrecognized shape $it")
}
}
}
polymorphic(TGeoMatrix::class) {
subclass(TGeoIdentity.serializer())
subclass(TGeoHMatrix.serializer().unref(refCache))
subclass(TGeoTranslation.serializer())
subclass(TGeoRotation.serializer())
subclass(TGeoCombiTrans.serializer().unref(refCache))
val unrefed = TGeoMatrix.serializer().unref(refCache)
default {
if (it == null) {
unrefed
} else {
error("Unrecognized matrix $it")
}
}
}
polymorphic(TGeoVolume::class, TGeoVolume.serializer().unref(refCache)) {
subclass(TGeoVolumeAssembly.serializer().unref(refCache))
val unrefed = TGeoVolume.serializer().unref(refCache)
default {
if (it == null) {
unrefed
} else {
error("Unrecognized volume $it")
}
}
}
polymorphic(TGeoNode::class, TGeoNode.serializer().unref(refCache)) {
subclass(TGeoNodeMatrix.serializer().unref(refCache))
subclass(TGeoNodeOffset.serializer().unref(refCache))
val unrefed = TGeoNode.serializer().unref(refCache)
default {
if (it == null) {
unrefed
} else {
error("Unrecognized node $it")
}
}
}
}
/**
* Create an instance of Json with unfolding Root references. This instance could not be reused because of the cache.
*/
private fun unrefJson(refCache: MutableList<RefEntry>): Json = Json {
encodeDefaults = true
ignoreUnknownKeys = true
classDiscriminator = "_typename"
serializersModule = unrefSerializersModule(refCache)
}
fun <T : TObject> decode(sourceDeserializer: KSerializer<T>, source: JsonElement): T {
val refCache = ArrayList<RefEntry>()
fun fillCache(element: JsonElement) {
when (element) {
is JsonObject -> {
if (element["_typename"] != null) {
refCache.add(RefEntry(element))
}
element.values.forEach {
fillCache(it)
}
}
is JsonArray -> {
element.forEach {
fillCache(it)
}
}
else -> {
//ignore primitives
}
}
}
fillCache(source)
return unrefJson(refCache).decodeFromJsonElement(sourceDeserializer.unref(refCache), source)
}
class RefEntry(val element: JsonElement) {
var value: Any? = null
fun <T> getOrPutValue(builder: (JsonElement) -> T): T {
if (value == null) {
value = builder(element)
}
return value as T
}
override fun toString(): String = element.toString()
}
// val json = Json {
// encodeDefaults = true
// ignoreUnknownKeys = true
// classDiscriminator = "_typename"
// serializersModule = this@RootDecoder.serializersModule
// }
}

View File

@ -0,0 +1,187 @@
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.solid.*
import kotlin.math.PI
import kotlin.math.atan2
import kotlin.math.pow
import kotlin.math.sqrt
private val solidsName = "solids".asName()
private val volumesName = "volumes".asName()
private operator fun Number.times(d: Double) = toDouble() * d
private operator fun Number.times(f: Float) = toFloat() * f
private fun degToRad(d: Double) = d * PI / 180.0
// converting to XYZ to TaitBryan angles according to https://en.wikipedia.org/wiki/Euler_angles#Rotation_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)
}
private fun Solid.translate(trans: DoubleArray) {
val (x, y, z) = trans
position = Point3D(x, y, z)
}
private fun Solid.useMatrix(matrix: TGeoMatrix?) {
when (matrix) {
null, is TGeoIdentity -> {
//do nothing
}
is TGeoTranslation -> {
translate(matrix.fTranslation)
}
is TGeoRotation -> {
rotate(matrix.fRotationMatrix)
}
is TGeoCombiTrans -> {
translate(matrix.fTranslation)
matrix.fRotation?.let { rotate(it.fRotationMatrix) }
}
is TGeoHMatrix -> {
translate(matrix.fTranslation)
rotate(matrix.fRotationMatrix)
val (xScale, yScale, zScale) = matrix.fScale
scale = Point3D(xScale, yScale, zScale)
}
}
}
private fun SolidGroup.addShape(shape: TGeoShape) {
when (shape) {
is TGeoShapeRef -> addShape(shape.value)
is TGeoCompositeShape -> {
val bool: TGeoBoolNode = shape.fNode
val compositeType = when (bool) {
is TGeoIntersection -> CompositeType.INTERSECT
is TGeoSubtraction -> CompositeType.SUBTRACT
is TGeoUnion -> CompositeType.UNION
}
composite(compositeType, name = shape.fName) {
addShape(bool.fLeft).apply {
useMatrix(bool.fLeftMat)
}
addShape(bool.fRight).apply {
useMatrix(bool.fRightMat)
}
}
}
is TGeoXtru -> extruded(name = shape.fName) {
(0 until shape.fNvert).forEach { index ->
shape {
point(shape.fX[index], shape.fY[index])
}
}
(0 until shape.fNz).forEach { index ->
layer(
shape.fZ[index],
shape.fX0[index],
shape.fY0[index],
shape.fScale[index]
)
}
}
is TGeoTube -> tube(
radius = shape.fRmax,
height = shape.fDz * 2,
innerRadius = shape.fRmin,
name = shape.fName
)
is TGeoTubeSeg -> tube(
radius = shape.fRmax,
height = shape.fDz * 2,
innerRadius = shape.fRmin,
startAngle = degToRad(shape.fPhi1),
angle = degToRad(shape.fPhi2 - shape.fPhi1),
name = shape.fName
)
is TGeoPcon -> TODO()
is TGeoPgon -> TODO()
is TGeoShapeAssembly -> volume(shape.fVolume)
is TGeoBBox -> box(shape.fDX * 2, shape.fDY * 2, shape.fDZ * 2, name = shape.fName)
}
}
private fun SolidGroup.node(obj: TGeoNode) {
if (obj.fVolume != null) {
volume(obj.fVolume, obj.fName).apply {
when (obj) {
is TGeoNodeMatrix -> {
useMatrix(obj.fMatrix)
}
is TGeoNodeOffset -> {
x = obj.fOffset
}
}
}
}
}
private fun buildGroup(volume: TGeoVolume): SolidGroup {
return if (volume is TGeoVolumeAssemblyRef) {
buildGroup(volume.value)
} else {
SolidGroup {
volume.fShape?.let { addShape(it) }
volume.fNodes?.let {
it.arr.forEach { obj ->
node(obj)
}
}
}
}
}
private val SolidGroup.rootPrototypes: SolidGroup get() = (parent as? SolidGroup)?.rootPrototypes ?: this
private fun SolidGroup.volume(volume: TGeoVolume, name: String? = null, cache: Boolean = true): Solid {
val group = buildGroup(volume)
val combinedName = if (volume.fName.isEmpty()) {
name
} else if (name == null) {
volume.fName
} else {
"${name}_${volume.fName}"
}
return if (!cache) {
group
} else newRef(
name = combinedName,
obj = group,
prototypeHolder = rootPrototypes,
templateName = volumesName + Name.parse(combinedName ?: "volume[${group.hashCode()}]")
)
}
// private fun load(geo: TGeoManager): SolidGroup {
//// /**
//// * A special group for local templates
//// */
//// val proto = SolidGroup()
////
//// val solids = proto.group(solidsName) {
//// setPropertyNode("edges.enabled", false)
//// }
////
//// val volumes = proto.group(volumesName)
////
//// val referenceStore = HashMap<Name, MutableList<SolidReferenceGroup>>()
// }
public fun TGeoManager.toSolid(): SolidGroup = SolidGroup {
fNodes.arr.forEach {
node(it)
}
}

4
demo/README.md Normal file
View File

@ -0,0 +1,4 @@
# Module demo

View File

@ -1,13 +1,4 @@
### GDML Example # Module gdml
Visualization example for geometry defined as GDML file.
##### Building project
To build the app, run `demo/gdml/Tasks/kotlin browser/jsBrowserDistribution` Gradle task, then
drag-and-drop GDML file to the window to see visualization. For an example file, you can use
`demo/gdml/src/jsMain/resources/cubes.gdml`.
##### Example view:
![](../../docs/images/gdml-demo.png)

27
demo/gdml/api/gdml.api Normal file
View File

@ -0,0 +1,27 @@
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;
}
public final class space/kscience/visionforge/gdml/demo/SaveToJsonKt {
public static final fun main ([Ljava/lang/String;)V
}

View File

@ -16,6 +16,7 @@ kotlin {
jvm { jvm {
withJava() withJava()
} }
js { js {
useCommonJs() useCommonJs()
browser { browser {
@ -24,6 +25,7 @@ kotlin {
} }
} }
} }
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
@ -34,6 +36,7 @@ kotlin {
jvmMain { jvmMain {
dependencies { dependencies {
implementation(project(":visionforge-fx")) implementation(project(":visionforge-fx"))
implementation("ch.qos.logback:logback-classic:1.2.5")
} }
} }
jsMain { jsMain {
@ -53,5 +56,5 @@ application {
val convertGdmlToJson by tasks.creating(JavaExec::class) { val convertGdmlToJson by tasks.creating(JavaExec::class) {
group = "application" group = "application"
classpath = sourceSets["main"].runtimeClasspath classpath = sourceSets["main"].runtimeClasspath
main = "space.kscience.dataforge.vis.spatial.gdml.demo.SaveToJsonKt" mainClass.set("space.kscience.dataforge.vis.spatial.gdml.demo.SaveToJsonKt")
} }

View File

@ -1,32 +1,41 @@
package space.kscience.visionforge.gdml package space.kscience.visionforge.gdml
import space.kscience.dataforge.meta.string import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.toName
import space.kscience.dataforge.values.asValue import space.kscience.dataforge.values.asValue
import space.kscience.dataforge.values.string
import space.kscience.gdml.GdmlShowCase 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.setProperty
import space.kscience.visionforge.solid.Solid
import space.kscience.visionforge.solid.SolidMaterial import space.kscience.visionforge.solid.SolidMaterial
import space.kscience.visionforge.solid.material
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
import kotlin.test.assertNotNull import kotlin.test.assertNotNull
class GDMLVisionTest { class GDMLVisionTest {
private val cubes = GdmlShowCase.cubes().toVision()
// @Test @Test
// fun testCubesStyles(){ fun testCubesStyles(){
// val cubes = gdml.toVision() val segment = cubes["composite-000.segment-0"] as Solid
// val segment = cubes["composite000.segment_0".toName()] as Solid println(segment.computeProperties().getValue(Vision.STYLE_KEY))
// println(segment.styles) // println(segment.computePropertyNode(SolidMaterial.MATERIAL_KEY))
// println(segment.material) // println(segment.computeProperty(SolidMaterial.MATERIAL_COLOR_KEY))
// }
println(segment.material?.meta)
//println(Solids.encodeToString(cubes))
}
@Test @Test
fun testPrototypeProperty() { fun testPrototypeProperty() {
val vision = GdmlShowCase.cubes().toVision() val child = cubes[Name.of("composite-000","segment-0")]
val child = vision["composite-000.segment-0".toName()]
assertNotNull(child) assertNotNull(child)
child.setProperty(SolidMaterial.MATERIAL_COLOR_KEY, "red".asValue()) child.setProperty(SolidMaterial.MATERIAL_COLOR_KEY, "red".asValue())
assertEquals("red", child.getProperty(SolidMaterial.MATERIAL_COLOR_KEY).string) assertEquals("red", child.getPropertyValue(SolidMaterial.MATERIAL_COLOR_KEY)?.string)
} }
} }

View File

@ -6,8 +6,8 @@ package drop
import org.w3c.dom.DragEvent import org.w3c.dom.DragEvent
import org.w3c.files.FileList import org.w3c.files.FileList
import react.Component import react.Component
import react.RProps import react.Props
import react.RState import react.State
external enum class DropEffects { external enum class DropEffects {
copy, copy,
@ -16,7 +16,7 @@ external enum class DropEffects {
none none
} }
external interface FileDropProps: RProps { external interface FileDropProps: Props {
var className: String? var className: String?
var targetClassName: String? var targetClassName: String?
var draggingOverFrameClassName: String? var draggingOverFrameClassName: String?
@ -32,7 +32,7 @@ external interface FileDropProps: RProps {
var dropEffect: DropEffects? var dropEffect: DropEffects?
} }
external interface FileDropState: RState { external interface FileDropState: State {
var draggingOverFrame: Boolean var draggingOverFrame: Boolean
var draggingOverTarget: Boolean var draggingOverTarget: Boolean
} }

View File

@ -1,10 +1,17 @@
package space.kscience.visionforge.gdml.demo package space.kscience.visionforge.gdml.demo
import kotlinx.browser.window import kotlinx.browser.window
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.Deferred
import kotlinx.css.*
import org.w3c.files.File
import org.w3c.files.FileReader import org.w3c.files.FileReader
import org.w3c.files.get import org.w3c.files.get
import react.* import react.Props
import react.dom.h2 import react.dom.h2
import react.fc
import react.useMemo
import react.useState
import space.kscience.dataforge.context.Context import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.fetch import space.kscience.dataforge.context.fetch
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
@ -14,27 +21,36 @@ import space.kscience.visionforge.gdml.markLayers
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.gdml.toVision
import space.kscience.visionforge.ring.ThreeCanvasWithControls import space.kscience.visionforge.ring.ThreeCanvasWithControls
import space.kscience.visionforge.ring.tab import space.kscience.visionforge.ring.tab
import space.kscience.visionforge.root import space.kscience.visionforge.setAsRoot
import space.kscience.visionforge.solid.Solid import space.kscience.visionforge.solid.Solid
import space.kscience.visionforge.solid.Solids import space.kscience.visionforge.solid.Solids
import styled.css
import styled.styledDiv
external interface GDMLAppProps : RProps { external interface GDMLAppProps : Props {
var context: Context var context: Context
var vision: Solid? var vision: Solid?
var selected: Name? var selected: Name?
} }
@JsExport @JsExport
val GDMLApp = functionalComponent<GDMLAppProps>("GDMLApp") { props -> val GDMLApp = fc<GDMLAppProps>("GDMLApp") { props ->
val visionManager = useMemo(props.context) { props.context.fetch(Solids).visionManager } val visionManager = useMemo(props.context) { props.context.fetch(Solids).visionManager }
var vision: Solid? by useState { props.vision?.apply { root(visionManager) } } var deferredVision: Deferred<Solid?> by useState {
CompletableDeferred(props.vision)
}
fun loadData(name: String, data: String) { fun readFileAsync(file: File): Deferred<Solid?> {
val deferred = CompletableDeferred<Solid?>()
FileReader().apply {
onload = {
val data = result as String
val name = file.name
val parsedVision = when { val parsedVision = when {
name.endsWith(".gdml") || name.endsWith(".xml") -> { name.endsWith(".gdml") || name.endsWith(".xml") -> {
val gdml = Gdml.decodeFromString(data) val gdml = Gdml.decodeFromString(data)
gdml.toVision().apply { gdml.toVision().apply {
root(visionManager) setAsRoot(visionManager)
console.info("Marking layers for file $name") console.info("Marking layers for file $name")
markLayers() markLayers()
} }
@ -45,14 +61,23 @@ val GDMLApp = functionalComponent<GDMLAppProps>("GDMLApp") { props ->
error("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") }
readAsText(file)
} }
return deferred
}
styledDiv {
css {
height = 100.vh - 12.pt
width = 100.vw
}
child(ThreeCanvasWithControls) { child(ThreeCanvasWithControls) {
attrs { attrs {
this.context = props.context this.context = props.context
this.solid = vision this.builderOfSolid = deferredVision
this.selected = props.selected this.selected = props.selected
tab("Load") { tab("Load") {
h2 { h2 {
@ -61,13 +86,7 @@ val GDMLApp = functionalComponent<GDMLAppProps>("GDMLApp") { props ->
fileDrop("(drag file here)") { files -> fileDrop("(drag file here)") { files ->
val file = files?.get(0) val file = files?.get(0)
if (file != null) { if (file != null) {
FileReader().apply { deferredVision = readFileAsync(file)
onload = {
val string = result as String
loadData(file.name, string)
}
readAsText(file)
}
} }
} }
} }
@ -75,4 +94,5 @@ val GDMLApp = functionalComponent<GDMLAppProps>("GDMLApp") { props ->
} }
} }
}

View File

@ -2,9 +2,8 @@ package space.kscience.visionforge.gdml.demo
import kotlinx.browser.document import kotlinx.browser.document
import kotlinx.css.* import kotlinx.css.*
import react.child
import react.dom.render import react.dom.render
import space.kscience.dataforge.context.Global import space.kscience.dataforge.context.Context
import space.kscience.gdml.GdmlShowCase import space.kscience.gdml.GdmlShowCase
import space.kscience.visionforge.Application import space.kscience.visionforge.Application
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.gdml.toVision
@ -16,7 +15,7 @@ import styled.injectGlobal
private class GDMLDemoApp : Application { private class GDMLDemoApp : Application {
override fun start(state: Map<String, Any>) { override fun start(state: Map<String, Any>) {
val context = Global.buildContext("gdml-demo"){ val context = Context("gdml-demo"){
plugin(ThreePlugin) plugin(ThreePlugin)
} }

View File

@ -7,9 +7,8 @@ import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.fetch import space.kscience.dataforge.context.fetch
import space.kscience.gdml.GdmlShowCase import space.kscience.gdml.GdmlShowCase
import space.kscience.visionforge.VisionManager import space.kscience.visionforge.VisionManager
import space.kscience.visionforge.describedProperties import space.kscience.visionforge.editor.VisionEditorFragment
import space.kscience.visionforge.editor.VisualObjectEditorFragment import space.kscience.visionforge.editor.VisionTreeFragment
import space.kscience.visionforge.editor.VisualObjectTreeFragment
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.gdml.toVision
import space.kscience.visionforge.solid.FX3DPlugin import space.kscience.visionforge.solid.FX3DPlugin
import space.kscience.visionforge.solid.FXCanvas3D import space.kscience.visionforge.solid.FXCanvas3D
@ -22,25 +21,21 @@ class GDMLDemoApp : App(GDMLView::class)
class GDMLView : View() { class GDMLView : View() {
private val context = Context { private val context = Context {
plugin(FX3DPlugin) plugin(FX3DPlugin)
plugin(VisionManager)
} }
private val fx3d = context.fetch(FX3DPlugin) private val fx3d = context.fetch(FX3DPlugin)
private val visionManager = context.fetch(VisionManager) private val visionManager = context.fetch(VisionManager)
private val canvas = FXCanvas3D(fx3d) private val canvas = FXCanvas3D(fx3d)
private val treeFragment = VisualObjectTreeFragment().apply { private val treeFragment = VisionTreeFragment().apply {
this.itemProperty.bind(canvas.rootObjectProperty) this.itemProperty.bind(canvas.rootObjectProperty)
} }
private val propertyEditor = VisualObjectEditorFragment { private val propertyEditor = VisionEditorFragment().apply {
it.describedProperties
}.apply {
descriptorProperty.set(SolidMaterial.descriptor) descriptorProperty.set(SolidMaterial.descriptor)
itemProperty.bind(treeFragment.selectedProperty) visionProperty.bind(treeFragment.selectedProperty)
} }
override val root: Parent = borderpane { override val root: Parent = borderpane {
top { top {
buttonbar { buttonbar {

View File

@ -0,0 +1,4 @@
# Module js-playground

View File

@ -20,8 +20,9 @@ kotlin{
dependencies{ dependencies{
implementation(project(":visionforge-gdml")) implementation(projects.visionforge.visionforgeGdml)
implementation(project(":visionforge-plotly")) implementation(projects.visionforge.visionforgePlotly)
implementation(project(":visionforge-threejs")) implementation(projects.visionforge.visionforgeMarkdown)
implementation(project(":ui:ring")) implementation(projects.visionforge.visionforgeThreejs)
implementation(projects.ui.ring)
} }

View File

@ -2,16 +2,29 @@ import kotlinx.browser.document
import kotlinx.css.* import kotlinx.css.*
import react.child import react.child
import react.dom.render import react.dom.render
import ringui.SmartTabs
import ringui.Tab
import space.kscience.dataforge.context.Context import space.kscience.dataforge.context.Context
import space.kscience.gdml.GdmlShowCase import space.kscience.plotly.models.Trace
import space.kscience.plotly.scatter
import space.kscience.visionforge.Application import space.kscience.visionforge.Application
import space.kscience.visionforge.VisionClient import space.kscience.visionforge.VisionClient
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.plotly.PlotlyPlugin
import space.kscience.visionforge.ring.ThreeCanvasWithControls import space.kscience.visionforge.ring.ThreeCanvasWithControls
import space.kscience.visionforge.ring.ThreeWithControlsPlugin import space.kscience.visionforge.ring.ThreeWithControlsPlugin
import space.kscience.visionforge.ring.solid
import space.kscience.visionforge.solid.*
import space.kscience.visionforge.startApplication import space.kscience.visionforge.startApplication
import styled.css import styled.css
import styled.styledDiv 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 { private class JsPlaygroundApp : Application {
@ -20,12 +33,11 @@ private class JsPlaygroundApp : Application {
val playgroundContext = Context { val playgroundContext = Context {
plugin(ThreeWithControlsPlugin) plugin(ThreeWithControlsPlugin)
plugin(VisionClient) plugin(VisionClient)
plugin(PlotlyPlugin)
} }
val element = document.getElementById("playground") ?: error("Element with id 'playground' not found on page") val element = document.getElementById("playground") ?: error("Element with id 'playground' not found on page")
val visionOfD0 = GdmlShowCase.babyIaxo().toVision()
render(element) { render(element) {
styledDiv { styledDiv {
css { css {
@ -34,10 +46,60 @@ private class JsPlaygroundApp : Application {
height = 100.vh height = 100.vh
width = 100.vw 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) { child(ThreeCanvasWithControls) {
val random = Random(112233)
attrs { attrs {
context = playgroundContext context = playgroundContext
solid = visionOfD0 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)
}
}
}
}
} }
} }
} }

View File

@ -0,0 +1,106 @@
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
}
}
}
}
}

View File

@ -0,0 +1,56 @@
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
}
}

View File

@ -0,0 +1,44 @@
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)
}
}

View File

@ -1,35 +0,0 @@
plugins {
kotlin("jvm")
kotlin("jupyter.api")
id("com.github.johnrengelman.shadow") version "6.1.0"
}
repositories {
mavenCentral()
maven("https://repo.kotlin.link")
}
dependencies {
implementation(project(":demo:playground"))
}
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
kotlinOptions {
useIR = true
jvmTarget = ru.mipt.npm.gradle.KScienceVersions.JVM_TARGET.toString()
}
}
extensions.findByType<JavaPluginExtension>()?.apply {
targetCompatibility = ru.mipt.npm.gradle.KScienceVersions.JVM_TARGET
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.processJupyterApiResources {
libraryProducers = listOf("space.kscience.dataforge.playground.VisionForgePlayGroundForJupyter")
}
tasks.findByName("shadowJar")?.dependsOn("processJupyterApiResources")

View File

@ -1,98 +0,0 @@
package space.kscience.dataforge.playground
import kotlinx.html.div
import kotlinx.html.id
import kotlinx.html.script
import kotlinx.html.stream.createHTML
import kotlinx.html.unsafe
import org.jetbrains.kotlinx.jupyter.api.HTML
import org.jetbrains.kotlinx.jupyter.api.annotations.JupyterLibrary
import org.jetbrains.kotlinx.jupyter.api.libraries.*
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.Vision
import space.kscience.visionforge.gdml.toVision
import space.kscience.visionforge.html.HtmlVisionFragment
import space.kscience.visionforge.html.Page
import space.kscience.visionforge.html.embedVisionFragment
import space.kscience.visionforge.plotly.PlotlyPlugin
import space.kscience.visionforge.plotly.asVision
import space.kscience.visionforge.solid.Solids
import space.kscience.visionforge.visionManager
@JupyterLibrary
@DFExperimental
internal class VisionForgePlayGroundForJupyter : JupyterIntegration() {
private val context = Context("VisionForge") {
plugin(Solids)
plugin(PlotlyPlugin)
}
private val jsBundle = ResourceFallbacksBundle(listOf(
ResourceLocation("js/visionforge-playground.js", ResourcePathType.CLASSPATH_PATH))
)
private val jsResource = LibraryResource(name = "VisionForge", type = ResourceType.JS, bundles = listOf(jsBundle))
private var counter = 0
private fun produceHtmlVisionString(fragment: HtmlVisionFragment) = createHTML().div {
val id = "visionforge.vision[${counter++}]"
div {
this.id = id
embedVisionFragment(context.visionManager, fragment = fragment)
}
script {
type = "text/javascript"
unsafe { +"window.renderAllVisionsById(\"$id\");" }
}
}
override fun Builder.onLoaded() {
resource(jsResource)
import(
"space.kscience.gdml.*",
"space.kscience.plotly.*",
"space.kscience.plotly.models.*",
"kotlinx.html.*",
"space.kscience.visionforge.solid.*",
"space.kscience.visionforge.html.Page",
"space.kscience.visionforge.html.page"
)
render<Gdml> { gdmlModel ->
val fragment = HtmlVisionFragment {
vision(gdmlModel.toVision())
}
HTML(produceHtmlVisionString(fragment))
}
render<Vision> { vision ->
val fragment = HtmlVisionFragment {
vision(vision)
}
HTML(produceHtmlVisionString(fragment))
}
render<Plot> { plot ->
val fragment = HtmlVisionFragment {
vision(plot.asVision())
}
HTML(produceHtmlVisionString(fragment))
}
render<space.kscience.plotly.PlotlyHtmlFragment> { fragment ->
HTML(createHTML().apply(fragment.visit).finalize())
}
render<Page> { page ->
HTML(page.render(createHTML()), true)
}
}
}

View File

@ -1,33 +1,4 @@
# Module muon-monitor
### Muon Monitor Visualization
This directory contains a full-stack application example built with `visionforge`.
It is visualizing the
[Muon Monitor](http://npm.mipt.ru/projects/physics.html#mounMonitor) experiment set-up,
including experiment's geometry and events (particle tracks).
#### Reusing code and going Full-Stack with Kotlin Multiplatform
The application includes both server back-end generating events, as well as client
visualization front-end.
As is common for Kotlin multiplatform projects, the code base of this simple application
is put in the following main directories:
* `commonMain` - common code, used by both JS client and JVM server. For example, the `Monitor`
object describes general geometry definitions needed in all parts of the application.
* `jsMain` - JavaScript client code. It performs visualization and reads events from the server.
* `jvmMain` - JVM server code. It runs `ktor` HTTP server, responding with event data when
client requests them.
Note that in a more traditional approach when client and server are developed separately
and possibly using different languages, there would be no common code and benefits associated
with it.
##### Building project
To run full-stack Muon Monitor Visualization application (both JVM server and Web browser front-end),
run `demo/muon-monitor/Tasks/application/run` task.
##### Example view:
![](../../docs/images/muon-monitor.png)

View File

@ -0,0 +1,148 @@
public final class ru/mipt/npm/muon/monitor/Event {
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;
public final fun component3 ()Ljava/util/Collection;
public final fun copy (ILjava/util/List;Ljava/util/Collection;)Lru/mipt/npm/muon/monitor/Event;
public static synthetic fun copy$default (Lru/mipt/npm/muon/monitor/Event;ILjava/util/List;Ljava/util/Collection;ILjava/lang/Object;)Lru/mipt/npm/muon/monitor/Event;
public fun equals (Ljava/lang/Object;)Z
public final fun getHits ()Ljava/util/Collection;
public final fun getId ()I
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 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;
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/muon/monitor/Event;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/muon/monitor/Event$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/muon/monitor/Model {
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;
public final fun getManager ()Lspace/kscience/visionforge/VisionManager;
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 CENTRAL_LAYER_Z F
public static final field GEOMETRY_TOLERANCE D
public static final field INSTANCE Lru/mipt/npm/muon/monitor/Monitor;
public static final field LOWER_LAYER_Z F
public static final field PIXEL_XY_SIZE F
public static final field PIXEL_XY_SPACING F
public static final field PIXEL_Z_SIZE F
public static final field UPPER_LAYER_Z F
public final fun getDetectors ()Ljava/util/Collection;
public final fun getPixels ()Ljava/util/Collection;
}
public final class ru/mipt/npm/muon/monitor/ReadResourceKt {
public static final fun readResource (Ljava/lang/String;)Ljava/lang/String;
}
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 final fun getName ()Ljava/lang/String;
public final fun getXSize ()F
public final fun getYSize ()F
public final fun getZSize ()F
}
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 final fun getName ()Ljava/lang/String;
public final fun getPixels ()Ljava/util/Collection;
}
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 final class ru/mipt/npm/muon/monitor/sim/Cos2TrackGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
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;
public final fun getMaxX ()F
public final fun getMaxY ()F
public final fun getPower ()D
public fun getRnd ()Lorg/apache/commons/math3/random/RandomGenerator;
}
public final class ru/mipt/npm/muon/monitor/sim/FixedAngleGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
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;
public final fun getMaxX ()F
public final fun getMaxY ()F
public final fun getPhi ()D
public fun getRnd ()Lorg/apache/commons/math3/random/RandomGenerator;
public final fun getTheta ()D
}
public final class ru/mipt/npm/muon/monitor/sim/LineKt {
public static final fun getPhi (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)D
public static final fun getTheta (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)D
public static final fun getX (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)D
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 final class ru/mipt/npm/muon/monitor/sim/MonitorKt {
public static final fun buildEventByTrack (ILorg/apache/commons/math3/geometry/euclidean/threed/Line;Lkotlin/jvm/functions/Function1;)Lru/mipt/npm/muon/monitor/Event;
public static synthetic fun buildEventByTrack$default (ILorg/apache/commons/math3/geometry/euclidean/threed/Line;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lru/mipt/npm/muon/monitor/Event;
public static final fun findLayer (F)Lorg/apache/commons/math3/geometry/euclidean/threed/Plane;
public static final fun getDefaultHitResolver ()Lkotlin/jvm/functions/Function1;
public static final fun readEffs ()Ljava/util/Map;
}
public final class ru/mipt/npm/muon/monitor/sim/PixelKt {
public static final fun isHit (Lru/mipt/npm/muon/monitor/SC1;Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)Z
}
public final class ru/mipt/npm/muon/monitor/sim/SimulationKt {
public static final fun simulateOne (Lru/mipt/npm/muon/monitor/sim/TrackGenerator;)Lru/mipt/npm/muon/monitor/Event;
}
public abstract interface class ru/mipt/npm/muon/monitor/sim/TrackGenerator {
public abstract fun generate ()Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
public abstract fun getRnd ()Lorg/apache/commons/math3/random/RandomGenerator;
}
public final class ru/mipt/npm/muon/monitor/sim/UniformTrackGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
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;
public final fun getMaxX ()F
public final fun getMaxY ()F
public fun getRnd ()Lorg/apache/commons/math3/random/RandomGenerator;
}

View File

@ -5,7 +5,7 @@ plugins {
group = "ru.mipt.npm" group = "ru.mipt.npm"
val ktorVersion: String = ru.mipt.npm.gradle.KScienceVersions.ktorVersion val ktorVersion: String = npmlibs.versions.ktor.get()
kscience { kscience {
useCoroutines() useCoroutines()
@ -17,6 +17,14 @@ kotlin {
jvm { jvm {
withJava() withJava()
} }
js {
useCommonJs()
browser {
commonWebpackConfig {
cssSupport.enabled = false
}
}
}
afterEvaluate { afterEvaluate {
val jsBrowserDistribution by tasks.getting val jsBrowserDistribution by tasks.getting
@ -37,17 +45,15 @@ kotlin {
jvmMain { jvmMain {
dependencies { dependencies {
implementation("org.apache.commons:commons-math3:3.6.1") implementation("org.apache.commons:commons-math3:3.6.1")
implementation("io.ktor:ktor-server-cio:$ktorVersion") implementation(npmlibs.ktor.server.cio)
implementation("io.ktor:ktor-serialization:$ktorVersion") implementation(npmlibs.ktor.serialization)
} }
} }
jsMain { jsMain {
dependencies { dependencies {
implementation(project(":ui:bootstrap")) implementation(project(":ui:ring"))
implementation("io.ktor:ktor-client-js:$ktorVersion")
implementation("io.ktor:ktor-client-serialization:$ktorVersion")
implementation(project(":visionforge-threejs")) implementation(project(":visionforge-threejs"))
implementation(devNpm("webpack-bundle-analyzer", "4.4.0")) //implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
} }
} }
} }
@ -57,12 +63,6 @@ application {
mainClass.set("ru.mipt.npm.muon.monitor.server.MMServerKt") mainClass.set("ru.mipt.npm.muon.monitor.server.MMServerKt")
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>() {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xir-property-lazy-initialization"
}
}
//distributions { //distributions {
// main { // main {
// contents { // contents {

View File

@ -5,7 +5,8 @@ import ru.mipt.npm.muon.monitor.Monitor.LOWER_LAYER_Z
import ru.mipt.npm.muon.monitor.Monitor.UPPER_LAYER_Z import ru.mipt.npm.muon.monitor.Monitor.UPPER_LAYER_Z
import space.kscience.visionforge.VisionManager import space.kscience.visionforge.VisionManager
import space.kscience.visionforge.removeAll import space.kscience.visionforge.removeAll
import space.kscience.visionforge.root import space.kscience.visionforge.setAsRoot
import space.kscience.visionforge.setProperty
import space.kscience.visionforge.solid.* import space.kscience.visionforge.solid.*
import kotlin.math.PI import kotlin.math.PI
@ -36,7 +37,11 @@ class Model(val manager: VisionManager) {
var tracks: SolidGroup var tracks: SolidGroup
val root: SolidGroup = SolidGroup().apply { val root: SolidGroup = SolidGroup().apply {
root(this@Model.manager) setAsRoot(this@Model.manager)
material {
wireframe
color("darkgreen")
}
rotationX = PI / 2 rotationX = PI / 2
group("bottom") { group("bottom") {
Monitor.detectors.filter { it.center.z == LOWER_LAYER_Z }.forEach { Monitor.detectors.filter { it.center.z == LOWER_LAYER_Z }.forEach {
@ -59,6 +64,7 @@ class Model(val manager: VisionManager) {
} }
private fun highlight(pixel: String) { private fun highlight(pixel: String) {
println("highlight $pixel")
map[pixel]?.color?.invoke("blue") map[pixel]?.color?.invoke("blue")
} }
@ -70,6 +76,7 @@ class Model(val manager: VisionManager) {
} }
fun displayEvent(event: Event) { fun displayEvent(event: Event) {
println("Received event: $event")
events.add(event) events.add(event)
event.hits.forEach { event.hits.forEach {
highlight(it) highlight(it)
@ -77,6 +84,7 @@ class Model(val manager: VisionManager) {
event.track?.let { event.track?.let {
tracks.polyline(*it.toTypedArray(), name = "track[${event.id}]") { tracks.polyline(*it.toTypedArray(), name = "track[${event.id}]") {
thickness = 4 thickness = 4
color("red")
} }
} }
} }

View File

@ -98,7 +98,7 @@ class SC16(
} }
val offset = Point3D(-y, x, 0)//rotateDetector(Point3D(x, y, 0.0)); val offset = Point3D(-y, x, 0)//rotateDetector(Point3D(x, y, 0.0));
val pixelName = "${name}_${index}" val pixelName = "${name}_${index}"
SC1(pixelName, center + offset) SC1(pixelName, offset + center)
} }
} }
} }

View File

@ -1,46 +1,44 @@
package ru.mipt.npm.muon.monitor package ru.mipt.npm.muon.monitor
import io.ktor.client.HttpClient import kotlinx.browser.window
import io.ktor.client.request.get import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.await
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.css.* import kotlinx.css.*
import kotlinx.html.js.onClickFunction import kotlinx.html.js.onClickFunction
import react.* import kotlinx.serialization.json.Json
import react.dom.* 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.context.Context
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.NameToken
import space.kscience.dataforge.names.isEmpty
import space.kscience.dataforge.names.length
import space.kscience.visionforge.Vision
import space.kscience.visionforge.bootstrap.canvasControls
import space.kscience.visionforge.bootstrap.card
import space.kscience.visionforge.bootstrap.gridRow
import space.kscience.visionforge.bootstrap.visionPropertyEditor
import space.kscience.visionforge.react.ThreeCanvasComponent
import space.kscience.visionforge.react.flexColumn import space.kscience.visionforge.react.flexColumn
import space.kscience.visionforge.react.visionTree 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.solid.specifications.Camera
import space.kscience.visionforge.solid.specifications.Canvas3DOptions import space.kscience.visionforge.solid.specifications.Canvas3DOptions
import space.kscience.visionforge.solid.three.edges
import styled.css import styled.css
import styled.styledDiv import styled.styledDiv
import styled.styledSpan
import kotlin.math.PI import kotlin.math.PI
external interface MMAppProps : RProps { external interface MMAppProps : Props {
var model: Model var model: Model
var context: Context var context: Context
var connection: HttpClient
var selected: Name? var selected: Name?
} }
@OptIn(DelicateCoroutinesApi::class)
@JsExport @JsExport
val MMApp = functionalComponent<MMAppProps>("Muon monitor") { props -> val MMApp = fc<MMAppProps>("Muon monitor") { props ->
var selected by useState { props.selected }
val onSelect: (Name?) -> Unit = {
selected = it
}
val mmOptions = useMemo { val mmOptions = useMemo {
Canvas3DOptions { Canvas3DOptions {
@ -49,74 +47,48 @@ val MMApp = functionalComponent<MMAppProps>("Muon monitor") { props ->
latitude = PI / 6 latitude = PI / 6
azimuth = PI + PI / 6 azimuth = PI + PI / 6
} }
this.onSelect = onSelect
} }
} }
val root = props.model.root val root = useMemo(props.model) {
props.model.root.apply {
edges()
}
}
gridRow { var events: Set<Event> by useState(emptySet())
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 { styledDiv {
css { css {
flex(0.0, 1.0, FlexBasis.zero) height = 100.vh - 12.pt
} }
//settings child(ThreeCanvasWithControls) {
card("Canvas configuration") { attrs {
canvasControls(mmOptions, root) this.context = props.context
} this.builderOfSolid = CompletableDeferred(root)
this.selected = props.selected
card("Events") { this.options = mmOptions
tab("Events") {
flexColumn {
flexRow {
button { button {
+"Next" +"Next"
attrs { attrs {
onClickFunction = { onClickFunction = {
GlobalScope.launch { context.launch {
val event = props.connection.get<Event>("http://localhost:8080/event") 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) props.model.displayEvent(event)
} }
} }
@ -126,66 +98,24 @@ val MMApp = functionalComponent<MMAppProps>("Muon monitor") { props ->
+"Clear" +"Clear"
attrs { attrs {
onClickFunction = { onClickFunction = {
events = emptySet()
props.model.reset() props.model.reset()
} }
} }
} }
} }
} }
styledDiv { events.forEach { event ->
p {
styledSpan {
+event.id.toString()
}
+" : "
styledSpan {
css { css {
padding(0.px) color = Color.blue
} }
nav { +event.hits.toString()
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)
} }
} }
} }
@ -194,3 +124,151 @@ val MMApp = functionalComponent<MMAppProps>("Muon monitor") { props ->
} }
} }
// 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)
// }
// }
// }
// }
// }
//
// }
}

View File

@ -1,41 +1,30 @@
package ru.mipt.npm.muon.monitor package ru.mipt.npm.muon.monitor
import io.ktor.client.HttpClient
import io.ktor.client.features.json.JsonFeature
import io.ktor.client.features.json.serializer.KotlinxSerializer
import kotlinx.browser.document import kotlinx.browser.document
import react.child
import react.dom.render import react.dom.render
import space.kscience.dataforge.context.Context import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.Global
import space.kscience.dataforge.context.fetch import space.kscience.dataforge.context.fetch
import space.kscience.visionforge.Application import space.kscience.visionforge.Application
import space.kscience.visionforge.VisionManager import space.kscience.visionforge.VisionManager
import space.kscience.visionforge.bootstrap.useBootstrap import space.kscience.visionforge.solid.three.ThreePlugin
import space.kscience.visionforge.startApplication import space.kscience.visionforge.startApplication
private class MMDemoApp : Application { private class MMDemoApp : Application {
private val visionManager = Global.fetch(VisionManager)
private val model = Model(visionManager)
private val connection = HttpClient {
install(JsonFeature) {
serializer = KotlinxSerializer()
}
}
override fun start(state: Map<String, Any>) { override fun start(state: Map<String, Any>) {
useBootstrap()
val context = Context("MM-demo") {
plugin(ThreePlugin)
}
val visionManager = context.fetch(VisionManager)
val model = Model(visionManager)
val element = document.getElementById("app") ?: error("Element with id 'app' not found on page") val element = document.getElementById("app") ?: error("Element with id 'app' not found on page")
val context = Context("demo")
render(element) { render(element) {
child(MMApp) { child(MMApp) {
attrs { attrs {
this.model = this@MMDemoApp.model this.model = model
this.connection = this@MMDemoApp.connection
this.context = context this.context = context
} }
} }

View File

@ -16,10 +16,10 @@ import kotlin.random.Random
*/ */
internal class SC1Aux(val sc: SC1, var efficiency: Double = 1.0) { internal class SC1Aux(val sc: SC1, var efficiency: Double = 1.0) {
// val layer: Layer = findLayer(center.z); // val layer: Layer = findLayer(center.z);
private val upLayer = private val upLayer = findLayer(sc.center.z + sc.zSize / 2f)
findLayer(sc.center.z + sc.zSize / 2f)//Layer("${name}_up", center.z + zSize / 2.0); //Layer("${name}_up", center.z + zSize / 2.0);
private val bottomLayer = private val bottomLayer = findLayer(sc.center.z - sc.zSize / 2f)
findLayer(sc.center.z - sc.zSize / 2f)//Layer("${name}_bottom", center.z - zSize / 2.0); //Layer("${name}_bottom", center.z - zSize / 2.0);
private val centralLayer = findLayer(sc.center.z) private val centralLayer = findLayer(sc.center.z)
private val center = Vector3D(sc.center.x.toDouble(), sc.center.y.toDouble(), sc.center.z.toDouble()) private val center = Vector3D(sc.center.x.toDouble(), sc.center.y.toDouble(), sc.center.z.toDouble())
@ -67,7 +67,7 @@ internal class SC1Aux(val sc: SC1, var efficiency: Double = 1.0) {
UPPER_LAYER_Z -> 1 UPPER_LAYER_Z -> 1
CENTRAL_LAYER_Z -> 2; CENTRAL_LAYER_Z -> 2;
LOWER_LAYER_Z -> 3; LOWER_LAYER_Z -> 3;
else -> throw RuntimeException("Unknown layer"); else -> error("Unknown layer");
} }
} }

View File

@ -78,6 +78,6 @@ class Cos2TrackGenerator(
return makeTrack(x, y, thetaCandidate, phi) return makeTrack(x, y, thetaCandidate, phi)
} }
} }
throw RuntimeException("Failed to generate theta from distribution") error("Failed to generate theta from distribution")
} }
} }

View File

@ -0,0 +1,4 @@
# Module playground

View File

@ -0,0 +1,60 @@
public final class space/kscience/visionforge/examples/AllThingsDemoKt {
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
}
public final class space/kscience/visionforge/examples/GdmlCubesKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
}
public final class space/kscience/visionforge/examples/GdmlCurveKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
}
public final class space/kscience/visionforge/examples/GdmlIaxoKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
}
public final class space/kscience/visionforge/examples/GenerateSchemaKt {
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
}
public final class space/kscience/visionforge/examples/RandomSpheresKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
}
public final class space/kscience/visionforge/examples/RootParserKt {
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/TablesKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
}

View File

@ -1,14 +1,13 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("jupyter.api")
id("com.github.johnrengelman.shadow") version "7.1.2"
} }
repositories { repositories {
jcenter() mavenCentral()
maven("https://kotlin.bintray.com/kotlinx") maven("https://jitpack.io")
maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://repo.kotlin.link")
maven("https://dl.bintray.com/mipt-npm/dataforge")
maven("https://dl.bintray.com/mipt-npm/kscience")
maven("https://dl.bintray.com/mipt-npm/dev")
} }
kotlin { kotlin {
@ -20,7 +19,7 @@ kotlin {
this.outputFileName = "js/visionforge-playground.js" this.outputFileName = "js/visionforge-playground.js"
} }
commonWebpackConfig { commonWebpackConfig {
sourceMaps = false sourceMaps = true
cssSupport.enabled = false cssSupport.enabled = false
} }
} }
@ -28,48 +27,64 @@ kotlin {
} }
jvm { jvm {
withJava()
compilations.all { compilations.all {
kotlinOptions.jvmTarget = "11" kotlinOptions {
jvmTarget = "11"
freeCompilerArgs =
freeCompilerArgs + "-Xjvm-default=all" + "-Xopt-in=kotlin.RequiresOptIn" + "-Xlambdas=indy"
}
} }
testRuns["test"].executionTask.configure { testRuns["test"].executionTask.configure {
useJUnitPlatform() useJUnitPlatform()
} }
} }
afterEvaluate {
val jsBrowserDistribution by tasks.getting
tasks.getByName<ProcessResources>("jvmProcessResources") {
dependsOn(jsBrowserDistribution)
afterEvaluate {
from(jsBrowserDistribution)
}
}
}
sourceSets { sourceSets {
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api(project(":visionforge-solid")) implementation(projects.visionforgeSolid)
api(project(":visionforge-gdml")) implementation(projects.visionforgeGdml)
api(project(":visionforge-plotly")) implementation(projects.visionforgePlotly)
implementation(projects.visionforgeMarkdown)
implementation(projects.visionforgeTables)
implementation(projects.cernRootLoader)
implementation(projects.jupyter)
} }
} }
val jsMain by getting { val jsMain by getting {
dependencies { dependencies {
implementation(project(":ui:ring")) implementation(projects.ui.ring)
api(project(":visionforge-threejs")) implementation(projects.visionforgeThreejs)
compileOnly(npm("webpack-bundle-analyzer","4.5.0"))
} }
} }
val jvmMain by getting { val jvmMain by getting {
dependencies { dependencies {
api(project(":visionforge-server")) implementation(projects.visionforgeServer)
api("ch.qos.logback:logback-classic:1.2.3") implementation("ch.qos.logback:logback-classic:1.2.3")
implementation("com.github.Ricky12Awesome:json-schema-serialization:0.6.6") implementation("com.github.Ricky12Awesome:json-schema-serialization:0.6.6")
} }
} }
all {
languageSettings.optIn("space.kscience.dataforge.misc.DFExperimental")
} }
} }
}
val jsBrowserDistribution = tasks.getByName("jsBrowserDistribution")
tasks.getByName<ProcessResources>("jvmProcessResources") {
dependsOn(jsBrowserDistribution)
from(jsBrowserDistribution) {
exclude("**/*.js.map")
}
}
val processJupyterApiResources by tasks.getting(org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask::class) {
libraryProducers = listOf("space.kscience.visionforge.examples.VisionForgePlayGroundForJupyter")
}
tasks.findByName("shadowJar")?.dependsOn(processJupyterApiResources)

View File

@ -1,10 +1,14 @@
import space.kscience.dataforge.misc.DFExperimental import space.kscience.dataforge.misc.DFExperimental
import space.kscience.visionforge.markup.MarkupPlugin
import space.kscience.visionforge.plotly.PlotlyPlugin import space.kscience.visionforge.plotly.PlotlyPlugin
import space.kscience.visionforge.ring.ThreeWithControlsPlugin import space.kscience.visionforge.ring.ThreeWithControlsPlugin
import space.kscience.visionforge.runVisionClient import space.kscience.visionforge.runVisionClient
import space.kscience.visionforge.tables.TableVisionJsPlugin
@DFExperimental @DFExperimental
fun main() = runVisionClient { fun main() = runVisionClient {
plugin(PlotlyPlugin)
plugin(ThreeWithControlsPlugin) plugin(ThreeWithControlsPlugin)
plugin(PlotlyPlugin)
plugin(MarkupPlugin)
plugin(TableVisionJsPlugin)
} }

View File

@ -1,40 +0,0 @@
/* Remove default bullets */
ul, .tree {
list-style-type: none;
}
/* Style the caret/arrow */
.tree-caret {
cursor: pointer;
user-select: none; /* Prevent text selection */
}
/* Create the caret/arrow with a unicode, and style it */
.tree-caret::before {
content: "\25B6";
color: black;
display: inline-block;
margin-right: 6px;
}
/* Rotate the caret/arrow icon when clicked on (using JavaScript) */
.tree-caret-down::before {
transform: rotate(90deg);
}
ul, .tree {
list-style-type: none;
}
i, .tree-caret{
display: inline-block;
margin-right: 6px;
}
.rotate {
transform: rotate(90deg);
}
.tree-label-inactive {
color: gray;
}

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Playground</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="css/common.css">
<script type="text/javascript" src="playground.js"></script>
</head>
<body class="application">
<div class="container">
<h1>Playground</h1>
</div>
<div id="app"></div>
</body>
</html>

View File

@ -0,0 +1,50 @@
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() }
}
}
}
}

View File

@ -0,0 +1,174 @@
package space.kscience.visionforge.examples
import kotlinx.html.h2
import space.kscience.dataforge.values.ValueType
import space.kscience.plotly.layout
import space.kscience.plotly.models.ScatterMode
import space.kscience.plotly.models.TextPosition
import space.kscience.plotly.scatter
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.box
import space.kscience.visionforge.solid.solid
import space.kscience.visionforge.solid.z
import space.kscience.visionforge.tables.columnTable
import java.nio.file.Paths
fun main() = makeVisionFile(
Paths.get("VisionForgeDemo.html"),
resourceLocation = ResourceLocation.EMBED
) {
markdown {
//language=markdown
"""
# VisionForge
This is a demo for current VisionForge features. This text is written in [MarkDown](https://github.com/JetBrains/markdown)
""".trimIndent()
}
h2 { +"3D visualization with Three-js" }
vision("3D") {
solid {
box(100, 100, 100, name = "aBox"){
z = 50.0
}
}
}
h2 { +"Interactive plots with Plotly" }
vision("plot") {
plotly {
scatter {
x(1, 2, 3, 4)
y(10, 15, 13, 17)
mode = ScatterMode.markers
name = "Team A"
text("A-1", "A-2", "A-3", "A-4", "A-5")
textposition = TextPosition.`top center`
textfont {
family = "Raleway, sans-serif"
}
marker { size = 12 }
}
scatter {
x(2, 3, 4, 5)
y(10, 15, 13, 17)
mode = ScatterMode.lines
name = "Team B"
text("B-a", "B-b", "B-c", "B-d", "B-e")
textposition = TextPosition.`bottom center`
textfont {
family = "Times New Roman"
}
marker { size = 12 }
}
layout {
title = "Data Labels Hover"
xaxis {
range(0.75..5.25)
}
legend {
y = 0.5
font {
family = "Arial, sans-serif"
size = 20
color("grey")
}
}
}
}
}
h2 { +"Interactive tables with Tabulator" }
vision("table") {
val x by ColumnHeader.value(ValueType.NUMBER)
val y by ColumnHeader.value(ValueType.NUMBER)
columnTable(
x to listOf(2, 3, 4, 5),
y to listOf(10, 15, 13, 17)
)
}
markdown {
//language=markdown
"""
## The code for everything above
```kotlin
markdown {
//language=markdown
""${'"'}
# VisionForge
This is a demo for current VisionForge features. This text is written in [MarkDown](https://github.com/JetBrains/markdown)
""${'"'}.trimIndent()
}
h2 { +"3D visualization with Three-js" }
vision("3D") {
solid {
box(100, 100, 100, name = "aBox")
}
}
h2 { +"Interactive plots with Plotly" }
vision("plot") {
plotly {
scatter {
x(1, 2, 3, 4)
y(10, 15, 13, 17)
mode = ScatterMode.markers
name = "Team A"
text("A-1", "A-2", "A-3", "A-4", "A-5")
textposition = TextPosition.`top center`
textfont {
family = "Raleway, sans-serif"
}
marker { size = 12 }
}
scatter {
x(2, 3, 4, 5)
y(10, 15, 13, 17)
mode = ScatterMode.lines
name = "Team B"
text("B-a", "B-b", "B-c", "B-d", "B-e")
textposition = TextPosition.`bottom center`
textfont {
family = "Times New Roman"
}
marker { size = 12 }
}
layout {
title = "Data Labels Hover"
xaxis {
range(0.75..5.25)
}
legend {
y = 0.5
font {
family = "Arial, sans-serif"
size = 20
color("grey")
}
}
}
}
}
h2 { +"Interactive tables with Tabulator" }
vision("table") {
val x by ColumnHeader.value(ValueType.NUMBER)
val y by ColumnHeader.value(ValueType.NUMBER)
columnTable(
x to listOf(2, 3, 4, 5),
y to listOf(10, 15, 13, 17)
)
}
```
""".trimIndent()
}
}

View File

@ -0,0 +1,65 @@
package space.kscience.visionforge.examples
import kotlinx.html.*
import space.kscience.dataforge.context.Global
import space.kscience.dataforge.context.fetch
import space.kscience.visionforge.VisionManager
import space.kscience.visionforge.html.Page
import space.kscience.visionforge.html.formFragment
import space.kscience.visionforge.onPropertyChange
import space.kscience.visionforge.server.close
import space.kscience.visionforge.server.openInBrowser
import space.kscience.visionforge.server.serve
fun main() {
val visionManager = Global.fetch(VisionManager)
val server = visionManager.serve {
page(header = Page.scriptHeader("js/visionforge-playground.js")) {
val form = formFragment("form") {
label {
htmlFor = "fname"
+"First name:"
}
br()
input {
type = InputType.text
id = "fname"
name = "fname"
value = "John"
}
br()
label {
htmlFor = "lname"
+"Last name:"
}
br()
input {
type = InputType.text
id = "lname"
name = "lname"
value = "Doe"
}
br()
br()
input {
type = InputType.submit
value = "Submit"
}
}
vision("form") { form }
form.onPropertyChange {
println(this)
}
}
}
server.openInBrowser()
while (readln() != "exit") {
}
server.close()
}

View File

@ -1,19 +1,13 @@
package space.kscience.visionforge.examples package space.kscience.visionforge.examples
import space.kscience.dataforge.context.Context
import space.kscience.gdml.GdmlShowCase import space.kscience.gdml.GdmlShowCase
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.gdml.toVision
import space.kscience.visionforge.html.ResourceLocation import space.kscience.visionforge.html.ResourceLocation
import space.kscience.visionforge.solid.Solids import space.kscience.visionforge.solid.Solids
fun main() { fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM){
val context = Context {
plugin(Solids)
}
context.makeVisionFile(resourceLocation = ResourceLocation.SYSTEM){
vision("canvas") { vision("canvas") {
requirePlugin(Solids)
GdmlShowCase.cubes().toVision() GdmlShowCase.cubes().toVision()
} }
} }
}

View File

@ -1,6 +1,7 @@
@file:Suppress("UNUSED_VARIABLE")
package space.kscience.visionforge.examples package space.kscience.visionforge.examples
import space.kscience.dataforge.context.Context
import space.kscience.gdml.* import space.kscience.gdml.*
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.gdml.toVision
import space.kscience.visionforge.html.ResourceLocation import space.kscience.visionforge.html.ResourceLocation
@ -10,13 +11,9 @@ import space.kscience.visionforge.solid.invoke
import space.kscience.visionforge.visible import space.kscience.visionforge.visible
import java.nio.file.Path import java.nio.file.Path
fun main() { fun main() = makeVisionFile(Path.of("curves.html"), resourceLocation = ResourceLocation.EMBED) {
val context = Context {
plugin(Solids)
}
context.makeVisionFile(Path.of("curves.html"), resourceLocation = ResourceLocation.EMBED) {
vision("canvas") { vision("canvas") {
requirePlugin(Solids)
Gdml { Gdml {
// geometry variables // geometry variables
val worldSize = 500 val worldSize = 500
@ -226,7 +223,7 @@ fun main() {
} }
} }
}.toVision { }.toVision {
configure { parent, solid, material -> configure { _, solid, _ ->
//disable visibility for the world box //disable visibility for the world box
if(solid.name == "world"){ if(solid.name == "world"){
visible = false visible = false
@ -241,4 +238,3 @@ fun main() {
} }
} }
} }
}

View File

@ -1,16 +1,12 @@
package space.kscience.visionforge.examples package space.kscience.visionforge.examples
import space.kscience.dataforge.context.Context
import space.kscience.gdml.GdmlShowCase import space.kscience.gdml.GdmlShowCase
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.gdml.toVision
import space.kscience.visionforge.solid.Solids import space.kscience.visionforge.solid.Solids
fun main() { fun main() = makeVisionFile {
val context = Context { vision("canvas") {
plugin(Solids) requirePlugin(Solids)
} GdmlShowCase.babyIaxo().toVision()
context.makeVisionFile {
vision("canvas") { GdmlShowCase.babyIaxo().toVision() }
} }
} }

View File

@ -6,9 +6,7 @@ import kotlinx.serialization.json.Json
import space.kscience.visionforge.solid.SolidGroup import space.kscience.visionforge.solid.SolidGroup
import space.kscience.visionforge.solid.Solids import space.kscience.visionforge.solid.Solids
@ExperimentalSerializationApi private val json = Json {
fun main() {
val schema = Json {
serializersModule = Solids.serializersModuleForSolids serializersModule = Solids.serializersModuleForSolids
prettyPrintIndent = " " prettyPrintIndent = " "
prettyPrint = true prettyPrint = true
@ -16,6 +14,10 @@ fun main() {
isLenient = true isLenient = true
coerceInputValues = true coerceInputValues = true
encodeDefaults = true encodeDefaults = true
}.encodeToSchema(SolidGroup.serializer(), generateDefinitions = false) }
@ExperimentalSerializationApi
fun main() {
val schema = json.encodeToSchema(SolidGroup.serializer(), generateDefinitions = false)
println(schema) println(schema)
} }

View File

@ -1,16 +1,10 @@
package space.kscience.visionforge.examples package space.kscience.visionforge.examples
import space.kscience.dataforge.context.Context
import space.kscience.plotly.scatter import space.kscience.plotly.scatter
import space.kscience.visionforge.html.ResourceLocation import space.kscience.visionforge.html.ResourceLocation
import space.kscience.visionforge.plotly.PlotlyPlugin
import space.kscience.visionforge.plotly.plotly import space.kscience.visionforge.plotly.plotly
fun main() { fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
val context = Context {
plugin(PlotlyPlugin)
}
context.makeVisionFile(resourceLocation = ResourceLocation.SYSTEM){
vision { vision {
plotly { plotly {
scatter { scatter {
@ -20,4 +14,3 @@ fun main() {
} }
} }
} }
}

View File

@ -2,22 +2,16 @@ package space.kscience.visionforge.examples
import kotlinx.html.div import kotlinx.html.div
import kotlinx.html.h1 import kotlinx.html.h1
import space.kscience.dataforge.context.Context
import space.kscience.visionforge.html.ResourceLocation import space.kscience.visionforge.html.ResourceLocation
import space.kscience.visionforge.solid.* import space.kscience.visionforge.solid.*
import java.nio.file.Paths import java.nio.file.Paths
import kotlin.random.Random import kotlin.random.Random
fun main() { private val random = Random(112233)
val context = Context {
plugin(Solids)
}
val random = Random(112233) fun main() = makeVisionFile(
context.makeVisionFile(
Paths.get("randomSpheres.html"), Paths.get("randomSpheres.html"),
resourceLocation = ResourceLocation.EMBED resourceLocation = ResourceLocation.SYSTEM
) { ) {
h1 { +"Happy new year!" } h1 { +"Happy new year!" }
div { div {
@ -38,4 +32,3 @@ fun main() {
} }
} }
} }
}

View File

@ -0,0 +1,106 @@
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)
}
}*//*
}*/

View File

@ -1,32 +1,26 @@
package space.kscience.visionforge.examples package space.kscience.visionforge.examples
import space.kscience.dataforge.context.Context import space.kscience.dataforge.context.Global
import space.kscience.dataforge.misc.DFExperimental import space.kscience.visionforge.html.HtmlVisionFragment
import space.kscience.visionforge.html.Page
import space.kscience.visionforge.html.ResourceLocation import space.kscience.visionforge.html.ResourceLocation
import space.kscience.visionforge.html.VisionTagConsumer import space.kscience.visionforge.html.importScriptHeader
import space.kscience.visionforge.html.page
import space.kscience.visionforge.html.scriptHeader
import space.kscience.visionforge.makeFile import space.kscience.visionforge.makeFile
import space.kscience.visionforge.three.server.VisionServer
import space.kscience.visionforge.three.server.useScript
import java.awt.Desktop import java.awt.Desktop
import java.nio.file.Path import java.nio.file.Path
public fun makeVisionFile(
public fun VisionServer.usePlayground(): Unit {
useScript("js/visionforge-playground.js")
}
@OptIn(DFExperimental::class)
public fun Context.makeVisionFile(
path: Path? = null, path: Path? = null,
title: String = "VisionForge page", title: String = "VisionForge page",
resourceLocation: ResourceLocation = ResourceLocation.SYSTEM, resourceLocation: ResourceLocation = ResourceLocation.SYSTEM,
show: Boolean = true, show: Boolean = true,
content: VisionTagConsumer<*>.() -> Unit content: HtmlVisionFragment,
): Unit { ): Unit {
val actualPath = page(title, content = content).makeFile(path) { actualPath -> val actualPath = Page(Global, content = content).makeFile(path) { actualPath ->
mapOf("threeJs" to scriptHeader("js/visionforge-playground.js", resourceLocation, actualPath)) mapOf(
"title" to Page.title(title),
"playground" to Page.importScriptHeader("js/visionforge-playground.js", resourceLocation, actualPath),
)
} }
if (show) Desktop.getDesktop().browse(actualPath.toFile().toURI()) if (show) Desktop.getDesktop().browse(actualPath.toFile().toURI())
} }

View File

@ -1,20 +1,17 @@
package space.kscience.visionforge.examples package space.kscience.visionforge.examples
import space.kscience.dataforge.context.Context
import space.kscience.visionforge.html.ResourceLocation import space.kscience.visionforge.html.ResourceLocation
import space.kscience.visionforge.solid.Solids
import space.kscience.visionforge.solid.box 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.solid.solid
fun main() { fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
val context = Context {
plugin(Solids)
}
context.makeVisionFile(resourceLocation = ResourceLocation.SYSTEM){
vision("canvas") { vision("canvas") {
solid { solid {
box(100, 100, 100) box(100, 100, 100)
material {
emissiveColor("red")
} }
} }
} }

View File

@ -0,0 +1,23 @@
package space.kscience.visionforge.examples
import space.kscience.dataforge.values.ValueType
import space.kscience.tables.ColumnHeader
import space.kscience.tables.valueRow
import space.kscience.visionforge.html.ResourceLocation
import space.kscience.visionforge.tables.table
import kotlin.math.pow
fun main() {
val x by ColumnHeader.value(ValueType.NUMBER)
val y by ColumnHeader.value(ValueType.NUMBER)
makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
vision {
table(x, y) {
repeat(100) {
valueRow(x to it, y to it.toDouble().pow(2))
}
}
}
}
}

View File

@ -1,3 +1,23 @@
const ringConfig = require('@jetbrains/ring-ui/webpack.config').config; const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
const path = require('path');
config.module.rules.push(...ringConfig.module.rules) 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: {}
}
]
}
)

View File

@ -0,0 +1,10 @@
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: "static",
reportFilename: "bundle-report.html"
})
]
}

4
demo/plotly-fx/README.md Normal file
View File

@ -0,0 +1,4 @@
# Module plotly-fx

4
demo/sat-demo/README.md Normal file
View File

@ -0,0 +1,4 @@
# Module sat-demo

View File

@ -0,0 +1,5 @@
public final class ru/mipt/npm/sat/SatServerKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
}

View File

@ -1,13 +1,11 @@
package ru.mipt.npm.sat package ru.mipt.npm.sat
import space.kscience.dataforge.meta.set import space.kscience.dataforge.meta.set
import space.kscience.dataforge.misc.DFExperimental
import space.kscience.visionforge.solid.* import space.kscience.visionforge.solid.*
import space.kscience.visionforge.style import space.kscience.visionforge.style
import space.kscience.visionforge.useStyle import space.kscience.visionforge.useStyle
import kotlin.math.PI import kotlin.math.PI
@DFExperimental
internal fun visionOfSatellite( internal fun visionOfSatellite(
layers: Int = 10, layers: Int = 10,
layerHeight: Number = 10, layerHeight: Number = 10,
@ -17,6 +15,7 @@ internal fun visionOfSatellite(
ySegmentSize: Number = xSegmentSize, ySegmentSize: Number = xSegmentSize,
fiberDiameter: Number = 1.0, fiberDiameter: Number = 1.0,
): SolidGroup = SolidGroup { ): SolidGroup = SolidGroup {
color("darkgreen")
val transparent by style { val transparent by style {
this[SolidMaterial.MATERIAL_OPACITY_KEY] = 0.3 this[SolidMaterial.MATERIAL_OPACITY_KEY] = 0.3
} }

View File

@ -1,21 +1,24 @@
package ru.mipt.npm.sat package ru.mipt.npm.sat
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.html.div import kotlinx.html.div
import kotlinx.html.h1 import kotlinx.html.h1
import space.kscience.dataforge.context.Global import space.kscience.dataforge.context.Context
import space.kscience.dataforge.names.toName 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.solid.*
import space.kscience.visionforge.three.server.* import space.kscience.visionforge.three.threeJsHeader
import space.kscience.visionforge.visionManager import space.kscience.visionforge.visionManager
import kotlin.random.Random import kotlin.random.Random
fun main() { fun main() {
val satContext = Global.buildContext ("sat") { val satContext = Context("sat") {
plugin(Solids) plugin(Solids)
} }
@ -23,26 +26,23 @@ fun main() {
val sat = visionOfSatellite(ySegments = 3) val sat = visionOfSatellite(ySegments = 3)
val server = satContext.visionManager.serve { val server = satContext.visionManager.serve {
//use client library page(header = Page.threeJsHeader + Page.styleSheetHeader("css/styles.css")) {
useThreeJs()
//use css
useCss("css/styles.css")
page {
div("flex-column") { div("flex-column") {
h1 { +"Satellite detector demo" } h1 { +"Satellite detector demo" }
vision(sat) vision { sat }
} }
} }
} }
server.show() server.openInBrowser()
@OptIn(DelicateCoroutinesApi::class)
GlobalScope.launch { GlobalScope.launch {
while (isActive) { while (isActive) {
val randomLayer = Random.nextInt(1, 11) val randomLayer = Random.nextInt(1, 11)
val randomI = Random.nextInt(1, 4) val randomI = Random.nextInt(1, 4)
val randomJ = Random.nextInt(1, 4) val randomJ = Random.nextInt(1, 4)
val target = "layer[$randomLayer].segment[$randomI,$randomJ]".toName() val target = Name.parse("layer[$randomLayer].segment[$randomI,$randomJ]")
val targetVision = sat[target] as Solid val targetVision = sat[target] as Solid
targetVision.color("red") targetVision.color("red")
delay(1000) delay(1000)

View File

@ -1,19 +1,4 @@
### Spatial Showcase # Module solid-showcase
Contains a simple demonstration with a grid including a few shapes that you can rotate, move camera, and so on.
Some shapes will also periodically change their color and visibility.
##### Building project
To see the JS demo: run `demo/solid-showcase/Tasks/kotlin browser/jsBrowserRun` Gradle task, then open
`build/distribuions/solid-showcase-js-0.1.3-dev/index.html` file in your browser.
To see Java FX demo, run `demo/spatial-showcase/Tasks/application/run` Gradle task, or `main()` from `FXDemoApp.kt`.
##### Example view for JS:
![](../../docs/images/spatial-showcase.png)
##### Example view for Java FX:
![](../../docs/images/spatial-showcase-FX.png)

View File

@ -0,0 +1,48 @@
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
public static final fun getCanvasOptions ()Lspace/kscience/visionforge/solid/specifications/Canvas3DOptions;
public static final fun showcase (Lspace/kscience/visionforge/solid/demo/VisionLayout;)V
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 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
}

View File

@ -1,7 +1,8 @@
package space.kscience.visionforge package space.kscience.visionforge.solid.demo
import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
import space.kscience.visionforge.Vision
public interface VisionLayout<in V: Vision> { public interface VisionLayout<in V: Vision> {
public fun render(name: Name, vision: V, meta: Meta = Meta.EMPTY) public fun render(name: Name, vision: V, meta: Meta = Meta.EMPTY)

View File

@ -1,14 +1,10 @@
package space.kscience.visionforge.solid.demo package space.kscience.visionforge.solid.demo
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.invoke import space.kscience.dataforge.meta.invoke
import space.kscience.dataforge.names.toName import space.kscience.dataforge.names.Name
import space.kscience.visionforge.Colors import space.kscience.visionforge.Colors
import space.kscience.visionforge.VisionLayout
import space.kscience.visionforge.solid.* import space.kscience.visionforge.solid.*
import space.kscience.visionforge.solid.specifications.Canvas3DOptions import space.kscience.visionforge.solid.specifications.Canvas3DOptions
import space.kscience.visionforge.visible import space.kscience.visionforge.visible
@ -23,7 +19,7 @@ fun VisionLayout<Solid>.demo(name: String, title: String = name, block: SolidGro
"title" put title "title" put title
} }
val vision = SolidGroup(block) val vision = SolidGroup(block)
render(name.toName(), vision) render(Name.parse(name), vision, meta)
} }
val canvasOptions = Canvas3DOptions { val canvasOptions = Canvas3DOptions {
@ -40,6 +36,7 @@ val canvasOptions = Canvas3DOptions {
} }
} }
@OptIn(DelicateCoroutinesApi::class)
fun VisionLayout<Solid>.showcase() { fun VisionLayout<Solid>.showcase() {
demo("shapes", "Basic shapes") { demo("shapes", "Basic shapes") {
box(100.0, 100.0, 100.0) { box(100.0, 100.0, 100.0) {
@ -77,7 +74,7 @@ fun VisionLayout<Solid>.showcase() {
//override color for this cube //override color for this cube
color(1530) color(1530)
launch(Dispatchers.Main) { GlobalScope.launch(Dispatchers.Main) {
while (isActive) { while (isActive) {
delay(500) delay(500)
visible = !(visible ?: false) visible = !(visible ?: false)
@ -86,7 +83,7 @@ fun VisionLayout<Solid>.showcase() {
} }
} }
launch(Dispatchers.Main) { GlobalScope.launch(Dispatchers.Main) {
val random = Random(111) val random = Random(111)
while (isActive) { while (isActive) {
delay(1000) delay(1000)
@ -108,7 +105,7 @@ fun VisionLayout<Solid>.showcase() {
} }
demo("extrude", "extruded shape") { demo("extrude", "extruded shape") {
extrude { extruded {
shape { shape {
polygon(8, 50) polygon(8, 50)
} }

View File

@ -1,7 +1,6 @@
package space.kscience.visionforge.solid.demo package space.kscience.visionforge.solid.demo
import kotlinx.browser.document import kotlinx.browser.document
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -30,7 +29,8 @@ private class ThreeDemoApp : Application {
} }
} }
} }
GlobalScope.launch {
launch {
while (isActive) { while (isActive) {
delay(500) delay(500)
boxes.forEach { box -> boxes.forEach { box ->

View File

@ -15,7 +15,6 @@ import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.get import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.string import space.kscience.dataforge.meta.string
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
import space.kscience.visionforge.VisionLayout
import space.kscience.visionforge.solid.Solid import space.kscience.visionforge.solid.Solid
import space.kscience.visionforge.solid.three.ThreeCanvas import space.kscience.visionforge.solid.three.ThreeCanvas
import space.kscience.visionforge.solid.three.ThreePlugin import space.kscience.visionforge.solid.three.ThreePlugin

View File

@ -3,6 +3,7 @@ package space.kscience.visionforge.solid.demo
import info.laht.threekt.core.Object3D import info.laht.threekt.core.Object3D
import info.laht.threekt.geometries.BoxGeometry import info.laht.threekt.geometries.BoxGeometry
import info.laht.threekt.objects.Mesh import info.laht.threekt.objects.Mesh
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.int import space.kscience.dataforge.meta.int
import space.kscience.dataforge.meta.number import space.kscience.dataforge.meta.number
import space.kscience.dataforge.names.asName import space.kscience.dataforge.names.asName
@ -43,13 +44,13 @@ internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision
it.layers.enable(this@VariableBox.layer) it.layers.enable(this@VariableBox.layer)
} }
} }
mesh.scale.z = getOwnProperty(VALUE).number?.toDouble() ?: 1.0 mesh.scale.z = meta[VALUE].number?.toDouble() ?: 1.0
//add listener to object properties //add listener to object properties
onPropertyChange(three.context) { name -> onPropertyChange { name ->
when { when {
name == VALUE -> { name == VALUE -> {
val value = getOwnProperty(VALUE).int ?: 0 val value = meta.get(VALUE).int ?: 0
val size = value.toFloat() / 255f * 20f val size = value.toFloat() / 255f * 20f
mesh.scale.z = size.toDouble() mesh.scale.z = size.toDouble()
mesh.position.z = size.toDouble() / 2 mesh.position.z = size.toDouble() / 2
@ -69,7 +70,7 @@ internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision
} }
var value: Int var value: Int
get() = getOwnProperty(VALUE).int ?: 0 get() = meta[VALUE].int ?: 0
set(value) { set(value) {
setProperty(VALUE, value.asValue()) setProperty(VALUE, value.asValue())
} }

View File

@ -14,7 +14,7 @@ class FXDemoApp : App(FXDemoGrid::class) {
stage.height = 600.0 stage.height = 600.0
view.showcase() view.showcase()
view.showcaseCSG() //view.showcaseCSG()
} }
} }

View File

@ -7,7 +7,6 @@ import space.kscience.dataforge.context.Global
import space.kscience.dataforge.context.fetch import space.kscience.dataforge.context.fetch
import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
import space.kscience.visionforge.VisionLayout
import space.kscience.visionforge.solid.FX3DPlugin import space.kscience.visionforge.solid.FX3DPlugin
import space.kscience.visionforge.solid.FXCanvas3D import space.kscience.visionforge.solid.FXCanvas3D
import space.kscience.visionforge.solid.Solid import space.kscience.visionforge.solid.Solid

View File

@ -1,13 +1,14 @@
package space.kscience.visionforge.demo package space.kscience.visionforge.demo
import javafx.geometry.Orientation import javafx.geometry.Orientation
import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.meta.MutableMeta
import space.kscience.dataforge.meta.asConfig import space.kscience.dataforge.meta.descriptors.MetaDescriptor
import space.kscience.dataforge.meta.descriptors.NodeDescriptor import space.kscience.dataforge.meta.descriptors.node
import space.kscience.dataforge.meta.descriptors.value
import space.kscience.dataforge.values.ValueType import space.kscience.dataforge.values.ValueType
import space.kscience.visionforge.editor.ConfigEditor import space.kscience.visionforge.editor.FXMetaModel
import space.kscience.visionforge.editor.FXMeta
import space.kscience.visionforge.editor.MetaViewer import space.kscience.visionforge.editor.MetaViewer
import space.kscience.visionforge.editor.MutableMetaEditor
import tornadofx.* import tornadofx.*
@ -15,7 +16,7 @@ class MetaEditorDemoApp : App(MetaEditorDemo::class)
class MetaEditorDemo : View("Meta editor demo") { class MetaEditorDemo : View("Meta editor demo") {
val meta = Meta { val meta = MutableMeta {
"aNode" put { "aNode" put {
"innerNode" put { "innerNode" put {
"innerValue" put true "innerValue" put true
@ -23,18 +24,16 @@ class MetaEditorDemo : View("Meta editor demo") {
"b" put 223 "b" put 223
"c" put "StringValue" "c" put "StringValue"
} }
}.asConfig() }
val descriptor = NodeDescriptor { val descriptor = MetaDescriptor {
node("aNode") { node("aNode") {
info = "A root demo node" info = "A root demo node"
value("b") { value("b", ValueType.NUMBER) {
info = "b number value" info = "b number value"
type(ValueType.NUMBER)
} }
node("otherNode") { node("otherNode") {
value("otherValue") { value("otherValue", ValueType.BOOLEAN) {
type(ValueType.BOOLEAN)
default(false) default(false)
info = "default value" info = "default value"
} }
@ -46,12 +45,13 @@ class MetaEditorDemo : View("Meta editor demo") {
} }
} }
private val rootNode = FXMeta.root(meta, descriptor) private val rootNode:FXMetaModel<MutableMeta> = FXMetaModel.root(meta, descriptor)
override val root = override val root = splitpane(
splitpane(Orientation.HORIZONTAL, MetaViewer(rootNode).root, ConfigEditor( Orientation.HORIZONTAL,
rootNode MetaViewer(rootNode).root,
).root) MutableMetaEditor(rootNode).root
)
} }
fun main() { fun main() {

View File

@ -1,5 +1,5 @@
## Library design ## Library design
The central point of the library design is the `Vision` interface. The `Vision` stores an optional reference to its parent and is able to store a number of mutable or read-only properties. Each property is represented by its `Name`, and a `MetaItem` value-tree, both following DataForge library specification (discussed in the [Appendix](appendix.md)). The `Vision` objects are organized in a tree using `VisionGroup` as nodes. `VisionGroup` additionally to all `Vision` properties holds a `children` container that holds named references to its direct children `Vision`s. Thus, `Vision`s form a doubly linked tree (a parent stores references to all its children and children store a reference to the parent). The central point of the library design is the `Vision` interface. The `Vision` stores an optional reference to its parent and is able to store a number of mutable or read-only properties. Each property is represented by its `Name`, and a `Meta` value-tree, both following DataForge library specification (discussed in the [Appendix](appendix.md)). The `Vision` objects are organized in a tree using `VisionGroup` as nodes. `VisionGroup` additionally to all `Vision` properties holds a `children` container that holds named references to its direct children `Vision`s. Thus, `Vision`s form a doubly linked tree (a parent stores references to all its children and children store a reference to the parent).
An important concept using in the VisionForge is the property layering mechanism. It means that if the property with a given name is not found in the `Vision` it is requested from, it could be requested from the parent `Vision`, form the style declaration, the prototype for the vision or any other place defined by the component author. For example, let's take a `color` attribute used in 3D visualization. When one draws a group of objects, he usually wants to make the color of all objects in the group to be defined by a single handle in the group common ancestor. So when the parent color changes, all children color must follow suite, but we also want to change children color individually without changing the parent. In this case two property layers are defined: An important concept using in the VisionForge is the property layering mechanism. It means that if the property with a given name is not found in the `Vision` it is requested from, it could be requested from the parent `Vision`, form the style declaration, the prototype for the vision or any other place defined by the component author. For example, let's take a `color` attribute used in 3D visualization. When one draws a group of objects, he usually wants to make the color of all objects in the group to be defined by a single handle in the group common ancestor. So when the parent color changes, all children color must follow suite, but we also want to change children color individually without changing the parent. In this case two property layers are defined:

50
docs/hierarchy.md Normal file
View File

@ -0,0 +1,50 @@
# Hierarchy
![](../docs/images/hierarchy.png)
### Vision
* function `getPropertyValue(name: Name, inherit: Boolean = false, includeStyles: Boolean = true, includeDefaults: Boolean = true)` - get property value with given layer flags.
* function `setProperty(name: Name, item: Any?)` - a convenient method to set property node or value. If `item` is null, then node is removed, not a value
Sets the `item` property to the element with the `name` identification.
### VisionBase
Basic vision implementation
### VisionGroup
A group of Visions.
### MutableVisionGroup
Mutable version of VisionGroup.
low structure changes of this group. Unconsumed changes are discarded.
### Solid
Interface for 3-dimensional Vision.
### SolidGroup
3D Visual Group with a container for templates visible inside this group. It has an interface `PrototypeHolder` which stands for being a container with prototype support.
* function `getPrototype(name: Name)` - get a prototype redirecting the request to the parent if prototype is not found. If prototype is a ref, then it is unfolded automatically.
* function `prototypes(builder: VisionContainerBuilder<Solid>.() -> Unit)` - create or edit prototype node as a group.
### SolidReferenceGroup
A class with `SolidReference` interface with reference `Solid`s for template objects reuse.
### VisionGroupBase
Abstract implementation of mutable group of `Vision`.
### RootVisionGroup
Non-serializable root group used to propagate manager to its children.
### MutableVisionGroup
Just a mutable version of `VisionGroup`

BIN
docs/images/hierarchy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Some files were not shown because too many files have changed in this diff Show More