Header menu logo issie

BusWireRoutingHelpers Module

Types and nested modules

Type/Module Description

Constants

Bound

Used to capture the 1D coordinates of the two ends of a line. (see Line).

Cluster

Used to cluster together overlapping and adjacent lines into a group that can be spread out. This is the parameter in a tail recursion used to do the clustering

DirectionToMove

Screen direction in which objects are moved

Extension

LType

Type of Line: note that this is correlated with whether line is a segment or a symbol edge

Line

Used to represent a line on the canvas, e.g. a wire segment or symbol edge. The array of lines will all have the same orientation - so optimisation is done in two phases for vertical and horizontal segments. Each phase optimises one half of the segments.

LineId

Protected type for Line IDs

LineInfo

Some operations need to work on Horizontal and Vertical lines together. This captures the static information needed to do this.

LocSearchDir

Controls direction of Cluster search in expandCluster. Search is upwards first and then downwards so downwards search takes a Cluster (generated from upwards search) as parameter.

WireCorner

Defines a wire corner that could be removed. the two removed segments are [StartSeg+1..EndSeg-1] In addition, StartSeg and EndSeg have Length changed.

Functions and values

Function or value Description

boundUnion b1 b2

Full Usage: boundUnion b1 b2

Parameters:
Returns: Bound

Return union of two bounds b1 and b2. b1 & b2 must overlap or be adjacent. Otherwise the inclusive interval containing b1 and b2 is returned.

b1 : Bound
b2 : Bound
Returns: Bound

clusterSegments_

Full Usage: clusterSegments_

Returns: Lens<Cluster, int list>
Returns: Lens<Cluster, int list>

getVisibleNubLength atEnd wire

Full Usage: getVisibleNubLength atEnd wire

Parameters:
    atEnd : bool
    wire : Wire

Returns: float

Get the horizontal length of the visible segment emerging from a port

atEnd : bool
wire : Wire
Returns: float

hasNearOverlap tolerance b1 b2

Full Usage: hasNearOverlap tolerance b1 b2

Parameters:
Returns: bool

True if bounds b1 and b2 overlap or are exactly adjacent

tolerance : float
b1 : Bound
b2 : Bound
Returns: bool

hasOverlap b1 b2

Full Usage: hasOverlap b1 b2

Parameters:
Returns: bool

True if bounds b1 and b2 overlap or are exactly adjacent

b1 : Bound
b2 : Bound
Returns: bool

lowerB lines loc

Full Usage: lowerB lines loc

Parameters:
Returns: float
Modifiers: inline

ideal lower bound in P direction of loc including possible fixed constraint

lines : Line array
loc : Cluster
Returns: float

lowerS pts

Full Usage: lowerS pts

Parameters:
    pts : ^a list

Returns: float
Modifiers: inline
Type parameters: ^a

ideal lower bound in P direction of segments with P value in pts

pts : ^a list
Returns: float

moveLine ori newP line wires

Full Usage: moveLine ori newP line wires

Parameters:
Returns: Map<ConnectionId, Wire>

Change wires to move a wire segment represented by line to the given new value of P coordinate. P is X or Y according to ori.

ori : Orientation
newP : float
line : Line
wires : Map<ConnectionId, Wire>
Returns: Map<ConnectionId, Wire>

moveSegment index posDelta wire

Full Usage: moveSegment index posDelta wire

Parameters:
    index : int
    posDelta : float
    wire : Wire

Returns: Wire

Move segment by amount posDelta in direction perpendicular to segment - + => X or y increases. Movement is by changing lengths of two segments on either side. Will fail if called to change a nub at either end of a wire (nubs cannot move).

index : int
posDelta : float
wire : Wire
Returns: Wire

pAllCluster lines loc

Full Usage: pAllCluster lines loc

Parameters:
Returns: string

Return string to display a Cluster (long form). See also pCluster.

lines : Line array
loc : Cluster
Returns: string

pCluster loc

Full Usage: pCluster loc

Parameters:
Returns: string

Return string to display a Cluster (compactly). See also pAllCluster.

loc : Cluster
Returns: string

pLine line

Full Usage: pLine line

Parameters:
Returns: string

Return string to display a Line

line : Line
Returns: string

pLineType line

Full Usage: pLineType line

Parameters:
Returns: string

Return string to display the type of a Line

line : Line
Returns: string

pLines lineA

Full Usage: pLines lineA

Parameters:
    lineA : Line array

Returns: string

Return string to display an array of Lines

lineA : Line array
Returns: string

pOpt x

Full Usage: pOpt x

Parameters:
    x : 'a option

Returns: string

Return string to display an Option

x : 'a option
Returns: string

pWire wire

Full Usage: pWire wire

Parameters:
Returns: string

Return string to display a wire

wire : Wire
Returns: string

segPL lines loc

Full Usage: segPL lines loc

Parameters:
Returns: float list
Modifiers: inline

Get the segment indexes within a Cluster (loc)

lines : Line array
loc : Cluster
Returns: float list

segmentIsNubExtension wire segIndex

Full Usage: segmentIsNubExtension wire segIndex

Parameters:
    wire : Wire
    segIndex : int

Returns: bool

Return true if the segment extends a wire parallel with a nub (wire end).

wire : Wire
segIndex : int
Returns: bool

swapBBXAndY box orientation

Full Usage: swapBBXAndY box orientation

Parameters:
Returns: BoundingBox

swap X & Y coordinats in BB if orientation is vertical

box : BoundingBox
orientation : Orientation
Returns: BoundingBox

swapXYWhenVertical pos orientation

Full Usage: swapXYWhenVertical pos orientation

Parameters:
Returns: XYPos

swap X and Y coordinates if orientation = Vertical

pos : XYPos
orientation : Orientation
Returns: XYPos

tryFindIndexInArray searchStart dir predicate giveUp arr

Full Usage: tryFindIndexInArray searchStart dir predicate giveUp arr

Parameters:
    searchStart : LineId
    dir : int
    predicate : 'T -> bool
    giveUp : 'T -> bool
    arr : 'T array

Returns: LineId option

Linear search in an array from searchStart in a direction dir = +1/-1 from searchStart. Give up and return None if giveUp is true. Return first location for which predicate is true.

searchStart : LineId
dir : int
predicate : 'T -> bool
giveUp : 'T -> bool
arr : 'T array
Returns: LineId option

updatePos direction distanceToShift pos

Full Usage: updatePos direction distanceToShift pos

Parameters:
Returns: XYPos

Return new poistion moved the the direction and amount shown.

direction : DirectionToMove
distanceToShift : float
pos : XYPos
Returns: XYPos

upperB lines loc

Full Usage: upperB lines loc

Parameters:
Returns: float
Modifiers: inline

ideal upper bound in P direction of loc including possible fixed constraint

lines : Line array
loc : Cluster
Returns: float

upperS pts

Full Usage: upperS pts

Parameters:
    pts : ^a list

Returns: float
Modifiers: inline
Type parameters: ^a

ideal upper bound in P direction of segments with P value in pts.

pts : ^a list
Returns: float

widthS loc

Full Usage: widthS loc

Parameters:
Returns: float
Modifiers: inline

ideal (max) width of segments in loc

loc : Cluster
Returns: float

Type something to start searching.