gui.tex 4.18 KB
 Tobias WEBER committed Jun 29, 2021 1 %  Tobias WEBER committed Jul 30, 2021 2 % path-finding user interfaces  Tobias WEBER committed Jun 29, 2021 3 % @author Tobias Weber  Tobias WEBER committed Jul 30, 2021 4 % @date july-2021  Tobias WEBER committed Jun 29, 2021 5 6 7 % @license see 'LICENSE' file %  Tobias WEBER committed Jul 27, 2021 8 \chapter{User Interfaces}  Tobias WEBER committed Jun 29, 2021 9 10 \label{ch:gui}  Tobias WEBER committed Jul 27, 2021 11 12 13 The software has been realised in a modular fashion, it comprises a core and a library module (see chapter \ref{ch:impl}), which can be easily linked into external C++ applications. Such a library usage will be important in the  Tobias WEBER committed Jul 31, 2021 14 future when we plan to utilise the software as a plug-in module to the instrument  Tobias WEBER committed Jul 27, 2021 15 control software \textit{NOMAD} \cite{web_NOMAD} that is employed at the Institut  Tobias WEBER committed Jul 27, 2021 16 17 18 19 20 21 Laue-Langevin. Furthermore, a graphical user interface (GUI) has been implemented for a visual and interactive representation of the instrument and the underlying algorithms. The GUI is described in detail in section \ref{sec:gui}.  Tobias WEBER committed Jul 27, 2021 22 Finally, the software allows scripting via \textit{Python} \cite{Rossum2011, web_python}.  Tobias WEBER committed Jul 27, 2021 23 24 Apart from simply setting up a workflow and plotting the results, the \textit{Python} interface will allow the usage of the software in \textit{Python}-based instrument  Tobias WEBER committed Jul 27, 2021 25 control systems such as \textit{NICOS} \cite{web_NICOS}, which is used at the  Tobias WEBER committed Jul 27, 2021 26 27 28 29 30 31 32 33 34 Forschungsreaktor M\"unchen II (FRM-II). Details on the scripting interface can be found in section \ref{sec:scripting}. \section{Graphical User Interface} \label{sec:gui}  Tobias WEBER committed Jul 31, 2021 35 36 37 38 39 40 41 42 The software's main graphical user interface (GUI), for which a typical session is depicted in Fig. \ref{fig:gui}, is based on the \textit{Qt} framework \cite{web_Qt}, which allows for an easy and rapid cross-platform GUI development in \textit{C++}. We support both current releases of \textit{Qt}, namely version 5 and version 6. Similar to the core calculation module, the GUI is written in the recent \textit{C++20} standard \cite{ISOCPP20} of the C++ language family \cite{Stroustrup2008, Stroustrup2018}. The source code of the GUI module can be found in the directory \lstinline|./src/gui| of the source repository, see chapter \ref{ch:online} for more information.  Tobias WEBER committed Jul 27, 2021 43   Tobias WEBER committed Jul 31, 2021 44 45 46 47 48 49 50 51 52 53 54 55 \begin{figure}[htb] \begin{center} \includegraphics[width = 1 \textwidth]{figures/gui} \end{center} \caption{Main GUI. Here, instrument and sample crystal properties can be set up, walls can be added and moved and paths around them be calculated. The central view provides a three-dimensional visualisation of the instrument configuration and is fully dynamic: Every element, including the instrument and the wall segments, can be moved or manipulated using the mouse. \label{fig:gui}} \end{figure}  Tobias WEBER committed Jul 31, 2021 56 57 58 59 60 61 62 63 64 65 66 67 The GUI allows the set-up of an instrument configuration and a crystal $UB$ matrix from a sample definition according to the formalism described in chapter \ref{ch:xtal}. All calculation is performed in the core module, which is described in chapter \ref{ch:impl} and to which the GUI is just that, an interface. By the same token, the core module itself is completely independent of the GUI, or any other interface code, and the full functionality of the software, except GUI-specific visualisations, is equally accessible from the other alternative interface modules, e.g. the \textit{Python} interface described in section \ref{sec:scripting}, or the raw \textit{C++} library interface. Graphical display of the instrument and the walls as well as the interaction with these elements is performed using \textit{OpenGL} \cite{web_OpenGL} via Qt's \lstinline[language=C++]|QOpenGLWidget| \cite{web_QOpenGLWidget} class.  Tobias WEBER committed Jul 31, 2021 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84  \begin{figure}[htb] \begin{center} \includegraphics[width = 0.66 \textwidth]{figures/gui_configspace} \end{center} \caption{Angular configuration space and path calculation. The figure plots all possible instrument positions for the monochromator and sample scattering angles, $2\theta_M$ and $2\theta_S$, respectively. Forbidden positions are shown in red. These can be invalid angles as well as collisions of the instrument with walls (here, specifically, the pillar from Fig \ref{fig:gui}), or with itself. Allowed positions are drawn in blue. The mesh of all possible instrument paths is shown as white lines, while a currently selected example path from the red start to the green target position is shown as a yellow line. \label{fig:gui_configspace}} \end{figure}  Tobias WEBER committed Jul 27, 2021 85 86 87 88 89  \section{Python Scripting Interface} \label{sec:scripting}