Header menu logo issie

CanvasExtractor Module

Types

Type Description

Signature

A sheet's ports: input labels and widths, then output labels and widths, each in the order the components appear on the sheet.

Functions and values

Function or value Description

addStateToLoadedComponents openFileName (arg2, arg3) loadedComponents

Full Usage: addStateToLoadedComponents openFileName (arg2, arg3) loadedComponents

Parameters:
Returns: LoadedComponent list

add given name,state to loadedcomponent list as a loaded component (overwriting existing if needed)

openFileName : string
arg1 : Component list
arg2 : Connection list
loadedComponents : LoadedComponent list
Returns: LoadedComponent list

compareCanvas tolerance (arg2, arg3) (arg4, arg5)

Full Usage: compareCanvas tolerance (arg2, arg3) (arg4, arg5)

Parameters:
Returns: bool

Robust comparison of two schematics. Tolerance determines how similar counts as equal. cannot use equality because float vertices may not be identical use to detemine whether schematic needs to be saved NB for electrical circuit comparison use extractReducedState.

tolerance : float
arg1 : Component list
arg2 : Connection list
arg3 : Component list
arg4 : Connection list
Returns: bool

compareComps tolerance comps1 comps2

Full Usage: compareComps tolerance comps1 comps2

Parameters:
Returns: bool

Are two lists of components identical

tolerance : float
comps1 : List<Component>
comps2 : List<Component>
Returns: bool

compareConns tolerance conns1 conns2

Full Usage: compareConns tolerance conns1 conns2

Parameters:
Returns: bool

Are two lists of connections identical

tolerance : float
conns1 : List<Connection>
conns2 : List<Connection>
Returns: bool

compareIOs ldc1 ldc2

Full Usage: compareIOs ldc1 ldc2

Parameters:
Returns: bool

Compare the name and IOs of two sheets as loadedcomponents For backups, if these change something major has happened

ldc1 : LoadedComponent
ldc2 : LoadedComponent
Returns: bool

compsAreEqual comp1 comp2

Full Usage: compsAreEqual comp1 comp2

Parameters:
Returns: bool
Modifiers: inline
comp1 : Component
comp2 : Component
Returns: bool

compsAreEqualExInputDefault comp1 comp2

Full Usage: compsAreEqualExInputDefault comp1 comp2

Parameters:
Returns: bool
Modifiers: inline
comp1 : Component
comp2 : Component
Returns: bool

connsAreEqual conn1 conn2

Full Usage: connsAreEqual conn1 conn2

Parameters:
Returns: bool
Modifiers: inline
conn1 : Connection
conn2 : Connection
Returns: bool

debugChangedConnections

Full Usage: debugChangedConnections

Returns: ConnectionId list

evil mutable for debugging only allows easy access to specific connections - so it can be highlighted in GUI

Returns: ConnectionId list

effectiveInstanceBindings childDefaults parentBindings instanceBindings

Full Usage: effectiveInstanceBindings childDefaults parentBindings instanceBindings

Parameters:
Returns: ParamBindings

The bindings a sheet is resolved with inside one instance of it. An instance binding is an expression in the parameters of the sheet the instance SITS ON, so it is evaluated there first and reaches the child sheet as a plain value; every parameter the instance does not bind takes the child's own declared default. This is the same merge GraphMerger.effectiveBindings makes for elaboration, so what is drawn and what is simulated agree. A binding that cannot be evaluated falls back to the default rather than to nothing.

childDefaults : ParamBindings
parentBindings : ParamBindings
instanceBindings : ParamBindings
Returns: ParamBindings

extractLoadedSimulatorComponent (arg1, arg2) name

Full Usage: extractLoadedSimulatorComponent (arg1, arg2) name

Parameters:
Returns: LoadedComponent

extract the fields compared to check circuit equality

arg0 : Component list
arg1 : Connection list
name : string
Returns: LoadedComponent

extractReducedState (arg1, arg2)

Full Usage: extractReducedState (arg1, arg2)

Parameters:
Returns: ReducedCanvasState

Transform the CanvasState into an f# data structure, with layout data removed (for checking electrically significant changes). Components and connections are sorted to make them order-invariant - selecting components alters order.

arg0 : Component list
arg1 : Connection list
Returns: ReducedCanvasState

getOrderedCompLabels compType (arg2, arg3)

Full Usage: getOrderedCompLabels compType (arg2, arg3)

Parameters:
Returns: (string * int) list

get sheet I/O labels in correct order based on position of components

compType : ComponentType
arg1 : Component list
arg2 : Connection list
Returns: (string * int) list

getStateAndDependencies diagramName ldcs

Full Usage: getStateAndDependencies diagramName ldcs

Parameters:
Returns: Result<(string * CanvasState * LoadedComponent list), string>

the inverse of addStateToLoadedConponents The loadedComponent list in the result does NOT include diagramName A sheet that is not there is an Error rather than an exception because one of the callers runs while rendering: the waveform viewer's buttons ask whether the sheet being simulated still builds, and the sheet named by Model.WaveSimSheet can belong to a project that has since been closed. Raising there threw out of the React render, which unmounted the UI and left every later render throwing the same way - nothing short of reloading the app recovered.

diagramName : string
ldcs : LoadedComponent list
Returns: Result<(string * CanvasState * LoadedComponent list), string>

loadedComponentIsEqual ldc1 ldc2

Full Usage: loadedComponentIsEqual ldc1 ldc2

Parameters:
Returns: bool

Is circuit (not geometry) the same for two LoadedComponents? They must also have the same name

ldc1 : LoadedComponent
ldc2 : LoadedComponent
Returns: bool

loadedComponentIsEqualExInputDefault ldc1 ldc2

Full Usage: loadedComponentIsEqualExInputDefault ldc1 ldc2

Parameters:
Returns: bool

Is circuit (not geometry) the same for two LoadedComponents? They must also have the same name

ldc1 : LoadedComponent
ldc2 : LoadedComponent
Returns: bool

loadedComponentIsSameAsProject (arg1, arg2) ldc p

Full Usage: loadedComponentIsSameAsProject (arg1, arg2) ldc p

Parameters:
Returns: bool

Returns true if project exists and ldc is electrically identical to same sheet in project canvasState must be the project currently open state.

arg0 : Component list
arg1 : Connection list
ldc : LoadedComponent
p : Project option
Returns: bool

logConnId id

Full Usage: logConnId id

Parameters:
Returns: string

Formats a ConnectionId for logging purposes

id : ConnectionId
Returns: string

parseDiagramSignature (arg1, arg2)

Full Usage: parseDiagramSignature (arg1, arg2)

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

Extract the labels and bus widths of the inputs and outputs nodes as a signature. Form is inputs,outputs

arg0 : Component list
arg1 : Connection list
Returns: (string * int) list * (string * int) list

signatureOfInstance ldcs parentBindings childSheet instanceBindings

Full Usage: signatureOfInstance ldcs parentBindings childSheet instanceBindings

Parameters:
Returns: Signature option

The signature an instance of `childSheet` has when it binds its parameters as given. None when the child sheet is not in the project.

ldcs : LoadedComponent list
parentBindings : ParamBindings
childSheet : string
instanceBindings : ParamBindings
Returns: Signature option

signatureOfInstanceWithCertainty ldcs parentBindings childSheet instanceBindings

Full Usage: signatureOfInstanceWithCertainty ldcs parentBindings childSheet instanceBindings

Parameters:
Returns: (Signature * bool) option

The signature an instance of `childSheet` has when it binds its parameters as given, and whether its widths are exact. The bindings are read as expressions in `parentBindings` - the parameters of the sheet the instance sits on. Not exact (see signatureIsExact) means some width could not be worked out here, and only the port NAMES may be relied on; the widths are then those the child sheet was saved with. None when the child sheet is not in the project.

ldcs : LoadedComponent list
parentBindings : ParamBindings
childSheet : string
instanceBindings : ParamBindings
Returns: (Signature * bool) option

sortQBy byFun ids

Full Usage: sortQBy byFun ids

Parameters:
    byFun : 'a -> 'b
    ids : 'a list

Returns: 'a list
byFun : 'a -> 'b
ids : 'a list
Returns: 'a list

stateIsEqual (arg1, arg2) (arg3, arg4)

Full Usage: stateIsEqual (arg1, arg2) (arg3, arg4)

Parameters:
Returns: bool

Is circuit (not geometry) the same for two CanvasStates? fast comparison

arg0 : Component list
arg1 : Connection list
arg2 : Component list
arg3 : Connection list
Returns: bool

stateIsEqualExInputDefault (arg1, arg2) (arg3, arg4)

Full Usage: stateIsEqualExInputDefault (arg1, arg2) (arg3, arg4)

Parameters:
Returns: bool
arg0 : Component list
arg1 : Connection list
arg2 : Component list
arg3 : Connection list
Returns: bool

syncInstancePorts ldcs

Full Usage: syncInstancePorts ldcs

Parameters:
Returns: LoadedComponent list

Every custom component instance in the project sized at its OWN bindings. Resolving a sheet's parameterised slots does not do this. ComponentSlots.setSlotValue writes a CustomCompParam slot into the instance's ParameterBindings, which is all it can reach: the port widths follow from that binding by way of the CHILD sheet, and only signatureOfInstance knows how. So a sheet whose parameter values changed came out of ParameterAnalysis.propagateParameterValues holding instances whose bindings said one width and whose ports still said another. The open sheet never showed it, because ParameterView.updateComponents pushes its slots through ChangeCustom, which recomputes ports on the way. A CLOSED sheet was written to its file as it stood, and opening it raised the instance-out-of-date error that the whole per-instance signature apparatus exists to avoid. Pure, and idempotent: it asks what each instance's ports should be and writes that, so running it again finds nothing to change. A sheet whose canvas it rewrites is flagged as needing saving.

ldcs : LoadedComponent list
Returns: LoadedComponent list

tidyParamSlots (arg1, arg2) paramDefs

Full Usage: tidyParamSlots (arg1, arg2) paramDefs

Parameters:
Returns: ParameterDefs option
 Put a sheet's parameter slots in order against its canvas, ready to be saved:

   - drop slots naming components that are no longer on the sheet. Every parameter slot must
     name a live component: a slot outliving its component cannot be displayed or edited, and
     pushing a value into it would throw;
   - re-point the label an `IO` slot carries at its component's current label. Nothing rewrites
     that label when the component is renamed, and while no reader depends on it (see
     ParameterTypes.sameSlotName) it is what the properties pane and the slot table print, so a
     stale one describes the sheet wrongly.
arg0 : Component list
arg1 : Connection list
paramDefs : ParameterDefs option
Returns: ParameterDefs option

verticesAreSame fixedOffset tolerance conns1 conns2

Full Usage: verticesAreSame fixedOffset tolerance conns1 conns2

Parameters:
    fixedOffset : XYPos
    tolerance : float
    conns1 : (float * float * bool) list
    conns2 : (float * float * bool) list

Returns: bool

Are two lists of vertices are very similar. The lengths are compared FIRST, and not after the fold, because two wires of different lengths are not similar however their common prefix compares - and folding them together first was how this came to raise under .NET, where `List.iter2` is defined only for equal lengths, while returning the right answer in the app, where Fable's stopped at the shorter list. `ListPairs` has since settled that difference in favour of stopping, so the order here is about the answer rather than about raising. Two versions of one connection differ in vertex count whenever the wire has been rerouted, which is the ordinary case for a sheet being edited.

fixedOffset : XYPos
tolerance : float
conns1 : (float * float * bool) list
conns2 : (float * float * bool) list
Returns: bool

withPortWidths labelToWidth cc

Full Usage: withPortWidths labelToWidth cc

Parameters:
Returns: CustomComponentType

A custom component instance holding the given port widths, matched to its ports by LABEL. Widths only. The ORDER of an instance's ports, and which ports it has, are deliberately left alone: an instance whose ports are in a different order from its sheet's is a correct instance (see CustomCompPorts.instanceIsOutOfDate), and a port added to or removed from the sheet is a change the user is asked to confirm rather than one to make behind them. A label the signature says nothing about therefore keeps the width it had.

labelToWidth : Map<string, int>
cc : CustomComponentType
Returns: CustomComponentType

Type something to start searching.