commonMain.earth.worldwind.PickedObjectList.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
open class PickedObjectList {
protected val objectsById = mutableMapOf()
val objects get() = objectsById.values
val count get() = objectsById.size
val topPickedObject get() = objects.firstOrNull { po -> po.isOnTop }
val terrainPickedObject get() = objects.firstOrNull { po -> po.isTerrain }
val hasNonTerrainObjects get() = objects.firstOrNull { po -> !po.isTerrain } != null
fun offerPickedObject(pickedObject: PickedObject) { objectsById[pickedObject.identifier] = pickedObject }
fun pickedObjectWithId(identifier: Int) = objectsById[identifier]
fun clearPickedObjects() = objectsById.clear()
fun keepTopAndTerrainObjects() = objectsById.entries.removeAll { e -> !e.value.isOnTop && !e.value.isTerrain }
override fun toString() = objects.joinToString(", ", "PickedObjectList{", "}") { po -> po.toString() }
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy