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

commonMain.org.jetbrains.letsPlot.livemap.geocoding.LocationCounterSystem.kt Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2019. JetBrains s.r.o.
 * Use of this source code is governed by the MIT license that can be found in the LICENSE file.
 */

package org.jetbrains.letsPlot.livemap.geocoding

import org.jetbrains.letsPlot.livemap.core.ecs.AbstractSystem
import org.jetbrains.letsPlot.livemap.core.ecs.EcsComponentManager
import org.jetbrains.letsPlot.livemap.mapengine.LiveMapContext

class LocationCounterSystem(
    componentManager: EcsComponentManager,
    private val myNeedLocation: Boolean
) : AbstractSystem(componentManager) {
    private val myLocation = LocationComponent()

    override fun initImpl(context: LiveMapContext) {
        createEntity("LocationSingleton").add(myLocation)
    }

    override fun updateImpl(context: LiveMapContext, dt: Double) {
        val entities = getMutableEntities()

        if (myNeedLocation) {
            myLocation.wait(entities.size)
        } else {
            entities.forEach {
                it.remove()
                it.remove()
            }
        }

        entities.forEach {
            it.remove()
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy