minotor
Version:
A lightweight client-side transit routing library.
109 lines (108 loc) • 3.09 kB
TypeScript
import { Result } from './result.js';
/**
* Generates DOT graph visualizations of routing results.
*
* The generated graph shows:
* - Stations as rectangular nodes (origin=blue, destination=violet)
* - Vehicle edges as ovals with route info
* - Transfer edges as dashed ovals
* - Continuation edges (same-station transfers) as bold yellow ovals
*
* @example
* ```typescript
* const plotter = new Plotter(routingResult);
* const dotGraph = plotter.plotDotGraph();
* // Use with Graphviz: dot -Tpng -o graph.png
* ```
*/
export declare class Plotter {
private result;
constructor(result: Result);
/**
* Generates a unique node ID for a station.
*/
private stationNodeId;
/**
* Generates a unique node ID for a vehicle edge oval.
*/
private vehicleEdgeNodeId;
/**
* Generates a unique node ID for a transfer edge oval.
*/
private transferEdgeNodeId;
/**
* Generates a unique node ID for a walking access edge oval.
*/
private accessEdgeNodeId;
/**
* Generates a unique node ID for a continuation edge oval.
*/
private continuationNodeId;
/**
* Gets the color for a round based on the configured palette.
*/
private getRoundColor;
/**
* Gets the appropriate fill color for a station based on its type.
*/
private getStationFillColor;
/**
* Escapes special characters in DOT strings to prevent syntax errors.
*/
private escapeDotString;
/**
* Formats a stop name for display, including platform information.
*/
private formatStopName;
/**
* Determines station type (origin/destination) information.
*/
private getStationInfo;
/**
* Resolves the actual StopId from a VehicleEdge's stopIndex.
*/
private getVehicleEdgeFromStopId;
/**
* Resolves the actual StopId from a VehicleEdge's hopOffStopIndex.
*/
private getVehicleEdgeToStopId;
/**
* Creates a DOT node for a station.
*/
private createStationNode;
/**
* Creates a vehicle edge with route information oval in the middle.
*/
private createVehicleEdge;
/**
* Creates a walking access leg as a dashed oval connecting the query origin
* to the initial boarding stop.
*/
private createAccessEdge;
/**
* Creates a transfer edge with transfer information oval in the middle.
*/
private createTransferEdge;
/**
* Creates a continuation edge to visually link trip continuations.
*/
private createContinuationEdge;
/**
* Collects all stations that appear in the routing graph.
*/
private collectStations;
/**
* Collects all continuation edges from a vehicle edge chain.
*/
private collectContinuationChain;
/**
* Collects all edges for the routing graph.
*/
private collectEdges;
/**
* Plots the routing graph as a DOT graph for visualization.
*
* @returns A string containing the DOT graph representation.
*/
plotDotGraph(): string;
}