TrenchBroom
TrenchBroom copied to clipboard
Refactor MapDocument
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.
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.