CanvasExtractor Module
Types
| Type | Description |
Functions and values
| Function or value | Description |
Full Usage:
addStateToLoadedComponents openFileName (arg2, arg3) loadedComponents
Parameters:
string
arg1 : Component list
arg2 : Connection list
loadedComponents : LoadedComponent list
Returns: LoadedComponent list
|
Add given name,state to loadedcomponent list as a loaded component (overwriting existing if needed). **Give it the WHOLE design, the named sheet included.** It replaces that sheet itself, and everything about a sheet that its canvas does not say - its parameters, whether it is the top sheet, and whether it is an ARRAY COMPONENT - can only be carried forward from the copy already in the list. Callers used to filter the sheet out first, which made this lookup dead: while an array component was the sheet being edited, every design built from the model said it was an ordinary sheet, so its ports came out as its drawn IO alone and it was never expanded.
|
Full Usage:
compareCanvas tolerance (arg2, arg3) (arg4, arg5)
Parameters:
float
arg1 : Component list
arg2 : Connection list
arg3 : Component list
arg4 : Connection list
Returns: bool
|
|
|
|
Full Usage:
compareConns tolerance conns1 conns2
Parameters:
float
conns1 : List<Connection>
conns2 : List<Connection>
Returns: bool
|
Are two lists of connections identical **A connection with no vertices on one side is not a difference.** Vertices are a record of a route, and a connection can arrive without one: `extractReducedState` strips them, the sheet DSL writes connections with none so that Issie routes them on load, and a `.dgm` need not have come from this version. In each of those the geometry is not being asserted rather than being asserted to differ, and the wire it names is the same wire between the same two ports. Counting it as changed made a sheet whose route is derived rather than stored report unsaved changes from the moment it opened - which is `currentSheetIsOutOfDate`, so it also prompted on close and drove the auto-backup. Two connections that BOTH carry vertices are compared as before, so an edit that moves a wire is still seen.
|
Full Usage:
compareIOs ldc1 ldc2
Parameters:
LoadedComponent
ldc2 : LoadedComponent
Returns: bool
|
|
|
|
|
|
Full Usage:
connsAreEqual conn1 conn2
Parameters:
Connection
conn2 : Connection
Returns: bool
Modifiers: inline |
|
|
|
Full Usage:
effectiveInstanceBindings childDefaults parentBindings instanceBindings
Parameters:
ParamBindings
parentBindings : ParamBindings
instanceBindings : ParamBindings
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.
|
Full Usage:
extractLoadedSimulatorComponent (arg1, arg2) name
Parameters:
Component list
arg1 : Connection list
name : string
Returns: LoadedComponent
|
|
Full Usage:
extractReducedState (arg1, arg2)
Parameters:
Component list
arg1 : Connection list
Returns: ReducedCanvasState
|
|
Full Usage:
getOrderedCompLabels compType (arg2, arg3)
Parameters:
ComponentType
arg1 : Component list
arg2 : Connection list
Returns: (string * int) list
|
|
Full Usage:
getStateAndDependencies diagramName ldcs
Parameters:
string
ldcs : LoadedComponent list
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.
|
Full Usage:
loadedComponentIsEqual ldc1 ldc2
Parameters:
LoadedComponent
ldc2 : LoadedComponent
Returns: bool
|
|
Full Usage:
loadedComponentIsEqualExInputDefault ldc1 ldc2
Parameters:
LoadedComponent
ldc2 : LoadedComponent
Returns: bool
|
|
Full Usage:
loadedComponentIsSameAsProject (arg1, arg2) ldc p
Parameters:
Component list
arg1 : Connection list
ldc : LoadedComponent
p : Project option
Returns: bool
|
|
|
|
Full Usage:
parseDiagramSignature (arg1, arg2)
Parameters:
Component list
arg1 : Connection list
Returns: (string * int) list * (string * int) list
|
|
Full Usage:
parseDiagramSignatureFor arrayInfo paramDefs (arg3, arg4)
Parameters:
ArrayInfo option
paramDefs : ParameterDefs option
arg2 : Component list
arg3 : Connection list
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 THE one place that says what a sheet's ports are. On an ordinary sheet they are its Input1 and Output components; on an ARRAY DESIGN SHEET they are derived from its contents and its copy count instead - an Output gives one port per copy, a BusOut one wide one, a loose join an end of a chain - and ArrayExpand.arrayOutlineOf works that out. Every path that asks what a sheet's ports are comes through here, which is what keeps the two kinds of sheet answering one question: loading a sheet, saving one, and CanvasExtractor.signatureOfInstance for an instance of one. The array settings and the parameter slots are taken rather than read off a LoadedComponent because two callers have a canvas and no sheet: an instance's signature is computed from the child sheet's canvas RESOLVED at that instance's bindings, and the sheet-description DSL builds a canvas before there is a sheet to hold it. A sheet whose array settings do not work out - a mux over an Array out that is not there, a channel number that will not evaluate - still has ports, and still has to be drawn while it is being fixed. So the problems are dropped here and CanvasStateAnalyser is what reports them and refuses to simulate: see ArrayExpand's note about nothing there throwing.
|
Full Usage:
sheetFromCanvas existing name (arg3, arg4)
Parameters:
LoadedComponent option
name : string
arg2 : Component list
arg3 : Connection list
Returns: LoadedComponent
|
A sheet rebuilt from a canvas: everything the canvas says, and everything it cannot say taken from the copy already held. **THE one place that splits a LoadedComponent's fields between those two.** A sheet is more than its canvas - its array settings say how many copies its components are and give it ports no component on it draws, its parameters give those ports their widths, and being the top sheet decides which design is simulated - and Issie rebuilds sheets from canvases in several places. Three of them dropped all of that and produced an ordinary sheet where an array component had been, with the wrong ports and no expansion. Written once so that there is one place to be right, and Tests/Issie.Tests/SheetIdentity.fs holds the two halves to the whole record. `existing` is None only where there genuinely is no sheet behind the canvas.
|
Full Usage:
signatureOfInstance ldcs parentBindings childSheet instanceBindings
Parameters:
LoadedComponent list
parentBindings : ParamBindings
childSheet : string
instanceBindings : ParamBindings
Returns: Signature option
|
|
Full Usage:
signatureOfInstanceWithCertainty ldcs parentBindings childSheet instanceBindings
Parameters:
LoadedComponent list
parentBindings : ParamBindings
childSheet : string
instanceBindings : ParamBindings
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.
|
Full Usage:
simpleDesignOfLoadedComponents ldcs
Parameters:
LoadedComponent list
Returns: SimpleDesign
|
|
|
|
Full Usage:
sortQBy byFun ids
Parameters:
'a -> 'b
ids : 'a list
Returns: 'a list
|
|
Full Usage:
stateIsEqual (arg1, arg2) (arg3, arg4)
Parameters:
Component list
arg1 : Connection list
arg2 : Component list
arg3 : Connection list
Returns: bool
|
|
Full Usage:
stateIsEqualExInputDefault (arg1, arg2) (arg3, arg4)
Parameters:
Component list
arg1 : Connection list
arg2 : Component list
arg3 : Connection list
Returns: bool
|
|
Full Usage:
syncInstancePorts ldcs
Parameters:
LoadedComponent list
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.
|
Full Usage:
tidyParamSlots (arg1, arg2) paramDefs
Parameters:
Component list
arg1 : Connection list
paramDefs : ParameterDefs option
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.
|
Full Usage:
verticesAreSame fixedOffset tolerance conns1 conns2
Parameters:
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.
|
Full Usage:
withPortWidths labelToWidth cc
Parameters:
Map<string, int>
cc : CustomComponentType
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.
|