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

com.github.tsingjyujing.geo.element.mutable.GeoPoint.scala Maven / Gradle / Ivy

There is a newer version: 2.8.9-2.11
Show newest version
package com.github.tsingjyujing.geo.element.mutable

import com.github.tsingjyujing.geo.basic.{IGeoPoint, IVector2}

/**
  * Mutable implementation of IGeoPoint
  *
  * @param longitude
  * @param latitude
  */
final case class GeoPoint(private var longitude: Double, private var latitude: Double) extends IGeoPoint {

    override def getLongitude: Double = longitude

    override def getLatitude: Double = latitude

    def setLongitude(value: Double): Unit = {
        verifyLongitude
        this.longitude = value
    }

    def setLatitude(value: Double): Unit = {
        verifyLatitude
        this.latitude = value
    }

    def +=(x: IVector2): Unit = {
        setLongitude(getLongitude + x.getX)
        setLatitude(getLatitude + x.getY)
    }

    def -=(x: IVector2): Unit = {
        setLongitude(getLongitude - x.getX)
        setLatitude(getLatitude - x.getY)
    }

    verifyValues
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy