Model View Control
Model view control (GUI)
OpenIndy uses the model-view-control principle to handle multi different views on the same data. The data (geometries, stations, functions etc. ) are stored in the model classes and the different views show extracts of the data and its attributes. The controller class handles the interactions between the view and the model. If some changes are made to the view (e.g. some data is edited) the controller calls all needed functions and manages the changes in the model.
This allows us to have our own internal data logic that manages our data all needed dependencies and does not depend on any view.
The multiple views give us different views on the data for a better support during the measurement task. Each view can have some benefits depending on the task, like the graphical representation of the data.
Views in OpenIndy:
The tableview is a tabular representation of the features and their attributes. Each row represents one feature (e.g. one point) and the columns represent the metadata, attributes and values, number of observations for this geometry, measurement configuration and the functions of this feature.
- Graphic view
The 3D graphic view, using OpenGL, gives the opportunity for a graphical representation of the features and their dependencies. The graphic view also contains a small tree view that contains all features and their attributes.
The console actually is used as a output device for information, warnings and errors of currently executed functions and actions as well as interactions.
Our model class
tablemodel is derived from
QAbstractTableModel and therefore has to implement three functions.
In addition the optional function
headerdata is also implemented to specify the column description. If you do not implement this function the column descriptions will be their index.
So all in all our model looks like this:
Now the different views on the model are implemented as
As an example here is the view for the main tableview
featureoverviewproxymodel.h including the geometries and their metadata, attributes, etc.
Here you only have to implement this two functions with your own logic, to filter the columns and rows displayed in the view. As a last step you need to set the filter on the source model and then show the filtered data in the view.
The graphic view is an
GLWidget rendered with OpenGL. The draw function of the widget handles the different draw methods of each feature type.
To do this it calls the draw function of
OiGraphix that determines the correct feature type (e.g. plane) and the specific draw function.
The specific drawing classes of the features need to derive from the
OiGraphixGeomtry class and implement the draw function. The X, Y and the Z attributes are parameters of the draw function. If more attributes are needed (e.g. ijk vector) they have to be given in the constructor.
In case of a
plane it looks as follows:
3D view (oiGraphixFactory)
OpenGL 3D View