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

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

package io.data2viz.geojson.jackson


class GeometryCollection : GeoJsonObject(), Iterable {

    private var geometries: MutableList = mutableListOf()

    fun getGeometries(): List = geometries

    fun setGeometries(geometries: MutableList) {
        this.geometries = geometries
    }

    override fun iterator(): Iterator = geometries!!.iterator()

    fun add(geometry: GeoJsonObject): GeometryCollection = this.apply { geometries!!.add(geometry)}

    override fun  accept(geoJsonObjectVisitor: GeoJsonObjectVisitor): T {
        return geoJsonObjectVisitor.visit(this)!!
    }

    override fun equals(o: Any?): Boolean {
        if (this === o)
            return true
        if (o !is GeometryCollection)
            return false
        if (!super.equals(o))
            return false
        val that = o as GeometryCollection?
        return !if (geometries != null) geometries != that!!.geometries else that!!.geometries != null
    }

    override fun hashCode(): Int = 31 * super.hashCode() + (geometries?.hashCode() ?:0)

    override fun toString(): String = "GeometryCollection{geometries=$geometries} ${super.toString()}"
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy