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

jvmMain.io.data2viz.geojson.jackson.FeatureCollection.kt Maven / Gradle / Ivy

package io.data2viz.geojson.jackson

import java.util.ArrayList

class FeatureCollection : GeoJsonObject(), Iterable {

    private var features: MutableList = ArrayList()

    fun getFeatures(): List = features

    fun setFeatures(features: MutableList) {
        this.features = features
    }

    fun add(feature: Feature): FeatureCollection = this.apply { features.add(feature) }

    fun addAll(features: Collection) {
        this.features.addAll(features)
    }

    override fun iterator(): Iterator = features.iterator()

    override fun  accept(geoJsonObjectVisitor: GeoJsonObjectVisitor): T = geoJsonObjectVisitor.visit(this)!!

    override fun equals(o: Any?): Boolean {
        if (this === o)
            return true
        if (o !is FeatureCollection)
            return false
        val features1 = o as FeatureCollection?
        return features == features1!!.features
    }

    override fun hashCode(): Int = features.hashCode()

    override fun toString(): String = "FeatureCollection{features=$features}"
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy