From 0ee14aa90e58a12f32a77e51c0f436525516bfa9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 5 Sep 2021 18:58:55 +0300 Subject: [PATCH] Minor fix to solid signatures --- .../kotlin/space/kscience/visionforge/solid/ConeSurface.kt | 3 ++- .../kotlin/space/kscience/visionforge/solid/Convex.kt | 3 ++- .../kotlin/space/kscience/visionforge/solid/PolyLine.kt | 7 ++----- .../kotlin/space/kscience/visionforge/solid/SolidLabel.kt | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/ConeSurface.kt b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/ConeSurface.kt index a9c5622b..25f79ee8 100644 --- a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/ConeSurface.kt +++ b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/ConeSurface.kt @@ -4,6 +4,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import space.kscience.visionforge.VisionBuilder import space.kscience.visionforge.VisionContainerBuilder +import space.kscience.visionforge.VisionPropertyContainer import space.kscience.visionforge.set import kotlin.math.PI import kotlin.math.cos @@ -23,7 +24,7 @@ public class ConeSurface( public val topInnerRadius: Float, public val startAngle: Float = 0f, public val angle: Float = PI2, -) : SolidBase(), GeometrySolid { +) : SolidBase(), GeometrySolid, VisionPropertyContainer { init { require(bottomRadius > 0) { "Cone surface bottom radius must be positive" } diff --git a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/Convex.kt b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/Convex.kt index 2d242391..24d1ff16 100644 --- a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/Convex.kt +++ b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/Convex.kt @@ -3,11 +3,12 @@ package space.kscience.visionforge.solid import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import space.kscience.visionforge.VisionContainerBuilder +import space.kscience.visionforge.VisionPropertyContainer import space.kscience.visionforge.set @Serializable @SerialName("solid.convex") -public class Convex(public val points: List) : SolidBase(), Solid +public class Convex(public val points: List) : SolidBase(), VisionPropertyContainer public inline fun VisionContainerBuilder.convex(name: String? = null, action: ConvexBuilder.() -> Unit = {}): Convex = ConvexBuilder().apply(action).build().also { set(name, it) } diff --git a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/PolyLine.kt b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/PolyLine.kt index d8aa937c..05d58744 100644 --- a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/PolyLine.kt +++ b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/PolyLine.kt @@ -5,14 +5,11 @@ import kotlinx.serialization.Serializable import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.asName import space.kscience.dataforge.names.plus -import space.kscience.visionforge.VisionBuilder -import space.kscience.visionforge.VisionContainerBuilder -import space.kscience.visionforge.numberProperty -import space.kscience.visionforge.set +import space.kscience.visionforge.* @Serializable @SerialName("solid.line") -public class PolyLine(public val points: List) : SolidBase(), Solid { +public class PolyLine(public val points: List) : SolidBase(), VisionPropertyContainer { //var lineType by string() public var thickness: Number by numberProperty(name = SolidMaterial.MATERIAL_KEY + THICKNESS_KEY) { 1.0 } diff --git a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/SolidLabel.kt b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/SolidLabel.kt index 3e725d0d..8cf27881 100644 --- a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/SolidLabel.kt +++ b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/SolidLabel.kt @@ -4,6 +4,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import space.kscience.visionforge.VisionBuilder import space.kscience.visionforge.VisionContainerBuilder +import space.kscience.visionforge.VisionPropertyContainer import space.kscience.visionforge.set @Serializable @@ -12,7 +13,7 @@ public class SolidLabel( public val text: String, public val fontSize: Double, public val fontFamily: String, -) : SolidBase(), Solid +) : SolidBase(), VisionPropertyContainer @VisionBuilder public fun VisionContainerBuilder.label(