﻿function MapPoint(myPoint) {
	this.className = "MapPoint";

	this.degrees = {};
	this.decimals = {};
	this.radians = {};
	var c = new DegreesConverter();
	if (myPoint.degrees) {
		this.degrees = myPoint.degrees;
		this.radians.latitude = c.degreesToRadians(this.degrees.latitude);
		this.radians.longitude = c.degreesToRadians(this.degrees.longitude);
		this.decimals.latitude = c.de60_de10(this.degrees.latitude);
		this.decimals.longitude = c.de60_de10(this.degrees.longitude);
	} else if (myPoint.radians) {
		this.radians = myPoint.radians;
		this.degrees.latitude = c.radiansToDegrees(this.radians.latitude);
		this.degrees.longitude = c.radiansToDegrees(this.radians.longitude);
		this.decimals.latitude = c.ra_de(this.degrees.latitude);
		this.decimals.longitude = c.ra_de(this.degrees.longitude);
	} else if (myPoint.decimals) {
		this.decimals = myPoint.decimals;
		this.radians.latitude = c.de_ra(this.decimals.latitude);
		this.radians.longitude = c.de_ra(this.decimals.longitude);
		this.degrees.latitude = c.radiansToDegrees(this.radians.latitude);
		this.degrees.longitude = c.radiansToDegrees(this.radians.longitude);
	} else {
		alert("Eccezione: non sono state impostate le coordinate geodetiche " + this.className);
		return false;
	}
	this.altitude = myPoint.altitude;
}
