package it.mice.voila.runtime.hibernatespatial;

import it.mice.voila.runtime.hibernatespatial.utils.GisConvertUtils;

import java.io.Serializable;

import com.vividsolutions.jts.geom.Point;

public class JsonPoint implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2225544951714323252L;

	private double latitude;
	private double longitude;
	
	public JsonPoint(double latitude, double longitude) {
		super();
		this.latitude = latitude;
		this.longitude = longitude;
	}
	
	public JsonPoint(Point point) {
		super();
		this.latitude = point.getX();
		this.longitude = point.getY();
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}
	
	public Point toPoint() {
		Point result = (Point)GisConvertUtils.toGeometry(getLatitude(), getLongitude());
		return result;
	}
}
