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

commonMain.earth.worldwind.render.AbstractRenderable.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.render

import kotlin.jvm.JvmOverloads

abstract class AbstractRenderable @JvmOverloads constructor(override var displayName: String? = null): Renderable {
    override var isEnabled = true
    override var isPickEnabled = true
    override var pickDelegate: Any? = null
    private var userProperties: MutableMap? = null

    @Suppress("UNCHECKED_CAST")
    override fun  getUserProperty(key: Any) = userProperties?.get(key) as? T

    override fun putUserProperty(key: Any, value: Any): Any? {
        val userProperties = userProperties ?: mutableMapOf().also { userProperties = it }
        return userProperties.put(key, value)
    }

    override fun removeUserProperty(key: Any) = userProperties?.remove(key)

    override fun hasUserProperty(key: Any) = userProperties?.containsKey(key) == true

    override fun render(rc: RenderContext) { if (isEnabled && (isPickEnabled || !rc.isPickMode)) doRender(rc) }

    protected abstract fun doRender(rc: RenderContext)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy