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

commonMain.io.realm.kotlin.internal.geo.UnmanagedGeoCircle.kt Maven / Gradle / Ivy

Go to download

Library code for Realm Kotlin. This artifact is not supposed to be consumed directly, but through 'io.realm.kotlin:gradle-plugin:1.11.1' instead.

There is a newer version: 3.0.0
Show newest version
package io.realm.kotlin.internal.geo

import io.realm.kotlin.annotations.ExperimentalGeoSpatialApi
import io.realm.kotlin.types.geo.Distance
import io.realm.kotlin.types.geo.GeoCircle
import io.realm.kotlin.types.geo.GeoPoint

@OptIn(ExperimentalGeoSpatialApi::class)
public data class UnmanagedGeoCircle(
    public override val center: GeoPoint,
    public override val radius: Distance
) : GeoCircle {
    init {
        if (radius.inRadians < 0) {
            // Currently `Distance` does not allow negative values, but since a UDouble doesn't
            // exists, we also validate the input here, just in case.
            throw IllegalArgumentException("A negative radius is not allowed: $radius")
        }
    }

    override fun toString(): String {
        return "geoCircle([${center.longitude}, ${center.latitude}], ${radius.inRadians})"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy