Documentation
¶
Overview ¶
Package route routes a rendering's edges orthogonally around its boxes with libavoid, the router the diagram panel bundles, run as WebAssembly in-process, and straightens the result as the panel does, so both draw the same routes.
Index ¶
Constants ¶
const ( Gap = 32.0 PortSize = 10.0 Clearance = Gap / 2 Nudging = 8.0 MinJog = 16.0 ExclusivePinLimit = 12 )
The panel's routing constants: a GAP between slots, PORT_SIZE for a port square.
const WasmPathEnv = "OPENSYSML_LIBAVOID_WASM"
WasmPathEnv names the environment variable that points at a libavoid WebAssembly module to route with instead of the embedded one.
Variables ¶
ErrUnavailable is what Routes returns in a build without the router: the js and wasip1 builds, which leave routing to the drawing program.
Functions ¶
This section is empty.
Types ¶
type Box ¶
type Box struct {
X, Y, Width, Height float64
}
Box is an axis-aligned rectangle given by its top-left corner and size.
type Obstacle ¶
Obstacle holds a shape's routing-clearance bounds and its raw interior.
func RoutingObstacle ¶
RoutingObstacle builds the routing geometry shared by libavoid and route simplification.
type PinPosition ¶
PinPosition is a libavoid pin as proportions (0..1) of the shape's routing box.
func RoutingPinPositions ¶
func RoutingPinPositions(shape *Shape) []PinPosition
RoutingPinPositions computes bounded libavoid portions for a shape's generic and named pins.
type Point ¶
type Point struct {
X, Y float64
}
Point is a position on the canvas.
func CompactRoute ¶
CompactRoute removes zero-length and same-direction collinear points from an orthogonal route.
func PortCenter ¶
PortCenter is the point on the border where a port sits.
type Port ¶
Port is a connection point on a shape's border at Offset (0..1) along Side; a Flush port sits on the border itself with no square straddling it.
type Route ¶
Route is the orthogonal polyline found for the edge at Index.
func Routes ¶
Routes is the orthogonal route of each edge the router found a path for, from its source to its target with every bend between, under the edge's Index; an edge whose ends are not among the shapes has none. Routes stay inside bounds when given. The js and wasip1 builds return ErrUnavailable.