commonMain.earth.worldwind.layer.AbstractLayer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of worldwind-jvm Show documentation
Show all versions of worldwind-jvm Show documentation
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.layer
import earth.worldwind.render.RenderContext
import kotlin.jvm.JvmOverloads
abstract class AbstractLayer @JvmOverloads constructor(override var displayName: String? = null): Layer {
override var isEnabled = true
override var isPickEnabled = true
override var opacity = 1f
override var minActiveAltitude = Double.NEGATIVE_INFINITY
override var maxActiveAltitude = Double.POSITIVE_INFINITY
private var userProperties: MutableMap? = null
override fun getUserProperty(key: Any) = userProperties?.get(key)
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) && isWithinActiveAltitudes(rc)) doRender(rc)
}
override fun isWithinActiveAltitudes(rc: RenderContext) = rc.camera.position.altitude in minActiveAltitude..maxActiveAltitude
protected abstract fun doRender(rc: RenderContext)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy