@typecad/typecad
Version:
🤖programmatically 💥create 🛰️hardware
50 lines (49 loc) • 1.86 kB
TypeScript
import { RoutingGrid } from './shared/routing_grid';
import type { IAutorouteWaypoint, IRouteDirectives, IRoutePath } from '../pcb/pcb_interfaces';
export interface IRoutingEngine {
route(start: {
x: number;
y: number;
layer: string;
}, end: {
x: number;
y: number;
layer: string;
}, directives?: IAutorouteWaypoint[] | IRouteDirectives): IRoutePath;
}
export interface IGridConfigurationContext {
requestedResolution: number;
defaultResolution: number;
pads: {
componentRef?: string;
size: {
width: number;
height: number;
};
type: 'smd' | 'thru_hole' | 'np_thru_hole' | 'connect';
layers: string[];
}[];
}
export interface IGridConfigurationResult {
gridResolution?: number;
reason?: string;
}
export type GridConfigurator = (context: IGridConfigurationContext) => IGridConfigurationResult | void;
export declare enum RoutingAlgorithm {
AStar = "astar"
}
type EngineFactory = (grid: RoutingGrid, options: unknown) => IRoutingEngine;
export type IRouterOptionsWithFreeVias = Record<string, unknown>;
export declare class RouterRegistry {
private static registrations;
static register(name: RoutingAlgorithm | string, factory: EngineFactory, options?: {
configureGrid?: GridConfigurator;
}): void;
static unregister(name: RoutingAlgorithm | string): void;
static has(name: RoutingAlgorithm | string): boolean;
static list(): string[];
static create(name: RoutingAlgorithm | string, grid: RoutingGrid, options: unknown): IRoutingEngine;
static createWithFreeVias(name: RoutingAlgorithm, grid: RoutingGrid, options: IRouterOptionsWithFreeVias): IRoutingEngine;
static getGridConfigurator(name: RoutingAlgorithm | string): GridConfigurator | undefined;
}
export {};