OGS
MainWindow Class Reference

Detailed Description

Main program window for the graphical user interface of OpenGeoSys.

Definition at line 40 of file mainwindow.h.

#include <mainwindow.h>

Inheritance diagram for MainWindow:
[legend]
Collaboration diagram for MainWindow:
[legend]

Signals

void fileUsed (QString filename)
 
void fileOpenRequested (int)
 

Public Member Functions

 MainWindow (QWidget *parent=nullptr)
 
void ShowWindow ()
 
void HideWindow ()
 
void loadFileOnStartUp (const QString &fileName)
 

Protected Slots

void showGeoDockWidget (bool show)
 
void showStationDockWidget (bool show)
 
void showMshDockWidget (bool show)
 
void showConditionDockWidget (bool show)
 
void showVisDockWidget (bool show)
 
void open (int file_type=0)
 Function calls for opening files. More...
 
void save ()
 Function calls for saving files. More...
 
void callGMSH (std::vector< std::string > &selectedGeometries, unsigned param1, double param2, double param3, double param4, bool delete_geo_file)
 Function calls for generating GMSH files from the GUI. More...
 
void exportBoreholesToGMS (std::string listName, std::string fileName)
 Function calls for GMS export. More...
 
void FEMTestStart ()
 Testing functionality for connection to FEM lib. More...
 
void loadPetrelFiles ()
 
void mapGeometry (const std::string &geo_name)
 
void convertMeshToGeometry (const MeshLib::Mesh *mesh)
 
void convertPointsToStations (std::string const &geo_name)
 
void openRecentFile ()
 
void about ()
 
void showAddPipelineFilterItemDialog (QModelIndex parentIndex)
 
void showDataExplorerSettingsDialog ()
 
void showGeoNameDialog (const std::string &geometry_name, const GeoLib::GEOTYPE object_type, std::size_t id)
 Allows setting the name for a geometric object. More...
 
void showStationNameDialog (const std::string &stn_vec_name, std::size_t id)
 Allows setting the name for a station. More...
 
void showCreateStructuredGridDialog ()
 Creates a structured grid with user-specified parameters. More...
 
void showMeshElementRemovalDialog ()
 Removal of mesh elements based on a number of criteria. More...
 
void showDiagramPrefsDialog ()
 Calls the diagram prefs dialog from the Tools menu. More...
 
void showDiagramPrefsDialog (QModelIndex &index)
 Calls the diagram prefs dialog from the station list (i.e. for a specific station). More...
 
void showFileConverter ()
 Calls the OGSFileConverter as an external tool. More...
 
void showLicense ()
 
void showLineEditDialog (const std::string &geoName)
 
void showGMSHPrefsDialog ()
 
void showMergeGeometriesDialog ()
 
void showMeshAnalysisDialog ()
 
void showMeshQualitySelectionDialog (MeshLib::VtkMappedMeshSource *mshSource)
 
void showVisalizationPrefsDialog ()
 
void updateDataViews ()
 
void writeGeometryToFile (QString gliName, QString fileName)
 
void writeStationListToFile (QString listName, QString fileName)
 
void on_actionExportVTK_triggered (bool checked=false)
 
void on_actionExportVRML2_triggered (bool checked=false)
 
void on_actionExportObj_triggered (bool checked=false)
 
void createPresentationMenu ()
 
void startPresentationMode ()
 
void quitPresentationMode ()
 

Protected Member Functions

void closeEvent (QCloseEvent *event) override
 

Private Member Functions

QMenu * createImportFilesMenu ()
 
void loadFile (ImportFileType::type t, const QString &fileName)
 
void loadFEMConditionsFromFile (const QString &fileName, std::string geoName="")
 
void readSettings ()
 
void writeSettings ()
 
QString getLastUsedDir ()
 

Private Attributes

DataHolderLib::Project _project
 
std::unique_ptr< MeshModel_meshModel
 
std::unique_ptr< ElementTreeModel_elementModel
 
std::unique_ptr< ProcessModel_processModel
 
std::unique_ptr< FemConditionModel_conditionModel
 
std::unique_ptr< VtkVisPipeline_vtkVisPipeline
 
QList< QRect > _screenGeometries
 
std::unique_ptr< QWidget > _vtkWidget
 
QByteArray _windowState
 
std::unique_ptr< VisPrefsDialog_visPrefsDialog
 
std::unique_ptr< GEOModels_geo_model
 

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( QWidget *  parent = nullptr)
explicit

Definition at line 100 of file mainwindow.cpp.

100  : QMainWindow(parent)
101 {
102  setupUi(this);
103 
104  // Setup various models
105  _geo_model = std::make_unique<GEOModels>(_project.getGEOObjects());
106  _meshModel = std::make_unique<MeshModel>(_project);
107  _elementModel = std::make_unique<ElementTreeModel>();
108  _processModel = std::make_unique<ProcessModel>(_project);
109  _conditionModel = std::make_unique<FemConditionModel>();
110 
111  geoTabWidget->treeView->setModel(_geo_model->getGeoModel());
112  stationTabWidget->treeView->setModel(_geo_model->getStationModel());
113  meshTabWidget->treeView->setModel(_meshModel.get());
114  meshTabWidget->elementView->setModel(_elementModel.get());
115  modellingTabWidget->treeView->setModel(_processModel.get());
116  modellingTabWidget->conditionView->setModel(_conditionModel.get());
117 
118  // vtk visualization pipeline
120  std::make_unique<VtkVisPipeline>(visualizationWidget->renderer());
121 
122  // station model connects
123  connect(stationTabWidget->treeView, SIGNAL(openStationListFile(int)), this,
124  SLOT(open(int)));
125  connect(stationTabWidget->treeView,
126  SIGNAL(stationListExportRequested(std::string, std::string)), this,
128  std::string, std::string))); // export Stationlist to GMS
129  connect(stationTabWidget->treeView, SIGNAL(stationListRemoved(std::string)),
130  _geo_model.get(),
131  SLOT(removeStationVec(
132  std::string))); // update model when stations are removed
133  connect(stationTabWidget->treeView,
134  SIGNAL(stationListSaved(QString, QString)), this,
135  SLOT(writeStationListToFile(QString,
136  QString))); // save Stationlist to File
137  connect(
138  _geo_model.get(),
139  SIGNAL(stationVectorRemoved(StationTreeModel*, std::string)), this,
140  SLOT(updateDataViews())); // update data view when stations are removed
141  connect(stationTabWidget->treeView,
142  SIGNAL(requestNameChangeDialog(const std::string&, std::size_t)),
143  this, SLOT(showStationNameDialog(const std::string&, std::size_t)));
144  connect(stationTabWidget->treeView,
145  SIGNAL(geometryMappingRequested(const std::string&)), this,
146  SLOT(mapGeometry(const std::string&)));
147  connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex&)),
148  this,
150  QModelIndex&))); // connect treeview to diagramview
151 
152  // geo model connects
153  connect(geoTabWidget->treeView, SIGNAL(openGeometryFile(int)), this,
154  SLOT(open(int)));
155  connect(geoTabWidget->treeView,
156  SIGNAL(listRemoved(std::string, GeoLib::GEOTYPE)), _geo_model.get(),
157  SLOT(removeGeometry(std::string, GeoLib::GEOTYPE)));
158  connect(geoTabWidget->treeView,
159  SIGNAL(geometryMappingRequested(const std::string&)), this,
160  SLOT(mapGeometry(const std::string&)));
161  connect(
162  geoTabWidget->treeView, SIGNAL(saveToFileRequested(QString, QString)),
163  this,
164  SLOT(writeGeometryToFile(QString, QString))); // save geometry to file
165  connect(geoTabWidget->treeView,
166  SIGNAL(requestPointToStationConversion(std::string const&)), this,
167  SLOT(convertPointsToStations(std::string const&)));
168  connect(
169  geoTabWidget->treeView,
170  SIGNAL(requestLineEditDialog(const std::string&)), this,
171  SLOT(showLineEditDialog(const std::string&))); // open line edit dialog
172  connect(geoTabWidget->treeView,
173  SIGNAL(requestNameChangeDialog(const std::string&,
174  const GeoLib::GEOTYPE, std::size_t)),
175  this,
176  SLOT(showGeoNameDialog(const std::string&, const GeoLib::GEOTYPE,
177  std::size_t)));
178  connect(_geo_model.get(),
179  SIGNAL(geoDataAdded(GeoTreeModel*, std::string, GeoLib::GEOTYPE)),
180  this, SLOT(updateDataViews()));
181  connect(_geo_model.get(),
182  SIGNAL(geoDataRemoved(GeoTreeModel*, std::string, GeoLib::GEOTYPE)),
183  this, SLOT(updateDataViews()));
184  connect(geoTabWidget->treeView,
185  SIGNAL(geoItemSelected(const vtkPolyDataAlgorithm*, int)),
186  _vtkVisPipeline.get(),
187  SLOT(highlightGeoObject(const vtkPolyDataAlgorithm*, int)));
188  connect(geoTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
189  _vtkVisPipeline.get(), SLOT(removeHighlightedGeoObject()));
190  connect(stationTabWidget->treeView,
191  SIGNAL(geoItemSelected(const vtkPolyDataAlgorithm*, int)),
192  _vtkVisPipeline.get(),
193  SLOT(highlightGeoObject(const vtkPolyDataAlgorithm*, int)));
194  connect(stationTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
195  _vtkVisPipeline.get(), SLOT(removeHighlightedGeoObject()));
196 
197  // Setup connections for mesh models to GUI
198  connect(meshTabWidget->treeView, SIGNAL(openMeshFile(int)), this,
199  SLOT(open(int)));
200  connect(meshTabWidget->treeView,
201  SIGNAL(requestMeshRemoval(const QModelIndex&)), _meshModel.get(),
202  SLOT(removeMesh(const QModelIndex&)));
203  connect(meshTabWidget->treeView,
204  SIGNAL(requestMeshRemoval(const QModelIndex&)), _elementModel.get(),
205  SLOT(clearView()));
206  connect(
207  meshTabWidget->treeView,
208  SIGNAL(qualityCheckRequested(MeshLib::VtkMappedMeshSource*)),
209  this,
211  connect(meshTabWidget->treeView,
212  SIGNAL(requestMeshToGeometryConversion(const MeshLib::Mesh*)), this,
213  SLOT(convertMeshToGeometry(const MeshLib::Mesh*)));
214  connect(meshTabWidget->treeView,
215  SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const,
216  unsigned, bool)),
217  _vtkVisPipeline.get(),
218  SLOT(highlightMeshComponent(
219  vtkUnstructuredGridAlgorithm const* const, unsigned, bool)));
220  connect(meshTabWidget->treeView, SIGNAL(meshSelected(MeshLib::Mesh const&)),
221  this->_elementModel.get(), SLOT(setMesh(MeshLib::Mesh const&)));
222  connect(meshTabWidget->treeView, SIGNAL(meshSelected(MeshLib::Mesh const&)),
223  meshTabWidget->elementView, SLOT(updateView()));
224  connect(
225  meshTabWidget->treeView,
226  SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const,
227  unsigned, bool)),
228  this->_elementModel.get(),
229  SLOT(setElement(vtkUnstructuredGridAlgorithm const* const, unsigned)));
230  connect(meshTabWidget->treeView,
231  SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const,
232  unsigned, bool)),
233  meshTabWidget->elementView, SLOT(updateView()));
234  connect(meshTabWidget->treeView,
235  SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const,
236  unsigned, bool)),
237  reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
238  SLOT(removeHighlightActor()));
239  connect(meshTabWidget->treeView, SIGNAL(removeSelectedMeshComponent()),
240  _vtkVisPipeline.get(), SLOT(removeHighlightedMeshComponent()));
241  connect(meshTabWidget->elementView,
242  SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm const* const,
243  unsigned, bool)),
244  reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
245  SLOT(removeHighlightActor()));
246  connect(meshTabWidget->elementView,
247  SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm const* const,
248  unsigned, bool)),
249  _vtkVisPipeline.get(),
250  SLOT(highlightMeshComponent(
251  vtkUnstructuredGridAlgorithm const* const, unsigned, bool)));
252  connect(meshTabWidget->elementView, SIGNAL(removeSelectedMeshComponent()),
253  _vtkVisPipeline.get(), SLOT(removeHighlightedMeshComponent()));
254 
255  // Connection for process model to GUI
256  connect(modellingTabWidget->treeView,
257  SIGNAL(processVarRemoved(QString const&)), _processModel.get(),
258  SLOT(removeProcessVariable(QString const&)));
259  connect(modellingTabWidget->treeView,
260  SIGNAL(conditionRemoved(QString const&, QString const&)),
261  _processModel.get(),
262  SLOT(removeCondition(QString const&, QString const&)));
263  connect(modellingTabWidget->treeView, SIGNAL(clearConditionView()),
264  _conditionModel.get(), SLOT(clearView()));
265  connect(modellingTabWidget->treeView,
266  SIGNAL(processVarSelected(DataHolderLib::FemCondition*)),
267  _conditionModel.get(),
268  SLOT(setProcessVariable(DataHolderLib::FemCondition*)));
269  connect(modellingTabWidget->treeView,
270  SIGNAL(conditionSelected(DataHolderLib::FemCondition*)),
271  _conditionModel.get(),
272  SLOT(setFemCondition(DataHolderLib::FemCondition*)));
273  connect(modellingTabWidget->treeView,
274  SIGNAL(processVarSelected(DataHolderLib::FemCondition*)),
275  modellingTabWidget->conditionView, SLOT(updateView()));
276  connect(modellingTabWidget->treeView,
277  SIGNAL(conditionSelected(DataHolderLib::FemCondition*)),
278  modellingTabWidget->conditionView, SLOT(updateView()));
279 
280  // VisPipeline Connects
281  connect(_geo_model.get(),
282  SIGNAL(geoDataAdded(GeoTreeModel*, std::string, GeoLib::GEOTYPE)),
283  _vtkVisPipeline.get(),
284  SLOT(addPipelineItem(GeoTreeModel*, std::string, GeoLib::GEOTYPE)));
285  connect(
286  _geo_model.get(),
287  SIGNAL(geoDataRemoved(GeoTreeModel*, std::string, GeoLib::GEOTYPE)),
288  _vtkVisPipeline.get(),
289  SLOT(removeSourceItem(GeoTreeModel*, std::string, GeoLib::GEOTYPE)));
290 
291  connect(_geo_model.get(),
292  SIGNAL(stationVectorAdded(StationTreeModel*, std::string)),
293  _vtkVisPipeline.get(),
294  SLOT(addPipelineItem(StationTreeModel*, std::string)));
295  connect(_geo_model.get(),
296  SIGNAL(stationVectorRemoved(StationTreeModel*, std::string)),
297  _vtkVisPipeline.get(),
298  SLOT(removeSourceItem(StationTreeModel*, std::string)));
299 
300  connect(_meshModel.get(), SIGNAL(meshAdded(MeshModel*, QModelIndex)),
301  _vtkVisPipeline.get(),
302  SLOT(addPipelineItem(MeshModel*, QModelIndex)));
303  connect(_meshModel.get(), SIGNAL(meshRemoved(MeshModel*, QModelIndex)),
304  _vtkVisPipeline.get(),
305  SLOT(removeSourceItem(MeshModel*, QModelIndex)));
306 
307  connect(_vtkVisPipeline.get(), SIGNAL(vtkVisPipelineChanged()),
308  visualizationWidget->vtkWidget, SLOT(update()));
309  connect(_vtkVisPipeline.get(), SIGNAL(vtkVisPipelineChanged()),
310  vtkVisTabWidget->vtkVisPipelineView, SLOT(expandAll()));
311  connect(_vtkVisPipeline.get(), SIGNAL(itemSelected(const QModelIndex&)),
312  vtkVisTabWidget->vtkVisPipelineView,
313  SLOT(selectItem(const QModelIndex&)));
314 
315  vtkVisTabWidget->vtkVisPipelineView->setModel(_vtkVisPipeline.get());
316  connect(vtkVisTabWidget->vtkVisPipelineView,
317  SIGNAL(requestRemovePipelineItem(QModelIndex)),
318  _vtkVisPipeline.get(), SLOT(removePipelineItem(QModelIndex)));
319  connect(vtkVisTabWidget->vtkVisPipelineView,
320  SIGNAL(requestAddPipelineFilterItem(QModelIndex)), this,
321  SLOT(showAddPipelineFilterItemDialog(QModelIndex)));
322  connect(vtkVisTabWidget, SIGNAL(requestViewUpdate()), visualizationWidget,
323  SLOT(updateView()));
324 
325  connect(vtkVisTabWidget->vtkVisPipelineView,
326  SIGNAL(actorSelected(vtkProp3D*)),
327  reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
328  SLOT(highlightActor(vtkProp3D*)));
329  connect(_vtkVisPipeline.get(), SIGNAL(vtkVisPipelineChanged()),
330  visualizationWidget, SLOT(updateView()));
331 
332  // Propagates selected vtk object in the pipeline to the pick interactor
333  connect(vtkVisTabWidget->vtkVisPipelineView,
334  SIGNAL(dataObjectSelected(vtkDataObject*)),
335  reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
336  SLOT(pickableDataObject(vtkDataObject*)));
337  connect(reinterpret_cast<QObject*>(visualizationWidget->vtkPickCallback()),
338  SIGNAL(actorPicked(vtkProp3D*)),
339  vtkVisTabWidget->vtkVisPipelineView, SLOT(selectItem(vtkProp3D*)));
340  connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
341  SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const* const,
342  const unsigned)),
343  this->_elementModel.get(),
344  SLOT(setElement(vtkUnstructuredGridAlgorithm const* const,
345  const unsigned)));
346  connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
347  SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const* const,
348  const unsigned)),
349  meshTabWidget->elementView, SLOT(updateView()));
350  connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
351  SIGNAL(clearElementView()), this->_elementModel.get(),
352  SLOT(clearView()));
353  connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
354  SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const* const,
355  const unsigned)),
356  this->_vtkVisPipeline.get(),
357  SLOT(removeHighlightedMeshComponent()));
358 
359  connect(vtkVisTabWidget->vtkVisPipelineView,
360  SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(),
361  SLOT(addMesh(MeshLib::Mesh*)));
362 
363  // Stack the data dock widgets together
364  tabifyDockWidget(geoDock, mshDock);
365  tabifyDockWidget(mshDock, modellingDock);
366  tabifyDockWidget(modellingDock, stationDock);
367 
368  // Restore window geometry
369  readSettings();
370 
371  // Get info on screens geometry(ies)
372  _vtkWidget.reset(visualizationWidget->vtkWidget);
373  for (auto const& screen : QGuiApplication::screens())
374  {
375  _screenGeometries.push_back(screen->availableGeometry());
376  }
377 
378  // Setup import files menu
379  QMenu* import_files_menu = createImportFilesMenu(); // owned by MainWindow
380  menu_File->insertMenu(action_Exit, import_files_menu);
381 
382  // Setup recent files menu
383  RecentFiles* recentFiles =
384  new RecentFiles(this, SLOT(openRecentFile()), "recentFileList");
385  connect(this, SIGNAL(fileUsed(QString)), recentFiles,
386  SLOT(setCurrentFile(QString)));
387  menu_File->insertMenu(action_Exit, recentFiles->menu());
388 
389  // Setup Windows menu
390  QAction* showGeoDockAction = geoDock->toggleViewAction();
391  showGeoDockAction->setStatusTip(tr("Shows / hides the geometry view"));
392  connect(showGeoDockAction, SIGNAL(triggered(bool)), this,
393  SLOT(showGeoDockWidget(bool)));
394  menuWindows->addAction(showGeoDockAction);
395 
396  QAction* showStationDockAction = stationDock->toggleViewAction();
397  showStationDockAction->setStatusTip(tr("Shows / hides the station view"));
398  connect(showStationDockAction, SIGNAL(triggered(bool)), this,
399  SLOT(showStationDockWidget(bool)));
400  menuWindows->addAction(showStationDockAction);
401 
402  QAction* showMshDockAction = mshDock->toggleViewAction();
403  showMshDockAction->setStatusTip(tr("Shows / hides the mesh view"));
404  connect(showMshDockAction, SIGNAL(triggered(bool)), this,
405  SLOT(showMshDockWidget(bool)));
406  menuWindows->addAction(showMshDockAction);
407 
408  QAction* showModellingDockAction = modellingDock->toggleViewAction();
409  showModellingDockAction->setStatusTip(tr("Shows / hides the Process view"));
410  connect(showModellingDockAction, SIGNAL(triggered(bool)), this,
411  SLOT(showConditionDockWidget(bool)));
412  menuWindows->addAction(showModellingDockAction);
413 
414  QAction* showVisDockAction = vtkVisDock->toggleViewAction();
415  showVisDockAction->setStatusTip(tr("Shows / hides the VTK Pipeline view"));
416  connect(showVisDockAction, SIGNAL(triggered(bool)), this,
417  SLOT(showVisDockWidget(bool)));
418  menuWindows->addAction(showVisDockAction);
419 
420  // Presentation mode
421  auto* presentationMenu = new QMenu(this);
422  presentationMenu->setTitle("Presentation on");
423  connect(presentationMenu, SIGNAL(aboutToShow()), this,
424  SLOT(createPresentationMenu()));
425  menuWindows->insertMenu(showVisDockAction, presentationMenu);
426 
427  _visPrefsDialog = std::make_unique<VisPrefsDialog>(*_vtkVisPipeline,
428  *visualizationWidget);
429 }
Base class for boundary conditions, initial conditions and source terms.
Definition: FemCondition.h:40
GeoLib::GEOObjects & getGEOObjects()
Returns the GEOObjects containing all points, polylines and surfaces.
Definition: Project.h:46
A model for the GeoTreeView implementing a tree as a double-linked list.
Definition: GeoTreeModel.h:41
void showConditionDockWidget(bool show)
Definition: mainwindow.cpp:473
void readSettings()
Definition: mainwindow.cpp:879
std::unique_ptr< MeshModel > _meshModel
Definition: mainwindow.h:127
void open(int file_type=0)
Function calls for opening files.
Definition: mainwindow.cpp:497
QMenu * createImportFilesMenu()
Definition: mainwindow.cpp:921
std::unique_ptr< ElementTreeModel > _elementModel
Definition: mainwindow.h:128
void showStationNameDialog(const std::string &stn_vec_name, std::size_t id)
Allows setting the name for a station.
void writeStationListToFile(QString listName, QString fileName)
void showGeoDockWidget(bool show)
Definition: mainwindow.cpp:437
void showGeoNameDialog(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, std::size_t id)
Allows setting the name for a geometric object.
void showLineEditDialog(const std::string &geoName)
void showStationDockWidget(bool show)
Definition: mainwindow.cpp:449
std::unique_ptr< VisPrefsDialog > _visPrefsDialog
Definition: mainwindow.h:136
void convertMeshToGeometry(const MeshLib::Mesh *mesh)
void showDiagramPrefsDialog()
Calls the diagram prefs dialog from the Tools menu.
void showMshDockWidget(bool show)
Definition: mainwindow.cpp:461
void showAddPipelineFilterItemDialog(QModelIndex parentIndex)
Definition: mainwindow.cpp:984
void showVisDockWidget(bool show)
Definition: mainwindow.cpp:485
std::unique_ptr< ProcessModel > _processModel
Definition: mainwindow.h:129
void createPresentationMenu()
void openRecentFile()
Definition: mainwindow.cpp:515
DataHolderLib::Project _project
Definition: mainwindow.h:126
void writeGeometryToFile(QString gliName, QString fileName)
Definition: mainwindow.cpp:990
std::unique_ptr< GEOModels > _geo_model
Definition: mainwindow.h:138
std::unique_ptr< VtkVisPipeline > _vtkVisPipeline
Definition: mainwindow.h:131
std::unique_ptr< QWidget > _vtkWidget
Definition: mainwindow.h:133
void mapGeometry(const std::string &geo_name)
void showMeshQualitySelectionDialog(MeshLib::VtkMappedMeshSource *mshSource)
QList< QRect > _screenGeometries
Definition: mainwindow.h:132
void fileUsed(QString filename)
std::unique_ptr< FemConditionModel > _conditionModel
Definition: mainwindow.h:130
void updateDataViews()
Definition: mainwindow.cpp:871
void convertPointsToStations(std::string const &geo_name)
void exportBoreholesToGMS(std::string listName, std::string fileName)
Function calls for GMS export.
QMenu * menu()
Returns the created menu. Add this menu to your QMainWindow menu.
Definition: RecentFiles.cpp:42
A model for the StationTreeView implementing a tree as a double-linked list.
GEOTYPE
Definition: GeoType.h:25

References _conditionModel, _elementModel, _geo_model, _meshModel, _processModel, _project, _screenGeometries, _visPrefsDialog, _vtkVisPipeline, _vtkWidget, convertMeshToGeometry(), convertPointsToStations(), createImportFilesMenu(), createPresentationMenu(), exportBoreholesToGMS(), fileUsed(), DataHolderLib::Project::getGEOObjects(), mapGeometry(), RecentFiles::menu(), open(), openRecentFile(), readSettings(), showAddPipelineFilterItemDialog(), showConditionDockWidget(), showDiagramPrefsDialog(), showGeoDockWidget(), showGeoNameDialog(), showLineEditDialog(), showMeshQualitySelectionDialog(), showMshDockWidget(), showStationDockWidget(), showStationNameDialog(), showVisDockWidget(), updateDataViews(), writeGeometryToFile(), and writeStationListToFile().

Member Function Documentation

◆ about

void MainWindow::about ( )
protectedslot

Definition at line 901 of file mainwindow.cpp.

902 {
903  QString about(
904  "<a href='https://www.opengeosys.org'>www.opengeosys.org</a><br /><br "
905  "/>");
906  about.append(
907  QString("Version: %1<br />")
908  .arg(QString::fromStdString(GitInfoLib::GitInfo::ogs_version)));
909 
910  about.append(
911  QString("Git commit: <a "
912  "href='https://github.com/ufz/ogs/commit/%1'>%1</a><br />")
913  .arg(QString::fromStdString(
915  about.append(QString("Built date: %1<br />")
916  .arg(QDate::currentDate().toString(Qt::ISODate)));
917 
918  QMessageBox::about(this, "About OpenGeoSys 6", about);
919 }
void about()
Definition: mainwindow.cpp:901
GITINFOLIB_EXPORT const std::string git_version_sha1_short
GITINFOLIB_EXPORT const std::string ogs_version
const char * toString(mgis::behaviour::Behaviour::Kinematic kin)
Converts MGIS kinematic to a string representation.
Definition: MFront.cpp:103

References GitInfoLib::GitInfo::git_version_sha1_short, GitInfoLib::GitInfo::ogs_version, and MaterialLib::Solids::MFront::toString().

◆ callGMSH

void MainWindow::callGMSH ( std::vector< std::string > &  selectedGeometries,
unsigned  param1,
double  param2,
double  param3,
double  param4,
bool  delete_geo_file 
)
protectedslot

Function calls for generating GMSH files from the GUI.

Definition at line 1123 of file mainwindow.cpp.

1126 {
1127  if (!selectedGeometries.empty())
1128  {
1129  INFO("Start meshing ...");
1130 
1131  QString fileName("");
1132  QString dir_str = this->getLastUsedDir();
1133 
1134  if (!delete_geo_file)
1135  {
1136  fileName = QFileDialog::getSaveFileName(
1137  this, "Save GMSH-file as",
1138  LastSavedFileDirectory::getDir() + "tmp_gmsh.geo",
1139  "GMSH geometry files (*.geo)");
1140  }
1141  else
1142  {
1143  fileName = "tmp_gmsh.geo";
1144  }
1145 
1146  if (!fileName.isEmpty())
1147  {
1148  if (param4 == -1)
1149  { // adaptive meshing selected
1151  _project.getGEOObjects(), true,
1153  param2, param3, param1, selectedGeometries, false, false);
1154  BaseLib::IO::writeStringToFile(gmsh_io.writeToString(),
1155  fileName.toStdString());
1156  }
1157  else
1158  { // homogeneous meshing selected
1160  _project.getGEOObjects(), true,
1162  param4, param3, param1, selectedGeometries, false, false);
1163  BaseLib::IO::writeStringToFile(gmsh_io.writeToString(),
1164  fileName.toStdString());
1165  }
1166 
1167  if (system(nullptr) != 0) // command processor available
1168  {
1169  QSettings settings;
1170  std::string gmsh_path = settings.value("DataExplorerGmshPath")
1171  .toString()
1172  .toStdString();
1173 
1174  if (!gmsh_path.empty())
1175  {
1176  std::string fname(fileName.toStdString());
1177  std::string gmsh_command =
1178  "\"" + gmsh_path + "\" -2 -algo meshadapt " + fname;
1179  std::size_t pos(fname.rfind("."));
1180  if (pos != std::string::npos)
1181  {
1182  fname = fname.substr(0, pos);
1183  }
1184  gmsh_command += " -o " + fname + ".msh";
1185  // Newer gmsh versions write a newer file format for meshes
1186  // per default. At the moment we can't read this new format.
1187  // This is a switch for gmsh to write the 'old' file format.
1188  gmsh_command += " -format msh22";
1189  auto const return_value = std::system(gmsh_command.c_str());
1190  if (return_value != 0)
1191  {
1192  QString const message =
1193  "Execution of gmsh command returned non-zero "
1194  "status, " +
1195  QString::number(return_value);
1196  OGSError::box(message, "Error");
1197  }
1198  else
1199  {
1200  this->loadFile(
1202  fileName.left(fileName.length() - 3).append("msh"));
1203  }
1204  }
1205  else
1206  {
1207  OGSError::box("Location of GMSH not specified.", "Error");
1208  }
1209  }
1210  else
1211  {
1212  OGSError::box(
1213  "Error executing command gmsh - no command processor "
1214  "available",
1215  "Error");
1216  }
1217 
1218  if (delete_geo_file)
1219  {
1220  BaseLib::removeFile(fileName.toStdString());
1221  }
1222  }
1223  }
1224  else
1225  INFO("No geometry information selected.");
1226  QApplication::restoreOverrideCursor();
1227 }
void INFO(char const *fmt, Args const &... args)
Definition: Logging.h:32
Reads and writes GMSH-files to and from OGS data structures.
Definition: GMSHInterface.h:46
static const QString getDir()
Returns the directory last used for saving a file.
void loadFile(ImportFileType::type t, const QString &fileName)
Definition: mainwindow.cpp:572
QString getLastUsedDir()
static void box(const QString &e)
Definition: OGSError.cpp:23
int writeStringToFile(std::string content, std::filesystem::path const &file_path)
Definition: Writer.cpp:45
void removeFile(std::string const &filename)
Definition: FileTools.cpp:236
@ AdaptiveMeshDensity
computing the mesh density employing a QuadTree
@ FixedMeshDensity
set the parameter with a fixed value

References _project, FileIO::GMSH::AdaptiveMeshDensity, OGSError::box(), FileIO::GMSH::FixedMeshDensity, LastSavedFileDirectory::getDir(), DataHolderLib::Project::getGEOObjects(), getLastUsedDir(), ImportFileType::GMSH, INFO(), loadFile(), BaseLib::removeFile(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().

Referenced by showGMSHPrefsDialog().

◆ closeEvent()

void MainWindow::closeEvent ( QCloseEvent *  event)
overrideprotected

Definition at line 431 of file mainwindow.cpp.

432 {
433  writeSettings();
434  QWidget::closeEvent(event);
435 }
void writeSettings()
Definition: mainwindow.cpp:887

References writeSettings().

◆ convertMeshToGeometry

void MainWindow::convertMeshToGeometry ( const MeshLib::Mesh mesh)
protectedslot

Definition at line 1110 of file mainwindow.cpp.

1111 {
1113 }
bool convertMeshToGeo(const MeshLib::Mesh &mesh, GeoLib::GEOObjects &geo_objects, double const eps)

References _project, MeshLib::convertMeshToGeo(), and DataHolderLib::Project::getGEOObjects().

Referenced by MainWindow().

◆ convertPointsToStations

void MainWindow::convertPointsToStations ( std::string const &  geo_name)
protectedslot

Definition at line 1334 of file mainwindow.cpp.

1335 {
1336  std::string stn_name = geo_name + " Stations";
1337  int ret = GeoLib::geoPointsToStations(_project.getGEOObjects(), geo_name,
1338  stn_name);
1339  if (ret == 1)
1340  {
1341  OGSError::box("No points found to convert.");
1342  }
1343 }
int geoPointsToStations(GEOObjects &geo_objects, std::string const &geo_name, std::string &stn_name, bool const only_unused_pnts)
Constructs a station-vector based on the points of a given geometry.
Definition: GEOObjects.cpp:698

References _project, OGSError::box(), GeoLib::geoPointsToStations(), and DataHolderLib::Project::getGEOObjects().

Referenced by MainWindow().

◆ createImportFilesMenu()

QMenu * MainWindow::createImportFilesMenu ( )
private

Definition at line 921 of file mainwindow.cpp.

922 {
923  QMenu* importFiles = new QMenu("&Import Files", this);
924  importFiles->addAction("&FEFLOW Files...",
925  [this] { open(ImportFileType::FEFLOW); });
926  importFiles->addAction("G&MS Files...",
927  [this] { open(ImportFileType::GMS); });
928  importFiles->addAction("&GMSH Files...",
929  [this] { open(ImportFileType::GMSH); });
930  importFiles->addAction("&Gocad TSurface...",
931  [this] { open(ImportFileType::GOCAD_TSURF); });
932 #ifdef OGS_USE_NETCDF
933  importFiles->addAction("&NetCDF Files...",
934  [this] { open(ImportFileType::NETCDF); });
935 #endif // OGS_USE_NETCDF
936  importFiles->addAction("&Petrel Files...", [this] { loadPetrelFiles(); });
937  importFiles->addAction("&Raster Files...",
938  [this] { open(ImportFileType::RASTER); });
939  importFiles->addAction("&Shape Files...",
940  [this] { open(ImportFileType::SHAPE); });
941  importFiles->addAction("&TetGen Files...",
942  [this] { open(ImportFileType::TETGEN); });
943  importFiles->addAction("&VTK Files...",
944  [this] { open(ImportFileType::VTK); });
945  return importFiles;
946 }
void loadPetrelFiles()
Definition: mainwindow.cpp:948

References ImportFileType::FEFLOW, ImportFileType::GMS, ImportFileType::GMSH, ImportFileType::GOCAD_TSURF, loadPetrelFiles(), ImportFileType::NETCDF, open(), ImportFileType::RASTER, ImportFileType::SHAPE, ImportFileType::TETGEN, and ImportFileType::VTK.

Referenced by MainWindow().

◆ createPresentationMenu

void MainWindow::createPresentationMenu ( )
protectedslot

Definition at line 1517 of file mainwindow.cpp.

1518 {
1519  auto* menu = static_cast<QMenu*>(QObject::sender());
1520  menu->clear();
1521  if (!_vtkWidget->parent())
1522  {
1523  QAction* action = new QAction("Quit presentation mode", menu);
1524  connect(action, SIGNAL(triggered()), this,
1525  SLOT(quitPresentationMode()));
1526  action->setShortcutContext(Qt::WidgetShortcut);
1527  action->setShortcut(QKeySequence(Qt::Key_Escape));
1528  menu->addAction(action);
1529  }
1530  else
1531  {
1532  int count = 0;
1533  const int currentScreen =
1534  QApplication::desktop()->screenNumber(visualizationWidget);
1535  foreach (QRect screenGeo, _screenGeometries)
1536  {
1537  Q_UNUSED(screenGeo);
1538  QAction* action =
1539  new QAction(QString("On screen %1").arg(count), menu);
1540  connect(action, SIGNAL(triggered()), this,
1541  SLOT(startPresentationMode()));
1542  if (count == currentScreen)
1543  {
1544  action->setEnabled(false);
1545  }
1546  menu->addAction(action);
1547  ++count;
1548  }
1549  }
1550 }
void quitPresentationMode()
void startPresentationMode()

References _screenGeometries, _vtkWidget, quitPresentationMode(), and startPresentationMode().

Referenced by MainWindow().

◆ exportBoreholesToGMS

void MainWindow::exportBoreholesToGMS ( std::string  listName,
std::string  fileName 
)
protectedslot

Function calls for GMS export.

Definition at line 1115 of file mainwindow.cpp.

1117 {
1118  const std::vector<GeoLib::Point*>* stations(
1119  _project.getGEOObjects().getStationVec(listName));
1120  GMSInterface::writeBoreholesToGMS(stations, fileName);
1121 }
const std::vector< GeoLib::Point * > * getStationVec(const std::string &name) const
Returns the station vector with the given name.
Definition: GEOObjects.cpp:131

References _project, DataHolderLib::Project::getGEOObjects(), and GeoLib::GEOObjects::getStationVec().

Referenced by MainWindow().

◆ FEMTestStart

void MainWindow::FEMTestStart ( )
protectedslot

Testing functionality for connection to FEM lib.

Definition at line 1423 of file mainwindow.cpp.

1423 {}

◆ fileOpenRequested

void MainWindow::fileOpenRequested ( int  )
signal

◆ fileUsed

void MainWindow::fileUsed ( QString  filename)
signal

Referenced by MainWindow(), and loadFile().

◆ getLastUsedDir()

QString MainWindow::getLastUsedDir ( )
private

Definition at line 1597 of file mainwindow.cpp.

1598 {
1599  QSettings settings;
1600  QString fileName("");
1601  QStringList files = settings.value("recentFileList").toStringList();
1602  if (!files.empty())
1603  {
1604  return QFileInfo(files[0]).absolutePath();
1605  }
1606 
1607  return QDir::homePath();
1608 }

Referenced by callGMSH().

◆ HideWindow()

void MainWindow::HideWindow ( )

Definition at line 1430 of file mainwindow.cpp.

1431 {
1432  this->hide();
1433 }

◆ loadFEMConditionsFromFile()

void MainWindow::loadFEMConditionsFromFile ( const QString &  fileName,
std::string  geoName = "" 
)
private

◆ loadFile()

void MainWindow::loadFile ( ImportFileType::type  t,
const QString &  fileName 
)
private

Definition at line 572 of file mainwindow.cpp.

573 {
574  QFile file(fileName);
575  if (!file.exists())
576  {
577  QMessageBox::warning(this, tr("Application"),
578  tr("Cannot read file %1:\n%2.")
579  .arg(fileName)
580  .arg(file.errorString()));
581  return;
582  }
583 
584  QApplication::setOverrideCursor(Qt::WaitCursor);
585  QFileInfo fi(fileName);
586  QSettings settings;
587  QDir dir = QDir(fileName);
588  std::string base =
589  fi.absoluteDir().absoluteFilePath(fi.completeBaseName()).toStdString();
590 
591  if (t == ImportFileType::OGS || t == ImportFileType::OGS_GEO ||
593  {
594  if (fi.suffix().toLower() == "gli")
595  {
596  std::string unique_name;
597  std::vector<std::string> errors;
598  std::string const gmsh_path =
599  settings.value("DataExplorerGmshPath").toString().toStdString();
600  if (!FileIO::Legacy::readGLIFileV4(fileName.toStdString(),
602  unique_name, errors, gmsh_path))
603  {
604  for (auto& error : errors)
605  {
606  OGSError::box(QString::fromStdString(error));
607  }
608  }
609  }
610  else if (fi.suffix().toLower() == "prj")
611  {
613  if (xml.readFile(fileName))
614  {
615  _meshModel->updateModel();
616  _processModel->updateModel();
617  }
618  else
619  {
621  "Failed to load project file.\n Please see console for "
622  "details.");
623  }
624  }
625  else if (fi.suffix().toLower() == "gml")
626  {
628  try
629  {
630  if (!xml.readFile(fileName))
631  {
633  "Failed to load geometry.\n Please see console for "
634  "details.");
635  }
636  }
637  catch (std::runtime_error const& err)
638  {
639  OGSError::box(err.what(),
640  "Failed to read file `" + fileName + "'");
641  }
642  }
643  // OpenGeoSys observation station files (incl. boreholes)
644  else if (fi.suffix().toLower() == "stn")
645  {
647  if (!xml.readFile(fileName))
648  {
650  "Failed to load station data.\n Please see console for "
651  "details.");
652  }
653  }
654  // OpenGeoSys mesh files
655  else if (fi.suffix().toLower() == "msh" ||
656  fi.suffix().toLower() == "vtu" ||
657  fi.suffix().toLower() == "vtk")
658  {
659 #ifndef NDEBUG
660  QElapsedTimer myTimer;
661  myTimer.start();
662 #endif
663  std::unique_ptr<MeshLib::Mesh> mesh(
664  MeshLib::IO::readMeshFromFile(fileName.toStdString()));
665 #ifndef NDEBUG
666  INFO("Mesh loading time: {:d} ms.", myTimer.restart());
667 #endif
668  if (mesh)
669  {
670  _meshModel->addMesh(std::move(mesh));
671  }
672  else
673  {
674  OGSError::box("Failed to load mesh file.");
675  }
676 #ifndef NDEBUG
677  INFO("Mesh model setup time: {:d} ms.", myTimer.elapsed());
678 #endif
679  }
680 
681  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
682  emit fileUsed(fileName);
683  }
684  else if (t == ImportFileType::FEFLOW)
685  {
686  if (fi.suffix().toLower() == "fem") // FEFLOW model files
687  {
688  FileIO::FEFLOWMeshInterface feflowMeshIO;
689  std::unique_ptr<MeshLib::Mesh> mesh(
690  feflowMeshIO.readFEFLOWFile(fileName.toStdString()));
691  if (mesh)
692  {
693  _meshModel->addMesh(std::move(mesh));
694  }
695  else
696  {
697  OGSError::box("Failed to load a FEFLOW mesh.");
698  }
699  FileIO::FEFLOWGeoInterface feflowGeoIO;
700  feflowGeoIO.readFEFLOWFile(fileName.toStdString(),
702  }
703  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
704  }
705  else if (t == ImportFileType::GMS)
706  {
707  if (fi.suffix().toLower() == "txt") // GMS borehole files
708  {
709  auto boreholes = std::make_unique<std::vector<GeoLib::Point*>>();
710  std::string name = fi.baseName().toStdString();
711 
712  if (GMSInterface::readBoreholesFromGMS(boreholes.get(),
713  fileName.toStdString()))
714  {
715  _project.getGEOObjects().addStationVec(std::move(boreholes),
716  name);
717  }
718  else
719  {
720  OGSError::box("Error reading GMS file.");
721  }
722  }
723  else if (fi.suffix().toLower() == "3dm") // GMS mesh files
724  {
725  std::string name = fileName.toStdString();
726  std::unique_ptr<MeshLib::Mesh> mesh(
727  GMSInterface::readGMS3DMMesh(name));
728  if (mesh)
729  {
730  _meshModel->addMesh(std::move(mesh));
731  }
732  else
733  {
734  OGSError::box("Failed to load a GMS mesh.");
735  }
736  }
737  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
738  }
739  else if (t == ImportFileType::GMSH)
740  {
741  std::string msh_name(fileName.toStdString());
742  if (FileIO::GMSH::isGMSHMeshFile(msh_name))
743  {
744  std::unique_ptr<MeshLib::Mesh> mesh(
745  FileIO::GMSH::readGMSHMesh(msh_name));
746  if (mesh)
747  {
748  _meshModel->addMesh(std::move(mesh));
749  }
750  else
751  {
752  OGSError::box("Failed to load a GMSH mesh.");
753  }
754  }
755  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
756  }
757  else if (t == ImportFileType::GOCAD_TSURF)
758  {
759  std::string file_name(fileName.toStdString());
760  std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
761  if (FileIO::Gocad::GocadAsciiReader::readFile(file_name, meshes))
762  {
763  for (auto& mesh : meshes)
764  {
765  if (mesh != nullptr)
766  {
767  _meshModel->addMesh(std::move(mesh));
768  }
769  }
770  }
771  else
772  {
773  OGSError::box("Error reading file.");
774  }
775  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
776  }
777 #ifdef OGS_USE_NETCDF
778  else if (t == ImportFileType::NETCDF) // CH 01.2012
779  {
780  NetCdfConfigureDialog dlg(fileName.toStdString());
781  dlg.exec();
782  if (dlg.getMesh())
783  {
784  std::unique_ptr<MeshLib::Mesh> mesh(dlg.getMesh());
785  mesh->setName(dlg.getName());
786  _meshModel->addMesh(std::move(mesh));
787  }
788  if (dlg.getRaster())
789  _vtkVisPipeline->addPipelineItem(dlg.getRaster());
790 
791  settings.setValue("lastOpenedRasterFileDirectory", dir.absolutePath());
792  }
793 #endif // OGS_USE_NETCDF
794  else if (t == ImportFileType::RASTER)
795  {
797  if (geoImage->readImage(fileName))
798  {
799  _vtkVisPipeline->addPipelineItem(geoImage);
800  }
801  else
802  {
803  geoImage->Delete();
804  OGSError::box("Error reading raster.");
805  }
806  settings.setValue("lastOpenedRasterFileDirectory", dir.absolutePath());
807  }
808  else if (t == ImportFileType::POLYRASTER)
809  {
810  QImage raster;
811  vtkImageAlgorithm* img = VtkRaster::loadImage(fileName.toStdString());
813  double* origin = img->GetOutput()->GetOrigin();
814  bg->SetRaster(img, origin[0], origin[1],
815  img->GetOutput()->GetSpacing()[0]);
816  bg->SetName(fileName);
817  _vtkVisPipeline->addPipelineItem(bg);
818  settings.setValue("lastOpenedRasterFileDirectory", dir.absolutePath());
819  }
820  else if (t == ImportFileType::SHAPE)
821  {
822  SHPImportDialog dlg(
823  fileName.toStdString(), _project.getGEOObjects(),
824  settings.value("DataExplorerGmshPath").toString().toStdString());
825  dlg.exec();
826  QDir dir = QDir(fileName);
827  settings.setValue("lastOpenedShapeFileDirectory", dir.absolutePath());
828  }
829  else if (t == ImportFileType::TETGEN)
830  {
831  if (fi.suffix().toLower().compare("poly") == 0 ||
832  fi.suffix().toLower().compare("smesh") == 0)
833  {
835  tetgen.readTetGenGeometry(fileName.toStdString(),
837  }
838  else
839  {
840  settings.setValue("lastOpenedTetgenFileDirectory",
841  QFileInfo(fileName).absolutePath());
842  QString element_fname(fi.path() + "/" + fi.completeBaseName() +
843  ".ele");
844 
845  if (!fileName.isEmpty())
846  {
848  std::unique_ptr<MeshLib::Mesh> mesh(tetgen.readTetGenMesh(
849  fileName.toStdString(), element_fname.toStdString()));
850  if (mesh)
851  {
852  _meshModel->addMesh(std::move(mesh));
853  }
854  else
855  {
856  OGSError::box("Failed to load a TetGen mesh.");
857  }
858  }
859  }
860  }
861  else if (t == ImportFileType::VTK)
862  {
863  _vtkVisPipeline->loadFromFile(fileName);
864  settings.setValue("lastOpenedVtkFileDirectory", dir.absolutePath());
865  }
866 
867  QApplication::restoreOverrideCursor();
868  updateDataViews();
869 }
void readFEFLOWFile(const std::string &filename, GeoLib::GEOObjects &geo_objects)
MeshLib::Mesh * readFEFLOWFile(const std::string &filename)
MeshLib::Mesh * readTetGenMesh(std::string const &nodes_fname, std::string const &ele_fname)
bool readTetGenGeometry(std::string const &geo_fname, GeoLib::GEOObjects &geo_objects)
void addStationVec(std::unique_ptr< std::vector< Point * >> stations, std::string &name)
Adds a vector of stations with the given name and colour to GEOObjects.
Definition: GEOObjects.cpp:122
Reads and writes GeoObjects to and from XML files.
Reads and writes Observation Sites to and from XML files.
The dialog for converting data from NetCDF-files into OGS data structures. While NetCDF files can inc...
Dialog for selecting which information should be loaded from a shape file.
void SetName(QString name)
Sets the name.
Uses an image source to create a plane in the 3D with the given image texture mapped on it.
void SetRaster(vtkImageAlgorithm *img, double x0, double y0, double scalingFactor)
Sets the raster/image to be used as a texture map.
static VtkBGImageSource * New()
Create new objects with New() because of VTKs object reference counting.
The VtkVisPipeline source object of a geo-referenced image (file).
static VtkGeoImageSource * New()
Create new objects with New() because of VTKs reference counting.
bool readImage(const QString &filename)
Reads an image from file.
static vtkImageAlgorithm * loadImage(const std::string &fileName)
Loads an image- or raster-file into an vtkImageAlgorithm-Object.
Definition: VtkRaster.cpp:43
bool isGMSHMeshFile(const std::string &fname)
Definition: GmshReader.cpp:33
MeshLib::Mesh * readGMSHMesh(std::string const &fname)
Definition: GmshReader.cpp:166
bool readFile(std::string const &file_name, std::vector< std::unique_ptr< MeshLib::Mesh >> &meshes, DataType const export_type)
Reads the specified file and writes data into internal mesh vector.
bool readGLIFileV4(const std::string &fname, GeoLib::GEOObjects &geo, std::string &unique_name, std::vector< std::string > &errors, std::string const &gmsh_path)
Definition: OGSIOVer4.cpp:506
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)

References _meshModel, _processModel, _project, _vtkVisPipeline, GeoLib::GEOObjects::addStationVec(), OGSError::box(), ImportFileType::FEFLOW, fileUsed(), DataHolderLib::Project::getGEOObjects(), NetCdfConfigureDialog::getMesh(), NetCdfConfigureDialog::getName(), NetCdfConfigureDialog::getRaster(), ImportFileType::GMS, ImportFileType::GMSH, ImportFileType::GOCAD_TSURF, INFO(), FileIO::GMSH::isGMSHMeshFile(), VtkRaster::loadImage(), MaterialPropertyLib::name, ImportFileType::NETCDF, VtkBGImageSource::New(), VtkGeoImageSource::New(), ImportFileType::OGS, ImportFileType::OGS_GEO, ImportFileType::OGS_MSH, ImportFileType::OGS_STN, ImportFileType::POLYRASTER, ImportFileType::RASTER, FileIO::FEFLOWMeshInterface::readFEFLOWFile(), FileIO::FEFLOWGeoInterface::readFEFLOWFile(), FileIO::XmlPrjInterface::readFile(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::XmlStnInterface::readFile(), FileIO::Gocad::GocadAsciiReader::readFile(), FileIO::Legacy::readGLIFileV4(), FileIO::GMSH::readGMSHMesh(), VtkGeoImageSource::readImage(), MeshLib::IO::readMeshFromFile(), FileIO::TetGenInterface::readTetGenGeometry(), FileIO::TetGenInterface::readTetGenMesh(), VtkAlgorithmProperties::SetName(), VtkBGImageSource::SetRaster(), ImportFileType::SHAPE, ImportFileType::TETGEN, updateDataViews(), and ImportFileType::VTK.

Referenced by callGMSH(), loadFileOnStartUp(), open(), and openRecentFile().

◆ loadFileOnStartUp()

void MainWindow::loadFileOnStartUp ( const QString &  fileName)

Definition at line 1435 of file mainwindow.cpp.

1436 {
1437  QString ext = QFileInfo(fileName).suffix();
1438  if (ext == "msh" || ext == "vtu" || ext == "gli" || ext == "gml")
1439  {
1440  this->loadFile(ImportFileType::OGS, fileName);
1441  }
1442 }

References loadFile(), and ImportFileType::OGS.

◆ loadPetrelFiles

void MainWindow::loadPetrelFiles ( )
protectedslot

Definition at line 948 of file mainwindow.cpp.

949 {
950  QSettings settings;
951  QStringList sfc_file_names = QFileDialog::getOpenFileNames(
952  this, "Select surface data file(s) to import", "", "Petrel files (*)");
953  QStringList well_path_file_names = QFileDialog::getOpenFileNames(
954  this, "Select well path data file(s) to import", "",
955  "Petrel files (*)");
956  if (!sfc_file_names.empty() || !well_path_file_names.empty())
957  {
958  QStringList::const_iterator it = sfc_file_names.begin();
959  std::list<std::string> sfc_files;
960  while (it != sfc_file_names.end())
961  {
962  sfc_files.push_back((*it).toStdString());
963  ++it;
964  }
965 
966  it = well_path_file_names.begin();
967  std::list<std::string> well_path_files;
968  while (it != well_path_file_names.end())
969  {
970  well_path_files.push_back((*it).toStdString());
971  ++it;
972  }
973 
974  std::string unique_str(*(sfc_files.begin()));
975 
976  PetrelInterface(sfc_files, well_path_files, unique_str,
978 
979  QDir dir = QDir(sfc_file_names.at(0));
980  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
981  }
982 }

References _project, and DataHolderLib::Project::getGEOObjects().

Referenced by createImportFilesMenu().

◆ mapGeometry

void MainWindow::mapGeometry ( const std::string &  geo_name)
protectedslot

Definition at line 1013 of file mainwindow.cpp.

1014 {
1016  if (dlg.exec() != QDialog::Accepted)
1017  {
1018  return;
1019  }
1020 
1021  int choice(dlg.getDataSetChoice());
1022 
1023  QString file_name("");
1024  if (choice < 2) // load something from a file
1025  {
1026  QString file_type[2] = {"OpenGeoSys mesh files (*.vtu *.msh)",
1027  "Raster files(*.asc *.grd)"};
1028  QSettings settings;
1029  file_name = QFileDialog::getOpenFileName(
1030  this,
1031  "Select file for mapping",
1032  settings.value("lastOpenedFileDirectory").toString(),
1033  file_type[choice]);
1034  if (file_name.isEmpty())
1035  {
1036  return;
1037  }
1038  QDir dir = QDir(file_name);
1039  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
1040  }
1041 
1042  MeshGeoToolsLib::GeoMapper geo_mapper(_project.getGEOObjects(), geo_name);
1043  QFileInfo fi(file_name);
1044  if (choice == 1) // load raster from file
1045  {
1046  if (fi.suffix().toLower() == "asc" || fi.suffix().toLower() == "grd")
1047  {
1048  std::unique_ptr<GeoLib::Raster> raster(
1050  file_name.toStdString()));
1051  if (raster)
1052  {
1053  geo_mapper.mapOnDEM(std::move(raster));
1054  }
1055  else
1056  {
1057  OGSError::box("Error reading raster file.");
1058  }
1059  _geo_model->updateGeometry(geo_name);
1060  }
1061  else
1062  {
1063  OGSError::box("The selected file is no supported raster file.");
1064  }
1065  return;
1066  }
1067 
1068  MeshLib::Mesh* mesh(nullptr);
1069  if (choice == 0) // load mesh from file
1070  {
1071  if (fi.suffix().toLower() == "vtu" || fi.suffix().toLower() == "vtk" ||
1072  fi.suffix().toLower() == "msh")
1073  {
1074  mesh = MeshLib::IO::readMeshFromFile(file_name.toStdString());
1075  }
1076  else
1077  {
1078  OGSError::box("The selected file is no supported mesh file.");
1079  return;
1080  }
1081  }
1082  else
1083  { // use mesh from ProjectData
1084  mesh = _project.getMeshObjects()[choice - 2].get();
1085  }
1086 
1087  std::string new_geo_name = dlg.getNewGeoName();
1088 
1089  if (new_geo_name.empty())
1090  {
1091  geo_mapper.mapOnMesh(mesh);
1092  _geo_model->updateGeometry(geo_name);
1093  }
1094  else
1095  {
1097  new_geo_name);
1098  new_geo_name = dup.getFinalizedOutputName();
1100  new_geo_name);
1101  mapper.advancedMapOnMesh(*mesh);
1102  _geo_model->updateGeometry(new_geo_name);
1103  }
1104  if (choice == 0)
1105  {
1106  delete mesh;
1107  }
1108 }
const std::vector< std::unique_ptr< MeshLib::Mesh > > & getMeshObjects() const
Returns all the meshes with their respective names.
Definition: Project.h:57
static GeoLib::Raster * getRasterFromASCFile(std::string const &fname)
Reads an ArcGis ASC raster file.
A dialog window for creating DIRECT boundary conditions from raster files.
A set of tools for mapping the elevation of geometric objects.
Definition: GeoMapper.h:40

References _geo_model, _project, MeshGeoToolsLib::GeoMapper::advancedMapOnMesh(), OGSError::box(), GeoOnMeshMappingDialog::getDataSetChoice(), GeoLib::DuplicateGeometry::getFinalizedOutputName(), DataHolderLib::Project::getGEOObjects(), DataHolderLib::Project::getMeshObjects(), GeoOnMeshMappingDialog::getNewGeoName(), FileIO::AsciiRasterInterface::getRasterFromASCFile(), MeshGeoToolsLib::GeoMapper::mapOnDEM(), MeshGeoToolsLib::GeoMapper::mapOnMesh(), and MeshLib::IO::readMeshFromFile().

Referenced by MainWindow().

◆ on_actionExportObj_triggered

void MainWindow::on_actionExportObj_triggered ( bool  checked = false)
protectedslot

Definition at line 1496 of file mainwindow.cpp.

1497 {
1498  Q_UNUSED(checked)
1499  QSettings settings;
1500  QString fileName = QFileDialog::getSaveFileName(
1501  this, "Save scene to Wavefront OBJ files",
1502  settings.value("lastExportedFileDirectory").toString(), ";;");
1503  if (!fileName.isEmpty())
1504  {
1505  QDir dir = QDir(fileName);
1506  settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1507 
1508  vtkOBJExporter* exporter = vtkOBJExporter::New();
1509  exporter->SetFilePrefix(fileName.toStdString().c_str());
1510  exporter->SetRenderWindow(
1511  visualizationWidget->vtkWidget->GetRenderWindow());
1512  exporter->Write();
1513  exporter->Delete();
1514  }
1515 }

◆ on_actionExportVRML2_triggered

void MainWindow::on_actionExportVRML2_triggered ( bool  checked = false)
protectedslot

Definition at line 1474 of file mainwindow.cpp.

1475 {
1476  Q_UNUSED(checked)
1477  QSettings settings;
1478  QString fileName = QFileDialog::getSaveFileName(
1479  this, "Save scene to VRML file",
1480  settings.value("lastExportedFileDirectory").toString(),
1481  "VRML files (*.wrl);;");
1482  if (!fileName.isEmpty())
1483  {
1484  QDir dir = QDir(fileName);
1485  settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1486 
1487  vtkVRMLExporter* exporter = vtkVRMLExporter::New();
1488  exporter->SetFileName(fileName.toStdString().c_str());
1489  exporter->SetRenderWindow(
1490  visualizationWidget->vtkWidget->GetRenderWindow());
1491  exporter->Write();
1492  exporter->Delete();
1493  }
1494 }

◆ on_actionExportVTK_triggered

void MainWindow::on_actionExportVTK_triggered ( bool  checked = false)
protectedslot

Definition at line 1444 of file mainwindow.cpp.

1445 {
1446  Q_UNUSED(checked)
1447  QSettings settings;
1448  int count = 0;
1449  QString const filename = QFileDialog::getSaveFileName(
1450  this,
1451  "Export object to vtk-files",
1452  settings.value("lastExportedFileDirectory").toString(),
1453  "VTK files (*.vtp *.vtu)");
1454  if (!filename.isEmpty())
1455  {
1456  QDir const dir = QDir(filename);
1457  settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1458 
1459  std::string const basename =
1460  QFileInfo(filename).path().toStdString() + "/" +
1461  QFileInfo(filename).baseName().toStdString();
1463  ++it;
1464  while (*it)
1465  {
1466  std::string const name = basename + std::to_string(++count) + "-" +
1467  (*it)->data(0).toString().toStdString();
1468  static_cast<VtkVisPipelineItem*>(*it)->writeToFile(name);
1469  ++it;
1470  }
1471  }
1472 }
TreeModelIterator provides a way to iterate over TreeItems in a TreeModel. Usage:
An item in the VtkVisPipeline containing a graphic object to be visualized.
int writeToFile(const std::string &filename) const
Writes this algorithm's vtkDataSet (i.e. vtkPolyData or vtkUnstructuredGrid) to a vtk-file.

References _vtkVisPipeline, MaterialPropertyLib::name, and VtkVisPipelineItem::writeToFile().

◆ open

void MainWindow::open ( int  file_type = 0)
protectedslot

Function calls for opening files.

Definition at line 497 of file mainwindow.cpp.

498 {
499  QSettings settings;
500  auto t = static_cast<ImportFileType::type>(file_type);
501  QString type_str = QString::fromStdString(
503  QString fileName = QFileDialog::getOpenFileName(
504  this, "Select " + type_str + " file to import",
505  settings.value("lastOpenedFileDirectory").toString(),
506  QString::fromStdString(ImportFileType::getFileSuffixString(t)));
507  if (!fileName.isEmpty())
508  {
509  loadFile(t, fileName);
510  QDir dir = QDir(fileName);
511  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
512  }
513 }
static std::string getFileSuffixString(ImportFileType::type t)
static std::string convertImportFileTypeToString(ImportFileType::type t)

References ImportFileType::convertImportFileTypeToString(), ImportFileType::getFileSuffixString(), and loadFile().

Referenced by MainWindow(), and createImportFilesMenu().

◆ openRecentFile

void MainWindow::openRecentFile ( )
protectedslot

Definition at line 515 of file mainwindow.cpp.

516 {
517  auto* action = qobject_cast<QAction*>(sender());
518  if (action)
519  {
520  loadFile(ImportFileType::OGS, action->data().toString());
521  }
522 }

References loadFile(), and ImportFileType::OGS.

Referenced by MainWindow().

◆ quitPresentationMode

void MainWindow::quitPresentationMode ( )
protectedslot

Definition at line 1581 of file mainwindow.cpp.

1582 {
1583  // Remove the quit action
1584  QAction* action = _vtkWidget->actions().back();
1585  _vtkWidget->removeAction(action);
1586  delete action;
1587 
1588  // Add the widget back to visualization widget
1589  visualizationWidget->layout()->addWidget(_vtkWidget.get());
1590 
1591  QMainWindow::centralWidget()->show();
1592 
1593  // Restore the previously saved QMainWindow state
1594  this->restoreState(_windowState);
1595 }
QByteArray _windowState
Definition: mainwindow.h:134

References _vtkWidget, and _windowState.

Referenced by createPresentationMenu(), and startPresentationMode().

◆ readSettings()

void MainWindow::readSettings ( )
private

Definition at line 879 of file mainwindow.cpp.

880 {
881  QSettings settings;
882 
883  restoreGeometry(settings.value("windowGeometry").toByteArray());
884  restoreState(settings.value("windowState").toByteArray());
885 }

Referenced by MainWindow().

◆ save

void MainWindow::save ( )
protectedslot

Function calls for saving files.

Definition at line 524 of file mainwindow.cpp.

525 {
526  QString fileName = QFileDialog::getSaveFileName(
527  this,
528  "Save data as",
530  "GeoSys project (*.prj);;GMSH geometry files (*.geo)");
531 
532  if (fileName.isEmpty())
533  {
534  OGSError::box("No filename specified.");
535  return;
536  }
537 
538  QFileInfo fi(fileName);
540 
541  if (fi.suffix().toLower() == "prj")
542  {
544  BaseLib::IO::writeStringToFile(xml.writeToString(),
545  fileName.toStdString());
546  }
547  else if (fi.suffix().toLower() == "geo")
548  {
549  auto const selected_geometries =
551 
552  // values necessary also for the adaptive meshing
553  const double point_density = 0;
554  const double station_density = point_density;
555  const int max_pnts_per_leaf = 0;
556 
558  _project.getGEOObjects(), true,
560  station_density, max_pnts_per_leaf, selected_geometries, false,
561  false);
562  bool const success = BaseLib::IO::writeStringToFile(
563  gmsh_io.writeToString(), fileName.toStdString());
564 
565  if (!success)
566  {
567  OGSError::box(" No geometry available\n to write to geo-file");
568  }
569  }
570 }
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
Definition: GEOObjects.cpp:401
static void setDir(const QString &path)
Sets the directory last used for saving a file.

References _project, OGSError::box(), FileIO::GMSH::FixedMeshDensity, LastSavedFileDirectory::getDir(), GeoLib::GEOObjects::getGeometryNames(), DataHolderLib::Project::getGEOObjects(), LastSavedFileDirectory::setDir(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().

◆ showAddPipelineFilterItemDialog

void MainWindow::showAddPipelineFilterItemDialog ( QModelIndex  parentIndex)
protectedslot

Definition at line 984 of file mainwindow.cpp.

985 {
986  VtkAddFilterDialog dlg(*_vtkVisPipeline, parentIndex);
987  dlg.exec();
988 }
Dialog for selecting a filter to be applied to a VtkPipelineItem. The dialog lets you select filters ...

References _vtkVisPipeline.

Referenced by MainWindow().

◆ showConditionDockWidget

void MainWindow::showConditionDockWidget ( bool  show)
protectedslot

Definition at line 473 of file mainwindow.cpp.

474 {
475  if (show)
476  {
477  modellingDock->show();
478  }
479  else
480  {
481  modellingDock->hide();
482  }
483 }

Referenced by MainWindow().

◆ showCreateStructuredGridDialog

void MainWindow::showCreateStructuredGridDialog ( )
protectedslot

Creates a structured grid with user-specified parameters.

Definition at line 1312 of file mainwindow.cpp.

1313 {
1315  connect(&dlg, SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(),
1316  SLOT(addMesh(MeshLib::Mesh*)));
1317  dlg.exec();
1318 }
A dialog window for managing general Data Explorer settings.

References _meshModel.

◆ showDataExplorerSettingsDialog

void MainWindow::showDataExplorerSettingsDialog ( )
protectedslot

Definition at line 1417 of file mainwindow.cpp.

1418 {
1420  dlg.exec();
1421 }
A dialog window for managing general Data Explorer settings.

◆ showDiagramPrefsDialog [1/2]

void MainWindow::showDiagramPrefsDialog ( )
protectedslot

Calls the diagram prefs dialog from the Tools menu.

Definition at line 1257 of file mainwindow.cpp.

1258 {
1259  QSettings settings;
1260  QString fileName = QFileDialog::getOpenFileName(
1261  this, "Select data file to open",
1262  settings.value("lastOpenedFileDirectory").toString(),
1263  "Text files (*.txt);;All files (* *.*)");
1264  if (!fileName.isEmpty())
1265  {
1266  QDir dir = QDir(fileName);
1267  settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
1268  auto* prefs = new DiagramPrefsDialog(fileName);
1269  prefs->setAttribute(Qt::WA_DeleteOnClose);
1270  prefs->show();
1271  }
1272 }
A dialog that allows for setting preferences for a requested diagram.

Referenced by MainWindow().

◆ showDiagramPrefsDialog [2/2]

void MainWindow::showDiagramPrefsDialog ( QModelIndex &  index)
protectedslot

Calls the diagram prefs dialog from the station list (i.e. for a specific station).

Definition at line 1239 of file mainwindow.cpp.

1240 {
1241  QString listName;
1242  GeoLib::Station* stn =
1243  _geo_model->getStationModel()->stationFromIndex(index, listName);
1244 
1245  if (dynamic_cast<GeoLib::StationBorehole*>(stn))
1246  {
1247  OGSError::box("No time series data available for borehole.");
1248  }
1249  else if (dynamic_cast<GeoLib::Station*>(stn) && stn->getSensorData())
1250  {
1251  auto* prefs(new DiagramPrefsDialog(stn));
1252  prefs->setAttribute(Qt::WA_DeleteOnClose);
1253  prefs->show();
1254  }
1255 }
A borehole as a geometric object.
A Station (observation site) is basically a Point with some additional information.
Definition: Station.h:37
const SensorData * getSensorData() const
Returns all the sensor data for this observation site.
Definition: Station.h:83

References _geo_model, OGSError::box(), and GeoLib::Station::getSensorData().

◆ showFileConverter

void MainWindow::showFileConverter ( )
protectedslot

Calls the OGSFileConverter as an external tool.

Definition at line 1229 of file mainwindow.cpp.

1230 {
1231  QSettings settings;
1232  auto* dlg = new OGSFileConverter(
1233  settings.value("DataExplorerGmshPath").toString().toStdString(), this);
1234  dlg->setAttribute(Qt::WA_DeleteOnClose);
1235  dlg->show();
1236  dlg->raise();
1237 }

◆ showGeoDockWidget

void MainWindow::showGeoDockWidget ( bool  show)
protectedslot

Definition at line 437 of file mainwindow.cpp.

438 {
439  if (show)
440  {
441  geoDock->show();
442  }
443  else
444  {
445  geoDock->hide();
446  }
447 }

Referenced by MainWindow().

◆ showGeoNameDialog

void MainWindow::showGeoNameDialog ( const std::string &  geometry_name,
const GeoLib::GEOTYPE  object_type,
std::size_t  id 
)
protectedslot

Allows setting the name for a geometric object.

Definition at line 1274 of file mainwindow.cpp.

1277 {
1278  std::string old_name = _project.getGEOObjects().getElementNameByID(
1279  geometry_name, object_type, id);
1280  SetNameDialog dlg(GeoLib::convertGeoTypeToString(object_type), id,
1281  old_name);
1282  if (dlg.exec() != QDialog::Accepted)
1283  {
1284  return;
1285  }
1286 
1287  _geo_model->addNameForElement(geometry_name, object_type, id,
1288  dlg.getNewName());
1289  static_cast<GeoTreeModel*>(this->geoTabWidget->treeView->model())
1290  ->setNameForItem(geometry_name, object_type, id,
1292  geometry_name, object_type, id));
1293 }
std::string getElementNameByID(const std::string &geometry_name, GeoLib::GEOTYPE type, std::size_t id) const
Definition: GEOObjects.cpp:414
Small dialog for setting a name for an object.
Definition: SetNameDialog.h:29
std::string convertGeoTypeToString(GEOTYPE geo_type)
Definition: GeoType.cpp:23

References _geo_model, _project, GeoLib::convertGeoTypeToString(), GeoLib::GEOObjects::getElementNameByID(), DataHolderLib::Project::getGEOObjects(), and SetNameDialog::getNewName().

Referenced by MainWindow().

◆ showGMSHPrefsDialog

void MainWindow::showGMSHPrefsDialog ( )
protectedslot

Definition at line 1360 of file mainwindow.cpp.

1361 {
1363  connect(&dlg,
1364  SIGNAL(requestMeshing(std::vector<std::string>&, unsigned, double,
1365  double, double, bool)),
1366  this,
1367  SLOT(callGMSH(std::vector<std::string>&, unsigned, double, double,
1368  double, bool)));
1369  dlg.exec();
1370 }
A dialog window for setting preferences for GMSH.
void callGMSH(std::vector< std::string > &selectedGeometries, unsigned param1, double param2, double param3, double param4, bool delete_geo_file)
Function calls for generating GMSH files from the GUI.

References _project, callGMSH(), and DataHolderLib::Project::getGEOObjects().

◆ showLicense

void MainWindow::showLicense ( )
protectedslot

Definition at line 895 of file mainwindow.cpp.

896 {
897  LicenseDialog dlg;
898  dlg.exec();
899 }
A dialog window displaying the OGS license information.
Definition: LicenseDialog.h:24

◆ showLineEditDialog

void MainWindow::showLineEditDialog ( const std::string &  geoName)
protectedslot

Definition at line 1345 of file mainwindow.cpp.

1346 {
1347  LineEditDialog lineEdit(
1348  *(_project.getGEOObjects().getPolylineVecObj(geoName)));
1349  connect(
1350  &lineEdit,
1351  SIGNAL(connectPolylines(const std::string&, std::vector<std::size_t>,
1352  double, std::string, bool, bool)),
1353  _geo_model.get(),
1354  SLOT(connectPolylineSegments(const std::string&,
1355  std::vector<std::size_t>, double,
1356  std::string, bool, bool)));
1357  lineEdit.exec();
1358 }
const PolylineVec * getPolylineVecObj(const std::string &name) const
Definition: GEOObjects.cpp:227
A dialog window for manipulation of polylines. Currently included functionality is the concatenation ...

References _geo_model, _project, DataHolderLib::Project::getGEOObjects(), and GeoLib::GEOObjects::getPolylineVecObj().

Referenced by MainWindow().

◆ showMergeGeometriesDialog

void MainWindow::showMergeGeometriesDialog ( )
protectedslot

Definition at line 1372 of file mainwindow.cpp.

1373 {
1375  if (dlg.exec() != QDialog::Accepted)
1376  {
1377  return;
1378  }
1379  std::string name(dlg.getGeometryName());
1380  if (_project.getGEOObjects().mergeGeometries(dlg.getSelectedGeometries(),
1381  name) < 0)
1382  {
1383  OGSError::box("Points are missing for\n at least one geometry.");
1384  }
1385 }
int mergeGeometries(std::vector< std::string > const &geo_names, std::string &merged_geo_name)
Definition: GEOObjects.cpp:435
A dialog window for setting preferences for GMSH.

References _project, OGSError::box(), MergeGeometriesDialog::getGeometryName(), DataHolderLib::Project::getGEOObjects(), MergeGeometriesDialog::getSelectedGeometries(), GeoLib::GEOObjects::mergeGeometries(), and MaterialPropertyLib::name.

◆ showMeshAnalysisDialog

void MainWindow::showMeshAnalysisDialog ( )
protectedslot

Definition at line 1328 of file mainwindow.cpp.

1329 {
1330  auto* dlg = new MeshAnalysisDialog(this->_project.getMeshObjects());
1331  dlg->exec();
1332 }
A dialog window for calling mesh analysis methods.

References _project, and DataHolderLib::Project::getMeshObjects().

◆ showMeshElementRemovalDialog

void MainWindow::showMeshElementRemovalDialog ( )
protectedslot

Removal of mesh elements based on a number of criteria.

Definition at line 1320 of file mainwindow.cpp.

1321 {
1323  connect(&dlg, SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(),
1324  SLOT(addMesh(MeshLib::Mesh*)));
1325  dlg.exec();
1326 }
A dialog window for settung up a database connection.

References _meshModel, and _project.

◆ showMeshQualitySelectionDialog

void MainWindow::showMeshQualitySelectionDialog ( MeshLib::VtkMappedMeshSource mshSource)
protectedslot

Definition at line 1387 of file mainwindow.cpp.

1389 {
1390  if (mshSource == nullptr)
1391  {
1392  return;
1393  }
1394 
1396  if (dlg.exec() != QDialog::Accepted)
1397  {
1398  return;
1399  }
1400  MeshLib::MeshQualityType const type(dlg.getSelectedMetric());
1401  MeshLib::ElementQualityInterface quality_interface(*mshSource->GetMesh(),
1402  type);
1403  _vtkVisPipeline->showMeshElementQuality(
1404  mshSource, type, quality_interface.getQualityVector());
1405 
1406  if (dlg.getHistogram())
1407  {
1408  quality_interface.writeHistogram(dlg.getHistogramPath());
1409  }
1410 }
const MeshLib::Mesh * GetMesh() const
Returns the mesh.
A dialog for selecting a mesh quality metric.
std::string getHistogramPath() const
Returns selected path for histogram (or empty string if no histogram is required)
bool getHistogram() const
Returns true if a histogram needs to be calculated.
MeshLib::MeshQualityType getSelectedMetric() const
Returns selected metric.
MeshQualityType
Describes a mesh quality metric.
Definition: MeshEnums.h:70

References _vtkVisPipeline, MeshQualitySelectionDialog::getHistogram(), MeshQualitySelectionDialog::getHistogramPath(), MeshLib::VtkMappedMeshSource::GetMesh(), MeshLib::ElementQualityInterface::getQualityVector(), MeshQualitySelectionDialog::getSelectedMetric(), and MeshLib::ElementQualityInterface::writeHistogram().

Referenced by MainWindow().

◆ showMshDockWidget

void MainWindow::showMshDockWidget ( bool  show)
protectedslot

Definition at line 461 of file mainwindow.cpp.

462 {
463  if (show)
464  {
465  mshDock->show();
466  }
467  else
468  {
469  mshDock->hide();
470  }
471 }

Referenced by MainWindow().

◆ showStationDockWidget

void MainWindow::showStationDockWidget ( bool  show)
protectedslot

Definition at line 449 of file mainwindow.cpp.

450 {
451  if (show)
452  {
453  stationDock->show();
454  }
455  else
456  {
457  stationDock->hide();
458  }
459 }

Referenced by MainWindow().

◆ showStationNameDialog

void MainWindow::showStationNameDialog ( const std::string &  stn_vec_name,
std::size_t  id 
)
protectedslot

Allows setting the name for a station.

Definition at line 1295 of file mainwindow.cpp.

1297 {
1298  std::vector<GeoLib::Point*> const* stations =
1299  _project.getGEOObjects().getStationVec(stn_vec_name);
1300  auto* const stn = static_cast<GeoLib::Station*>((*stations)[id]);
1301  SetNameDialog dlg("Station", id, stn->getName());
1302  if (dlg.exec() != QDialog::Accepted)
1303  {
1304  return;
1305  }
1306 
1307  stn->setName(dlg.getNewName());
1308  static_cast<StationTreeModel*>(this->stationTabWidget->treeView->model())
1309  ->setNameForItem(stn_vec_name, id, stn->getName());
1310 }

References _project, DataHolderLib::Project::getGEOObjects(), SetNameDialog::getNewName(), and GeoLib::GEOObjects::getStationVec().

Referenced by MainWindow().

◆ showVisalizationPrefsDialog

void MainWindow::showVisalizationPrefsDialog ( )
protectedslot

Definition at line 1412 of file mainwindow.cpp.

1413 {
1414  _visPrefsDialog->show();
1415 }

References _visPrefsDialog.

◆ showVisDockWidget

void MainWindow::showVisDockWidget ( bool  show)
protectedslot

Definition at line 485 of file mainwindow.cpp.

486 {
487  if (show)
488  {
489  vtkVisDock->show();
490  }
491  else
492  {
493  vtkVisDock->hide();
494  }
495 }

Referenced by MainWindow().

◆ ShowWindow()

void MainWindow::ShowWindow ( )

Definition at line 1425 of file mainwindow.cpp.

1426 {
1427  this->show();
1428 }

◆ startPresentationMode

void MainWindow::startPresentationMode ( )
protectedslot

Definition at line 1552 of file mainwindow.cpp.

1553 {
1554  // Save the QMainWindow state to restore when quitting presentation mode
1555  _windowState = this->saveState();
1556 
1557  // Get the screen number from the QAction which sent the signal
1558  QString actionText = static_cast<QAction*>(QObject::sender())->text();
1559  int screen = actionText.split(" ").back().toInt();
1560 
1561  // Move the widget to the screen and maximize it
1562  // Real fullscreen hides the menu
1563  _vtkWidget->setParent(nullptr, Qt::Window);
1564  _vtkWidget->move(
1565  QPoint(_screenGeometries[screen].x(), _screenGeometries[screen].y()));
1566  //_vtkWidget->showFullScreen();
1567  _vtkWidget->showMaximized();
1568 
1569  // Create an action which quits the presentation mode when pressing
1570  // ESCAPE when the the window has focus
1571  QAction* action = new QAction("Quit presentation mode", this);
1572  connect(action, SIGNAL(triggered()), this, SLOT(quitPresentationMode()));
1573  action->setShortcutContext(Qt::WidgetShortcut);
1574  action->setShortcut(QKeySequence(Qt::Key_Escape));
1575  _vtkWidget->addAction(action);
1576 
1577  // Hide the central widget to maximize the dock widgets
1578  QMainWindow::centralWidget()->hide();
1579 }

References _screenGeometries, _vtkWidget, _windowState, and quitPresentationMode().

Referenced by createPresentationMenu().

◆ updateDataViews

void MainWindow::updateDataViews ( )
protectedslot

Definition at line 871 of file mainwindow.cpp.

872 {
873  visualizationWidget->updateViewOnLoad();
874  geoTabWidget->treeView->updateView();
875  stationTabWidget->treeView->updateView();
876  meshTabWidget->treeView->updateView();
877 }

Referenced by MainWindow(), and loadFile().

◆ writeGeometryToFile

void MainWindow::writeGeometryToFile ( QString  gliName,
QString  fileName 
)
protectedslot

Definition at line 990 of file mainwindow.cpp.

991 {
992 #ifndef NDEBUG
993  QFileInfo fi(fileName);
994  if (fi.suffix().toLower() == "gli")
995  {
996  FileIO::Legacy::writeAllDataToGLIFileV4(fileName.toStdString(),
998  return;
999  }
1000 #endif
1002  xml.export_name = gliName.toStdString();
1003  BaseLib::IO::writeStringToFile(xml.writeToString(), fileName.toStdString());
1004 }
void writeAllDataToGLIFileV4(const std::string &fname, const GeoLib::GEOObjects &geo)
Definition: OGSIOVer4.cpp:711

References _project, BaseLib::IO::XMLInterface::export_name, DataHolderLib::Project::getGEOObjects(), FileIO::Legacy::writeAllDataToGLIFileV4(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().

Referenced by MainWindow().

◆ writeSettings()

void MainWindow::writeSettings ( )
private

Definition at line 887 of file mainwindow.cpp.

888 {
889  QSettings settings;
890 
891  settings.setValue("windowGeometry", saveGeometry());
892  settings.setValue("windowState", saveState());
893 }

Referenced by closeEvent().

◆ writeStationListToFile

void MainWindow::writeStationListToFile ( QString  listName,
QString  fileName 
)
protectedslot

Definition at line 1006 of file mainwindow.cpp.

1007 {
1009  xml.export_name = listName.toStdString();
1010  BaseLib::IO::writeStringToFile(xml.writeToString(), fileName.toStdString());
1011 }

References _project, BaseLib::IO::XMLInterface::export_name, DataHolderLib::Project::getGEOObjects(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().

Referenced by MainWindow().

Member Data Documentation

◆ _conditionModel

std::unique_ptr<FemConditionModel> MainWindow::_conditionModel
private

Definition at line 130 of file mainwindow.h.

Referenced by MainWindow().

◆ _elementModel

std::unique_ptr<ElementTreeModel> MainWindow::_elementModel
private

Definition at line 128 of file mainwindow.h.

Referenced by MainWindow().

◆ _geo_model

std::unique_ptr<GEOModels> MainWindow::_geo_model
private

◆ _meshModel

std::unique_ptr<MeshModel> MainWindow::_meshModel
private

◆ _processModel

std::unique_ptr<ProcessModel> MainWindow::_processModel
private

Definition at line 129 of file mainwindow.h.

Referenced by MainWindow(), and loadFile().

◆ _project

◆ _screenGeometries

QList<QRect> MainWindow::_screenGeometries
private

Definition at line 132 of file mainwindow.h.

Referenced by MainWindow(), createPresentationMenu(), and startPresentationMode().

◆ _visPrefsDialog

std::unique_ptr<VisPrefsDialog> MainWindow::_visPrefsDialog
private

Definition at line 136 of file mainwindow.h.

Referenced by MainWindow(), and showVisalizationPrefsDialog().

◆ _vtkVisPipeline

std::unique_ptr<VtkVisPipeline> MainWindow::_vtkVisPipeline
private

◆ _vtkWidget

std::unique_ptr<QWidget> MainWindow::_vtkWidget
private

◆ _windowState

QByteArray MainWindow::_windowState
private

Definition at line 134 of file mainwindow.h.

Referenced by quitPresentationMode(), and startPresentationMode().


The documentation for this class was generated from the following files: