Header menu logo issie

Symbol Module

Nested modules

Modules Description

Constants

--------- STATIC VARIABLES --------- ///

Functions and values

Function or value Description

addPortToMaps edge portMaps portId

Full Usage: addPortToMaps edge portMaps portId

Parameters:
Returns: PortMaps
edge : Edge
portMaps : PortMaps
portId : string
Returns: PortMaps

addToPortModel model sym

Full Usage: addToPortModel model sym

Parameters:
Returns: Map<string, Port>
model : Model
sym : Symbol
Returns: Map<string, Port>

autoScaleHAndW sym

Full Usage: autoScaleHAndW sym

Parameters:
Returns: Symbol

adjust symbol (and component) dimensions based on current ports and labels of a custom component. leaves other symbols unchanged

sym : Symbol
Returns: Symbol

busSelectTitle wob lsb

Full Usage: busSelectTitle wob lsb

Parameters:
    wob : int
    lsb : int

Returns: string
Insert titles for bus select
 used once
wob : int
lsb : int
Returns: string

busTitleAndBits t n

Full Usage: busTitleAndBits t n

Parameters:
    t : string
    n : int

Returns: string

Insert titles compatible with greater than 1 buswidth

t : string
n : int
Returns: string

calcLabelBoundingBox sym

Full Usage: calcLabelBoundingBox sym

Parameters:
Returns: Symbol

Work out a label bounding box from symbol, return symbol with box added. The box has a margin Constants. componentLabelOffsetDistance around the label text outline. This function should be included at the end of any function that changes component or label position or orientation or shape.

sym : Symbol
Returns: Symbol

combineRotation r1 r2

Full Usage: combineRotation r1 r2

Parameters:
Returns: Rotation
Modifiers: inline

the output is the rotation got from the two inputs one after the other.

r1 : Rotation
r2 : Rotation
Returns: Rotation

createNewSymbol ldcs pos comptype label theme

Full Usage: createNewSymbol ldcs pos comptype label theme

Parameters:
Returns: Symbol

Function to generate a new symbol

ldcs : LoadedComponent list
pos : XYPos
comptype : ComponentType
label : string
theme : ThemeType
Returns: Symbol

customStringToLength lst

Full Usage: customStringToLength lst

Parameters:
    lst : string list

Returns: float

get the max length (in pixels) of any of the Text strings in a list Hack - for now assume text char width is constant

lst : string list
Returns: float

customToLength lst

Full Usage: customToLength lst

Parameters:
    lst : (string * int) list

Returns: int
lst : (string * int) list
Returns: int

deletePortFromMaps port portMaps

Full Usage: deletePortFromMaps port portMaps

Parameters:
Returns: PortMaps
port : string
portMaps : PortMaps
Returns: PortMaps

getBoundingBox symModel compid

Full Usage: getBoundingBox symModel compid

Parameters:
Returns: BoundingBox
Modifiers: inline

Returns bounding box of a component based on component id

symModel : Model
compid : ComponentId
Returns: BoundingBox

getBoundingBoxes symModel

Full Usage: getBoundingBoxes symModel

Parameters:
Returns: Map<ComponentId, BoundingBox>

Returns all the bounding boxes of all components in the model

symModel : Model
Returns: Map<ComponentId, BoundingBox>

getCompRotatedHAndW comp transform hScale vScale

Full Usage: getCompRotatedHAndW comp transform hScale vScale

Parameters:
Returns: float * float
Modifiers: inline

Returns the correct height and width of a transformed symbol as the tuple (real H, real W). Needed because H & W in Component do not change with rotation. NB Pos in component = Pos in Symbol and DOES change with rotation!

comp : Component
transform : STransform
hScale : float option
vScale : float option
Returns: float * float

getComponentLegend componentType rotation

Full Usage: getComponentLegend componentType rotation

Parameters:
Returns: string
componentType : ComponentType
rotation : Rotation
Returns: string

getComponentProperties compType label

Full Usage: getComponentProperties compType label

Parameters:
Returns: int * int * float * float

return (num inputs, num outputs, height, width)

compType : ComponentType
label : string
Returns: int * int * float * float

getCustomPortIdMap comp

Full Usage: getCustomPortIdMap comp

Parameters:
Returns: Map<string, string>

obtain map from port IDs to port names for Custom Component. for other components types this returns empty map

comp : Component
Returns: Map<string, string>

getGateComponentLegend gType

Full Usage: getGateComponentLegend gType

Parameters:
Returns: string
gType : GateComponentType
Returns: string

getGateNComponentLegend numInputs gType

Full Usage: getGateNComponentLegend numInputs gType

Parameters:
Returns: string
numInputs : int
gType : GateComponentType
Returns: string

getInputPortLocation defPos model portId

Full Usage: getInputPortLocation defPos model portId

Parameters:
Returns: XYPos
Modifiers: inline

Returns the location of an input port based on their portId

defPos : XYPos option
model : Model
portId : InputPortId
Returns: XYPos

getInputPortsLocationMap model symbols

Full Usage: getInputPortsLocationMap model symbols

Parameters:
Returns: Map<InputPortId, XYPos>

Returns the input port positions of the specified symbols in model

model : Model
symbols : Symbol list
Returns: Map<InputPortId, XYPos>

getLabelBoundingBox model compId

Full Usage: getLabelBoundingBox model compId

Parameters:
Returns: BoundingBox

Returns the bounding box of the symbol associated with compId

model : Model
compId : ComponentId
Returns: BoundingBox

getLabelBoundingBoxes model

Full Usage: getLabelBoundingBoxes model

Parameters:
Returns: Map<ComponentId, BoundingBox>

Returns the bounding boxes of all symbol labels in the model

model : Model
Returns: Map<ComponentId, BoundingBox>

getMuxSelOffset sym side

Full Usage: getMuxSelOffset sym side

Parameters:
Returns: XYPos

Based on a symbol and an edge, if the port is a mux select, return an extra offset required for the port (because of the weird shape of the mux)

sym : Symbol
side : Edge
Returns: XYPos

getOutputPortLocation defPos model portId

Full Usage: getOutputPortLocation defPos model portId

Parameters:
Returns: XYPos
Modifiers: inline

Returns the location of an output port based on their portId

defPos : XYPos option
model : Model
portId : OutputPortId
Returns: XYPos

getOutputPortsLocationMap model symbols

Full Usage: getOutputPortsLocationMap model symbols

Parameters:
Returns: Map<OutputPortId, XYPos>

Returns the output port positions of the specified symbols in model

model : Model
symbols : Symbol list
Returns: Map<OutputPortId, XYPos>

getPortBaseOffset sym side

Full Usage: getPortBaseOffset sym side

Parameters:
Returns: XYPos
Modifiers: inline

Returns the xy offset of a side relative to the symbol topleft

sym : Symbol
side : Edge
Returns: XYPos

getPortLocation defPos model portId

Full Usage: getPortLocation defPos model portId

Parameters:
    defPos : XYPos option
    model : Model
    portId : string

Returns: XYPos

Returns the location of a given portId, with good efficiency

defPos : XYPos option
model : Model
portId : string
Returns: XYPos

getPortLocations model symbolIds

Full Usage: getPortLocations model symbolIds

Parameters:
Returns: Map<InputPortId, XYPos> * Map<OutputPortId, XYPos>

Returns all the port locations of the given components

model : Model
symbolIds : ComponentId list
Returns: Map<InputPortId, XYPos> * Map<OutputPortId, XYPos>

getPortPos sym port

Full Usage: getPortPos sym port

Parameters:
Returns: XYPos

Given a symbol and a port, it returns the offset of the port from the top left corner of the symbol

sym : Symbol
port : Port
Returns: XYPos

getPortPosEdgeGap ct

Full Usage: getPortPosEdgeGap ct

Parameters:
Returns: float
Modifiers: inline

hack so that bounding box of splitwire, mergewires can be smaller height relative to ports

ct : ComponentType
Returns: float

getPortPosModel model port

Full Usage: getPortPosModel model port

Parameters:
Returns: XYPos
Modifiers: inline
model : Model
port : Port
Returns: XYPos

getPortPosToRender sym port

Full Usage: getPortPosToRender sym port

Parameters:
Returns: XYPos
Modifiers: inline

Gives the port positions to the render function, it gives the moving port pos where the mouse is, if there is a moving port

sym : Symbol
port : Port
Returns: XYPos

getPrefix compType

Full Usage: getPrefix compType

Parameters:
Returns: string

Decodes the component type into component labels

compType : ComponentType
Returns: string

getRotatedCompCentre comp transform hScale vScale

Full Usage: getRotatedCompCentre comp transform hScale vScale

Parameters:
Returns: XYPos
Modifiers: inline

returns the true centre of a component's symbol

comp : Component
transform : STransform
hScale : float option
vScale : float option
Returns: XYPos

getRotatedHAndW sym

Full Usage: getRotatedHAndW sym

Parameters:
Returns: float * float
Modifiers: inline

Returns the correct height and width of a transformed symbol as the tuple (real H, real W). Needed because H & W in Component do not change with rotation. NB Pos in component = Pos in Symbol and DOES change with rotation!

sym : Symbol
Returns: float * float

getRotatedSymbolCentre symbol

Full Usage: getRotatedSymbolCentre symbol

Parameters:
Returns: XYPos
Modifiers: inline

returns the true centre of a symbol, taking into account its current rotation

symbol : Symbol
Returns: XYPos

getSymbolBoundingBox sym

Full Usage: getSymbolBoundingBox sym

Parameters:
Returns: BoundingBox
Modifiers: inline

Returns the bounding box of a symbol. It is defined by the height and the width as well as the x,y position of the symbol. Works with rotation. For a rotated symbol, TopLeft = Pos, and H,W swapped in getrotatedHAndW

sym : Symbol
Returns: BoundingBox

getSymbolColour compType clocked theme

Full Usage: getSymbolColour compType clocked theme

Parameters:
Returns: string

Returns color for the fill of a symbol (when not selected) Depends on theme and whether symbol is closed or not.

compType : ComponentType
clocked : bool
theme : ThemeType
Returns: string

getSymbolPortOrientation sym port

Full Usage: getSymbolPortOrientation sym port

Parameters:
Returns: Edge
Modifiers: inline

Given a symbol and a Port, it returns the orientation of the port

sym : Symbol
port : Port
Returns: Edge

getTextGateComponentLegend gType

Full Usage: getTextGateComponentLegend gType

Parameters:
Returns: string
gType : GateComponentType
Returns: string

getTwoPortLocations model inputPortId outputPortId

Full Usage: getTwoPortLocations model inputPortId outputPortId

Parameters:
Returns: XYPos * XYPos
Modifiers: inline

Returns the locations of a given input port and output port based on their portId

model : Model
inputPortId : InputPortId
outputPortId : OutputPortId
Returns: XYPos * XYPos

initPortOrientation comp

Full Usage: initPortOrientation comp

Parameters:
Returns: PortMaps

work out the initial (default) port placing for a componenent. also used for legacy circuits loaded without port layoiut info.

comp : Component
Returns: PortMaps

invertRotation rot

Full Usage: invertRotation rot

Parameters:
Returns: Rotation
Modifiers: inline
rot : Rotation
Returns: Rotation

isMuxSel sym side

Full Usage: isMuxSel sym side

Parameters:
Returns: bool

Returns true if an edge has the select port of a mux

sym : Symbol
side : Edge
Returns: bool

makeComponent pos compType id label

Full Usage: makeComponent pos compType id label

Parameters:
Returns: Component

make a completely new component

pos : XYPos
compType : ComponentType
id : string
label : string
Returns: Component

makeMapsConsistent portIdMap sym

Full Usage: makeMapsConsistent portIdMap sym

Parameters:
    portIdMap : Map<string, string>
    sym : Symbol

Returns: PortMaps

Needed because the I/Os of a custom component can be changed on anotehr sheet. When the component is reloaded its port maps will be inconsistent. This function keeps existing layout, and adds new I/Os or deletes old ones.

portIdMap : Map<string, string>
sym : Symbol
Returns: PortMaps

movePortToBottom portMaps index

Full Usage: movePortToBottom portMaps index

Parameters:
Returns: PortMaps

Modify port position maps to move an existing Lefthand port (index in the list) to the bottom edge

portMaps : PortMaps
index : int
Returns: PortMaps

movePortsToCorrectEdgeForComponentType ct portMaps

Full Usage: movePortsToCorrectEdgeForComponentType ct portMaps

Parameters:
Returns: PortMaps

By default all output ports are on the right, input ports on lefty, (of a normal orientation symbol). A few symbols have ports on top or bottom as defined here. Note that custom components can have ports positioned by user.

ct : ComponentType
portMaps : PortMaps
Returns: PortMaps

nBitsGateTitle gateType n

Full Usage: nBitsGateTitle gateType n

Parameters:
    gateType : string
    n : int

Returns: string
gateType : string
n : int
Returns: string

portLists numOfPorts hostID portType

Full Usage: portLists numOfPorts hostID portType

Parameters:
    numOfPorts : int
    hostID : string
    portType : PortType

Returns: Port list

Generates a new list of ports of specified type

numOfPorts : int
hostID : string
portType : PortType
Returns: Port list

Type extensions

Type extension Description

this.SymbolBoundingBox

Full Usage: this.SymbolBoundingBox

Parameters:
    () : unit

Returns: BoundingBox

Extended Type: Symbol

() : unit
Returns: BoundingBox

this.SymbolBoundingBox

Full Usage: this.SymbolBoundingBox

Returns: BoundingBox

Extended Type: Symbol

Returns: BoundingBox

Type something to start searching.