SerialName for all defined 3d objects

This commit is contained in:
Alexander Nozik 2020-03-07 10:49:13 +03:00
parent 82c003ca22
commit 5e1abf7d9d
8 changed files with 16 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import hep.dataforge.meta.Config
import hep.dataforge.meta.update
import hep.dataforge.vis.common.AbstractVisualObject
import hep.dataforge.vis.common.set
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
@ -17,6 +18,7 @@ enum class CompositeType {
}
@Serializable
@SerialName("3d.composite")
class Composite(
val compositeType: CompositeType,
val first: VisualObject3D,

View File

@ -6,6 +6,7 @@ import hep.dataforge.io.serialization.ConfigSerializer
import hep.dataforge.meta.Config
import hep.dataforge.vis.common.AbstractVisualObject
import hep.dataforge.vis.common.set
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import kotlin.math.cos
@ -15,6 +16,7 @@ import kotlin.math.sin
* A cylinder or cut cone segment
*/
@Serializable
@SerialName("3d.cone")
class ConeSegment(
var radius: Float,
var height: Float,

View File

@ -6,10 +6,12 @@ import hep.dataforge.io.serialization.ConfigSerializer
import hep.dataforge.meta.Config
import hep.dataforge.vis.common.AbstractVisualObject
import hep.dataforge.vis.common.set
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
@Serializable
@SerialName("3d.convex")
class Convex(val points: List<Point3D>) : AbstractVisualObject(), VisualObject3D {
@Serializable(ConfigSerializer::class)

View File

@ -5,6 +5,7 @@ import hep.dataforge.io.serialization.ConfigSerializer
import hep.dataforge.meta.Config
import hep.dataforge.vis.common.AbstractVisualObject
import hep.dataforge.vis.common.set
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import kotlin.math.PI
@ -38,6 +39,7 @@ fun Shape2DBuilder.polygon(vertices: Int, radius: Number) {
data class Layer(var x: Float, var y: Float, var z: Float, var scale: Float)
@Serializable
@SerialName("3d.extrude")
class Extruded(
var shape: List<Point2D> = ArrayList(),
var layers: MutableList<Layer> = ArrayList()

View File

@ -6,10 +6,12 @@ import hep.dataforge.io.serialization.ConfigSerializer
import hep.dataforge.meta.Config
import hep.dataforge.vis.common.AbstractVisualObject
import hep.dataforge.vis.common.set
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
@Serializable
@SerialName("3d.label")
class Label3D(var text: String, var fontSize: Double, var fontFamily: String) : AbstractVisualObject(),
VisualObject3D {
@Serializable(ConfigSerializer::class)

View File

@ -9,10 +9,12 @@ import hep.dataforge.names.asName
import hep.dataforge.names.plus
import hep.dataforge.vis.common.AbstractVisualObject
import hep.dataforge.vis.common.set
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
@Serializable
@SerialName("3d.line")
class PolyLine(var points: List<Point3D>) : AbstractVisualObject(), VisualObject3D {
@Serializable(ConfigSerializer::class)
override var properties: Config? = null

View File

@ -6,6 +6,7 @@ import hep.dataforge.io.serialization.ConfigSerializer
import hep.dataforge.meta.Config
import hep.dataforge.vis.common.AbstractVisualObject
import hep.dataforge.vis.common.set
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import kotlin.math.PI
@ -13,6 +14,7 @@ import kotlin.math.cos
import kotlin.math.sin
@Serializable
@SerialName("3d.sphere")
class Sphere(
var radius: Float,
var phiStart: Float = 0f,

View File

@ -5,6 +5,7 @@ import hep.dataforge.io.serialization.ConfigSerializer
import hep.dataforge.meta.Config
import hep.dataforge.vis.common.AbstractVisualObject
import hep.dataforge.vis.common.set
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import kotlin.math.PI
@ -15,6 +16,7 @@ import kotlin.math.sin
* Straight tube segment
*/
@Serializable
@SerialName("3d.tube")
class Tube(
var radius: Float,
var height: Float,