TrenchBroom icon indicating copy to clipboard operation
TrenchBroom copied to clipboard

Refactor MapDocument

Open kduske opened this issue 4 years ago • 1 comments

MapDocument has become very large and takes a long time to compile due to all the lambdas being used. We should consider simplifying it or extracting classes that take up some of its responsibilities.

kduske avatar Dec 08 '20 19:12 kduske

In the meantime, the additional complexity introduced by linseed groups is making it quite difficult to ensure consistency and correctness across all operations that MapDocument provides.

Ideas:

  • MapDocument provides a minimal set of operations that are easier to keep consistent: add nodes, remove nodes, reparent nodes, swap node contents. Essentially everything that corresponds to a command.
  • Operations like transforming nodes etc. are moved out of MapDocument. Where possible, these functions are inclined to the call sites or moved to free helper functions.
  • Get rid of MapDocumentCommandFacade - maybe just make those functions private and make the commands into friends of MapDocument.
  • Get rid of MapFacade. This was only introduced to implement issue quickfixes. Instead we can just move the quickfixes and such to the view namespace and pass MapDocument to the quickfixes.

kduske avatar Feb 18 '24 22:02 kduske