UNPKG

@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

47 lines (46 loc) 1.07 kB
import { RouteLeg } from "./route-leg"; import { RouteAction } from "./route-action"; import { Waypoint } from "./waypoint"; export class AgentSolution { constructor(raw) { if (raw) { this.raw = raw; } else { throw new Error("AgentSolutionData is undefined"); } } getRaw() { return this.raw; } getAgentIndex() { return this.raw.agentIndex; } getAgentId() { return this.raw.agentId; } getTime() { return this.raw.time; } getStartTime() { return this.raw.start_time; } getEndTime() { return this.raw.end_time; } getDistance() { return this.raw.distance; } getMode() { return this.raw.mode; } getLegs() { return this.raw.legs.map((leg) => new RouteLeg(leg)); } getActions() { return this.raw.actions.map((action) => new RouteAction(action)); } getWaypoints() { return this.raw.waypoints.map((waypoint) => new Waypoint(waypoint)); } }