Minor fix to solid signatures

This commit is contained in:
Alexander Nozik 2021-09-05 18:58:55 +03:00
parent e25c1bd49b
commit 0ee14aa90e
4 changed files with 8 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import space.kscience.visionforge.VisionBuilder import space.kscience.visionforge.VisionBuilder
import space.kscience.visionforge.VisionContainerBuilder import space.kscience.visionforge.VisionContainerBuilder
import space.kscience.visionforge.VisionPropertyContainer
import space.kscience.visionforge.set import space.kscience.visionforge.set
import kotlin.math.PI import kotlin.math.PI
import kotlin.math.cos import kotlin.math.cos
@ -23,7 +24,7 @@ public class ConeSurface(
public val topInnerRadius: Float, public val topInnerRadius: Float,
public val startAngle: Float = 0f, public val startAngle: Float = 0f,
public val angle: Float = PI2, public val angle: Float = PI2,
) : SolidBase(), GeometrySolid { ) : SolidBase(), GeometrySolid, VisionPropertyContainer<ConeSurface> {
init { init {
require(bottomRadius > 0) { "Cone surface bottom radius must be positive" } require(bottomRadius > 0) { "Cone surface bottom radius must be positive" }

View File

@ -3,11 +3,12 @@ package space.kscience.visionforge.solid
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import space.kscience.visionforge.VisionContainerBuilder import space.kscience.visionforge.VisionContainerBuilder
import space.kscience.visionforge.VisionPropertyContainer
import space.kscience.visionforge.set import space.kscience.visionforge.set
@Serializable @Serializable
@SerialName("solid.convex") @SerialName("solid.convex")
public class Convex(public val points: List<Point3D>) : SolidBase(), Solid public class Convex(public val points: List<Point3D>) : SolidBase(), VisionPropertyContainer<Convex>
public inline fun VisionContainerBuilder<Solid>.convex(name: String? = null, action: ConvexBuilder.() -> Unit = {}): Convex = public inline fun VisionContainerBuilder<Solid>.convex(name: String? = null, action: ConvexBuilder.() -> Unit = {}): Convex =
ConvexBuilder().apply(action).build().also { set(name, it) } ConvexBuilder().apply(action).build().also { set(name, it) }

View File

@ -5,14 +5,11 @@ import kotlinx.serialization.Serializable
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.asName import space.kscience.dataforge.names.asName
import space.kscience.dataforge.names.plus import space.kscience.dataforge.names.plus
import space.kscience.visionforge.VisionBuilder import space.kscience.visionforge.*
import space.kscience.visionforge.VisionContainerBuilder
import space.kscience.visionforge.numberProperty
import space.kscience.visionforge.set
@Serializable @Serializable
@SerialName("solid.line") @SerialName("solid.line")
public class PolyLine(public val points: List<Point3D>) : SolidBase(), Solid { public class PolyLine(public val points: List<Point3D>) : SolidBase(), VisionPropertyContainer<PolyLine> {
//var lineType by string() //var lineType by string()
public var thickness: Number by numberProperty(name = SolidMaterial.MATERIAL_KEY + THICKNESS_KEY) { 1.0 } public var thickness: Number by numberProperty(name = SolidMaterial.MATERIAL_KEY + THICKNESS_KEY) { 1.0 }

View File

@ -4,6 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import space.kscience.visionforge.VisionBuilder import space.kscience.visionforge.VisionBuilder
import space.kscience.visionforge.VisionContainerBuilder import space.kscience.visionforge.VisionContainerBuilder
import space.kscience.visionforge.VisionPropertyContainer
import space.kscience.visionforge.set import space.kscience.visionforge.set
@Serializable @Serializable
@ -12,7 +13,7 @@ public class SolidLabel(
public val text: String, public val text: String,
public val fontSize: Double, public val fontSize: Double,
public val fontFamily: String, public val fontFamily: String,
) : SolidBase(), Solid ) : SolidBase(), VisionPropertyContainer<SolidLabel>
@VisionBuilder @VisionBuilder
public fun VisionContainerBuilder<Solid>.label( public fun VisionContainerBuilder<Solid>.label(