info.gratour.jtmodel.Coordinate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jt-core Show documentation
Show all versions of jt-core Show documentation
`jt-core` is a java/scala communication processing library for JT808/JT809/JT1078 standard.
The newest version!
/*******************************************************************************
* Copyright (c) 2019, 2020 lucendar.com.
* All rights reserved.
*
* Contributors:
* KwanKin Yau ([email protected]) - initial API and implementation
*******************************************************************************/
package info.gratour.jtmodel;
import info.gratour.jtcommon.JTUtils;
import java.util.Objects;
public class Coordinate {
private double lng;
private double lat;
public Coordinate() {
}
public Coordinate(double lng, double lat) {
this.lng = lng;
this.lat = lat;
}
public double getLng() {
return lng;
}
public void setLng(double lng) {
this.lng = lng;
}
public String lngStr() {
return JTUtils.formatAxis(lng);
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public String latStr() {
return JTUtils.formatAxis(lat);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Coordinate that = (Coordinate) o;
return Double.compare(that.lng, lng) == 0 &&
Double.compare(that.lat, lat) == 0;
}
@Override
public int hashCode() {
return Objects.hash(lng, lat);
}
@Override
public String toString() {
return "POINT (" + lng +
", " + lat +
')';
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy