v0.5.0 #80
.gitignoreCHANGELOG.mdREADME.mdbuild.gradle.kts
cern-root-loader
demo
compose-desktop-demo/api
gdml/src
commonTest/kotlin/space/kscience/visionforge/gdml
jsMain/kotlin/space/kscience/visionforge/gdml/demo
js-playground
muon-monitor
api
build.gradle.ktssrc
commonMain/kotlin/ru/mipt/npm/muon/monitor
jsMain/kotlin/ru/mipt/npm/muon/monitor
jvmMain/kotlin/ru/mipt/npm/muon/monitor
playground
sat-demo
solid-showcase/src
commonMain/kotlin/space/kscience/visionforge/solid/demo
jsMain/kotlin/space/kscience/visionforge/solid/demo
docs/templates
gradle.propertiesgradle/wrapper
plotly-kt
CHANGELOG.mdREADME.mdbuild.gradle.kts
docs
examples
README.md
api
build.gradle.ktscompose-demo
fx-demo
js-demo
native-demo
notebooks
.ipynb_checkpoints
Issue-sim-checkpoint.ipynblatex-demo-checkpoint.ipynbplotly-experimental-checkpoint.jsonplotlykt-demo-checkpoint.ipynbplotlykt-demo-classic-checkpoint.ipynbplotlykt-demo-experimental-checkpoint.ipynbplotlykt-demo_1-checkpoint.ipynbplotlykt-server-demo-checkpoint.ipynb
Issue-sim.ipynblatex-demo.ipynbplotlykt-demo.ipynbplotlykt-server-demo.ipynbscripts
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,10 +3,9 @@
|
||||
*.iws
|
||||
out/
|
||||
.gradle
|
||||
.kotlin
|
||||
.kotlin/
|
||||
build/
|
||||
data/
|
||||
.kotlin/
|
||||
|
||||
jcef-bundle/
|
||||
|
||||
|
21
CHANGELOG.md
21
CHANGELOG.md
@ -14,6 +14,27 @@
|
||||
|
||||
### Security
|
||||
|
||||
## 0.5.0 - 2025-03-21
|
||||
|
||||
### Added
|
||||
|
||||
- Plotly refactored on top of visionforge/server. Now it is called `plotly-kt`. Version follows general VisionForge version.
|
||||
|
||||
### Changed
|
||||
|
||||
- Simplified Vision and VisionGroup logic. Observation logic moved out.
|
||||
- Use `Name` for child designation and `Path` for tree access
|
||||
- The default intensity for AmbientLight is 1.0. The intensity scale for Three-js is 3.0.
|
||||
|
||||
### Removed
|
||||
|
||||
- VisionChildren and VisionProperties
|
||||
|
||||
### Fixed
|
||||
|
||||
- Vision server now automatically switches to WSS protocol for updates if incoming protocol is HTTPS
|
||||
- Issue with track removal in muon monitor demo.
|
||||
|
||||
## 0.4.2 - 2024-06-06
|
||||
|
||||
### Added
|
||||
|
30
README.md
30
README.md
@ -70,7 +70,7 @@ To learn more about DataForge, please consult the following URLs:
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly](plotly)
|
||||
### [plotly-kt](plotly-kt)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
@ -99,10 +99,6 @@ To learn more about DataForge, please consult the following URLs:
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [visionforge-plotly](visionforge-plotly)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [visionforge-server](visionforge-server)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
@ -147,23 +143,15 @@ To learn more about DataForge, please consult the following URLs:
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly/examples](plotly/examples)
|
||||
### [plotly-kt/examples](plotly-kt/examples)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly/plotlykt-core](plotly/plotlykt-core)
|
||||
### [plotly-kt/plotly-kt-core](plotly-kt/plotly-kt-core)
|
||||
>
|
||||
> **Maturity**: DEVELOPMENT
|
||||
|
||||
### [plotly/plotlykt-jupyter](plotly/plotlykt-jupyter)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly/plotlykt-script](plotly/plotlykt-script)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly/plotlykt-server](plotly/plotlykt-server)
|
||||
### [plotly-kt/plotly-kt-server](plotly-kt/plotly-kt-server)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
@ -176,19 +164,15 @@ To learn more about DataForge, please consult the following URLs:
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly/examples/compose-demo](plotly/examples/compose-demo)
|
||||
### [plotly-kt/examples/compose-demo](plotly-kt/examples/compose-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly/examples/fx-demo](plotly/examples/fx-demo)
|
||||
### [plotly-kt/examples/js-demo](plotly-kt/examples/js-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly/examples/js-demo](plotly/examples/js-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
### [plotly/examples/native-demo](plotly/examples/native-demo)
|
||||
### [plotly-kt/examples/native-demo](plotly-kt/examples/native-demo)
|
||||
>
|
||||
> **Maturity**: EXPERIMENTAL
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import space.kscience.gradle.useApache2Licence
|
||||
import space.kscience.gradle.useSPCTeam
|
||||
|
||||
@ -6,11 +7,11 @@ plugins {
|
||||
alias(spclibs.plugins.kotlinx.kover)
|
||||
}
|
||||
|
||||
val dataforgeVersion by extra("0.9.0")
|
||||
val dataforgeVersion by extra("0.10.1")
|
||||
|
||||
allprojects {
|
||||
group = "space.kscience"
|
||||
version = "0.4.2"
|
||||
version = "0.5.0"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
@ -24,9 +25,9 @@ subprojects {
|
||||
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
tasks.withType<KotlinCompile> {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-Xcontext-receivers")
|
||||
freeCompilerArgs.addAll("-Xcontext-parameters")
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,13 +38,14 @@ subprojects {
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
ksciencePublish {
|
||||
pom("https://github.com/SciProgCentre/visionforge") {
|
||||
useApache2Licence()
|
||||
useSPCTeam()
|
||||
}
|
||||
repository("spc","https://maven.sciprog.center/kscience")
|
||||
sonatype()
|
||||
repository("spc", "https://maven.sciprog.center/kscience")
|
||||
central()
|
||||
}
|
||||
|
||||
apiValidation {
|
||||
|
@ -2,3 +2,20 @@
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
## Artifact:
|
||||
|
||||
The Maven coordinates of this project are `space.kscience:cern-root-loader:0.5.0`.
|
||||
|
||||
**Gradle Kotlin DSL:**
|
||||
```kotlin
|
||||
repositories {
|
||||
maven("https://repo.kotlin.link")
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("space.kscience:cern-root-loader:0.5.0")
|
||||
}
|
||||
```
|
||||
|
@ -5,7 +5,7 @@ public final class ru/mipt/npm/root/BMN {
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/BMNKt {
|
||||
public static final fun toVector (Lru/mipt/npm/root/FairTrackParam;)Lspace/kscience/visionforge/solid/Float32Vector3D;
|
||||
public static final fun toVector (Lru/mipt/npm/root/FairTrackParam;)Lspace/kscience/kmath/geometry/Vector3D;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/BmnEventContainer {
|
||||
@ -36,7 +36,6 @@ public synthetic class ru/mipt/npm/root/BmnGlobalTrack$$serializer : kotlinx/ser
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/BmnGlobalTrack;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/BmnGlobalTrack$Companion {
|
||||
@ -65,7 +64,6 @@ public synthetic class ru/mipt/npm/root/CbmStsTrack$$serializer : kotlinx/serial
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/CbmStsTrack;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/CbmStsTrack$Companion {
|
||||
@ -234,7 +232,6 @@ public synthetic class ru/mipt/npm/root/FairTrackParam$$serializer : kotlinx/ser
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/FairTrackParam;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/root/FairTrackParam$Companion {
|
||||
@ -274,7 +271,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoBBox$$serializer : kot
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -311,7 +307,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoCombiTrans$$serializer
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -332,7 +327,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoCompositeShape$$serial
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -355,7 +349,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoHMatrix$$serializer :
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -375,7 +368,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoIdentity$$serializer :
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -397,7 +389,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoIntersection$$serializ
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -421,7 +412,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoManager$$serializer :
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -443,7 +433,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoMaterial$$serializer :
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -476,7 +465,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoMedium$$serializer : k
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -496,7 +484,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoMixture$$serializer :
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -523,7 +510,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoNode$$serializer : kot
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -544,7 +530,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoNodeMatrix$$serializer
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -565,7 +550,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoNodeOffset$$serializer
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -593,7 +577,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoPcon$$serializer : kot
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -616,7 +599,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoPgon$$serializer : kot
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -637,7 +619,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoRotation$$serializer :
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -672,7 +653,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoShapeAssembly$$seriali
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -699,7 +679,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoSubtraction$$serialize
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -720,7 +699,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoTranslation$$serialize
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -745,7 +723,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoTube$$serializer : kot
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -774,7 +751,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoTubeSeg$$serializer :
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -796,7 +772,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoUnion$$serializer : ko
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -830,7 +805,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoVolume$$serializer : k
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -852,7 +826,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoVolumeAssembly$$serial
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -891,7 +864,6 @@ public synthetic class ru/mipt/npm/root/serialization/TGeoXtru$$serializer : kot
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -912,7 +884,6 @@ public synthetic class ru/mipt/npm/root/serialization/THashList$$serializer : ko
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -933,7 +904,6 @@ public synthetic class ru/mipt/npm/root/serialization/TList$$serializer : kotlin
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -957,7 +927,6 @@ public synthetic class ru/mipt/npm/root/serialization/TNamed$$serializer : kotli
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
|
@ -4,7 +4,7 @@ import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonArray
|
||||
import space.kscience.visionforge.solid.Float32Vector3D
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D
|
||||
|
||||
|
||||
@Serializable
|
||||
|
@ -2,14 +2,14 @@ package ru.mipt.npm.root
|
||||
|
||||
import space.kscience.dataforge.meta.*
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.parseAsName
|
||||
import space.kscience.dataforge.names.NameToken
|
||||
import space.kscience.dataforge.names.plus
|
||||
import space.kscience.dataforge.names.withIndex
|
||||
import space.kscience.kmath.complex.Quaternion
|
||||
import space.kscience.kmath.geometry.fromRotationMatrix
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D
|
||||
import space.kscience.kmath.geometry.euclidean3d.fromRotationMatrix
|
||||
import space.kscience.kmath.linear.VirtualMatrix
|
||||
import space.kscience.visionforge.MutableVisionContainer
|
||||
import space.kscience.visionforge.isEmpty
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.SolidMaterial.Companion.MATERIAL_COLOR_KEY
|
||||
import kotlin.math.PI
|
||||
@ -198,7 +198,7 @@ private fun SolidGroup.addShape(
|
||||
val startphi = degToRad(fPhi1)
|
||||
val deltaphi = degToRad(fDphi)
|
||||
|
||||
fun Shape2DBuilder.pGon(radius: Double){
|
||||
fun Shape2DBuilder.pGon(radius: Double) {
|
||||
(0..<fNedges).forEach {
|
||||
val phi = deltaphi / fNedges * it + startphi
|
||||
point(radius * cos(phi), radius * sin(phi))
|
||||
@ -208,7 +208,7 @@ private fun SolidGroup.addShape(
|
||||
surface(name) {
|
||||
//getting the radius of first
|
||||
require(fNz > 1) { "The polyhedron geometry requires at least two planes" }
|
||||
for (index in 0 until fNz){
|
||||
for (index in 0 until fNz) {
|
||||
layer(
|
||||
fZ[index],
|
||||
innerBuilder = {
|
||||
@ -265,7 +265,7 @@ private fun SolidGroup.addShape(
|
||||
val fShape by shape.dObject(::DGeoShape)
|
||||
val fScale by shape.dObject(::DGeoScale)
|
||||
fShape?.let { scaledShape ->
|
||||
solidGroup(name?.let { Name.parse(it) }) {
|
||||
solidGroup(name?.let { NameToken.parse(it) }) {
|
||||
scale = Float32Vector3D(fScale?.x ?: 1.0, fScale?.y ?: 1.0, fScale?.z ?: 1.0)
|
||||
addShape(scaledShape, context)
|
||||
apply(block)
|
||||
@ -360,10 +360,10 @@ private fun buildVolume(volume: DGeoVolume, context: RootToSolidContext): Solid?
|
||||
}
|
||||
}
|
||||
}
|
||||
return if (group.children.isEmpty()) {
|
||||
return if (group.visions.isEmpty()) {
|
||||
null
|
||||
} else if (group.items.size == 1 && group.properties.own.isEmpty()) {
|
||||
group.items.values.first().apply { parent = null }
|
||||
} else if (group.visions.size == 1 && group.properties.isEmpty()) {
|
||||
group.visions.values.first().apply { parent = null }
|
||||
} else {
|
||||
group
|
||||
}.apply {
|
||||
@ -388,25 +388,26 @@ private fun SolidGroup.addRootVolume(
|
||||
cache: Boolean = true,
|
||||
block: Solid.() -> Unit = {},
|
||||
) {
|
||||
val combinedName = name?.parseAsName()?.let {
|
||||
val combinedName: NameToken = name?.let {
|
||||
val token = NameToken.parse(it)
|
||||
// this fix is required to work around malformed root files with duplicated node names
|
||||
if (get(it) != null) {
|
||||
it.withIndex(volume.hashCode().toString(16))
|
||||
token.withIndex(volume.hashCode().toString(16))
|
||||
} else {
|
||||
it
|
||||
token
|
||||
}
|
||||
}
|
||||
} ?: NameToken("volume[${volume.hashCode().toString(16)}]")
|
||||
|
||||
if (!cache) {
|
||||
val group = buildVolume(volume, context)?.apply(block) ?: return
|
||||
setChild(combinedName, group)
|
||||
set(combinedName, group)
|
||||
} else {
|
||||
val templateName = volumesName + volume.name
|
||||
val existing = context.prototypeHolder.getPrototype(templateName)
|
||||
if (existing == null) {
|
||||
context.prototypeHolder.prototypes {
|
||||
val group = buildVolume(volume, context) ?: return@prototypes
|
||||
setChild(templateName, group)
|
||||
set(templateName, group)
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +420,7 @@ public fun MutableVisionContainer<Solid>.rootGeo(
|
||||
name: String? = null,
|
||||
maxLayer: Int = 5,
|
||||
ignoreRootColors: Boolean = false,
|
||||
): SolidGroup = solidGroup(name = name?.parseAsName()) {
|
||||
): SolidGroup = solidGroup(token = name?.let { NameToken.parse(it) }) {
|
||||
val context = RootToSolidContext(this, maxLayer = maxLayer, ignoreRootColors = ignoreRootColors)
|
||||
dGeoManager.fNodes.forEach { node ->
|
||||
addRootNode(node, context)
|
||||
|
@ -3,6 +3,7 @@ package ru.mipt.npm.root.serialization
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.dataforge.names.plus
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D
|
||||
import space.kscience.visionforge.MutableVisionContainer
|
||||
import space.kscience.visionforge.solid.*
|
||||
import kotlin.math.PI
|
||||
|
@ -1,12 +1,9 @@
|
||||
public final class ComposableSingletons$MainKt {
|
||||
public static final field INSTANCE LComposableSingletons$MainKt;
|
||||
public static field lambda-1 Lkotlin/jvm/functions/Function2;
|
||||
public static field lambda-2 Lkotlin/jvm/functions/Function3;
|
||||
public static field lambda-3 Lkotlin/jvm/functions/Function3;
|
||||
public fun <init> ()V
|
||||
public final fun getLambda-1$compose_desktop_demo ()Lkotlin/jvm/functions/Function2;
|
||||
public final fun getLambda-2$compose_desktop_demo ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getLambda-3$compose_desktop_demo ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getLambda$-1618970650$compose_desktop_demo ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getLambda$272118144$compose_desktop_demo ()Lkotlin/jvm/functions/Function2;
|
||||
public final fun getLambda$436015572$compose_desktop_demo ()Lkotlin/jvm/functions/Function3;
|
||||
}
|
||||
|
||||
public final class MainKt {
|
||||
|
@ -5,9 +5,8 @@ import space.kscience.dataforge.meta.string
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.gdml.GdmlShowCase
|
||||
import space.kscience.visionforge.Vision
|
||||
import space.kscience.visionforge.getChild
|
||||
import space.kscience.visionforge.solid.Solid
|
||||
import space.kscience.visionforge.solid.SolidMaterial
|
||||
import space.kscience.visionforge.solid.get
|
||||
import space.kscience.visionforge.solid.material
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
@ -18,7 +17,7 @@ class GDMLVisionTest {
|
||||
|
||||
@Test
|
||||
fun testCubesStyles(){
|
||||
val segment = cubes.children.getChild("composite-000.segment-0") as Solid
|
||||
val segment = cubes.get("composite-000.segment-0")!!
|
||||
println(segment.properties.getValue(Vision.STYLE_KEY))
|
||||
// println(segment.computePropertyNode(SolidMaterial.MATERIAL_KEY))
|
||||
// println(segment.computeProperty(SolidMaterial.MATERIAL_COLOR_KEY))
|
||||
@ -34,6 +33,6 @@ class GDMLVisionTest {
|
||||
val child = cubes[Name.of("composite-000","segment-0")]
|
||||
assertNotNull(child)
|
||||
child.properties.setValue(SolidMaterial.MATERIAL_COLOR_KEY, "red".asValue())
|
||||
assertEquals("red", child.properties[SolidMaterial.MATERIAL_COLOR_KEY].string)
|
||||
assertEquals("red", child.readProperty(SolidMaterial.MATERIAL_COLOR_KEY).string)
|
||||
}
|
||||
}
|
@ -3,8 +3,8 @@
|
||||
package space.kscience.visionforge.gdml.demo
|
||||
|
||||
import androidx.compose.runtime.*
|
||||
import bootstrap.Container
|
||||
import bootstrap.Icon
|
||||
import app.softwork.bootstrapcompose.Container
|
||||
import app.softwork.bootstrapcompose.Icon
|
||||
import org.jetbrains.compose.web.ExperimentalComposeWebApi
|
||||
import org.jetbrains.compose.web.attributes.InputType
|
||||
import org.jetbrains.compose.web.attributes.name
|
||||
|
@ -3,59 +3,53 @@ package space.kscience.visionforge.gdml.demo
|
||||
import org.jetbrains.compose.web.css.*
|
||||
import org.jetbrains.compose.web.dom.Style
|
||||
import org.jetbrains.compose.web.renderComposable
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.gdml.GdmlShowCase
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.gdml.toVision
|
||||
import space.kscience.visionforge.html.Application
|
||||
import space.kscience.visionforge.html.VisionForgeStyles
|
||||
import space.kscience.visionforge.html.startApplication
|
||||
import space.kscience.visionforge.setAsRoot
|
||||
import space.kscience.visionforge.solid.ambientLight
|
||||
import space.kscience.visionforge.solid.invoke
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
import space.kscience.visionforge.visionManager
|
||||
|
||||
|
||||
private class GDMLDemoApp : Application {
|
||||
fun main() = startApplication { document ->
|
||||
|
||||
val context = Context("gdml-demo") {
|
||||
plugin(ThreePlugin)
|
||||
}
|
||||
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
val element = document.getElementById("application") ?: error("Element with id 'application' not found on page")
|
||||
|
||||
val element = document.getElementById("application") ?: error("Element with id 'application' not found on page")
|
||||
val vision = GdmlShowCase.cubes().toVision().apply {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
setAsRoot(context.visionManager)
|
||||
}
|
||||
|
||||
val vision = GdmlShowCase.cubes().toVision().apply {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
renderComposable(element) {
|
||||
Style(VisionForgeStyles)
|
||||
Style {
|
||||
"html" {
|
||||
height(100.percent)
|
||||
}
|
||||
|
||||
"body" {
|
||||
height(100.percent)
|
||||
display(DisplayStyle.Flex)
|
||||
alignItems(AlignItems.Stretch)
|
||||
}
|
||||
|
||||
"#application" {
|
||||
width(100.percent)
|
||||
display(DisplayStyle.Flex)
|
||||
alignItems(AlignItems.Stretch)
|
||||
}
|
||||
}
|
||||
|
||||
renderComposable(element) {
|
||||
Style(VisionForgeStyles)
|
||||
Style {
|
||||
"html" {
|
||||
height(100.percent)
|
||||
}
|
||||
|
||||
"body" {
|
||||
height(100.percent)
|
||||
display(DisplayStyle.Flex)
|
||||
alignItems(AlignItems.Stretch)
|
||||
}
|
||||
|
||||
"#application" {
|
||||
width(100.percent)
|
||||
display(DisplayStyle.Flex)
|
||||
alignItems(AlignItems.Stretch)
|
||||
}
|
||||
}
|
||||
GDMLApp(context, vision)
|
||||
}
|
||||
GDMLApp(context, vision)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
startApplication(::GDMLDemoApp)
|
||||
}
|
@ -28,8 +28,8 @@ kotlin {
|
||||
|
||||
kscience {
|
||||
dependencies {
|
||||
implementation(projects.plotlyKt.plotlyKtCore)
|
||||
implementation(projects.visionforge.visionforgeGdml)
|
||||
implementation(projects.visionforge.visionforgePlotly)
|
||||
implementation(projects.visionforge.visionforgeMarkdown)
|
||||
implementation(projects.visionforge.visionforgeThreejs)
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
import org.jetbrains.compose.web.css.*
|
||||
import org.jetbrains.compose.web.dom.Div
|
||||
import org.jetbrains.compose.web.renderComposable
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.plotly.PlotlyJsPlugin
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.plotly.scatter
|
||||
import space.kscience.plotly.models.scatter
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.html.Application
|
||||
import space.kscience.visionforge.html.Tabs
|
||||
import space.kscience.visionforge.html.VisionForgeStyles
|
||||
import space.kscience.visionforge.html.startApplication
|
||||
import space.kscience.visionforge.markup.MarkupPlugin
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.markup.MarkupJsPlugin
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
import space.kscience.visionforge.solid.three.compose.ThreeView
|
||||
@ -24,15 +22,13 @@ fun Trace.appendXYLatest(x: Number, y: Number, history: Int = 400, xErr: Number?
|
||||
yErr?.let { error_y.array = (error_y.array + yErr).takeLast(history) }
|
||||
}
|
||||
|
||||
private class JsPlaygroundApp : Application {
|
||||
|
||||
public fun main() {
|
||||
val playgroundContext = Context {
|
||||
plugin(ThreePlugin)
|
||||
plugin(PlotlyPlugin)
|
||||
plugin(MarkupPlugin)
|
||||
plugin(PlotlyJsPlugin)
|
||||
plugin(MarkupJsPlugin)
|
||||
}
|
||||
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
startApplication { document ->
|
||||
|
||||
// val solids = playgroundContext.request(Solids)
|
||||
// val client = playgroundContext.request(JsVisionClient)
|
||||
@ -98,9 +94,4 @@ private class JsPlaygroundApp : Application {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public fun main() {
|
||||
startApplication(::JsPlaygroundApp)
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.remember
|
||||
import bootstrap.Column
|
||||
import bootstrap.Row
|
||||
import app.softwork.bootstrapcompose.Column
|
||||
import app.softwork.bootstrapcompose.Row
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import org.jetbrains.compose.web.css.*
|
||||
@ -14,11 +14,11 @@ import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.plotly.Plot
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.plotly.models.invoke
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.html.Vision
|
||||
import space.kscience.visionforge.html.VisionDiv
|
||||
import space.kscience.visionforge.html.zIndex
|
||||
import space.kscience.visionforge.markup.VisionOfMarkup
|
||||
import space.kscience.visionforge.plotly.asVision
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.three.compose.ThreeView
|
||||
import kotlin.math.sqrt
|
||||
@ -29,11 +29,11 @@ fun Plot(
|
||||
meta: Meta = Meta.EMPTY,
|
||||
attrs: AttrBuilderContext<HTMLDivElement>? = null,
|
||||
block: Plot.() -> Unit,
|
||||
) = Vision(
|
||||
) = VisionDiv(
|
||||
context = context,
|
||||
attrs = attrs,
|
||||
meta = meta,
|
||||
vision = Plot().apply(block).asVision()
|
||||
vision = Plot().apply(block)
|
||||
)
|
||||
|
||||
@Composable
|
||||
@ -42,7 +42,7 @@ fun Markup(
|
||||
markup: VisionOfMarkup,
|
||||
meta: Meta = Meta.EMPTY,
|
||||
attrs: AttrBuilderContext<HTMLDivElement>? = null,
|
||||
) = Vision(
|
||||
) = VisionDiv(
|
||||
context = context,
|
||||
attrs = attrs,
|
||||
meta = meta,
|
||||
|
@ -24,7 +24,6 @@ public synthetic class ru/mipt/npm/muon/monitor/Event$$serializer : kotlinx/seri
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public final 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 {
|
||||
@ -69,9 +68,9 @@ public final class ru/mipt/npm/muon/monitor/ReadResourceKt {
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/SC1 {
|
||||
public static final field $stable I
|
||||
public fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;FFF)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;FFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getCenter ()Lspace/kscience/visionforge/solid/Float32Vector3D;
|
||||
public fun <init> (Ljava/lang/String;Lspace/kscience/kmath/geometry/Vector3D;FFF)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Lspace/kscience/kmath/geometry/Vector3D;FFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getCenter ()Lspace/kscience/kmath/geometry/Vector3D;
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public final fun getXSize ()F
|
||||
public final fun getYSize ()F
|
||||
@ -80,8 +79,8 @@ public final class ru/mipt/npm/muon/monitor/SC1 {
|
||||
|
||||
public final class ru/mipt/npm/muon/monitor/SC16 {
|
||||
public static final field $stable I
|
||||
public fun <init> (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;)V
|
||||
public final fun getCenter ()Lspace/kscience/visionforge/solid/Float32Vector3D;
|
||||
public fun <init> (Ljava/lang/String;Lspace/kscience/kmath/geometry/Vector3D;)V
|
||||
public final fun getCenter ()Lspace/kscience/kmath/geometry/Vector3D;
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public final fun getPixels ()Ljava/util/Collection;
|
||||
}
|
||||
@ -116,7 +115,7 @@ public final class ru/mipt/npm/muon/monitor/sim/LineKt {
|
||||
public static final fun getY (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)D
|
||||
public static final fun makeTrack (DDDD)Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
|
||||
public static final fun makeTrack (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
|
||||
public static final fun toKMathVector (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lspace/kscience/visionforge/solid/Float32Vector3D;
|
||||
public static final fun toKMathVector (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lspace/kscience/kmath/geometry/Vector3D;
|
||||
public static final fun toKMathVectors (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)Ljava/util/List;
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@ plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
alias(spclibs.plugins.compose.compiler)
|
||||
alias(spclibs.plugins.compose.jb)
|
||||
// alias(spclibs.plugins.ktor)
|
||||
application
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
@ -12,7 +10,14 @@ group = "ru.mipt.npm"
|
||||
kscience {
|
||||
fullStack(
|
||||
"muon-monitor.js",
|
||||
jvmConfig = {withJava()},
|
||||
development = true,
|
||||
jvmConfig = {
|
||||
binaries {
|
||||
executable {
|
||||
mainClass.set("ru.mipt.npm.muon.monitor.MMServerKt")
|
||||
}
|
||||
}
|
||||
},
|
||||
browserConfig = {
|
||||
commonWebpackConfig {
|
||||
cssSupport {
|
||||
@ -27,7 +32,6 @@ kscience {
|
||||
|
||||
useCoroutines()
|
||||
useSerialization()
|
||||
useKtor()
|
||||
|
||||
commonMain {
|
||||
implementation(projects.visionforgeSolid)
|
||||
@ -42,14 +46,9 @@ kscience {
|
||||
}
|
||||
jsMain {
|
||||
implementation(projects.visionforgeThreejs)
|
||||
//implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
explicitApi = null
|
||||
}
|
||||
|
||||
|
||||
application {
|
||||
mainClass.set("ru.mipt.npm.muon.monitor.MMServerKt")
|
||||
}
|
@ -1,7 +1,11 @@
|
||||
@file:UseSerializers(Float32Space3D.VectorSerializer::class)
|
||||
package ru.mipt.npm.muon.monitor
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import space.kscience.visionforge.solid.Float32Vector3D
|
||||
import kotlinx.serialization.UseSerializers
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Space3D
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D
|
||||
|
||||
|
||||
typealias Track = List<Float32Vector3D>
|
||||
|
||||
|
@ -3,12 +3,11 @@ package ru.mipt.npm.muon.monitor
|
||||
import ru.mipt.npm.muon.monitor.Monitor.CENTRAL_LAYER_Z
|
||||
import ru.mipt.npm.muon.monitor.Monitor.LOWER_LAYER_Z
|
||||
import ru.mipt.npm.muon.monitor.Monitor.UPPER_LAYER_Z
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D
|
||||
import space.kscience.visionforge.MutableVisionContainer
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.setAsRoot
|
||||
import space.kscience.visionforge.solid.*
|
||||
import kotlin.collections.set
|
||||
import kotlin.math.PI
|
||||
|
||||
class Model(val manager: VisionManager) {
|
||||
@ -61,7 +60,7 @@ class Model(val manager: VisionManager) {
|
||||
}
|
||||
}
|
||||
|
||||
setChild("tracks".asName(), tracks)
|
||||
set("tracks", tracks)
|
||||
}
|
||||
|
||||
private fun highlight(pixel: String) {
|
||||
@ -73,7 +72,10 @@ class Model(val manager: VisionManager) {
|
||||
map.values.forEach {
|
||||
it.properties[SolidMaterial.MATERIAL_COLOR_KEY] = null
|
||||
}
|
||||
tracks.children.clear()
|
||||
val tracksToRemove = tracks.visions.keys.toList()
|
||||
tracksToRemove.forEach {
|
||||
tracks.setVision(it, null)
|
||||
}
|
||||
}
|
||||
|
||||
fun displayEvent(event: Event) {
|
||||
|
@ -2,8 +2,8 @@ package ru.mipt.npm.muon.monitor
|
||||
|
||||
import ru.mipt.npm.muon.monitor.Monitor.PIXEL_XY_SIZE
|
||||
import ru.mipt.npm.muon.monitor.Monitor.PIXEL_Z_SIZE
|
||||
import space.kscience.visionforge.solid.Float32Euclidean3DSpace
|
||||
import space.kscience.visionforge.solid.Float32Vector3D
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Space3D
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D
|
||||
|
||||
/**
|
||||
* A single pixel
|
||||
@ -111,7 +111,7 @@ class SC16(
|
||||
}
|
||||
val offset = Float32Vector3D(-y, x, 0)//rotateDetector(Point3D(x, y, 0.0));
|
||||
val pixelName = "${name}_${index}"
|
||||
SC1(pixelName, with(Float32Euclidean3DSpace) { offset + center })
|
||||
SC1(pixelName, with(Float32Space3D) { offset + center })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ package ru.mipt.npm.muon.monitor
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.remember
|
||||
import bootstrap.Button
|
||||
import bootstrap.ButtonGroup
|
||||
import bootstrap.Layout.Width.Full
|
||||
import app.softwork.bootstrapcompose.Button
|
||||
import app.softwork.bootstrapcompose.ButtonGroup
|
||||
import app.softwork.bootstrapcompose.Layout.Width
|
||||
import kotlinx.browser.window
|
||||
import kotlinx.coroutines.await
|
||||
import kotlinx.coroutines.launch
|
||||
@ -66,7 +66,7 @@ fun MMApp(context: Context, model: Model, selected: Name? = null) {
|
||||
options = mmOptions,
|
||||
sidebarTabs = {
|
||||
Tab("Events") {
|
||||
ButtonGroup({ Layout.width = Full }) {
|
||||
ButtonGroup({ Layout.width = Width.Full }) {
|
||||
Button("Next") {
|
||||
context.launch {
|
||||
val event = window.fetch(
|
||||
@ -85,7 +85,7 @@ fun MMApp(context: Context, model: Model, selected: Name? = null) {
|
||||
model.displayEvent(event)
|
||||
}
|
||||
}
|
||||
Button("Clear", color = bootstrap.Color.Secondary) {
|
||||
Button("Clear", color = app.softwork.bootstrapcompose.Color.Secondary) {
|
||||
events.clear()
|
||||
model.reset()
|
||||
}
|
||||
|
@ -2,34 +2,25 @@ package ru.mipt.npm.muon.monitor
|
||||
|
||||
import org.jetbrains.compose.web.css.Style
|
||||
import org.jetbrains.compose.web.renderComposable
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.visionforge.VisionManager
|
||||
import space.kscience.visionforge.html.Application
|
||||
import space.kscience.visionforge.html.VisionForgeStyles
|
||||
import space.kscience.visionforge.html.startApplication
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
|
||||
private class MMDemoApp : Application {
|
||||
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
fun main(): Unit = startApplication {
|
||||
val context = Context("MM-demo") {
|
||||
plugin(ThreePlugin)
|
||||
}
|
||||
|
||||
val context = Context("MM-demo") {
|
||||
plugin(ThreePlugin)
|
||||
}
|
||||
val visionManager = context.request(VisionManager)
|
||||
|
||||
val visionManager = context.request(VisionManager)
|
||||
val model = Model(visionManager)
|
||||
|
||||
val model = Model(visionManager)
|
||||
|
||||
renderComposable("app") {
|
||||
Style(VisionForgeStyles)
|
||||
MMApp(context, model)
|
||||
}
|
||||
renderComposable("app") {
|
||||
Style(VisionForgeStyles)
|
||||
MMApp(context, model)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
startApplication(::MMDemoApp)
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
package ru.mipt.npm.muon.monitor
|
||||
|
||||
actual fun readResource(path: String): String {
|
||||
return kotlinext.js.require(path) as String
|
||||
}
|
||||
actual fun readResource(path: String): String = js("require(path)")
|
||||
|
||||
// TODO replace by resource
|
||||
internal actual fun readMonitorConfig(): String{
|
||||
internal actual fun readMonitorConfig(): String {
|
||||
return """
|
||||
--Place-|-SC16-|-TB-CHN-|-HB-CHN-|-X-coord-|-Y-coord-|-Z-coord-|-Theta-|-Phi
|
||||
----------------------------------------------------------------------------
|
||||
|
@ -5,7 +5,6 @@ import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import io.ktor.server.application.Application
|
||||
import io.ktor.server.application.call
|
||||
import io.ktor.server.application.install
|
||||
import io.ktor.server.application.log
|
||||
import io.ktor.server.cio.CIO
|
||||
@ -14,8 +13,8 @@ import io.ktor.server.http.content.staticResources
|
||||
import io.ktor.server.plugins.contentnegotiation.ContentNegotiation
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.server.response.respondText
|
||||
import io.ktor.server.routing.Routing
|
||||
import io.ktor.server.routing.get
|
||||
import io.ktor.server.routing.routing
|
||||
import org.apache.commons.math3.random.JDKRandomGenerator
|
||||
import ru.mipt.npm.muon.monitor.sim.Cos2TrackGenerator
|
||||
import ru.mipt.npm.muon.monitor.sim.simulateOne
|
||||
@ -39,7 +38,8 @@ fun Application.module(context: Context = Global) {
|
||||
install(ContentNegotiation) {
|
||||
json()
|
||||
}
|
||||
install(Routing) {
|
||||
|
||||
routing {
|
||||
get("/event") {
|
||||
val event = generator.simulateOne()
|
||||
call.respond(event)
|
||||
@ -53,6 +53,7 @@ fun Application.module(context: Context = Global) {
|
||||
}
|
||||
staticResources("/", null)
|
||||
}
|
||||
|
||||
try {
|
||||
Desktop.getDesktop().browse(URI("http://localhost:8080/index.html"))
|
||||
} catch (ex: Exception) {
|
||||
|
@ -1,10 +1,7 @@
|
||||
package ru.mipt.npm.muon.monitor
|
||||
|
||||
actual fun readResource(path: String): String {
|
||||
return ClassLoader.getSystemClassLoader().getResourceAsStream(path)?.readBytes()?.decodeToString()
|
||||
actual fun readResource(path: String): String =
|
||||
ClassLoader.getSystemClassLoader().getResourceAsStream(path)?.readBytes()?.decodeToString()
|
||||
?: error("Resource '$path' not found")
|
||||
}
|
||||
|
||||
internal actual fun readMonitorConfig(): String {
|
||||
return readResource("map-RMM110.sc16")
|
||||
}
|
||||
internal actual fun readMonitorConfig(): String = readResource("map-RMM110.sc16")
|
@ -5,7 +5,7 @@ import org.apache.commons.math3.geometry.euclidean.threed.Plane
|
||||
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D
|
||||
import ru.mipt.npm.muon.monitor.Monitor.CENTRAL_LAYER_Z
|
||||
import ru.mipt.npm.muon.monitor.Monitor.GEOMETRY_TOLERANCE
|
||||
import space.kscience.visionforge.solid.Float32Vector3D
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D
|
||||
|
||||
/**
|
||||
* Created by darksnake on 11-May-16.
|
||||
|
@ -4,7 +4,7 @@ public final class space/kscience/visionforge/examples/AllThingsDemoKt {
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/AntennaKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
@ -19,12 +19,12 @@ public final class space/kscience/visionforge/examples/BmnDemoKt {
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/ControlVisionKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/DynamicPlotlyVisionKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public final class space/kscience/visionforge/examples/ExtrudedKt {
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/FormServerKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
@ -53,11 +53,6 @@ public final class space/kscience/visionforge/examples/GdmlIaxoKt {
|
||||
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/MarkdownVisionKt {
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
@ -74,10 +69,11 @@ public final class space/kscience/visionforge/examples/RandomSpheresKt {
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/ServerExtensionsKt {
|
||||
public static final fun getContext ()Lspace/kscience/dataforge/context/Context;
|
||||
public static final fun makeVisionFile (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLspace/kscience/visionforge/html/HtmlVisionFragment;)V
|
||||
public static synthetic fun makeVisionFile$default (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLspace/kscience/visionforge/html/HtmlVisionFragment;ILjava/lang/Object;)V
|
||||
public static final fun serve (Ljava/lang/String;ZLspace/kscience/visionforge/html/HtmlVisionFragment;)V
|
||||
public static synthetic fun serve$default (Ljava/lang/String;ZLspace/kscience/visionforge/html/HtmlVisionFragment;ILjava/lang/Object;)V
|
||||
public static final fun serve (Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lspace/kscience/visionforge/html/HtmlVisionFragment;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun serve$default (Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lspace/kscience/visionforge/html/HtmlVisionFragment;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class space/kscience/visionforge/examples/ShapesKt {
|
||||
|
@ -1,8 +1,8 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
kotlin("jupyter.api")
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
// application
|
||||
id("com.gradleup.shadow") version "8.3.6"
|
||||
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -12,17 +12,18 @@ repositories {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(11)
|
||||
js(IR) {
|
||||
jvmToolchain(17)
|
||||
js {
|
||||
useEsModules()
|
||||
browser {
|
||||
webpackTask {
|
||||
cssSupport{
|
||||
commonWebpackConfig {
|
||||
outputFileName = "js/visionforge-playground.js"
|
||||
cssSupport {
|
||||
enabled = true
|
||||
}
|
||||
scssSupport{
|
||||
scssSupport {
|
||||
enabled = true
|
||||
}
|
||||
mainOutputFileName.set("js/visionforge-playground.js")
|
||||
}
|
||||
}
|
||||
binaries.executable()
|
||||
@ -31,7 +32,7 @@ kotlin {
|
||||
jvm {
|
||||
// withJava()
|
||||
compilerOptions {
|
||||
freeCompilerArgs.addAll("-Xjvm-default=all", "-Xopt-in=kotlin.RequiresOptIn", "-Xlambdas=indy", "-Xcontext-receivers")
|
||||
freeCompilerArgs.addAll("-Xjvm-default=all", "-Xcontext-parameters")
|
||||
|
||||
}
|
||||
testRuns["test"].executionTask.configure {
|
||||
@ -43,9 +44,9 @@ kotlin {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
implementation(projects.visionforgeSolid)
|
||||
// implementation(projects.visionforgePlotly)
|
||||
implementation(projects.plotlyKt.plotlyKtCore)
|
||||
implementation(projects.visionforgeMarkdown)
|
||||
// implementation(projects.visionforgeTables)
|
||||
implementation(projects.visionforgeTables)
|
||||
implementation(projects.cernRootLoader)
|
||||
api(projects.visionforgeJupyter.visionforgeJupyterCommon)
|
||||
}
|
||||
@ -54,32 +55,36 @@ kotlin {
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
implementation(projects.visionforgeThreejs)
|
||||
compileOnly(npm("webpack-bundle-analyzer","4.5.0"))
|
||||
// compileOnly(npm("webpack-bundle-analyzer","4.5.0"))
|
||||
}
|
||||
}
|
||||
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
implementation("io.ktor:ktor-server-cio:${spclibs.versions.ktor.get()}")
|
||||
implementation("io.ktor:ktor-server-cio")
|
||||
implementation(projects.visionforgeGdml)
|
||||
implementation(projects.visionforgeServer)
|
||||
implementation(spclibs.logback.classic)
|
||||
implementation("com.github.Ricky12Awesome:json-schema-serialization:0.6.6")
|
||||
}
|
||||
}
|
||||
|
||||
all {
|
||||
languageSettings.optIn("space.kscience.dataforge.misc.DFExperimental")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val jsBrowserDistribution = tasks.getByName("jsBrowserDistribution")
|
||||
val debug = false
|
||||
|
||||
val jsBrowserDistribution = if(debug) {
|
||||
tasks.getByName("jsBrowserDevelopmentExecutableDistribution")
|
||||
} else {
|
||||
tasks.getByName("jsBrowserDistribution")
|
||||
}
|
||||
|
||||
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
||||
dependsOn(jsBrowserDistribution)
|
||||
from(jsBrowserDistribution) {
|
||||
exclude("**/*.js.map")
|
||||
}
|
||||
from(jsBrowserDistribution)
|
||||
}
|
||||
|
||||
val processJupyterApiResources by tasks.getting(org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask::class) {
|
||||
|
@ -2,29 +2,27 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"@file:Repository(\"*mavenLocal\")\n",
|
||||
"@file:Repository(\"https://repo.kotlin.link\")\n",
|
||||
"@file:Repository(\"https://maven.pkg.jetbrains.space/spc/p/sci/dev\")\n",
|
||||
"@file:DependsOn(\"space.kscience:visionforge-jupyter-common-jvm:0.3.0-dev-12\")\n",
|
||||
"//import space.kscience.visionforge.jupyter.JupyterCommonIntegration\n",
|
||||
"//\n",
|
||||
"//val integration = JupyterCommonIntegration()\n",
|
||||
"//USE(integration.getDefinitions(notebook).first())"
|
||||
]
|
||||
"//@file:Repository(\"*mavenLocal\")\n",
|
||||
"//@file:Repository(\"https://repo.kotlin.link\")\n",
|
||||
"//@file:Repository(\"https://maven.pkg.jetbrains.space/spc/p/sci/dev\")\n",
|
||||
"//@file:DependsOn(\"space.kscience:visionforge-jupyter-common-jvm:0.3.0-dev-12\")\n",
|
||||
"import space.kscience.visionforge.jupyter.JupyterCommonIntegration\n",
|
||||
"\n",
|
||||
"val integration = JupyterCommonIntegration()\n",
|
||||
"USE(integration.getDefinitions(notebook))"
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vf.fragment {\n",
|
||||
" h1 { +\"AAA\" }\n",
|
||||
@ -48,15 +46,15 @@
|
||||
" }\n",
|
||||
" }\n",
|
||||
"}"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"Plotly.plot { \n",
|
||||
" scatter{\n",
|
||||
@ -64,14 +62,16 @@
|
||||
" y(1,2,3)\n",
|
||||
" }\n",
|
||||
"}"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"source": [],
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"execution_count": null
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -90,7 +90,10 @@
|
||||
"version": "1.8.20"
|
||||
},
|
||||
"ktnbPluginMetadata": {
|
||||
"projectLibraries": []
|
||||
"projectDependencies": [
|
||||
"visionforge.demo.playground.jvmMain"
|
||||
],
|
||||
"projectLibraries": false
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -1,16 +1,16 @@
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.plotly.PlotlyJsPlugin
|
||||
import space.kscience.visionforge.html.runVisionClient
|
||||
import space.kscience.visionforge.jupyter.VFNotebookClient
|
||||
import space.kscience.visionforge.markup.MarkupPlugin
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.markup.MarkupJsPlugin
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
import space.kscience.visionforge.tables.TableVisionJsPlugin
|
||||
|
||||
@DFExperimental
|
||||
fun main() = runVisionClient {
|
||||
plugin(ThreePlugin)
|
||||
plugin(PlotlyPlugin)
|
||||
plugin(MarkupPlugin)
|
||||
plugin(PlotlyJsPlugin)
|
||||
plugin(MarkupJsPlugin)
|
||||
plugin(TableVisionJsPlugin)
|
||||
plugin(VFNotebookClient)
|
||||
}
|
@ -5,12 +5,10 @@ import ru.mipt.npm.root.DGeoManager
|
||||
import ru.mipt.npm.root.rootGeo
|
||||
import ru.mipt.npm.root.serialization.TGeoManager
|
||||
import ru.mipt.npm.root.toVector
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.get
|
||||
import space.kscience.dataforge.meta.isLeaf
|
||||
import space.kscience.dataforge.meta.string
|
||||
import space.kscience.dataforge.meta.*
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.html.meta
|
||||
import space.kscience.visionforge.solid.*
|
||||
import java.util.zip.ZipInputStream
|
||||
import kotlin.io.path.Path
|
||||
@ -41,16 +39,22 @@ fun main() {
|
||||
println(it)
|
||||
}
|
||||
|
||||
val events = BMN.readEventJson(TGeoManager::class.java.getResourceAsStream("/root/event_0.json")!!.bufferedReader().readText())
|
||||
val events = BMN.readEventJson(
|
||||
TGeoManager::class.java.getResourceAsStream("/root/event_0.json")!!.bufferedReader().readText()
|
||||
)
|
||||
|
||||
makeVisionFile(path = Path("data/output.html"), resourceLocation = ResourceLocation.EMBED) {
|
||||
vision("canvas") {
|
||||
requirePlugin(Solids)
|
||||
meta {
|
||||
"layers" put ListValue(0, 1, 2, 3, 4, 5, 6)
|
||||
}
|
||||
solid {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
}
|
||||
rootGeo(geo,"BM@N", ignoreRootColors = true).also {
|
||||
|
||||
rootGeo(geo, "BM@N", ignoreRootColors = true).also {
|
||||
Path("data/BM@N.vf.json").writeText(Solids.encodeToString(it))
|
||||
}
|
||||
|
||||
|
@ -2,14 +2,15 @@ package space.kscience.visionforge.examples
|
||||
|
||||
import kotlinx.html.h2
|
||||
import space.kscience.dataforge.meta.ValueType
|
||||
import space.kscience.plotly.PlotlyPlugin
|
||||
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.plotly.models.scatter
|
||||
import space.kscience.plotly.plotly
|
||||
import space.kscience.tables.ColumnHeader
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.markup.markdown
|
||||
import space.kscience.visionforge.plotly.plotly
|
||||
import space.kscience.visionforge.solid.axes
|
||||
import space.kscience.visionforge.solid.box
|
||||
import space.kscience.visionforge.solid.solid
|
||||
@ -43,6 +44,7 @@ fun main() = makeVisionFile(
|
||||
|
||||
h2 { +"Interactive plots with Plotly" }
|
||||
vision("plot") {
|
||||
requirePlugin(PlotlyPlugin)
|
||||
plotly {
|
||||
scatter {
|
||||
x(1, 2, 3, 4)
|
||||
|
@ -5,15 +5,25 @@ import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import space.kscience.dataforge.meta.configure
|
||||
import space.kscience.kmath.complex.Quaternion
|
||||
import space.kscience.kmath.complex.QuaternionField
|
||||
import space.kscience.kmath.complex.QuaternionAlgebra
|
||||
import space.kscience.kmath.complex.conjugate
|
||||
import space.kscience.kmath.geometry.*
|
||||
import space.kscience.kmath.geometry.Angle
|
||||
import space.kscience.kmath.geometry.degrees
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float64Space3D
|
||||
import space.kscience.kmath.geometry.euclidean3d.RotationOrder
|
||||
import space.kscience.kmath.geometry.euclidean3d.fromEuler
|
||||
import space.kscience.kmath.geometry.euclidean3d.fromRotation
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.solid.*
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() = serve {
|
||||
suspend fun main() = serve(
|
||||
routeConfiguration = {
|
||||
updateInterval = 100
|
||||
}
|
||||
) {
|
||||
|
||||
// val azimuth = 60.degrees
|
||||
// val inclination = 15.degrees
|
||||
@ -37,7 +47,10 @@ fun main() = serve {
|
||||
rotationX = -PI / 2
|
||||
rotationZ = PI
|
||||
//axes(200)
|
||||
ambientLight()
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
intensity = 3.0
|
||||
}
|
||||
val platform = solidGroup("platform") {
|
||||
cylinder(50, 5, name = "base")
|
||||
solidGroup("frame") {
|
||||
@ -72,27 +85,27 @@ fun main() = serve {
|
||||
val xPeriod = 5000 //ms
|
||||
val yPeriod = 7000 //ms
|
||||
|
||||
val incRot = Quaternion.fromRotation(30.degrees, Euclidean3DSpace.zAxis)
|
||||
val incRot = Quaternion.fromRotation(30.degrees, Float64Space3D.zAxis)
|
||||
|
||||
|
||||
context.launch {
|
||||
var time: Long = 0L
|
||||
while (isActive) {
|
||||
with(QuaternionField) {
|
||||
delay(200)
|
||||
with(QuaternionAlgebra) {
|
||||
delay(100)
|
||||
platform.quaternion = Quaternion.fromRotation(
|
||||
15.degrees * sin(time.toDouble() * 2 * PI / xPeriod),
|
||||
Euclidean3DSpace.xAxis
|
||||
Float64Space3D.xAxis
|
||||
) * Quaternion.fromRotation(
|
||||
15.degrees * cos(time * 2 * PI / yPeriod),
|
||||
Euclidean3DSpace.yAxis
|
||||
Float64Space3D.yAxis
|
||||
)
|
||||
|
||||
val qi = platform.quaternion * incRot
|
||||
|
||||
antenna.quaternion = qi.conjugate * incRot.conjugate * target
|
||||
|
||||
time += 200
|
||||
time += 100
|
||||
//antenna.quaternion = Quaternion.fromRotation(5.degrees, Euclidean3DSpace.zAxis) * antenna.quaternion
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.kmath.geometry.Euclidean3DSpace
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float64Space3D
|
||||
import space.kscience.kmath.geometry.radians
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.solid.*
|
||||
@ -13,7 +13,7 @@ fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
axes(100, "root-axes")
|
||||
solidGroup("group") {
|
||||
z = 100
|
||||
rotate((PI / 4).radians, Euclidean3DSpace.vector(1, 1, 1))
|
||||
rotate((PI / 4).radians, Float64Space3D.vector(1, 1, 1))
|
||||
axes(100, "local-axes")
|
||||
box(50, 50, 50, "box")
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import space.kscience.visionforge.onSubmit
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
|
||||
fun main() = serve {
|
||||
suspend fun main() = serve {
|
||||
|
||||
val events = ArrayDeque<VisionControlEvent>(10)
|
||||
|
||||
|
@ -11,20 +11,19 @@ import kotlinx.html.a
|
||||
import kotlinx.html.h1
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.plotly.PlotlyPlugin
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.plotly.models.invoke
|
||||
import space.kscience.plotly.plotly
|
||||
import space.kscience.visionforge.html.VisionPage
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.plotly.plotly
|
||||
import space.kscience.visionforge.server.close
|
||||
import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.visionPage
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
suspend fun main() {
|
||||
val plotlyPlugin = Global.request(PlotlyPlugin)
|
||||
val visionManager = plotlyPlugin.visionManager
|
||||
|
||||
@ -53,8 +52,6 @@ fun main() {
|
||||
h1 { +"This is the plot page" }
|
||||
a("/other") { +"The other page" }
|
||||
vision {
|
||||
|
||||
|
||||
plotly {
|
||||
traces(sinTrace, cosTrace)
|
||||
layout {
|
||||
@ -108,5 +105,5 @@ fun main() {
|
||||
|
||||
}
|
||||
|
||||
server.close()
|
||||
server.stop()
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.visionPage
|
||||
|
||||
@Suppress("ExtractKtorModule")
|
||||
fun main() {
|
||||
suspend fun main() {
|
||||
val visionManager = Global.request(VisionManager)
|
||||
|
||||
val server = embeddedServer(CIO) {
|
||||
@ -27,7 +27,7 @@ fun main() {
|
||||
}
|
||||
|
||||
val form = VisionOfHtmlForm("form").apply {
|
||||
onPropertyChange(visionManager.context) {
|
||||
onPropertyChange(visionManager.context) { _, _ ->
|
||||
println(values)
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ fun main() = makeVisionFile(Path.of("curves.html"), resourceLocation = ResourceL
|
||||
val cathodeTeflonDiskThickness = 5
|
||||
val cathodeCopperSupportOuterRadius = 45
|
||||
val cathodeCopperSupportInnerRadius = 8.5
|
||||
val cathodeCopperSupportThickness = 1
|
||||
val cathodeCopperSupportThickness = 1.0
|
||||
// mylar cathode
|
||||
val mylarCathodeThickness = 0.004
|
||||
// patern
|
||||
|
@ -1,24 +0,0 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import com.github.ricky12awesome.jss.encodeToSchema
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.json.Json
|
||||
import space.kscience.visionforge.solid.SolidGroup
|
||||
import space.kscience.visionforge.solid.Solids
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
private val json = Json {
|
||||
serializersModule = Solids.serializersModuleForSolids
|
||||
prettyPrintIndent = " "
|
||||
prettyPrint = true
|
||||
ignoreUnknownKeys = true
|
||||
isLenient = true
|
||||
coerceInputValues = true
|
||||
encodeDefaults = true
|
||||
}
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
fun main() {
|
||||
val schema = json.encodeToSchema(SolidGroup.serializer(), generateDefinitions = false)
|
||||
println(schema)
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import space.kscience.dataforge.meta.Value
|
||||
import space.kscience.plotly.Plotly
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.*
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.plotly.plotly
|
||||
|
||||
fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
vision {
|
||||
@ -39,9 +39,11 @@ fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
}
|
||||
name = "F"
|
||||
|
||||
x(10.07, 34.83, 10.65, 12.43, 24.08, 13.42, 12.48, 29.8, 14.52, 11.38,
|
||||
x(
|
||||
10.07, 34.83, 10.65, 12.43, 24.08, 13.42, 12.48, 29.8, 14.52, 11.38,
|
||||
20.27, 11.17, 12.26, 18.26, 8.51, 10.33, 14.15, 13.16, 17.47, 27.05, 16.43,
|
||||
8.35, 18.64, 11.87, 19.81, 43.11, 13.0, 12.74, 13.0, 16.4, 16.47, 18.78)
|
||||
8.35, 18.64, 11.87, 19.81, 43.11, 13.0, 12.74, 13.0, 16.4, 16.47, 18.78
|
||||
)
|
||||
}
|
||||
|
||||
val trace2 = Violin {
|
||||
@ -76,12 +78,14 @@ fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
}
|
||||
name = "M"
|
||||
|
||||
x(27.2, 22.76, 17.29, 19.44, 16.66, 32.68, 15.98, 13.03, 18.28, 24.71,
|
||||
x(
|
||||
27.2, 22.76, 17.29, 19.44, 16.66, 32.68, 15.98, 13.03, 18.28, 24.71,
|
||||
21.16, 11.69, 14.26, 15.95, 8.52, 22.82, 19.08, 16.0, 34.3, 41.19, 9.78,
|
||||
7.51, 28.44, 15.48, 16.58, 7.56, 10.34, 13.51, 18.71, 20.53)
|
||||
7.51, 28.44, 15.48, 16.58, 7.56, 10.34, 13.51, 18.71, 20.53
|
||||
)
|
||||
}
|
||||
|
||||
plotly {
|
||||
Plotly.plot {
|
||||
traces(trace1, trace2)
|
||||
layout {
|
||||
width = 800
|
||||
|
@ -4,11 +4,12 @@ import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.http.content.staticResources
|
||||
import io.ktor.server.routing.routing
|
||||
import kotlinx.html.unsafe
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.Global
|
||||
import space.kscience.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.html.*
|
||||
import space.kscience.visionforge.markup.MarkupPlugin
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.server.VisionRoute
|
||||
import space.kscience.visionforge.server.close
|
||||
import space.kscience.visionforge.server.openInBrowser
|
||||
import space.kscience.visionforge.server.visionPage
|
||||
@ -18,6 +19,13 @@ import space.kscience.visionforge.visionManager
|
||||
import java.awt.Desktop
|
||||
import java.nio.file.Path
|
||||
|
||||
val context = Context("playground") {
|
||||
plugin(Solids)
|
||||
plugin(PlotlyPlugin)
|
||||
plugin(MarkupPlugin)
|
||||
plugin(TableVisionPlugin)
|
||||
}
|
||||
|
||||
|
||||
public fun makeVisionFile(
|
||||
path: Path? = null,
|
||||
@ -26,7 +34,7 @@ public fun makeVisionFile(
|
||||
show: Boolean = true,
|
||||
content: HtmlVisionFragment,
|
||||
): Unit {
|
||||
val actualPath = VisionPage(Global.visionManager, content = content).makeFile(path) { actualPath ->
|
||||
val actualPath = VisionPage(context.visionManager, content = content).makeFile(path) { actualPath ->
|
||||
mapOf(
|
||||
"title" to VisionPage.title(title),
|
||||
"playground" to VisionPage.importScriptHeader(
|
||||
@ -34,23 +42,22 @@ public fun makeVisionFile(
|
||||
resourceLocation,
|
||||
actualPath
|
||||
),
|
||||
"playground-style" to VisionPage.styleHeader {
|
||||
unsafe {
|
||||
+".visionforge-output { height:100vh; }"
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
if (show) Desktop.getDesktop().browse(actualPath.toFile().toURI())
|
||||
}
|
||||
|
||||
public fun serve(
|
||||
public suspend fun serve(
|
||||
title: String = "VisionForge page",
|
||||
show: Boolean = true,
|
||||
routeConfiguration: VisionRoute.() -> Unit = {},
|
||||
content: HtmlVisionFragment,
|
||||
) {
|
||||
val context = Context("playground") {
|
||||
plugin(Solids)
|
||||
plugin(PlotlyPlugin)
|
||||
plugin(MarkupPlugin)
|
||||
plugin(TableVisionPlugin)
|
||||
}
|
||||
|
||||
val server = embeddedServer(CIO, port = 7779) {
|
||||
routing {
|
||||
staticResources("", null, null)
|
||||
@ -62,6 +69,7 @@ public fun serve(
|
||||
defer = true
|
||||
},
|
||||
VisionPage.title(title),
|
||||
routeConfiguration = routeConfiguration,
|
||||
visionFragment = content
|
||||
)
|
||||
}.start(false)
|
||||
|
10
demo/playground/webpack.config.d/02.bundle.js
vendored
10
demo/playground/webpack.config.d/02.bundle.js
vendored
@ -1,10 +0,0 @@
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new BundleAnalyzerPlugin({
|
||||
analyzerMode: "static",
|
||||
reportFilename: "bundle-report.html"
|
||||
})
|
||||
]
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
public final class ru/mipt/npm/sat/SatServerKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class ru/mipt/npm/sat/StaticKt {
|
||||
public static final fun getContext ()Lspace/kscience/dataforge/context/Context;
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
@ -3,17 +3,22 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
|
||||
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
alias(spclibs.plugins.ktor)
|
||||
application
|
||||
// alias(spclibs.plugins.ktor)
|
||||
}
|
||||
|
||||
|
||||
group = "center.sciprog"
|
||||
|
||||
kscience {
|
||||
// useSerialization {
|
||||
// json()
|
||||
// }
|
||||
jvm{
|
||||
withJava()
|
||||
binaries {
|
||||
executable {
|
||||
mainClass.set("ru.mipt.npm.sat.SatServerKt")
|
||||
}
|
||||
}
|
||||
}
|
||||
jvmMain{
|
||||
implementation("io.ktor:ktor-server-cio")
|
||||
@ -22,10 +27,4 @@ kscience {
|
||||
}
|
||||
}
|
||||
|
||||
group = "center.sciprog"
|
||||
|
||||
kotlin.explicitApi = ExplicitApiMode.Disabled
|
||||
|
||||
application {
|
||||
mainClass.set("ru.mipt.npm.sat.SatServerKt")
|
||||
}
|
||||
kotlin.explicitApi = ExplicitApiMode.Disabled
|
@ -25,7 +25,7 @@ import kotlin.random.Random
|
||||
|
||||
|
||||
@Suppress("ExtractKtorModule")
|
||||
fun main() {
|
||||
suspend fun main() {
|
||||
val satContext = Context("sat") {
|
||||
plugin(Solids)
|
||||
}
|
||||
@ -36,6 +36,7 @@ fun main() {
|
||||
val sat = solids.visionOfSatellite(ySegments = 3).apply {
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
intensity = 3.0
|
||||
}
|
||||
}
|
||||
val server = embeddedServer(CIO, port = 7777) {
|
||||
|
@ -1,16 +1,20 @@
|
||||
package ru.mipt.npm.sat
|
||||
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.dataforge.context.request
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
import space.kscience.visionforge.solid.box
|
||||
import space.kscience.visionforge.solid.invoke
|
||||
import space.kscience.visionforge.solid.material
|
||||
import space.kscience.visionforge.solid.solid
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.three.makeThreeJsFile
|
||||
|
||||
val context = Context("Sat-server") {
|
||||
plugin(Solids)
|
||||
}
|
||||
|
||||
|
||||
@OptIn(DFExperimental::class)
|
||||
fun main() = makeThreeJsFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
vision ("canvas") {
|
||||
fun main() = context.request(Solids).makeThreeJsFile(resourceLocation = ResourceLocation.SYSTEM) {
|
||||
vision("canvas") {
|
||||
solid {
|
||||
box(100, 100, 100)
|
||||
material {
|
||||
|
@ -4,7 +4,8 @@ import kotlinx.coroutines.*
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.invoke
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.kmath.geometry.Euclidean3DSpace
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D
|
||||
import space.kscience.kmath.geometry.euclidean3d.Float64Space3D
|
||||
import space.kscience.kmath.geometry.radians
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.solid.*
|
||||
@ -24,7 +25,6 @@ fun VisionLayout<Solid>.demo(name: String, title: String = name, block: SolidGro
|
||||
block()
|
||||
ambientLight {
|
||||
color(Colors.white)
|
||||
intensity = 0.5
|
||||
}
|
||||
pointLight(0, 0, 1000) {
|
||||
color(Colors.white)
|
||||
@ -110,11 +110,11 @@ fun VisionLayout<Solid>.showcase() {
|
||||
rotationY = PI / 4
|
||||
axes(200)
|
||||
box(100, 100, 100) {
|
||||
rotate((PI / 4).radians, Euclidean3DSpace.zAxis)
|
||||
rotate((PI / 4).radians, Float64Space3D.zAxis)
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
while (isActive) {
|
||||
delay(100)
|
||||
rotate((PI / 20).radians, Euclidean3DSpace.yAxis)
|
||||
rotate((PI / 20).radians, Float64Space3D.yAxis)
|
||||
}
|
||||
}
|
||||
color(Colors.red)
|
||||
|
@ -1,19 +1,17 @@
|
||||
package space.kscience.visionforge.solid.demo
|
||||
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import org.w3c.dom.Document
|
||||
import space.kscience.visionforge.html.Application
|
||||
import space.kscience.visionforge.html.startApplication
|
||||
import space.kscience.visionforge.solid.x
|
||||
import space.kscience.visionforge.solid.y
|
||||
import kotlin.random.Random
|
||||
|
||||
private class ThreeDemoApp : Application {
|
||||
|
||||
override fun start(document: Document, state: Map<String, Any>) {
|
||||
|
||||
fun main() {
|
||||
startApplication { document ->
|
||||
val element = document.getElementById("demo") ?: error("Element with id 'demo' not found on page")
|
||||
|
||||
ThreeDemoGrid(element).run {
|
||||
@ -30,7 +28,7 @@ private class ThreeDemoApp : Application {
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
GlobalScope.launch {
|
||||
while (isActive) {
|
||||
delay(500)
|
||||
boxes.forEach { box ->
|
||||
@ -41,8 +39,4 @@ private class ThreeDemoApp : Application {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
startApplication(::ThreeDemoApp)
|
||||
}
|
@ -6,10 +6,10 @@ import space.kscience.dataforge.meta.number
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.dataforge.names.startsWith
|
||||
import space.kscience.visionforge.onPropertyChange
|
||||
import space.kscience.visionforge.setChild
|
||||
import space.kscience.visionforge.solid.SolidGroup
|
||||
import space.kscience.visionforge.solid.SolidMaterial.Companion.EDGES_KEY
|
||||
import space.kscience.visionforge.solid.layer
|
||||
import space.kscience.visionforge.solid.set
|
||||
import space.kscience.visionforge.solid.three.*
|
||||
import three.core.Object3D
|
||||
import three.geometries.BoxGeometry
|
||||
@ -21,7 +21,7 @@ internal fun SolidGroup.varBox(
|
||||
ySize: Number,
|
||||
name: String = "",
|
||||
action: VariableBox.() -> Unit = {},
|
||||
): VariableBox = VariableBox(xSize, ySize).apply(action).also { setChild(name, it) }
|
||||
): VariableBox = VariableBox(xSize, ySize).apply(action).also { set(name, it) }
|
||||
|
||||
internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision() {
|
||||
|
||||
@ -46,7 +46,7 @@ internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision
|
||||
mesh.scale.z = properties.getValue(VALUE)?.number?.toDouble() ?: 1.0
|
||||
|
||||
//add listener to object properties
|
||||
onPropertyChange(three.context) { name ->
|
||||
onPropertyChange(three.context) { name, _ ->
|
||||
when {
|
||||
name == VALUE -> {
|
||||
val value = properties.getValue(VALUE)?.int ?: 0
|
||||
|
16
docs/templates/README-TEMPLATE.md
vendored
16
docs/templates/README-TEMPLATE.md
vendored
@ -5,14 +5,14 @@
|
||||
|
||||
[](https://kotlinlang.slack.com/archives/CEXV2QWNM)
|
||||
|
||||
# DataForge Visualization Platform
|
||||
# VisionForge platform
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Introduction](#introduction)
|
||||
* [Requirements](#requirements)
|
||||
* [Features](#features)
|
||||
* [About DataForge](#about-dataforge)
|
||||
* [About VisionForge](#about-VisionForge)
|
||||
* [Modules contained in this repository](#modules-contained-in-this-repository)
|
||||
* [Visualization for External Systems](#visualization-for-external-systems)
|
||||
* [Demonstrations](#demonstrations)
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
This repository contains a [DataForge](#about-dataforge)\-based framework
|
||||
This repository contains a [VisionForge](#about-VisionForge) framework
|
||||
used for visualization in various scientific applications.
|
||||
|
||||
The main framework's use case for now is 3D visualization for particle physics experiments.
|
||||
@ -41,16 +41,16 @@ JVM backend requires JDK 11 or later
|
||||
The main framework's features for now include:
|
||||
- 3D visualization of complex experimental set-ups
|
||||
- Event display such as particle tracks, etc.
|
||||
- Scales up to few hundred thousands of elements
|
||||
- Camera move, rotate, zoom-in and zoom-out
|
||||
- Scales up to hundreds of thousands of elements
|
||||
- The camera moves, rotates, zoom-in and zoom-out
|
||||
- Scene graph as an object tree with property editor
|
||||
- Settings export and import
|
||||
- Multiple platform support
|
||||
|
||||
## About DataForge
|
||||
## About VisionForge
|
||||
|
||||
DataForge is a software framework for automated scientific data processing. DataForge Visualization
|
||||
Platform uses some of the concepts and modules of DataForge, including: `Meta`, `Configuration`, `Context`,
|
||||
[DataForge](https://git.sciprog.center/kscience/dataforge-core) is a software framework for automated scientific data processing. VisionForge
|
||||
Platform uses some concepts and modules of DataForge, including: `Meta`, `Configuration`, `Context`,
|
||||
`Provider`, and some others.
|
||||
|
||||
To learn more about DataForge, please consult the following URLs:
|
||||
|
@ -3,5 +3,9 @@ kotlin.mpp.stability.nowarn=true
|
||||
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
org.gradle.workers.max=4
|
||||
|
||||
toolsVersion=0.15.4-kotlin-2.0.0
|
||||
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
|
||||
kotlin.native.enableKlibsCrossCompilation=true
|
||||
|
||||
toolsVersion=0.17.1-kotlin-2.1.20
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -18,6 +18,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Security
|
||||
|
||||
## 0.5.0 (package and versioning change!)
|
||||
|
||||
### Changed
|
||||
|
||||
- Package changed to plotly-kt. Now use VisionForge versions.
|
||||
- Plotly-kt now fully relies on VisionForge classes.
|
||||
|
||||
## 0.7.2 - 2024-06-06
|
||||
|
||||
### Changed
|
||||
@ -92,13 +99,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- #85
|
||||
- Rendering in JS that used backend HTML generation
|
||||
|
||||
## 0.5.0
|
||||
|
||||
### Changed
|
||||
|
||||
- Switch to DataForge 0.5
|
||||
-
|
||||
|
||||
## 0.4.4
|
||||
|
||||
### Added
|
@ -2,12 +2,6 @@ plugins{
|
||||
id("org.jetbrains.changelog")
|
||||
}
|
||||
|
||||
|
||||
allprojects {
|
||||
group = "space.kscience"
|
||||
version = "0.7.2"
|
||||
}
|
||||
|
||||
readme {
|
||||
readmeTemplate = file("docs/templates/README-TEMPLATE.md")
|
||||
}
|
Before ![]() (image error) Size: 2.8 KiB After ![]() (image error) Size: 2.8 KiB ![]() ![]() |
Before (image error) Size: 8.3 KiB After (image error) Size: 8.3 KiB |
Before (image error) Size: 9.8 KiB After (image error) Size: 9.8 KiB |
0
plotly/docs/templates/ARTIFACT-TEMPLATE.md → plotly-kt/docs/templates/ARTIFACT-TEMPLATE.md
vendored
0
plotly/docs/templates/ARTIFACT-TEMPLATE.md → plotly-kt/docs/templates/ARTIFACT-TEMPLATE.md
vendored
@ -1,5 +1,5 @@
|
||||
public final class ComplexDynamicServerKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
public static final fun updateFrom (Lspace/kscience/plotly/models/Trace;Ljava/lang/String;Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun updateXYFrom (Lspace/kscience/plotly/models/Trace;Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
@ -17,12 +17,12 @@ public final class DownloadChartAsSVGKt {
|
||||
}
|
||||
|
||||
public final class DynamicBarsKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class DynamicServerKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
@ -54,27 +54,27 @@ public final class LocalFileExportKt {
|
||||
public final class PlotTabs {
|
||||
public fun <init> ()V
|
||||
public final fun getTabs ()Ljava/util/List;
|
||||
public final fun tab (Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function2;)V
|
||||
public static synthetic fun tab$default (LPlotTabs;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)V
|
||||
public final fun tab (Ljava/lang/String;Ljava/lang/String;Lspace/kscience/visionforge/html/HtmlFragment;)V
|
||||
public static synthetic fun tab$default (LPlotTabs;Ljava/lang/String;Ljava/lang/String;Lspace/kscience/visionforge/html/HtmlFragment;ILjava/lang/Object;)V
|
||||
}
|
||||
|
||||
public final class PlotTabs$Tab {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lspace/kscience/plotly/PlotlyFragment;)V
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lspace/kscience/visionforge/html/HtmlFragment;)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()Lspace/kscience/plotly/PlotlyFragment;
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lspace/kscience/plotly/PlotlyFragment;)LPlotTabs$Tab;
|
||||
public static synthetic fun copy$default (LPlotTabs$Tab;Ljava/lang/String;Ljava/lang/String;Lspace/kscience/plotly/PlotlyFragment;ILjava/lang/Object;)LPlotTabs$Tab;
|
||||
public final fun component3 ()Lspace/kscience/visionforge/html/HtmlFragment;
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lspace/kscience/visionforge/html/HtmlFragment;)LPlotTabs$Tab;
|
||||
public static synthetic fun copy$default (LPlotTabs$Tab;Ljava/lang/String;Ljava/lang/String;Lspace/kscience/visionforge/html/HtmlFragment;ILjava/lang/Object;)LPlotTabs$Tab;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getContent ()Lspace/kscience/plotly/PlotlyFragment;
|
||||
public final fun getContent ()Lspace/kscience/visionforge/html/HtmlFragment;
|
||||
public final fun getId ()Ljava/lang/String;
|
||||
public final fun getTitle ()Ljava/lang/String;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class SimpleServerKt {
|
||||
public static final fun main ()V
|
||||
public final class ServeStaticPlotsKt {
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
@ -89,10 +89,11 @@ public final class SvgSaveViaOrcaKt {
|
||||
}
|
||||
|
||||
public final class TabPageLayoutKt {
|
||||
public static final fun getCdnBootstrap ()Lspace/kscience/visionforge/html/HtmlFragment;
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
public static final fun tabs (Lspace/kscience/plotly/Plotly;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lspace/kscience/plotly/PlotlyPage;
|
||||
public static synthetic fun tabs$default (Lspace/kscience/plotly/Plotly;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/plotly/PlotlyPage;
|
||||
public static final fun tabs (Lspace/kscience/plotly/Plotly;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lspace/kscience/visionforge/html/VisionPage;
|
||||
public static synthetic fun tabs$default (Lspace/kscience/plotly/Plotly;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/visionforge/html/VisionPage;
|
||||
}
|
||||
|
||||
public final class UnsupportedFeatureKt {
|
||||
@ -177,7 +178,7 @@ public final class candlestick/BasicCandleStickKt {
|
||||
}
|
||||
|
||||
public final class candlestick/DynamicCandleStickKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
@ -252,7 +253,7 @@ public final class geo/ChoroplethKt {
|
||||
}
|
||||
|
||||
public final class geo/DynamicMapKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
@ -355,7 +356,7 @@ public final class io/LoadFromResourceKt {
|
||||
}
|
||||
|
||||
public final class misc/DynamicHistogramKt {
|
||||
public static final fun main ()V
|
||||
public static final fun main (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
@ -8,24 +8,23 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.plotly.plotlyktServer)
|
||||
implementation(projects.plotly.plotlyktJupyter)
|
||||
implementation(projects.plotly.plotlyktScript)
|
||||
implementation(projects.plotlyKt.plotlyKtServer)
|
||||
// implementation(projects.plotly.plotlyktScript)
|
||||
implementation(kotlin("script-runtime"))
|
||||
implementation("org.jetbrains.kotlinx:dataframe:0.13.1")
|
||||
implementation("org.jetbrains.kotlinx:dataframe:0.15.0")
|
||||
}
|
||||
|
||||
kotlin{
|
||||
jvmToolchain(11)
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
// A workaround for https://youtrack.jetbrains.com/issue/KT-44101
|
||||
|
||||
val copyPlotlyResources by tasks.creating(Copy::class){
|
||||
dependsOn(":plotly:plotlykt-core:jvmProcessResources")
|
||||
mustRunAfter(":plotly:plotlykt-core:jvmTestProcessResources")
|
||||
from(project(":plotly:plotlykt-core").layout.buildDirectory.file("processedResources/jvm"))
|
||||
into(layout.buildDirectory.file("resources"))
|
||||
dependsOn(":plotly-kt:plotly-kt-server:jvmProcessResources")
|
||||
mustRunAfter(":plotly-kt:plotly-kt-server:jvmTestProcessResources")
|
||||
from(project(":plotly-kt:plotly-kt-server").layout.buildDirectory.file("processedResources/jvm/main"))
|
||||
into(layout.buildDirectory.file("resources/main"))
|
||||
}
|
||||
|
||||
tasks.getByName("classes").dependsOn(copyPlotlyResources)
|
24
plotly-kt/examples/compose-demo/api/compose-demo.api
Normal file
24
plotly-kt/examples/compose-demo/api/compose-demo.api
Normal file
@ -0,0 +1,24 @@
|
||||
public final class space/kscience/plotly/compose/AppKt {
|
||||
public static final fun App (Landroidx/compose/runtime/Composer;I)V
|
||||
public static final fun getPort ()I
|
||||
public static final fun main ()V
|
||||
public static synthetic fun main ([Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class space/kscience/plotly/compose/ComposableSingletons$AppKt {
|
||||
public static final field INSTANCE Lspace/kscience/plotly/compose/ComposableSingletons$AppKt;
|
||||
public fun <init> ()V
|
||||
public final fun getLambda$-101810039$compose_demo ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getLambda$-1219049393$compose_demo ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getLambda$-430675520$compose_demo ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getLambda$-484018975$compose_demo ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getLambda$1513332475$compose_demo ()Lkotlin/jvm/functions/Function2;
|
||||
}
|
||||
|
||||
public final class space/kscience/plotly/compose/ServerKt {
|
||||
public static final fun Scatter (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Lspace/kscience/plotly/models/Scatter;
|
||||
public static synthetic fun Scatter$default (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/plotly/models/Scatter;
|
||||
public static final fun servePlots (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/coroutines/flow/StateFlow;I)Lio/ktor/server/engine/EmbeddedServer;
|
||||
public static synthetic fun servePlots$default (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/coroutines/flow/StateFlow;IILjava/lang/Object;)Lio/ktor/server/engine/EmbeddedServer;
|
||||
}
|
||||
|
@ -16,12 +16,14 @@ kotlin {
|
||||
sourceSets {
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation(projects.plotlyKt.plotlyKtServer)
|
||||
api("io.ktor:ktor-server-cio")
|
||||
|
||||
implementation(compose.runtime)
|
||||
implementation(compose.foundation)
|
||||
implementation(compose.material)
|
||||
implementation(compose.desktop.currentOs)
|
||||
implementation("io.github.kevinnzou:compose-webview-multiplatform:1.9.8")
|
||||
implementation(projects.plotly.plotlyktServer)
|
||||
implementation("io.github.kevinnzou:compose-webview-multiplatform:1.9.40")
|
||||
implementation(spclibs.logback.classic)
|
||||
}
|
||||
}
|
127
plotly-kt/examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/App.kt
Normal file
127
plotly-kt/examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/App.kt
Normal file
@ -0,0 +1,127 @@
|
||||
package space.kscience.plotly.compose
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Window
|
||||
import androidx.compose.ui.window.application
|
||||
import com.multiplatform.webview.web.LoadingState
|
||||
import com.multiplatform.webview.web.WebView
|
||||
import com.multiplatform.webview.web.rememberWebViewNavigator
|
||||
import com.multiplatform.webview.web.rememberWebViewStateWithHTMLData
|
||||
import dev.datlag.kcef.KCEF
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
private val allowedPages = listOf(
|
||||
"Static",
|
||||
"Dynamic"
|
||||
)
|
||||
|
||||
val port = 7778
|
||||
|
||||
@Composable
|
||||
fun App() {
|
||||
var downloadProgress by remember { mutableStateOf(-1F) }
|
||||
var initialized by remember { mutableStateOf(false) } // if true, KCEF can be used to create clients, browsers etc
|
||||
|
||||
val scaleFlow = remember { MutableStateFlow(1f) }
|
||||
val scale by scaleFlow.collectAsState()
|
||||
val scope = rememberCoroutineScope()
|
||||
val server = remember {
|
||||
scope.servePlots(scaleFlow, port)
|
||||
}
|
||||
|
||||
val state = rememberWebViewStateWithHTMLData(staticPlot())
|
||||
|
||||
val navigator = rememberWebViewNavigator()
|
||||
|
||||
val loadingState = state.loadingState
|
||||
if (loadingState is LoadingState.Loading) {
|
||||
LinearProgressIndicator(
|
||||
progress = loadingState.progress,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
withContext(Dispatchers.IO) { // IO scope recommended but not required
|
||||
KCEF.init(
|
||||
builder = {
|
||||
progress {
|
||||
onDownloading {
|
||||
downloadProgress = it
|
||||
println("Downloading $it")
|
||||
// use this if you want to display a download progress for example
|
||||
}
|
||||
onInitialized {
|
||||
initialized = true
|
||||
}
|
||||
}
|
||||
},
|
||||
onError = {
|
||||
// error during initialization
|
||||
it?.printStackTrace()
|
||||
},
|
||||
onRestartRequired = {
|
||||
// all required CEF packages downloaded but the application needs a restart to load them (unlikely to happen)
|
||||
println("Restart required")
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
DisposableEffect(Unit) {
|
||||
onDispose {
|
||||
KCEF.disposeBlocking()
|
||||
server.stop()
|
||||
}
|
||||
}
|
||||
|
||||
Row(Modifier.fillMaxSize()) {
|
||||
Column(Modifier.width(300.dp)) {
|
||||
Button({
|
||||
val html = staticPlot()
|
||||
println(html)
|
||||
navigator.loadHtml(html)
|
||||
}, modifier = Modifier.fillMaxWidth()) {
|
||||
Text("Static")
|
||||
}
|
||||
Button({ navigator.loadUrl("http://localhost:$port/Dynamic") }, modifier = Modifier.fillMaxWidth()) {
|
||||
Text("Dynamic")
|
||||
}
|
||||
|
||||
Slider(
|
||||
scale,
|
||||
{ scaleFlow.value = it },
|
||||
valueRange = 0.1f..10f,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
Column(Modifier.fillMaxSize()) {
|
||||
|
||||
|
||||
if (initialized) {
|
||||
WebView(
|
||||
state = state,
|
||||
navigator = navigator,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
} else {
|
||||
Text("Downloading CEF: ${downloadProgress}%")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main() = application {
|
||||
Window(onCloseRequest = ::exitApplication) {
|
||||
MaterialTheme {
|
||||
App()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package space.kscience.plotly.compose
|
||||
|
||||
import io.ktor.server.engine.ApplicationEngine
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.EmbeddedServer
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
@ -8,14 +10,29 @@ import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import space.kscience.plotly.*
|
||||
import space.kscience.plotly.models.Scatter
|
||||
import space.kscience.plotly.models.invoke
|
||||
import space.kscience.plotly.server.pushUpdates
|
||||
import space.kscience.plotly.server.serve
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.visionforge.html.VisionPage
|
||||
import space.kscience.visionforge.html.makeString
|
||||
import space.kscience.visionforge.plotly.plotlyPage
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun staticPlot(): String = Plotly.page {
|
||||
|
||||
public fun Scatter(
|
||||
xs: Any,
|
||||
ys: Any? = null,
|
||||
zs: Any? = null,
|
||||
block: Trace.() -> Unit,
|
||||
): Scatter = Scatter().apply {
|
||||
x.set(xs)
|
||||
if (ys != null) y.set(ys)
|
||||
if (zs != null) z.set(zs)
|
||||
block()
|
||||
}
|
||||
|
||||
|
||||
internal fun staticPlot(): String = Plotly.plugin.visionManager.VisionPage(cdnPlotlyHeader) {
|
||||
val x = (0..100).map { it.toDouble() / 100.0 }.toDoubleArray()
|
||||
val y1 = x.map { sin(2.0 * PI * it) }.toDoubleArray()
|
||||
val y2 = x.map { cos(2.0 * PI * it) }.toDoubleArray()
|
||||
@ -25,7 +42,7 @@ fun staticPlot(): String = Plotly.page {
|
||||
val trace2 = Scatter(x, y2) {
|
||||
name = "cos"
|
||||
}
|
||||
plot(config = PlotlyConfig { responsive = true }) {//static plot
|
||||
staticPlot {
|
||||
traces(trace1, trace2)
|
||||
layout {
|
||||
title = "First graph, row: 1, size: 8/12"
|
||||
@ -33,11 +50,13 @@ fun staticPlot(): String = Plotly.page {
|
||||
yaxis { title = "y axis name" }
|
||||
}
|
||||
}
|
||||
}.render()
|
||||
}.makeString()
|
||||
|
||||
fun CoroutineScope.servePlots(scale: StateFlow<Number>): ApplicationEngine = Plotly.serve(this, port = 7778) {
|
||||
page("Static") { container ->
|
||||
val x = (0..100).map { it.toDouble() / 100.0 }.toDoubleArray()
|
||||
fun CoroutineScope.servePlots(scale: StateFlow<Number>, port: Int = 7778): EmbeddedServer<*, *> = embeddedServer(CIO, port = port) {
|
||||
|
||||
val x = (0..100).map { it.toDouble() / 100.0 }.toDoubleArray()
|
||||
|
||||
plotlyPage("Static") {
|
||||
val y1 = x.map { sin(2.0 * PI * it) }.toDoubleArray()
|
||||
val y2 = x.map { cos(2.0 * PI * it) }.toDoubleArray()
|
||||
val trace1 = Scatter(x, y1) {
|
||||
@ -46,7 +65,8 @@ fun CoroutineScope.servePlots(scale: StateFlow<Number>): ApplicationEngine = Plo
|
||||
val trace2 = Scatter(x, y2) {
|
||||
name = "cos"
|
||||
}
|
||||
plot(renderer = container) {//static plot
|
||||
|
||||
plot {
|
||||
traces(trace1, trace2)
|
||||
layout {
|
||||
title = "First graph, row: 1, size: 8/12"
|
||||
@ -56,37 +76,35 @@ fun CoroutineScope.servePlots(scale: StateFlow<Number>): ApplicationEngine = Plo
|
||||
}
|
||||
}
|
||||
|
||||
page("Dynamic") { container ->
|
||||
val x = (0..100).map { it.toDouble() / 100.0 }
|
||||
plotlyPage("Dynamic") {
|
||||
val y = x.map { sin(2.0 * PI * it) }
|
||||
|
||||
val trace = Scatter(x, y) { name = "sin" }
|
||||
|
||||
val plot = plot("dynamic", config = PlotlyConfig { responsive = true }, renderer = container) {
|
||||
|
||||
plot {
|
||||
traces(trace)
|
||||
layout {
|
||||
title = "Dynamic plot"
|
||||
xaxis.title = "x axis name"
|
||||
yaxis.title = "y axis name"
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
var time: Long = 0
|
||||
while (isActive) {
|
||||
delay(10)
|
||||
time += 10
|
||||
val frequency = scale.value.toDouble()
|
||||
val dynamicY = x.map { sin(2.0 * PI * frequency * (it + time.toDouble() / 1000.0)) }
|
||||
//trace.y.numbers = dynamicY
|
||||
plot.data[0].y.numbers = dynamicY
|
||||
plot.layout {
|
||||
xaxis.title = "x axis name (t = $time)"
|
||||
launch {
|
||||
var time: Long = 0
|
||||
while (isActive) {
|
||||
delay(10)
|
||||
time += 10
|
||||
val frequency = scale.value.toDouble()
|
||||
val dynamicY = x.map { sin(2.0 * PI * frequency * (it + time.toDouble() / 1000.0)) }
|
||||
//trace.y.numbers = dynamicY
|
||||
data[0].y.numbers = dynamicY
|
||||
layout {
|
||||
xaxis.title = "x axis name (t = $time)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pushUpdates(100)
|
||||
}
|
||||
|
||||
}.start()
|
||||
|
@ -10,14 +10,13 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":plotly:plotlykt-server"))
|
||||
implementation("no.tornado:tornadofx:1.7.20")
|
||||
implementation(spclibs.logback.classic)
|
||||
}
|
||||
|
||||
javafx{
|
||||
modules("javafx.web")
|
||||
version = "11"
|
||||
version = "17"
|
||||
}
|
||||
|
||||
application {
|
||||
@ -25,6 +24,6 @@ application {
|
||||
}
|
||||
|
||||
kotlin{
|
||||
jvmToolchain(11)
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import space.kscience.plotly.Plotly
|
||||
import space.kscience.plotly.layout
|
||||
import space.kscience.plotly.models.Trace
|
||||
import space.kscience.plotly.models.invoke
|
||||
import space.kscience.plotly.plot
|
||||
import space.kscience.plotly.plotly
|
||||
import space.kscience.plotly.server.pushUpdates
|
||||
import space.kscience.plotly.server.serve
|
||||
import kotlin.math.PI
|
||||
@ -27,7 +27,7 @@ fun serve(scale: ObservableIntegerValue) = Plotly.serve(port = 7778) {
|
||||
val trace2 = Trace(x, y2) {
|
||||
name = "cos"
|
||||
}
|
||||
plot {//static plot
|
||||
plotly {//static plot
|
||||
traces(trace1, trace2)
|
||||
layout {
|
||||
title = "First graph, row: 1, size: 8/12"
|
||||
@ -43,7 +43,7 @@ fun serve(scale: ObservableIntegerValue) = Plotly.serve(port = 7778) {
|
||||
|
||||
val trace = Trace(x, y) { name = "sin" }
|
||||
|
||||
val plot = plot("dynamic", renderer = container) {
|
||||
val plot = plotly("dynamic", renderer = container) {
|
||||
traces(trace)
|
||||
layout {
|
||||
title = "Dynamic plot"
|
@ -15,7 +15,7 @@ kotlin {
|
||||
sourceSets{
|
||||
jsMain{
|
||||
dependencies{
|
||||
implementation(projects.plotly.plotlyktCore)
|
||||
implementation(projects.plotlyKt.plotlyKtCore)
|
||||
implementation(spclibs.kotlinx.coroutines.core)
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ kotlin {
|
||||
sourceSets{
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(project(":plotly:plotlykt-core"))
|
||||
implementation(project(":plotly-kt:plotly-kt-core"))
|
||||
}
|
||||
}
|
||||
}
|
286
plotly-kt/examples/notebooks/plotlykt-demo.ipynb
Normal file
286
plotly-kt/examples/notebooks/plotlykt-demo.ipynb
Normal file
@ -0,0 +1,286 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-01-29T05:44:54.673735900Z",
|
||||
"start_time": "2025-01-29T05:44:53.204850Z"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"//import space.kscience.plotly.PlotlyIntegration\n",
|
||||
"//USE(PlotlyIntegration())\n",
|
||||
"@file:CompilerArgs(\"-jvm-target=11\")\n",
|
||||
"@file:Repository(\"https://repo.kotlin.link\")\n",
|
||||
"@file:DependsOn(\"space.kscience:plotlykt-jupyter-jvm:0.7.1.1\")"
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": 9
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-01-29T05:44:45.885663700Z",
|
||||
"start_time": "2025-01-29T05:44:45.777526100Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": "Plotly.jupyter.notebook()",
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div style=\"color: blue;\">Plotly notebook integration switched into the notebook mode.</div>\n"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"execution_count": 2
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
"tags": [],
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-01-29T05:44:56.131336600Z",
|
||||
"start_time": "2025-01-29T05:44:55.855736400Z"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"import kotlin.math.*\n",
|
||||
"\n",
|
||||
"val x1 = (0..100).map { it.toDouble() / 100.0 }\n",
|
||||
"val y1 = x1.map { sin(2.0 * PI * it) }\n",
|
||||
"val y2 = x1.map { cos(2.0 * PI * it) }\n",
|
||||
"\n",
|
||||
"val trace1 = Trace(x1, y1) { name = \"sin\" }\n",
|
||||
"val trace2 = Trace(x1, y2) { name = \"cos\" }\n",
|
||||
"\n",
|
||||
"Plotly.page { renderer ->\n",
|
||||
" val plotConfig = PlotlyConfig{\n",
|
||||
" responsive = true\n",
|
||||
" imageFormat = \"svg\"\n",
|
||||
" } \n",
|
||||
" h1 { +\"A custom header\" }\n",
|
||||
" hr()\n",
|
||||
" plot(\"below\", config = plotConfig, renderer = renderer) {\n",
|
||||
" traces(trace1, trace2)\n",
|
||||
" layout {\n",
|
||||
" title = \"The plot below\"\n",
|
||||
" xaxis.title = \"x axis name\"\n",
|
||||
" yaxis.title = \"y axis name\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
"}"
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<html>\n",
|
||||
" <head>\n",
|
||||
" <meta charset=\"utf-8\">\n",
|
||||
" <title>Plotly.kt</title>\n",
|
||||
" <script type=\"text/javascript\" src=\"https://cdn.plot.ly/plotly-2.24.1.min.js\"></script>\n",
|
||||
" </head>\n",
|
||||
" <body>\n",
|
||||
" <h1>A custom header</h1>\n",
|
||||
" <hr>\n",
|
||||
" <div id=\"below\">\n",
|
||||
" <script>if(typeof Plotly !== \"undefined\"){\n",
|
||||
" Plotly.react(\n",
|
||||
" 'below',\n",
|
||||
" [{\"y\":[0.0,0.06279051952931337,0.12533323356430426,0.1873813145857246,0.2486898871648548,0.3090169943749474,0.3681245526846779,0.4257792915650727,0.4817536741017153,0.5358267949789967,0.5877852522924731,0.6374239897486896,0.6845471059286886,0.7289686274214116,0.7705132427757893,0.8090169943749475,0.8443279255020151,0.8763066800438637,0.9048270524660196,0.9297764858882513,0.9510565162951535,0.9685831611286311,0.9822872507286886,0.9921147013144779,0.9980267284282716,1.0,0.9980267284282716,0.9921147013144778,0.9822872507286886,0.9685831611286312,0.9510565162951536,0.9297764858882513,0.9048270524660195,0.8763066800438635,0.844327925502015,0.8090169943749475,0.7705132427757893,0.7289686274214114,0.6845471059286888,0.6374239897486899,0.5877852522924732,0.535826794978997,0.4817536741017156,0.4257792915650729,0.36812455268467814,0.3090169943749475,0.24868988716485482,0.18738131458572502,0.12533323356430454,0.06279051952931358,1.2246467991473532E-16,-0.06279051952931335,-0.12533323356430429,-0.18738131458572477,-0.24868988716485502,-0.30901699437494773,-0.3681245526846783,-0.42577929156507227,-0.481753674101715,-0.5358267949789964,-0.587785252292473,-0.6374239897486896,-0.6845471059286887,-0.7289686274214113,-0.7705132427757894,-0.8090169943749473,-0.8443279255020153,-0.8763066800438636,-0.9048270524660198,-0.9297764858882511,-0.9510565162951535,-0.968583161128631,-0.9822872507286887,-0.9921147013144778,-0.9980267284282716,-1.0,-0.9980267284282716,-0.9921147013144779,-0.9822872507286887,-0.9685831611286311,-0.9510565162951536,-0.9297764858882512,-0.9048270524660199,-0.8763066800438638,-0.8443279255020155,-0.8090169943749476,-0.7705132427757896,-0.7289686274214116,-0.684547105928689,-0.6374239897486896,-0.5877852522924734,-0.5358267949789963,-0.4817536741017153,-0.4257792915650722,-0.3681245526846787,-0.3090169943749476,-0.24868988716485535,-0.18738131458572468,-0.12533323356430465,-0.06279051952931326,-2.4492935982947064E-16],\"x\":[0.0,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.11,0.12,0.13,0.14,0.15,0.16,0.17,0.18,0.19,0.2,0.21,0.22,0.23,0.24,0.25,0.26,0.27,0.28,0.29,0.3,0.31,0.32,0.33,0.34,0.35,0.36,0.37,0.38,0.39,0.4,0.41,0.42,0.43,0.44,0.45,0.46,0.47,0.48,0.49,0.5,0.51,0.52,0.53,0.54,0.55,0.56,0.57,0.58,0.59,0.6,0.61,0.62,0.63,0.64,0.65,0.66,0.67,0.68,0.69,0.7,0.71,0.72,0.73,0.74,0.75,0.76,0.77,0.78,0.79,0.8,0.81,0.82,0.83,0.84,0.85,0.86,0.87,0.88,0.89,0.9,0.91,0.92,0.93,0.94,0.95,0.96,0.97,0.98,0.99,1.0],\"name\":\"sin\"},{\"y\":[1.0,0.9980267284282716,0.9921147013144779,0.9822872507286887,0.9685831611286311,0.9510565162951535,0.9297764858882515,0.9048270524660195,0.8763066800438636,0.8443279255020151,0.8090169943749475,0.7705132427757893,0.7289686274214116,0.6845471059286886,0.6374239897486896,0.5877852522924731,0.5358267949789965,0.48175367410171516,0.42577929156507266,0.3681245526846781,0.30901699437494745,0.24868988716485496,0.18738131458572474,0.12533323356430426,0.06279051952931353,6.123233995736766E-17,-0.0627905195293134,-0.12533323356430437,-0.18738131458572482,-0.24868988716485463,-0.30901699437494734,-0.368124552684678,-0.4257792915650727,-0.48175367410171543,-0.5358267949789969,-0.587785252292473,-0.6374239897486897,-0.6845471059286887,-0.7289686274214113,-0.7705132427757891,-0.8090169943749473,-0.8443279255020149,-0.8763066800438634,-0.9048270524660194,-0.9297764858882513,-0.9510565162951535,-0.9685831611286311,-0.9822872507286886,-0.9921147013144778,-0.9980267284282716,-1.0,-0.9980267284282716,-0.9921147013144779,-0.9822872507286886,-0.9685831611286311,-0.9510565162951535,-0.9297764858882512,-0.9048270524660197,-0.8763066800438637,-0.8443279255020152,-0.8090169943749476,-0.7705132427757893,-0.7289686274214116,-0.684547105928689,-0.6374239897486895,-0.5877852522924732,-0.5358267949789963,-0.48175367410171527,-0.42577929156507216,-0.3681245526846786,-0.30901699437494756,-0.2486898871648553,-0.18738131458572463,-0.1253332335643046,-0.06279051952931321,-1.8369701987210297E-16,0.06279051952931283,0.12533323356430423,0.18738131458572427,0.24868988716485493,0.30901699437494723,0.36812455268467825,0.4257792915650718,0.48175367410171493,0.535826794978996,0.5877852522924729,0.6374239897486893,0.6845471059286886,0.7289686274214112,0.7705132427757894,0.8090169943749473,0.8443279255020153,0.8763066800438636,0.9048270524660197,0.9297764858882511,0.9510565162951535,0.968583161128631,0.9822872507286887,0.9921147013144778,0.9980267284282716,1.0],\"x\":[0.0,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.11,0.12,0.13,0.14,0.15,0.16,0.17,0.18,0.19,0.2,0.21,0.22,0.23,0.24,0.25,0.26,0.27,0.28,0.29,0.3,0.31,0.32,0.33,0.34,0.35,0.36,0.37,0.38,0.39,0.4,0.41,0.42,0.43,0.44,0.45,0.46,0.47,0.48,0.49,0.5,0.51,0.52,0.53,0.54,0.55,0.56,0.57,0.58,0.59,0.6,0.61,0.62,0.63,0.64,0.65,0.66,0.67,0.68,0.69,0.7,0.71,0.72,0.73,0.74,0.75,0.76,0.77,0.78,0.79,0.8,0.81,0.82,0.83,0.84,0.85,0.86,0.87,0.88,0.89,0.9,0.91,0.92,0.93,0.94,0.95,0.96,0.97,0.98,0.99,1.0],\"name\":\"cos\"}],\n",
|
||||
" {\"title\":{\"text\":\"The plot below\"},\"xaxis\":{\"title\":\"x axis name\"},\"yaxis\":{\"title\":\"y axis name\"}},\n",
|
||||
" {\"toImageButtonOptions\":{\"format\":\"svg\"},\"responsive\":true}\n",
|
||||
" ); \n",
|
||||
"} else {\n",
|
||||
" console.error(\"Plotly not loaded\")\n",
|
||||
"}</script>\n",
|
||||
" </div>\n",
|
||||
" </body>\n",
|
||||
"</html>\n"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"text/html": {
|
||||
"isolated": true
|
||||
}
|
||||
},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"execution_count": 10
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"HTML(\n",
|
||||
" \"\"\"\n",
|
||||
" <div id=\"debug\">\n",
|
||||
" debug\n",
|
||||
" </div>\n",
|
||||
" \"\"\".trimIndent()\n",
|
||||
")"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-01-29T05:44:47.639174900Z",
|
||||
"start_time": "2025-01-29T05:44:47.443119300Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div id=\"debug\">\n",
|
||||
" debug\n",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"execution_count": 4
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"HTML(\"\"\"\n",
|
||||
"<script type = \"text/javascript\">\n",
|
||||
" element = document.getElementById(\"debug\")\n",
|
||||
" element.append(window.Plotly)\n",
|
||||
" element.append(window.plotlyConnect)\n",
|
||||
"</script>\n",
|
||||
" \"\"\".trimIndent())"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-01-29T05:44:47.996860500Z",
|
||||
"start_time": "2025-01-29T05:44:47.801222500Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<script type = \"text/javascript\">\n",
|
||||
" element = document.getElementById(\"debug\")\n",
|
||||
" element.append(window.Plotly)\n",
|
||||
" element.append(window.plotlyConnect)\n",
|
||||
"</script>"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"execution_count": 5
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-01-29T05:44:48.014863Z",
|
||||
"start_time": "2025-01-29T05:44:48.010858500Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"HTML(\"\"\"\n",
|
||||
"<script src=\"https://cdn.plot.ly/plotly-2.29.1.min.js\" charset=\"utf-8\"></script>\n",
|
||||
"\"\"\")"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-01-29T05:44:48.097386400Z",
|
||||
"start_time": "2025-01-29T05:44:48.036859600Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"\n",
|
||||
"<script src=\"https://cdn.plot.ly/plotly-2.29.1.min.js\" charset=\"utf-8\"></script>\n"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"execution_count": 7
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-01-29T05:44:48.109384Z",
|
||||
"start_time": "2025-01-29T05:44:48.106385700Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"@webio": {
|
||||
"lastCommId": null,
|
||||
"lastKernelId": null
|
||||
},
|
||||
"hide_input": false,
|
||||
"kernelspec": {
|
||||
"display_name": "Kotlin",
|
||||
"language": "kotlin",
|
||||
"name": "kotlin"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": "text/x-kotlin",
|
||||
"file_extension": ".kt",
|
||||
"mimetype": "text/x-kotlin",
|
||||
"name": "kotlin",
|
||||
"nbconvert_exporter": "",
|
||||
"pygments_lexer": "kotlin",
|
||||
"version": "1.5.30-dev-598"
|
||||
},
|
||||
"toc": {
|
||||
"base_numbering": 1,
|
||||
"nav_menu": {},
|
||||
"number_sections": false,
|
||||
"sideBar": false,
|
||||
"skip_h1_title": false,
|
||||
"title_cell": "Table of Contents",
|
||||
"title_sidebar": "Contents",
|
||||
"toc_cell": false,
|
||||
"toc_position": {},
|
||||
"toc_section_display": false,
|
||||
"toc_window_display": false
|
||||
},
|
||||
"ktnbPluginMetadata": {
|
||||
"projectLibraries": false
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -2,32 +2,43 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import space.kscience.plotly.server.PlotlyServerIntegration\n",
|
||||
"import space.kscience.plotly.server.jupyter\n",
|
||||
"\n",
|
||||
"USE(PlotlyServerIntegration())"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"//import space.kscience.plotly.server.PlotlyServerIntegration\n",
|
||||
"//import space.kscience.plotly.server.jupyter\n",
|
||||
"//\n",
|
||||
"//USE(PlotlyServerIntegration())\n",
|
||||
"@file:CompilerArgs(\"-jvm-target=11\")\n",
|
||||
"@file:Repository(\"https://repo.kotlin.link\")\n",
|
||||
"@file:DependsOn(\"space.kscience:plotlykt-server-jvm:0.7.1.1\")"
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": "Plotly.jupyter.notebook()",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import kotlin.math.*"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"val x1 = (0..100).map { it.toDouble() / 100.0 }\n",
|
||||
"val y1 = x1.map { sin(2.0 * PI * it) }\n",
|
||||
@ -64,13 +75,13 @@
|
||||
" }\n",
|
||||
"}\n",
|
||||
"fragment"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"Plotly.plot {\n",
|
||||
" traces(trace1, trace2)\n",
|
||||
@ -80,13 +91,13 @@
|
||||
" yaxis.title = \"y axis name\"\n",
|
||||
" }\n",
|
||||
"}"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"val x = (0..100).map { it.toDouble() / 100.0 }\n",
|
||||
"val y = x.map { sin(2.0 * PI * it) }\n",
|
||||
@ -104,13 +115,13 @@
|
||||
"}\n",
|
||||
"\n",
|
||||
"dynamicPlot"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import kotlinx.coroutines.*\n",
|
||||
"\n",
|
||||
@ -123,52 +134,57 @@
|
||||
" trace.y.set(dynamicY)\n",
|
||||
" }\n",
|
||||
"}"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"job.cancel()"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"dynamicPlot.layout.xaxis.title = \"крокозябра\""
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"Plotly.jupyter.port = 8884"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"Plotly.jupyter.port"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -182,6 +198,9 @@
|
||||
"language": "kotlin",
|
||||
"name": "kotlin"
|
||||
},
|
||||
"ktnbPluginMetadata": {
|
||||
"projectLibraries": false
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": "text/x-kotlin",
|
||||
"file_extension": ".kt",
|
||||
@ -189,7 +208,7 @@
|
||||
"name": "kotlin",
|
||||
"nbconvert_exporter": "",
|
||||
"pygments_lexer": "kotlin",
|
||||
"version": "1.5.30-dev-598"
|
||||
"version": "1.9.23"
|
||||
},
|
||||
"toc": {
|
||||
"base_numbering": 1,
|
||||
@ -203,9 +222,6 @@
|
||||
"toc_position": {},
|
||||
"toc_section_display": false,
|
||||
"toc_window_display": false
|
||||
},
|
||||
"ktnbPluginMetadata": {
|
||||
"projectDependencies": true
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user