tomcl/issie

Rationalise Boundingbox maps in Sheet

Closed this issue · 1 comments

tomcl commented

The sheet model contains 3 fields:
BoundingBoxes
LabelBoundingBoxes
LastValidBoundingBoxes

These are, in retrospect, a mistake. They contain redundant information - after all, the bounding box info is on the component and could be got from a function worked it out from component position.

The cost of maintaining these copies is not worth any possible performance benefit. Probably, there is performance loss.

LastValidBoundingBoxes is used when a drag fails, to return everything to its initial state. Again, this is not needed.

Info:

  • Symbol.getSymbolBoundingBox (sym: Symbol) calculates the bounding box of a symbol
    • Symbol bounding bozes are stored in a map in Sheet model, field BoundingBoxes
  • Symbol.calcLabelBoundingBox (sym: Symbol) calculated the label bounding box of a symbol
    • Label bounding boxes are stored on symbols and (why?) duplicated stored in LabelboundingBoxes field of sheet model.

TODO:

  • check in detail how these fields on sheet are used
  • work out equivalent operations using bounding boxes on symbols without calculating the summary maps in sheet
  • delete these bounding boxes on Sheet and the messages used for them and the many calls to update functions.
  • Write helper functions (symbolUpdateHelpers) which implement use cases of bounding boxes efficiently directly from the symbols
  • Work out what LastValidBoundingBoxes is used for and maybe save a copy of Symbols instead (from which the bboxes can be calculated).
tomcl commented

closed - not worth doing for now.