![JAR search and dependency download from the Maven repository](/logo.png)
eu.limetri.client.mapviewer.fx.Coordinate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapviewer-javafx Show documentation
Show all versions of mapviewer-javafx Show documentation
JXMapViewer JavaFX implementation
/**
* Copyright (C) 2008-2012 AgroSense Foundation.
*
* AgroSense is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
* this software, see the FLOSS License Exception
* .
*
* AgroSense is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AgroSense. If not, see .
*/
package eu.limetri.client.mapviewer.fx;
//License: GPL. Copyright 2009 by Stefan Zeller
import java.awt.geom.Point2D;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* This class encapsulates a Point2D.Double and provide access
* via lat and lon.
*
* @author Jan Peter Stotz
*
*/
public class Coordinate implements Serializable {
private static final long serialVersionUID = 1L;
private transient Point2D.Double data;
public Coordinate(double lat, double lon) {
data = new Point2D.Double(lon, lat);
}
public double getLat() {
return data.y;
}
public void setLat(double lat) {
data.y = lat;
}
public double getLon() {
return data.x;
}
public void setLon(double lon) {
data.x = lon;
}
private void writeObject(ObjectOutputStream out) throws IOException {
out.writeObject(data.x);
out.writeObject(data.y);
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
data = new Point2D.Double();
data.x = (Double) in.readObject();
data.y = (Double) in.readObject();
}
public String toString() {
return "Coordinate[" + data.y + ", " + data.x + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy