diff --git a/doc/dev/documentation.org b/doc/dev/documentation.org index f078bbb75665097feb5aee65babd5549b43f0314..e245b959573cfac10d87f2ca0f492605a0d08e06 100644 --- a/doc/dev/documentation.org +++ b/doc/dev/documentation.org @@ -75,62 +75,41 @@ https://doc.qt.io/qt-5/model-view-programming.html (last access * TODO Architecture -Pamhyr2 architecture is based on Qt Model/View programming[fn:qt-mv] architecture. - -#+name: graph-pipeline -#+header: :results drawer -#+header: :exports results -#+header: :post attr_wrap(width="12cm", data=*this*, name="graph-pipeline", caption="Pamhyr2 solver execution pipeline architecture scheme", float="t") -#+begin_src dot :file "images/graph-pipeline.png" :cache no - digraph { - node[colorscheme=set19,shape=box,style="filled",fillcolor=9]; - - subgraph cluster0 { - label="Pamhyr2" - config[label="Config",fillcolor=5]; - model[label="Model",fillcolor=2]; - obj[label="Solver",fillcolor=6]; - results[label="Results",fillcolor=2]; - view[label="View",fillcolor=1]; - - results -> model[style="dotted"]; - results -> obj[style="dotted"]; - } - - config -> obj[label=""]; - obj -> model; - - subgraph cluster1{ - label="System"; - in[label="Solver input files",shape=note]; - out[label="Solver output files",shape=note]; - bin[label="Solver binary",shape=note]; - } - - obj -> in[label="Write"]; - bin -> in[label="Read"]; - obj -> bin[label="Execute"]; - bin -> out[label="Write"]; - obj -> results[label="Create"]; - results -> out[label="Read"]; - view -> model; - view -> results; - } -#+end_src +Pamhyr2's architecture is based on Qt Model/View, see Figure +[[graph-architecture]]. It is made up of several different components: the +model (in blue), the graphical components (in red), the +actions/delegates (in green), the commands (in purple), the solvers +(in yellow) and the save file (in grey). + +The model is a set of python classes and can be exported to a single +SQLite3 format backup file. The view can be made up of various +components, generally a Qt window with other view components, such as: +a table, a text box, a button, a plot, and so on. The user can view +the data using the view and interact with certain components. These +components are linked to an action (such as a Python function) or to a +delegate class. These actions or delegate can create a command (based +on Qt UndoCommand class), this command must implement two functions: +One to modify the model, one to reverte this modification and reset +the model to previous state. All model modification must be perform by +a command to be cancelled. The user can also run a solver and add some +simulation results to model data. #+name: graph-architecture #+header: :results drawer #+header: :exports results -#+header: :post attr_wrap(width="7cm", data=*this*, name="graph-architecture", caption="Pamhyr2 Model/View architecture scheme (inspired by Qt Model/View architecture [[https://doc.qt.io/qt-5/model-view-programming.html]])", float="t") +#+header: :post attr_wrap(width="9cm", data=*this*, name="graph-architecture", caption="Pamhyr2 Model/View architecture scheme (inspired by Qt Model/View architecture [[https://doc.qt.io/qt-5/model-view-programming.html]])", float="t") #+begin_src dot :file "images/graph-architecture.png" :cache no digraph { + bgcolor="transparent"; node[colorscheme=set19,shape=box,style="filled",fillcolor=white]; save[label="Pamhyr save",fillcolor="9",shape=note]; model[label="Model",fillcolor="2"]; view[label="View",fillcolor="1"]; delegate[label="Delegate",fillcolor="3"]; - undocommand[label="UndoCommand",fillcolor="4"]; + action[label="Action",fillcolor="3"]; + solver[label="Solver",fillcolor="6"]; + undocommand[label="Command",fillcolor="4"]; user[label="User",shape=ellipse]; model -> save[label="Save"]; @@ -139,19 +118,37 @@ Pamhyr2 architecture is based on Qt Model/View programming[fn:qt-mv] architectur model -> view[label="Rendering"]; view -> delegate[label="Rendering"]; delegate -> undocommand[label="Create"]; - undocommand -> model[label="Modify"] + action -> undocommand[label="Create"]; + action -> solver[label="Run"]; + solver -> model[label="Add results"]; + undocommand -> model[label="Modify"]; view -> user[label="Vizualize"]; user -> delegate[label="Modify"]; + user -> action[label="Activate"]; } #+end_src +All the model source code are in the directory {{{file(src/Model)}}} +(let see section [[Model]] for more details), the View components, +delegate and command are in {{{file(src/View)}}} (see section [[View]]). Solvers classes are +in {{{file(src/Solver)}}} (see section [[Solver]]). + +[fn:qt-mv] The Qt Model/View documentation web page: +https://doc.qt.io/qt-5/model-view-programming.html + +** TODO Model + +- Model de donnée Python +- Correspond à une sauvegarde SQL + #+name: graph-model #+header: :results drawer #+header: :exports results -#+header: :post attr_wrap(width="16cm", data=*this*, name="graph-model", caption="Pamhyr2 Model architecture scheme", float="t") +#+header: :post attr_wrap(width="16cm", data=*this*, name="graph-model", caption="Pamhyr2 model class dependencies", float="t") #+begin_src dot :file "images/graph-model.png" :cache no digraph { + bgcolor="transparent"; node[colorscheme=set19,shape=box,style="filled",fillcolor="2"]; study[label="Study"]; @@ -202,6 +199,14 @@ Pamhyr2 architecture is based on Qt Model/View programming[fn:qt-mv] architectur geopoint[label="Point"]; } + subgraph cluster07 { + label="Results" + results[label="Results"] + rriver[label="River"]; + rreach[label="Reach"]; + rcrosssection[label="Cross-section"]; + } + study -> river; river -> rnode; river -> redge; @@ -218,20 +223,71 @@ Pamhyr2 architecture is based on Qt Model/View programming[fn:qt-mv] architectur geocrosssection -> sedimentlayer; geopoint -> sedimentlayer; + results -> study[style="dashed"]; + results -> rriver; + rriver -> river[style="dashed"]; + rriver -> rreach; + rreach -> georeach[style="dashed"]; + rreach -> rcrosssection; + rcrosssection -> geocrosssection[style="dashed"]; } #+end_src -[fn:qt-mv] The Qt Model/View documentation web page: -https://doc.qt.io/qt-5/model-view-programming.html - -** TODO Model +*** TODO SQL study file +*** TODO List class +*** TODO Dict class ** TODO View *** TODO UI file -*** TODO Window class -** TODO UndoCommand -** TODO Table -** TODO Plot +*** TODO Translate +*** TODO Window +*** TODO UndoCommand +*** TODO Table +*** TODO Plot +*** TODO Mainwindow ** TODO Solver + +#+name: graph-pipeline +#+header: :results drawer +#+header: :exports results +#+header: :post attr_wrap(width="12cm", data=*this*, name="graph-pipeline", caption="Pamhyr2 solver execution pipeline architecture scheme", float="t") +#+begin_src dot :file "images/graph-pipeline.png" :cache no + digraph { + bgcolor="transparent"; + node[colorscheme=set19,shape=box,style="filled",fillcolor=9]; + + subgraph cluster0 { + label="Pamhyr2" + config[label="Config",fillcolor=5]; + model[label="Model",fillcolor=2]; + obj[label="Solver",fillcolor=6]; + results[label="Results",fillcolor=2]; + view[label="View",fillcolor=1]; + + results -> model[style="dashed"]; + results -> obj[style="dashed"]; + } + + config -> obj[label=""]; + obj -> model[style="dashed"]; + + subgraph cluster1{ + label="System"; + in[label="Solver input files",shape=note]; + out[label="Solver output files",shape=note]; + bin[label="Solver binary",shape=note]; + } + + obj -> in[label="Write (1)"]; + obj -> bin[label="Execute (2)"]; + bin -> in[label="Read (2.1)"]; + bin -> out[label="Write (2.2)"]; + obj -> results[label="Create (3)"]; + obj -> out[label="Read (3.1)"]; + view -> model[style="dashed"]; + view -> results[style="dashed"]; + } +#+end_src + ** TODO Unit tests ** TODO The debug mode * TODO Build the project @@ -530,10 +586,9 @@ file and make a merge request. #+end_src #+NAME: qt-linguist-setup -#+ATTR_HTML: :width 8cm #+ATTR_LATEX: :width 8cm #+CAPTION: Qt linguist lang setup example with italian. -[[../images/Qt-linguist-setup-lang.png]] +[[./images/Qt-linguist-setup-lang.png]] [fn:qt-linguist] The Qt linguist documentation web page: https://doc.qt.io/qt-5/qtlinguist-index.html (last access 2023-09-18) diff --git a/doc/images/Qt-linguist-setup-lang.png b/doc/dev/images/Qt-linguist-setup-lang.png similarity index 100% rename from doc/images/Qt-linguist-setup-lang.png rename to doc/dev/images/Qt-linguist-setup-lang.png