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

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

905{
906 QString about(
907 "<a href='https://www.opengeosys.org'>www.opengeosys.org</a><br /><br "
908 "/>");
909 about.append(
910 QString("Version: %1<br />")
911 .arg(QString::fromStdString(GitInfoLib::GitInfo::ogs_version)));
912
913 about.append(
914 QString("Git commit: <a "
915 "href='https://github.com/ufz/ogs/commit/%1'>%1</a><br />")
916 .arg(QString::fromStdString(
918 about.append(QString("Built date: %1<br />")
919 .arg(QDate::currentDate().toString(Qt::ISODate)));
920
921 QMessageBox::about(this, "About OpenGeoSys 6", about);
922}
void about()
Definition: mainwindow.cpp:904
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 1126 of file mainwindow.cpp.

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

435{
437 QWidget::closeEvent(event);
438}
void writeSettings()
Definition: mainwindow.cpp:890

References writeSettings().

◆ convertMeshToGeometry

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

Definition at line 1113 of file mainwindow.cpp.

1114{
1116}
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 1378 of file mainwindow.cpp.

1379{
1380 std::string stn_name = geo_name + " Stations";
1382 stn_name);
1383 if (ret == 1)
1384 {
1385 OGSError::box("No points found to convert.");
1386 }
1387}
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:611

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

Referenced by MainWindow().

◆ createImportFilesMenu()

QMenu * MainWindow::createImportFilesMenu ( )
private

Definition at line 924 of file mainwindow.cpp.

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

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

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

1120{
1121 const std::vector<GeoLib::Point*>* stations(
1123 GMSInterface::writeBoreholesToGMS(stations, fileName);
1124}
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.
Definition: GEOObjects.cpp:133

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

1467{}

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

1642{
1643 QSettings settings;
1644 QString fileName("");
1645 QStringList files = settings.value("recentFileList").toStringList();
1646 if (!files.empty())
1647 {
1648 return QFileInfo(files[0]).absolutePath();
1649 }
1650
1651 return QDir::homePath();
1652}

Referenced by callGMSH().

◆ HideWindow()

void MainWindow::HideWindow ( )

Definition at line 1474 of file mainwindow.cpp.

1475{
1476 this->hide();
1477}

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

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

1480{
1481 QString ext = QFileInfo(fileName).suffix();
1482 if (ext == "msh" || ext == "vtu" || ext == "gli" || ext == "gml")
1483 {
1484 this->loadFile(ImportFileType::OGS, fileName);
1485 }
1486}

References loadFile(), and ImportFileType::OGS.

◆ loadPetrelFiles

void MainWindow::loadPetrelFiles ( )
protectedslot

Definition at line 951 of file mainwindow.cpp.

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

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

Referenced by createImportFilesMenu().

◆ mapGeometry

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

Definition at line 1016 of file mainwindow.cpp.

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

1541{
1542 Q_UNUSED(checked)
1543 QSettings settings;
1544 QString fileName = QFileDialog::getSaveFileName(
1545 this, "Save scene to Wavefront OBJ files",
1546 settings.value("lastExportedFileDirectory").toString(), ";;");
1547 if (!fileName.isEmpty())
1548 {
1549 QDir dir = QDir(fileName);
1550 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1551
1552 vtkOBJExporter* exporter = vtkOBJExporter::New();
1553 exporter->SetFilePrefix(fileName.toStdString().c_str());
1554 exporter->SetRenderWindow(
1555 visualizationWidget->vtkWidget->renderWindow());
1556 exporter->Write();
1557 exporter->Delete();
1558 }
1559}

◆ on_actionExportVRML2_triggered

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

Definition at line 1518 of file mainwindow.cpp.

1519{
1520 Q_UNUSED(checked)
1521 QSettings settings;
1522 QString fileName = QFileDialog::getSaveFileName(
1523 this, "Save scene to VRML file",
1524 settings.value("lastExportedFileDirectory").toString(),
1525 "VRML files (*.wrl);;");
1526 if (!fileName.isEmpty())
1527 {
1528 QDir dir = QDir(fileName);
1529 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1530
1531 vtkVRMLExporter* exporter = vtkVRMLExporter::New();
1532 exporter->SetFileName(fileName.toStdString().c_str());
1533 exporter->SetRenderWindow(
1534 visualizationWidget->vtkWidget->renderWindow());
1535 exporter->Write();
1536 exporter->Delete();
1537 }
1538}

◆ on_actionExportVTK_triggered

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

Definition at line 1488 of file mainwindow.cpp.

1489{
1490 Q_UNUSED(checked)
1491 QSettings settings;
1492 int count = 0;
1493 QString const filename = QFileDialog::getSaveFileName(
1494 this,
1495 "Export object to vtk-files",
1496 settings.value("lastExportedFileDirectory").toString(),
1497 "VTK files (*.vtp *.vtu)");
1498 if (!filename.isEmpty())
1499 {
1500 QDir const dir = QDir(filename);
1501 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1502
1503 std::string const basename =
1504 QFileInfo(filename).path().toStdString() + "/" +
1505 QFileInfo(filename).baseName().toStdString();
1507 ++it;
1508 while (*it)
1509 {
1510 std::string const name = basename + std::to_string(++count) + "-" +
1511 (*it)->data(0).toString().toStdString();
1512 static_cast<VtkVisPipelineItem*>(*it)->writeToFile(name);
1513 ++it;
1514 }
1515 }
1516}
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 500 of file mainwindow.cpp.

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

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

References loadFile(), and ImportFileType::OGS.

Referenced by MainWindow().

◆ quitPresentationMode

void MainWindow::quitPresentationMode ( )
protectedslot

Definition at line 1625 of file mainwindow.cpp.

1626{
1627 // Remove the quit action
1628 QAction* action = _vtkWidget->actions().back();
1629 _vtkWidget->removeAction(action);
1630 delete action;
1631
1632 // Add the widget back to visualization widget
1633 visualizationWidget->layout()->addWidget(_vtkWidget.get());
1634
1635 QMainWindow::centralWidget()->show();
1636
1637 // Restore the previously saved QMainWindow state
1638 this->restoreState(_windowState);
1639}
QByteArray _windowState
Definition: mainwindow.h:140

References _vtkWidget, and _windowState.

Referenced by createPresentationMenu(), and startPresentationMode().

◆ readSettings()

void MainWindow::readSettings ( )
private

Definition at line 882 of file mainwindow.cpp.

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

Referenced by MainWindow().

◆ save

void MainWindow::save ( )
protectedslot

Function calls for saving files.

Definition at line 527 of file mainwindow.cpp.

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

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

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

Referenced by MainWindow().

◆ showCreateStructuredGridDialog

void MainWindow::showCreateStructuredGridDialog ( )
protectedslot

Creates a structured grid with user-specified parameters.

Definition at line 1329 of file mainwindow.cpp.

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

References _meshModel.

◆ showDataExplorerSettingsDialog

void MainWindow::showDataExplorerSettingsDialog ( )
protectedslot

Definition at line 1461 of file mainwindow.cpp.

1462{
1464 dlg.exec();
1465}
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 1274 of file mainwindow.cpp.

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

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

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

◆ showGeoDockWidget

void MainWindow::showGeoDockWidget ( bool  show)
protectedslot

Definition at line 440 of file mainwindow.cpp.

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

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

1294{
1295 std::string old_name = _project.getGEOObjects().getElementNameByID(
1296 geometry_name, object_type, id);
1297 SetNameDialog dlg(GeoLib::convertGeoTypeToString(object_type), id,
1298 old_name);
1299 if (dlg.exec() != QDialog::Accepted)
1300 {
1301 return;
1302 }
1303
1304 _geo_model->addNameForElement(geometry_name, object_type, id,
1305 dlg.getNewName());
1306 static_cast<GeoTreeModel*>(this->geoTabWidget->treeView->model())
1307 ->setNameForItem(geometry_name, object_type, id,
1309 geometry_name, object_type, id));
1310}
std::string getElementNameByID(const std::string &geometry_name, GeoLib::GEOTYPE type, std::size_t id) const
Definition: GEOObjects.cpp:355
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 1404 of file mainwindow.cpp.

1405{
1407 connect(&dlg,
1408 SIGNAL(requestMeshing(std::vector<std::string>&, unsigned, double,
1409 double, double, bool)),
1410 this,
1411 SLOT(callGMSH(std::vector<std::string>&, unsigned, double, double,
1412 double, bool)));
1413 dlg.exec();
1414}
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 1357 of file mainwindow.cpp.

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

References _meshModel, and OGSError::box().

◆ showLicense

void MainWindow::showLicense ( )
protectedslot

Definition at line 898 of file mainwindow.cpp.

899{
900 LicenseDialog dlg;
901 dlg.exec();
902}
A dialog window displaying the OGS license information.
Definition: LicenseDialog.h:24

◆ showLineEditDialog

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

Definition at line 1389 of file mainwindow.cpp.

1390{
1391 LineEditDialog lineEdit(
1393 connect(
1394 &lineEdit,
1395 SIGNAL(connectPolylines(const std::string&, std::vector<std::size_t>,
1396 double, std::string, bool, bool)),
1397 _geo_model.get(),
1398 SLOT(connectPolylineSegments(const std::string&,
1399 std::vector<std::size_t>, double,
1400 std::string, bool, bool)));
1401 lineEdit.exec();
1402}
const PolylineVec * getPolylineVecObj(const std::string &name) const
Definition: GEOObjects.cpp:206
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 1416 of file mainwindow.cpp.

1417{
1419 if (dlg.exec() != QDialog::Accepted)
1420 {
1421 return;
1422 }
1423 std::string name(dlg.getGeometryName());
1424 if (_project.getGEOObjects().mergeGeometries(dlg.getSelectedGeometries(),
1425 name) < 0)
1426 {
1427 OGSError::box("Points are missing for\n at least one geometry.");
1428 }
1429}
int mergeGeometries(std::vector< std::string > const &geo_names, std::string &merged_geo_name)
Definition: GEOObjects.cpp:376
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 1345 of file mainwindow.cpp.

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

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

References _meshModel, and _project.

◆ showMeshQualitySelectionDialog

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

Definition at line 1431 of file mainwindow.cpp.

1433{
1434 if (mshSource == nullptr)
1435 {
1436 return;
1437 }
1438
1440 if (dlg.exec() != QDialog::Accepted)
1441 {
1442 return;
1443 }
1445 MeshToolsLib::ElementQualityInterface quality_interface(
1446 *mshSource->GetMesh(), type);
1447 _vtkVisPipeline->showMeshElementQuality(
1448 mshSource, type, quality_interface.getQualityVector());
1449
1450 if (dlg.getHistogram())
1451 {
1452 quality_interface.writeHistogram(dlg.getHistogramPath());
1453 }
1454}
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 464 of file mainwindow.cpp.

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

Referenced by MainWindow().

◆ showStationDockWidget

void MainWindow::showStationDockWidget ( bool  show)
protectedslot

Definition at line 452 of file mainwindow.cpp.

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

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

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

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

Referenced by MainWindow().

◆ showTranslateDataDialog

void MainWindow::showTranslateDataDialog ( )
protectedslot

Definition at line 1351 of file mainwindow.cpp.

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

References _geo_model, and _meshModel.

◆ showVisalizationPrefsDialog

void MainWindow::showVisalizationPrefsDialog ( )
protectedslot

Definition at line 1456 of file mainwindow.cpp.

1457{
1458 _visPrefsDialog->show();
1459}

References _visPrefsDialog.

◆ showVisDockWidget

void MainWindow::showVisDockWidget ( bool  show)
protectedslot

Definition at line 488 of file mainwindow.cpp.

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

Referenced by MainWindow().

◆ showVtu2GridDialog

void MainWindow::showVtu2GridDialog ( )
protectedslot

Definition at line 1368 of file mainwindow.cpp.

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

References _meshModel, and OGSError::box().

◆ ShowWindow()

void MainWindow::ShowWindow ( )

Definition at line 1469 of file mainwindow.cpp.

1470{
1471 this->show();
1472}

◆ startPresentationMode

void MainWindow::startPresentationMode ( )
protectedslot

Definition at line 1596 of file mainwindow.cpp.

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

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

Referenced by createPresentationMenu().

◆ updateDataViews

void MainWindow::updateDataViews ( )
protectedslot

Definition at line 874 of file mainwindow.cpp.

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

Referenced by MainWindow(), and loadFile().

◆ writeGeometryToFile

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

Definition at line 993 of file mainwindow.cpp.

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

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

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

Referenced by closeEvent().

◆ writeStationListToFile

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

Definition at line 1009 of file mainwindow.cpp.

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

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

Referenced by MainWindow().

◆ _elementModel

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

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

Referenced by MainWindow(), and loadFile().

◆ _project

◆ _screenGeometries

QList<QRect> MainWindow::_screenGeometries
private

Definition at line 138 of file mainwindow.h.

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

◆ _visPrefsDialog

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

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

Referenced by quitPresentationMode(), and startPresentationMode().


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