Fix serial names for trajectory serializers

This commit is contained in:
Alexander Nozik 2023-02-12 10:40:53 +03:00
parent 6deeaf057e
commit 784d397ab1

View File

@ -6,6 +6,7 @@
package space.kscience.kmath.trajectory package space.kscience.kmath.trajectory
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers import kotlinx.serialization.UseSerializers
import space.kscience.kmath.geometry.* import space.kscience.kmath.geometry.*
@ -21,6 +22,7 @@ public sealed interface Trajectory2D {
* Straight path segment. The order of start and end defines the direction * Straight path segment. The order of start and end defines the direction
*/ */
@Serializable @Serializable
@SerialName("straight")
public data class StraightTrajectory2D( public data class StraightTrajectory2D(
public val start: DoubleVector2D, public val start: DoubleVector2D,
public val end: DoubleVector2D, public val end: DoubleVector2D,
@ -34,6 +36,7 @@ public data class StraightTrajectory2D(
* An arc segment * An arc segment
*/ */
@Serializable @Serializable
@SerialName("arc")
public data class CircleTrajectory2D( public data class CircleTrajectory2D(
public val circle: Circle2D, public val circle: Circle2D,
public val start: DubinsPose2D, public val start: DubinsPose2D,
@ -106,6 +109,7 @@ public data class CircleTrajectory2D(
} }
@Serializable @Serializable
@SerialName("composite")
public class CompositeTrajectory2D(public val segments: List<Trajectory2D>) : Trajectory2D { public class CompositeTrajectory2D(public val segments: List<Trajectory2D>) : Trajectory2D {
override val length: Double get() = segments.sumOf { it.length } override val length: Double get() = segments.sumOf { it.length }
} }