@rr0/place
Version:
Place representation API
33 lines (32 loc) • 1.04 kB
JavaScript
import { PlaceLocation } from "./location/PlaceLocation.js";
import { RR0Data } from "@rr0/data";
export class Place extends RR0Data {
constructor(locations, elevation, dirName,
/**
* Remote geo IP service specific data.
*/
data) {
super("place");
this.locations = locations;
this.elevation = elevation;
this.dirName = dirName;
this.events = [];
this.id = dirName;
}
/**
*
* @param {float} lat Latitude in decimal degrees. North is positive.
* @param {float} lng Longitude in decimal degrees. East is positive.
*/
static fromLocation(lat, lng) {
return new Place([new PlaceLocation(lat, lng)]);
}
static fromDMS(latLng) {
return new Place([PlaceLocation.fromDMS(latLng)]);
}
toString() {
var _a;
return (_a = this.id) !== null && _a !== void 0 ? _a : this.locations.map(location => location.toString()).join("$");
}
}
export const placeDirName = "place/systeme/solaire/planete/terre/";