A
A
awsoft2016-10-02 08:35:25
Programming
awsoft, 2016-10-02 08:35:25

Document/view architecture, which one to choose?

I am working on a project in Qt for conducting specialized calculations, as the initial data, a model consisting of rooms, corridors, openings, stairs (i.e. building layout) is transferred to the calculation module. The model is created in the graphical module of the 2D vector editor (I plan to use QGraphicsScene and QGraphicsView)
According to all the canons of the architecture, the document / view of the building model is stored in an instance of the document class, the model is drawn in the graphical module, which also implements the document-view architecture.
The building model document and the graphic module document differ from each other, for example, they are positioned in different coordinate systems (the building model - physical coordinates, the graphic module - screen coordinates); individual elements such as markers (which change the size of elements), element labels, etc. appear in the graphic module.
As a result, a document/document/view architecture is obtained, in order to render the model, it must be transferred from the building model document format to the graphic module document format; when editing the model in the graphic module, it is necessary to make changes to the building model document, i.e. synchronize two documents.
Question: How does such a decision fit in with the accepted canons of document/view architecture in programming? Or is it necessary to create a single document that knows about physical coordinates and about screen coordinates, knows the features of a physical object and a screen element? Is there a more elegant solution?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2016-10-02
@2ord

There is such a little-known tool BlackBox Component Builder , written in Component Pascal, a descendant of Oberon and Pascal. Open source, the code is easy to read and there is documentation in English. So it is a framework that runs on top of the OS and its GUI is implemented as an abstract graphical model. Physical units are used for output, be it dimensions in mm or points. All this is converted by formulas into the final raster format when displayed.
See the code of System/Mod/Ports (abstraction) and Host/Mod/Ports (implementation under WinAPI).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question