All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.earth.worldwind.geom.LookAt.kt Maven / Gradle / Ivy

Go to download

The WorldWind Kotlin SDK (WWK) includes the library, examples and tutorials for building multiplatform 3D virtual globe applications for Android, Web and Java.

The newest version!
package earth.worldwind.geom

import earth.worldwind.geom.Angle.Companion.ZERO

open class LookAt(
    val position: Position, var altitudeMode: AltitudeMode, var range: Double, var heading: Angle, var tilt: Angle, var roll: Angle,
) {
    constructor(): this(
        position = Position(),
        altitudeMode = AltitudeMode.ABSOLUTE,
        range = 0.0,
        heading = ZERO,
        tilt = ZERO,
        roll = ZERO)

    constructor(lookAt: LookAt): this(
        Position(lookAt.position),
        lookAt.altitudeMode,
        lookAt.range,
        lookAt.heading,
        lookAt.tilt,
        lookAt.roll
    )

    fun set(
        latitude: Angle, longitude: Angle, altitude: Double, altitudeMode: AltitudeMode,
        range: Double, heading: Angle, tilt: Angle, roll: Angle
    ) = apply {
        this.position.set(latitude, longitude, altitude)
        this.altitudeMode = altitudeMode
        this.range = range
        this.heading = heading
        this.tilt = tilt
        this.roll = roll
    }

    fun copy(lookAt: LookAt) = set(
        lookAt.position.latitude, lookAt.position.longitude, lookAt.position.altitude,
        lookAt.altitudeMode, lookAt.range, lookAt.heading, lookAt.tilt, lookAt.roll
    )

    override fun toString() = "LookAt(position=$position, altitudeMode=$altitudeMode, range=$range, heading=$heading, tilt=$tilt, roll=$roll)"
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy