@geoapify/route-planner-sdk
Version:
TypeScript SDK for the Geoapify Route Planner API. Supports route optimization, delivery planning, and timeline visualization in browser and Node.js
43 lines (42 loc) • 962 B
JavaScript
import { RouteAction } from "./route-action";
export class Waypoint {
constructor(raw) {
if (raw) {
this.raw = raw;
}
else {
throw new Error("WaypointData is undefined");
}
}
getRaw() {
return this.raw;
}
getOriginalLocation() {
return this.raw.original_location;
}
;
getOriginalLocationIndex() {
return this.raw.original_location_index;
}
getOriginalLocationId() {
return this.raw.original_location_id;
}
getLocation() {
return this.raw.location;
}
getStartTime() {
return this.raw.start_time;
}
getDuration() {
return this.raw.duration;
}
getActions() {
return this.raw.actions.map((action) => new RouteAction(action));
}
getPrevLegIndex() {
return this.raw.prev_leg_index;
}
getNextLegIndex() {
return this.raw.next_leg_index;
}
}