/**
* BeNomad BeMap JavaScript API - Coordinate class
*/
/**
* @classdesc
* Base class for geographical coordinate.
* @public
* @constructor
* @param {double} lon Longitude in degrees decimal (WGS84).
* @param {double} lat Latitude in degrees decimal (WGS84).
*/
bemap.Coordinate = function(lon, lat) {
/**
* @type {double}
* @protected
*/
this.lon = lon ? lon : 0;
/**
* @type {double}
* @protected
*/
this.lat = lat ? lat : 0;
};
/**
* Return an array of composed by latitude and longitude coordinate in degrees decimal (WGS84).
* @public
* @return {array} Return an array of composed by latitude and longitude coordinate in degrees decimal (WGS84).
*/
bemap.Coordinate.prototype.getLonLatArray = function() {
return [this.lon, this.lat];
};
/**
* Return an array of composed by longitude and latitude coordinate in degrees decimal (WGS84).
* @public
* @return {array} Return an array of composed by longitude and latitude coordinate in degrees decimal (WGS84).
*/
bemap.Coordinate.prototype.getLatLonArray = function() {
return [this.lat, this.lon];
};
/* Getters and setters methods */
/**
* Return the longitude coordinate in degrees decimal (WGS84).
* @public
* @return {double} Return the longitude coordinate in degrees decimal (WGS84).
*/
bemap.Coordinate.prototype.getLon = function() {
return this.lon;
};
/**
* Set the longitude coordinate in degrees decimal (WGS84).
* @public
* @param {double} lon Longitude in degrees decimal (WGS84).
* @return {bemap.Coordinate} Return this.
*/
bemap.Coordinate.prototype.setLon = function(lon) {
this.lon = lon;
return this;
};
/**
* Return the latitude coordinate in degrees decimal (WGS84).
* @public
* @return {double} Return the latitude coordinate in degrees decimal (WGS84).
*/
bemap.Coordinate.prototype.getLat = function() {
return this.lat;
};
/**
* Set the latitude coordinate in degrees decimal (WGS84).
* @public
* @param {double} lat Latitude in degrees decimal (WGS84).
* @return {bemap.Coordinate} Return this.
*/
bemap.Coordinate.prototype.setLat = function(lat) {
this.lat = lat;
return this;
};