GeoLocation

data class GeoLocation(val id: Long = 0, val latitude: Double, val longitude: Double)

Represents the geographic location of a point on a map using a spherical coordinate system.

Constructors

Link copied to clipboard
constructor(latitude: Int, longitude: Int)
constructor(id: Long = 0, latitude: Double, longitude: Double)

Properties

Link copied to clipboard
val id: Long = 0

its database id.

Link copied to clipboard

the y-axis coordinate of the location in degrees, ranging from -90 (South Pole) to 90 (North Pole).

Link copied to clipboard

the x-axis coordinate of the location in degrees, ranging from -180 (West) to 180 (East).

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Checks if two GeoLocation objects are equal. This method considers two GeoLocations equal if their latitude and longitude coordinates are identical, excluding the id field (which might be used for database purposes).

Link copied to clipboard
open override fun hashCode(): Int

Calculates a hash code for this GeoLocation object. This method excludes the id field from the hash code calculation. The hash code is based on the latitude and longitude values to ensure objects with the same location have the same hash code. This is important for efficient use in hash-based collections.

Link copied to clipboard

Creates a degenerate bounding box (with zero area) by setting both southwest and northeast corners to this GeoLocation. A single GeoLocation doesn't define an area in the traditional bounding box sense.

Link copied to clipboard
fun GeoLocation.toGeoLocationEntity(administrativeUnitNameGeoLocationsID: Long): GeoLocationEntity

Converts the GeoLocation into the GeoLocationEntity with an association to an administrative unit name.

Converts the GeoLocation into the GeoLocationEntity, optionally associating it with an image.

fun GeoLocation.toGeoLocationEntity(id: Long, geoLocationsID: Long? = null): GeoLocationEntity

Converts the GeoLocation into the GeoLocationEntity, optionally associating it with an image, and using a provided ID.

Link copied to clipboard

Converts the GeoLocation model into the view object GeoLocationViewData used to represent geo locations in the UI.

Link copied to clipboard
open override fun toString(): String

Returns a string representation of the GeoLocation object in degrees for latitude and longitude. This is useful for debug, test, and log purposes.

Link copied to clipboard
fun wasAntimeridianCrossed(otherLongitude: Double): Boolean

Checks if the antimeridian (longitude 180°) was crossed between this longitude and the provided one.