OGS
MainWindow Class Reference

Detailed Description

Main program window for the graphical user interface of OpenGeoSys.

Definition at line 38 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 showAddFaultsToVoxelGridDialog ()
 
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.
 
void save ()
 Function calls for saving files.
 
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.
 
void exportBoreholesToGMS (std::string listName, std::string fileName)
 Function calls for GMS export.
 
void FEMTestStart ()
 Testing functionality for connection to FEM lib.
 
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.
 
void showStationNameDialog (const std::string &stn_vec_name, std::size_t id)
 Allows setting the name for a station.
 
void showCreateStructuredGridDialog ()
 Creates a structured grid with user-specified parameters.
 
void showMeshElementRemovalDialog ()
 Removal of mesh elements based on a number of criteria.
 
void showDiagramPrefsDialog ()
 Calls the diagram prefs dialog from the Tools menu.
 
void showDiagramPrefsDialog (QModelIndex &index)
 
void showFileConverter ()
 Calls the OGSFileConverter as an external tool.
 
void showLicense ()
 
void showLineEditDialog (const std::string &geoName)
 
void showGMSHPrefsDialog ()
 
void showMergeGeometriesDialog ()
 
void showMeshAnalysisDialog ()
 
void showTranslateDataDialog ()
 
void showLayers2GridDialog ()
 
void showMeshQualitySelectionDialog (MeshLib::VtkMappedMeshSource *mshSource)
 
void showVisalizationPrefsDialog ()
 
void showVtu2GridDialog ()
 
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 104 of file mainwindow.cpp.

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

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 905 of file mainwindow.cpp.

906{
907 QString about(
908 "<a href='https://www.opengeosys.org'>www.opengeosys.org</a><br /><br "
909 "/>");
910 about.append(
911 QString("Version: %1<br />")
912 .arg(QString::fromStdString(GitInfoLib::GitInfo::ogs_version)));
913
914 about.append(
915 QString("Git commit: <a "
916 "href='https://github.com/ufz/ogs/commit/%1'>%1</a><br />")
917 .arg(QString::fromStdString(
919 about.append(QString("Built date: %1<br />")
920 .arg(QDate::currentDate().toString(Qt::ISODate)));
921
922 QMessageBox::about(this, "About OpenGeoSys 6", about);
923}
GITINFOLIB_EXPORT const std::string git_version_sha1_short
GITINFOLIB_EXPORT const std::string ogs_version
const char * toString(mgis::behaviour::Behaviour::Kinematic kin)

References about(), GitInfoLib::GitInfo::git_version_sha1_short, and GitInfoLib::GitInfo::ogs_version.

Referenced by about().

◆ 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 1127 of file mainwindow.cpp.

1130{
1131 if (!selectedGeometries.empty())
1132 {
1133 INFO("Start meshing ...");
1134
1135 QString fileName("");
1136 QString dir_str = this->getLastUsedDir();
1137
1138 if (!delete_geo_file)
1139 {
1140 fileName = QFileDialog::getSaveFileName(
1141 this, "Save GMSH-file as",
1142 LastSavedFileDirectory::getDir() + "tmp_gmsh.geo",
1143 "GMSH geometry files (*.geo)");
1144 }
1145 else
1146 {
1147 fileName = "tmp_gmsh.geo";
1148 }
1149
1150 if (!fileName.isEmpty())
1151 {
1152 try
1153 {
1154 if (param4 == -1)
1155 { // adaptive meshing selected
1157 _project.getGEOObjects(), true,
1159 param2, param3, param1, selectedGeometries, false,
1160 false);
1161 BaseLib::IO::writeStringToFile(gmsh_io.writeToString(),
1162 fileName.toStdString());
1163 }
1164 else
1165 { // homogeneous meshing selected
1167 _project.getGEOObjects(), true,
1169 param4, param3, param1, selectedGeometries, false,
1170 false);
1171 BaseLib::IO::writeStringToFile(gmsh_io.writeToString(),
1172 fileName.toStdString());
1173 }
1174
1175 if (system(nullptr) != 0) // command processor available
1176 {
1177 QSettings settings;
1178 std::string gmsh_path =
1179 settings.value("DataExplorerGmshPath")
1180 .toString()
1181 .toStdString();
1182
1183 if (!gmsh_path.empty())
1184 {
1185 std::string fname(fileName.toStdString());
1186 std::string gmsh_command =
1187 "\"" + gmsh_path + "\" -2 -algo meshadapt " + fname;
1188 std::size_t pos(fname.rfind("."));
1189 if (pos != std::string::npos)
1190 {
1191 fname = fname.substr(0, pos);
1192 }
1193 gmsh_command += " -o " + fname + ".msh";
1194 // Newer gmsh versions write a newer file format for
1195 // meshes per default. At the moment we can't read this
1196 // new format. This is a switch for gmsh to write the
1197 // 'old' file format.
1198 gmsh_command += " -format msh22";
1199 auto const return_value =
1200 std::system(gmsh_command.c_str());
1201 if (return_value != 0)
1202 {
1203 QString const message =
1204 "Execution of gmsh command returned non-zero "
1205 "status, " +
1206 QString::number(return_value);
1207 OGSError::box(message, "Error");
1208 }
1209 else
1210 {
1212 fileName.left(fileName.length() - 3)
1213 .append("msh"));
1214 }
1215 }
1216 else
1217 {
1218 OGSError::box("Location of GMSH not specified.",
1219 "Error");
1220 }
1221 }
1222 else
1223 {
1225 "Error executing command gmsh - no command processor "
1226 "available",
1227 "Error");
1228 }
1229 }
1230 catch (std::runtime_error& error)
1231 {
1232 OGSError::box(QString(error.what()) +
1233 QString("\n Please cleanup the input data."),
1234 "ERROR");
1235 }
1236 if (delete_geo_file)
1237 {
1238 BaseLib::removeFile(fileName.toStdString());
1239 }
1240 }
1241 }
1242 else
1243 INFO("No geometry information selected.");
1244 QApplication::restoreOverrideCursor();
1245}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
Reads and writes GMSH-files to and from OGS data structures.
static const QString getDir()
Returns the directory last used for saving a file.
void loadFile(ImportFileType::type t, const QString &fileName)
QString getLastUsedDir()
static void box(const QString &e)
Definition OGSError.cpp:23
int writeStringToFile(std::string_view content, std::filesystem::path const &file_path)
Definition Writer.cpp:45
void removeFile(std::string const &filename)
@ 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 435 of file mainwindow.cpp.

436{
438 QWidget::closeEvent(event);
439}
void writeSettings()

References writeSettings().

◆ convertMeshToGeometry

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

Definition at line 1114 of file mainwindow.cpp.

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

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

Referenced by MainWindow().

◆ convertPointsToStations

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

Definition at line 1388 of file mainwindow.cpp.

1389{
1390 std::string stn_name = geo_name + " Stations";
1392 stn_name);
1393 if (ret == 1)
1394 {
1395 OGSError::box("No points found to convert.");
1396 }
1397}
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.

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

Referenced by MainWindow().

◆ createImportFilesMenu()

QMenu * MainWindow::createImportFilesMenu ( )
private

Definition at line 925 of file mainwindow.cpp.

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

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 1571 of file mainwindow.cpp.

1572{
1573 auto* menu = static_cast<QMenu*>(QObject::sender());
1574 menu->clear();
1575 if (!_vtkWidget->parent())
1576 {
1577 QAction* action = new QAction("Quit presentation mode", menu);
1578 connect(action, SIGNAL(triggered()), this,
1579 SLOT(quitPresentationMode()));
1580 action->setShortcutContext(Qt::WidgetShortcut);
1581 action->setShortcut(QKeySequence(Qt::Key_Escape));
1582 menu->addAction(action);
1583 }
1584 else
1585 {
1586 int count = 0;
1587 const int currentScreen =
1588 QApplication::desktop()->screenNumber(visualizationWidget);
1589 foreach (QRect screenGeo, _screenGeometries)
1590 {
1591 Q_UNUSED(screenGeo);
1592 QAction* action =
1593 new QAction(QString("On screen %1").arg(count), menu);
1594 connect(action, SIGNAL(triggered()), this,
1595 SLOT(startPresentationMode()));
1596 if (count == currentScreen)
1597 {
1598 action->setEnabled(false);
1599 }
1600 menu->addAction(action);
1601 ++count;
1602 }
1603 }
1604}
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 1119 of file mainwindow.cpp.

1121{
1122 const std::vector<GeoLib::Point*>* stations(
1124 GMSInterface::writeBoreholesToGMS(stations, fileName);
1125}
static void writeBoreholesToGMS(const std::vector< GeoLib::Point * > *stations, const std::string &filename)
const std::vector< GeoLib::Point * > * getStationVec(const std::string &name) const
Returns the station vector with the given name.

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

Referenced by MainWindow().

◆ FEMTestStart

void MainWindow::FEMTestStart ( )
protectedslot

Testing functionality for connection to FEM lib.

Definition at line 1477 of file mainwindow.cpp.

1477{}

◆ 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 1651 of file mainwindow.cpp.

1652{
1653 QSettings settings;
1654 QString fileName("");
1655 QStringList files = settings.value("recentFileList").toStringList();
1656 if (!files.empty())
1657 {
1658 return QFileInfo(files[0]).absolutePath();
1659 }
1660
1661 return QDir::homePath();
1662}

Referenced by callGMSH().

◆ HideWindow()

void MainWindow::HideWindow ( )

Definition at line 1484 of file mainwindow.cpp.

1485{
1486 this->hide();
1487}

◆ 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 576 of file mainwindow.cpp.

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

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(), ImportFileType::NETCDF, VtkBGImageSource::New(), VtkGeoImageSource::New(), ImportFileType::OGS, ImportFileType::OGS_GEO, ImportFileType::OGS_MSH, ImportFileType::OGS_STN, ImportFileType::POLYRASTER, ImportFileType::RASTER, FileIO::GMSInterface::readBoreholesFromGMS(), FileIO::FEFLOWGeoInterface::readFEFLOWFile(), FileIO::FEFLOWMeshInterface::readFEFLOWFile(), FileIO::Gocad::GocadAsciiReader::readFile(), FileIO::XmlPrjInterface::readFile(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::XmlStnInterface::readFile(), FileIO::Legacy::readGLIFileV4(), FileIO::GMSH::readGMSHMesh(), VtkGeoImageSource::readImage(), FileIO::GMSInterface::readMesh(), 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 1489 of file mainwindow.cpp.

1490{
1491 QString ext = QFileInfo(fileName).suffix();
1492 if (ext == "msh" || ext == "vtu" || ext == "gli" || ext == "gml")
1493 {
1494 this->loadFile(ImportFileType::OGS, fileName);
1495 }
1496}

References loadFile(), and ImportFileType::OGS.

◆ loadPetrelFiles

void MainWindow::loadPetrelFiles ( )
protectedslot

Definition at line 952 of file mainwindow.cpp.

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

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

Referenced by createImportFilesMenu().

◆ mapGeometry

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

Definition at line 1017 of file mainwindow.cpp.

1018{
1020 if (dlg.exec() != QDialog::Accepted)
1021 {
1022 return;
1023 }
1024
1025 int choice(dlg.getDataSetChoice());
1026
1027 QString file_name("");
1028 if (choice < 2) // load something from a file
1029 {
1030 QString file_type[2] = {"OpenGeoSys mesh files (*.vtu *.msh)",
1031 "Raster files(*.asc *.grd *.xyz)"};
1032 QSettings settings;
1033 file_name = QFileDialog::getOpenFileName(
1034 this,
1035 "Select file for mapping",
1036 settings.value("lastOpenedFileDirectory").toString(),
1037 file_type[choice]);
1038 if (file_name.isEmpty())
1039 {
1040 return;
1041 }
1042 QDir dir = QDir(file_name);
1043 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
1044 }
1045
1046 MeshGeoToolsLib::GeoMapper geo_mapper(_project.getGEOObjects(), geo_name);
1047 QFileInfo fi(file_name);
1048 if (choice == 1) // load raster from file
1049 {
1050 if (fi.suffix().toLower() == "asc" || fi.suffix().toLower() == "grd")
1051 {
1052 std::unique_ptr<GeoLib::Raster> raster(
1054 file_name.toStdString()));
1055 if (raster)
1056 {
1057 geo_mapper.mapOnDEM(std::move(raster));
1058 }
1059 else
1060 {
1061 OGSError::box("Error reading raster file.");
1062 }
1063 _geo_model->updateGeometry(geo_name);
1064 }
1065 else
1066 {
1067 OGSError::box("The selected file is no supported raster file.");
1068 }
1069 return;
1070 }
1071
1072 MeshLib::Mesh* mesh(nullptr);
1073 if (choice == 0) // load mesh from file
1074 {
1075 if (fi.suffix().toLower() == "vtu" || fi.suffix().toLower() == "vtk" ||
1076 fi.suffix().toLower() == "msh")
1077 {
1078 mesh = MeshLib::IO::readMeshFromFile(file_name.toStdString());
1079 }
1080 else
1081 {
1082 OGSError::box("The selected file is no supported mesh file.");
1083 return;
1084 }
1085 }
1086 else
1087 { // use mesh from ProjectData
1088 mesh = _project.getMeshObjects()[choice - 2].get();
1089 }
1090
1091 std::string new_geo_name = dlg.getNewGeoName();
1092
1093 if (new_geo_name.empty())
1094 {
1095 geo_mapper.mapOnMesh(mesh);
1096 _geo_model->updateGeometry(geo_name);
1097 }
1098 else
1099 {
1101 new_geo_name);
1102 new_geo_name = dup.getFinalizedOutputName();
1104 new_geo_name);
1105 mapper.advancedMapOnMesh(*mesh);
1106 _geo_model->updateGeometry(new_geo_name);
1107 }
1108 if (choice == 0)
1109 {
1110 delete mesh;
1111 }
1112}
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 1550 of file mainwindow.cpp.

1551{
1552 Q_UNUSED(checked)
1553 QSettings settings;
1554 QString fileName = QFileDialog::getSaveFileName(
1555 this, "Save scene to Wavefront OBJ files",
1556 settings.value("lastExportedFileDirectory").toString(), ";;");
1557 if (!fileName.isEmpty())
1558 {
1559 QDir dir = QDir(fileName);
1560 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1561
1562 vtkOBJExporter* exporter = vtkOBJExporter::New();
1563 exporter->SetFilePrefix(fileName.toStdString().c_str());
1564 exporter->SetRenderWindow(
1565 visualizationWidget->vtkWidget->renderWindow());
1566 exporter->Write();
1567 exporter->Delete();
1568 }
1569}

◆ on_actionExportVRML2_triggered

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

Definition at line 1528 of file mainwindow.cpp.

1529{
1530 Q_UNUSED(checked)
1531 QSettings settings;
1532 QString fileName = QFileDialog::getSaveFileName(
1533 this, "Save scene to VRML file",
1534 settings.value("lastExportedFileDirectory").toString(),
1535 "VRML files (*.wrl);;");
1536 if (!fileName.isEmpty())
1537 {
1538 QDir dir = QDir(fileName);
1539 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1540
1541 vtkVRMLExporter* exporter = vtkVRMLExporter::New();
1542 exporter->SetFileName(fileName.toStdString().c_str());
1543 exporter->SetRenderWindow(
1544 visualizationWidget->vtkWidget->renderWindow());
1545 exporter->Write();
1546 exporter->Delete();
1547 }
1548}

◆ on_actionExportVTK_triggered

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

Definition at line 1498 of file mainwindow.cpp.

1499{
1500 Q_UNUSED(checked)
1501 QSettings settings;
1502 int count = 0;
1503 QString const filename = QFileDialog::getSaveFileName(
1504 this,
1505 "Export object to vtk-files",
1506 settings.value("lastExportedFileDirectory").toString(),
1507 "VTK files (*.vtp *.vtu)");
1508 if (!filename.isEmpty())
1509 {
1510 QDir const dir = QDir(filename);
1511 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1512
1513 std::string const basename =
1514 QFileInfo(filename).path().toStdString() + "/" +
1515 QFileInfo(filename).baseName().toStdString();
1517 ++it;
1518 while (*it)
1519 {
1520 std::string const name = basename + std::to_string(++count) + "-" +
1521 (*it)->data(0).toString().toStdString();
1522 static_cast<VtkVisPipelineItem*>(*it)->writeToFile(name);
1523 ++it;
1524 }
1525 }
1526}
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, and VtkVisPipelineItem::writeToFile().

◆ open

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

Function calls for opening files.

Definition at line 501 of file mainwindow.cpp.

502{
503 QSettings settings;
504 auto t = static_cast<ImportFileType::type>(file_type);
505 QString type_str = QString::fromStdString(
507 QString fileName = QFileDialog::getOpenFileName(
508 this, "Select " + type_str + " file to import",
509 settings.value("lastOpenedFileDirectory").toString(),
510 QString::fromStdString(ImportFileType::getFileSuffixString(t)));
511 if (!fileName.isEmpty())
512 {
513 loadFile(t, fileName);
514 QDir dir = QDir(fileName);
515 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
516 }
517}
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 519 of file mainwindow.cpp.

520{
521 auto* action = qobject_cast<QAction*>(sender());
522 if (action)
523 {
524 loadFile(ImportFileType::OGS, action->data().toString());
525 }
526}

References loadFile(), and ImportFileType::OGS.

Referenced by MainWindow().

◆ quitPresentationMode

void MainWindow::quitPresentationMode ( )
protectedslot

Definition at line 1635 of file mainwindow.cpp.

1636{
1637 // Remove the quit action
1638 QAction* action = _vtkWidget->actions().back();
1639 _vtkWidget->removeAction(action);
1640 delete action;
1641
1642 // Add the widget back to visualization widget
1643 visualizationWidget->layout()->addWidget(_vtkWidget.get());
1644
1645 QMainWindow::centralWidget()->show();
1646
1647 // Restore the previously saved QMainWindow state
1648 this->restoreState(_windowState);
1649}
QByteArray _windowState
Definition mainwindow.h:141

References _vtkWidget, and _windowState.

Referenced by createPresentationMenu(), and startPresentationMode().

◆ readSettings()

void MainWindow::readSettings ( )
private

Definition at line 883 of file mainwindow.cpp.

884{
885 QSettings settings;
886
887 restoreGeometry(settings.value("windowGeometry").toByteArray());
888 restoreState(settings.value("windowState").toByteArray());
889}

Referenced by MainWindow().

◆ save

void MainWindow::save ( )
protectedslot

Function calls for saving files.

Definition at line 528 of file mainwindow.cpp.

529{
530 QString fileName = QFileDialog::getSaveFileName(
531 this,
532 "Save data as",
534 "GeoSys project (*.prj);;GMSH geometry files (*.geo)");
535
536 if (fileName.isEmpty())
537 {
538 OGSError::box("No filename specified.");
539 return;
540 }
541
542 QFileInfo fi(fileName);
544
545 if (fi.suffix().toLower() == "prj")
546 {
548 BaseLib::IO::writeStringToFile(xml.writeToString(),
549 fileName.toStdString());
550 }
551 else if (fi.suffix().toLower() == "geo")
552 {
553 auto const selected_geometries =
555
556 // values necessary also for the adaptive meshing
557 const double point_density = 0;
558 const double station_density = point_density;
559 const int max_pnts_per_leaf = 0;
560
562 _project.getGEOObjects(), true,
564 station_density, max_pnts_per_leaf, selected_geometries, false,
565 false);
566 bool const success = BaseLib::IO::writeStringToFile(
567 gmsh_io.writeToString(), fileName.toStdString());
568
569 if (!success)
570 {
571 OGSError::box(" No geometry available\n to write to geo-file");
572 }
573 }
574}
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
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().

◆ showAddFaultsToVoxelGridDialog

void MainWindow::showAddFaultsToVoxelGridDialog ( )
protectedslot

Definition at line 1369 of file mainwindow.cpp.

1370{
1371 if (_meshModel == nullptr)
1372 {
1373 OGSError::box("The given mesh model does not exist.");
1374 }
1375 AddFaultsToVoxelGridDialog(*_meshModel).exec();
1376}

References _meshModel, and OGSError::box().

◆ showAddPipelineFilterItemDialog

void MainWindow::showAddPipelineFilterItemDialog ( QModelIndex parentIndex)
protectedslot

Definition at line 988 of file mainwindow.cpp.

989{
990 VtkAddFilterDialog dlg(*_vtkVisPipeline, parentIndex);
991 dlg.exec();
992}
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 477 of file mainwindow.cpp.

478{
479 if (show)
480 {
481 modellingDock->show();
482 }
483 else
484 {
485 modellingDock->hide();
486 }
487}

Referenced by MainWindow().

◆ showCreateStructuredGridDialog

void MainWindow::showCreateStructuredGridDialog ( )
protectedslot

Creates a structured grid with user-specified parameters.

Definition at line 1330 of file mainwindow.cpp.

1331{
1333 connect(&dlg, SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(),
1334 SLOT(addMesh(MeshLib::Mesh*)));
1335 dlg.exec();
1336}
A dialog window for managing general Data Explorer settings.

References _meshModel.

◆ showDataExplorerSettingsDialog

void MainWindow::showDataExplorerSettingsDialog ( )
protectedslot

Definition at line 1471 of file mainwindow.cpp.

1472{
1474 dlg.exec();
1475}
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 1275 of file mainwindow.cpp.

1276{
1277 QSettings settings;
1278 QString fileName = QFileDialog::getOpenFileName(
1279 this, "Select data file to open",
1280 settings.value("lastOpenedFileDirectory").toString(),
1281 "Text files (*.txt);;All files (* *.*)");
1282 if (!fileName.isEmpty())
1283 {
1284 QDir dir = QDir(fileName);
1285 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
1286 auto* prefs = new DiagramPrefsDialog(fileName);
1287 prefs->setAttribute(Qt::WA_DeleteOnClose);
1288 prefs->show();
1289 }
1290}
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 1257 of file mainwindow.cpp.

1258{
1259 QString listName;
1260 GeoLib::Station* stn =
1261 _geo_model->getStationModel()->stationFromIndex(index, listName);
1262
1263 if (dynamic_cast<GeoLib::StationBorehole*>(stn))
1264 {
1265 OGSError::box("No time series data available for borehole.");
1266 }
1267 else if (dynamic_cast<GeoLib::Station*>(stn) && stn->getSensorData())
1268 {
1269 auto* prefs(new DiagramPrefsDialog(stn));
1270 prefs->setAttribute(Qt::WA_DeleteOnClose);
1271 prefs->show();
1272 }
1273}
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:89

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

◆ showFileConverter

void MainWindow::showFileConverter ( )
protectedslot

Calls the OGSFileConverter as an external tool.

Definition at line 1247 of file mainwindow.cpp.

1248{
1249 QSettings settings;
1250 auto* dlg = new OGSFileConverter(
1251 settings.value("DataExplorerGmshPath").toString().toStdString(), this);
1252 dlg->setAttribute(Qt::WA_DeleteOnClose);
1253 dlg->show();
1254 dlg->raise();
1255}

◆ showGeoDockWidget

void MainWindow::showGeoDockWidget ( bool show)
protectedslot

Definition at line 441 of file mainwindow.cpp.

442{
443 if (show)
444 {
445 geoDock->show();
446 }
447 else
448 {
449 geoDock->hide();
450 }
451}

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 1292 of file mainwindow.cpp.

1295{
1296 std::string old_name = _project.getGEOObjects().getElementNameByID(
1297 geometry_name, object_type, id);
1298 SetNameDialog dlg(GeoLib::convertGeoTypeToString(object_type), id,
1299 old_name);
1300 if (dlg.exec() != QDialog::Accepted)
1301 {
1302 return;
1303 }
1304
1305 _geo_model->addNameForElement(geometry_name, object_type, id,
1306 dlg.getNewName());
1307 static_cast<GeoTreeModel*>(this->geoTabWidget->treeView->model())
1308 ->setNameForItem(geometry_name, object_type, id,
1310 geometry_name, object_type, id));
1311}
std::string getElementNameByID(const std::string &geometry_name, GeoLib::GEOTYPE type, std::size_t id) const
void setNameForItem(const std::string &name, GeoLib::GEOTYPE type, std::size_t id, std::string item_name)
Small dialog for setting a name for an object.
std::string convertGeoTypeToString(GEOTYPE geo_type)
Definition GeoType.cpp:23

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

Referenced by MainWindow().

◆ showGMSHPrefsDialog

void MainWindow::showGMSHPrefsDialog ( )
protectedslot

Definition at line 1414 of file mainwindow.cpp.

1415{
1417 connect(&dlg,
1418 SIGNAL(requestMeshing(std::vector<std::string>&, unsigned, double,
1419 double, double, bool)),
1420 this,
1421 SLOT(callGMSH(std::vector<std::string>&, unsigned, double, double,
1422 double, bool)));
1423 dlg.exec();
1424}
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().

◆ showLayers2GridDialog

void MainWindow::showLayers2GridDialog ( )
protectedslot

Definition at line 1358 of file mainwindow.cpp.

1359{
1360 if (_meshModel == nullptr)
1361 {
1362 OGSError::box("The given mesh model does not exist.");
1363 }
1364
1365 auto dlg = Layers2GridDialog(*_meshModel);
1366 dlg.exec();
1367}

References _meshModel, and OGSError::box().

◆ showLicense

void MainWindow::showLicense ( )
protectedslot

Definition at line 899 of file mainwindow.cpp.

900{
901 LicenseDialog dlg;
902 dlg.exec();
903}
A dialog window displaying the OGS license information.

◆ showLineEditDialog

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

Definition at line 1399 of file mainwindow.cpp.

1400{
1401 LineEditDialog lineEdit(
1403 connect(
1404 &lineEdit,
1405 SIGNAL(connectPolylines(const std::string&, std::vector<std::size_t>,
1406 double, std::string, bool, bool)),
1407 _geo_model.get(),
1408 SLOT(connectPolylineSegments(const std::string&,
1409 std::vector<std::size_t>, double,
1410 std::string, bool, bool)));
1411 lineEdit.exec();
1412}
const PolylineVec * getPolylineVecObj(const std::string &name) const
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 1426 of file mainwindow.cpp.

1427{
1429 if (dlg.exec() != QDialog::Accepted)
1430 {
1431 return;
1432 }
1433 std::string name(dlg.getGeometryName());
1434 if (_project.getGEOObjects().mergeGeometries(dlg.getSelectedGeometries(),
1435 name) < 0)
1436 {
1437 OGSError::box("Points are missing for\n at least one geometry.");
1438 }
1439}
int mergeGeometries(std::vector< std::string > const &geo_names, std::string &merged_geo_name)
A dialog window for setting preferences for GMSH.

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

◆ showMeshAnalysisDialog

void MainWindow::showMeshAnalysisDialog ( )
protectedslot

Definition at line 1346 of file mainwindow.cpp.

1347{
1348 auto* dlg = new MeshAnalysisDialog(this->_project.getMeshObjects());
1349 dlg->exec();
1350}
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 1338 of file mainwindow.cpp.

1339{
1341 connect(&dlg, SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(),
1342 SLOT(addMesh(MeshLib::Mesh*)));
1343 dlg.exec();
1344}
A dialog window for settung up a database connection.

References _meshModel, and _project.

◆ showMeshQualitySelectionDialog

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

Definition at line 1441 of file mainwindow.cpp.

1443{
1444 if (mshSource == nullptr)
1445 {
1446 return;
1447 }
1448
1450 if (dlg.exec() != QDialog::Accepted)
1451 {
1452 return;
1453 }
1455 MeshToolsLib::ElementQualityInterface quality_interface(
1456 *mshSource->GetMesh(), type);
1457 _vtkVisPipeline->showMeshElementQuality(
1458 mshSource, type, quality_interface.getQualityVector());
1459
1460 if (dlg.getHistogram())
1461 {
1462 quality_interface.writeHistogram(dlg.getHistogramPath());
1463 }
1464}
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(), MeshToolsLib::ElementQualityInterface::getQualityVector(), MeshQualitySelectionDialog::getSelectedMetric(), and MeshToolsLib::ElementQualityInterface::writeHistogram().

Referenced by MainWindow().

◆ showMshDockWidget

void MainWindow::showMshDockWidget ( bool show)
protectedslot

Definition at line 465 of file mainwindow.cpp.

466{
467 if (show)
468 {
469 mshDock->show();
470 }
471 else
472 {
473 mshDock->hide();
474 }
475}

Referenced by MainWindow().

◆ showStationDockWidget

void MainWindow::showStationDockWidget ( bool show)
protectedslot

Definition at line 453 of file mainwindow.cpp.

454{
455 if (show)
456 {
457 stationDock->show();
458 }
459 else
460 {
461 stationDock->hide();
462 }
463}

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 1313 of file mainwindow.cpp.

1315{
1316 std::vector<GeoLib::Point*> const* stations =
1317 _project.getGEOObjects().getStationVec(stn_vec_name);
1318 auto* const stn = static_cast<GeoLib::Station*>((*stations)[id]);
1319 SetNameDialog dlg("Station", id, stn->getName());
1320 if (dlg.exec() != QDialog::Accepted)
1321 {
1322 return;
1323 }
1324
1325 stn->setName(dlg.getNewName());
1326 static_cast<StationTreeModel*>(this->stationTabWidget->treeView->model())
1327 ->setNameForItem(stn_vec_name, id, stn->getName());
1328}
void setNameForItem(const std::string &stn_vec_name, std::size_t id, std::string const &item_name)

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

Referenced by MainWindow().

◆ showTranslateDataDialog

void MainWindow::showTranslateDataDialog ( )
protectedslot

Definition at line 1352 of file mainwindow.cpp.

1353{
1354 auto dlg = TranslateDataDialog(_meshModel.get(), _geo_model.get());
1355 dlg.exec();
1356}
A dialog window for calling translation methods.

References _geo_model, and _meshModel.

◆ showVisalizationPrefsDialog

void MainWindow::showVisalizationPrefsDialog ( )
protectedslot

Definition at line 1466 of file mainwindow.cpp.

1467{
1468 _visPrefsDialog->show();
1469}

References _visPrefsDialog.

◆ showVisDockWidget

void MainWindow::showVisDockWidget ( bool show)
protectedslot

Definition at line 489 of file mainwindow.cpp.

490{
491 if (show)
492 {
493 vtkVisDock->show();
494 }
495 else
496 {
497 vtkVisDock->hide();
498 }
499}

Referenced by MainWindow().

◆ showVtu2GridDialog

void MainWindow::showVtu2GridDialog ( )
protectedslot

Definition at line 1378 of file mainwindow.cpp.

1379{
1380 if (_meshModel == nullptr)
1381 {
1382 OGSError::box("The given mesh model does not exist.");
1383 }
1384 auto dlg = Vtu2GridDialog(*_meshModel);
1385 dlg.exec();
1386}

References _meshModel, and OGSError::box().

◆ ShowWindow()

void MainWindow::ShowWindow ( )

Definition at line 1479 of file mainwindow.cpp.

1480{
1481 this->show();
1482}

◆ startPresentationMode

void MainWindow::startPresentationMode ( )
protectedslot

Definition at line 1606 of file mainwindow.cpp.

1607{
1608 // Save the QMainWindow state to restore when quitting presentation mode
1609 _windowState = this->saveState();
1610
1611 // Get the screen number from the QAction which sent the signal
1612 QString actionText = static_cast<QAction*>(QObject::sender())->text();
1613 int screen = actionText.split(" ").back().toInt();
1614
1615 // Move the widget to the screen and maximize it
1616 // Real fullscreen hides the menu
1617 _vtkWidget->setParent(nullptr, Qt::Window);
1618 _vtkWidget->move(
1619 QPoint(_screenGeometries[screen].x(), _screenGeometries[screen].y()));
1620 //_vtkWidget->showFullScreen();
1621 _vtkWidget->showMaximized();
1622
1623 // Create an action which quits the presentation mode when pressing
1624 // ESCAPE when the the window has focus
1625 QAction* action = new QAction("Quit presentation mode", this);
1626 connect(action, SIGNAL(triggered()), this, SLOT(quitPresentationMode()));
1627 action->setShortcutContext(Qt::WidgetShortcut);
1628 action->setShortcut(QKeySequence(Qt::Key_Escape));
1629 _vtkWidget->addAction(action);
1630
1631 // Hide the central widget to maximize the dock widgets
1632 QMainWindow::centralWidget()->hide();
1633}

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

Referenced by createPresentationMenu().

◆ updateDataViews

void MainWindow::updateDataViews ( )
protectedslot

Definition at line 875 of file mainwindow.cpp.

876{
877 visualizationWidget->updateViewOnLoad();
878 geoTabWidget->treeView->updateView();
879 stationTabWidget->treeView->updateView();
880 meshTabWidget->treeView->updateView();
881}

Referenced by MainWindow(), and loadFile().

◆ writeGeometryToFile

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

Definition at line 994 of file mainwindow.cpp.

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

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 891 of file mainwindow.cpp.

892{
893 QSettings settings;
894
895 settings.setValue("windowGeometry", saveGeometry());
896 settings.setValue("windowState", saveState());
897}

Referenced by closeEvent().

◆ writeStationListToFile

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

Definition at line 1010 of file mainwindow.cpp.

1011{
1013 xml.export_name = listName.toStdString();
1014 BaseLib::IO::writeStringToFile(xml.writeToString(), fileName.toStdString());
1015}

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 137 of file mainwindow.h.

Referenced by MainWindow().

◆ _elementModel

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

Definition at line 135 of file mainwindow.h.

Referenced by MainWindow().

◆ _geo_model

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

◆ _meshModel

◆ _processModel

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

Definition at line 136 of file mainwindow.h.

Referenced by MainWindow(), and loadFile().

◆ _project

◆ _screenGeometries

QList<QRect> MainWindow::_screenGeometries
private

Definition at line 139 of file mainwindow.h.

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

◆ _visPrefsDialog

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

Definition at line 143 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 141 of file mainwindow.h.

Referenced by quitPresentationMode(), and startPresentationMode().


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